Skip to content

chore(codemap): exclude test files from the API surface - #84

Merged
Lillevang merged 1 commit into
mainfrom
chore/codemap-exclude-tests
Jul 17, 2026
Merged

chore(codemap): exclude test files from the API surface#84
Lillevang merged 1 commit into
mainfrom
chore/codemap-exclude-tests

Conversation

@Lillevang

Copy link
Copy Markdown
Owner

Closes #59.

Problem

gen-codemap.sh built the "Public API surface" section by grepping for exported symbols (^func [A-Z], ^export ..., etc.), which also matched test functions — Go TestXxx, test_*.py, *.test.ts. Those aren't public API, and their bulk pushed real exported symbols past the per-language head -100 cap, silently dropping them from the committed CODEBASE.md. #59 observed this in the repo's own map: the entire internal/trackers surface (Tracker, MergeMCPServer, …) had been evicted.

Fix

Exclude test files from the API-surface grep, per the issue's recommended option (accurate and shrinks the list). Applied in two places, each in its existing idiom:

  • internal/flavors/common/templates/.agent/scripts/gen-codemap.sh (shipped downstream) — grep --exclude globs.
  • .agent/scripts/gen-codemap.sh (this repo's own drifted, ripgrep-based copy) — rg -g '!...' globs.

Languages: Go (*_test.go), TypeScript (*.test.ts / *.spec.ts / .tsx), Python (test_*.py / *_test.py). Rust is intentionally left as-is — its tests are inline #[cfg(test)] modules with no filename convention to exclude on.

Scope note: I fixed the test-exclusion bug in place and deliberately did not re-sync the repo copy's older ripgrep idiom to the template's grep idiom — that drift is a separate concern, out of scope here.

Verification

  • Regenerated this repo's CODEBASE.mdinternal/trackers is back in the surface; no Test* functions remain in it.
  • Regenerated flavor goldens via just smoke-test-update: the go-cli / go-backend scaffolds now correctly omit TestString / TestHealthz from their Go surface (the only content changes; the rest is the script itself).
  • just smoke-test passes; go vet and go test ./... pass.

🤖 Generated with Claude Code

Closes #59.

gen-codemap.sh built the "Public API surface" by grepping for exported
symbols, which also matched test functions (Go `TestXxx`, `test_*.py`,
`*.test.ts`). Test functions aren't public API, and their bulk pushed real
exported symbols past the per-language `head -100` cap, silently dropping
them from the committed CODEBASE.md — as observed in #59, where the entire
internal/trackers surface was evicted.

Exclude test files from the surface grep in both the shipped common
template and this repo's own drifted copy (kept in their respective grep /
ripgrep idioms). Rust is left as-is: its tests are inline `#[cfg(test)]`
modules with no filename convention to exclude on.

Regenerated this repo's CODEBASE.md (internal/trackers is back) and the
flavor goldens (go-cli/go-backend scaffolds now correctly omit TestString
/ TestHealthz from their Go surface). smoke-test passes.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@Lillevang
Lillevang merged commit c59bf89 into main Jul 17, 2026
1 check passed
@Lillevang
Lillevang deleted the chore/codemap-exclude-tests branch July 17, 2026 22:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

chore(codemap): gen-codemap.sh head -100 cap evicts later packages from the API surface

1 participant