chore(codemap): exclude test files from the API surface - #84
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #59.
Problem
gen-codemap.shbuilt the "Public API surface" section by grepping for exported symbols (^func [A-Z],^export ..., etc.), which also matched test functions — GoTestXxx,test_*.py,*.test.ts. Those aren't public API, and their bulk pushed real exported symbols past the per-languagehead -100cap, silently dropping them from the committedCODEBASE.md. #59 observed this in the repo's own map: the entireinternal/trackerssurface (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--excludeglobs..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
CODEBASE.md—internal/trackersis back in the surface; noTest*functions remain in it.just smoke-test-update: thego-cli/go-backendscaffolds now correctly omitTestString/TestHealthzfrom their Go surface (the only content changes; the rest is the script itself).just smoke-testpasses;go vetandgo test ./...pass.🤖 Generated with Claude Code