Summary
The workspace/CLI scanner counts test fixtures, compiled test output, and other non-production files as real production API endpoints. This dominates the cost estimate — e.g. scanning this repo itself reports $5,346.94/mo, of which $5,310 comes from three Stripe endpoints that only exist in dist-test/**/*.test.js test fixtures.
Evidence
Local scan of recost/extension (its own source):
- 45 endpoints detected; 40 of them appear only in test-like files (
dist-test/...test.js, src/test/...).
- Dropping test-only endpoints takes the total from $5,346.94 → $0.02 (the 5 survivors are the extension's actual external calls).
sapling: 74 of 224 endpoints are test-only noise.
Root cause
The intent to skip test files already exists but is incomplete and duplicated:
file-discovery.ts:DEFAULT_IGNORE_PATTERNS only ignores **/*.test.ts / .tsx / .spec.ts / .tsx — so compiled *.test.js / *.spec.js slip through.
file-discovery.ts:HARD_EXCLUDED_SEGMENTS is missing dist-test and dashboard-dist. (A second, drifted copy in src/scanner/path-excludes.ts does list them, but that copy is imported only by a test — production scanning uses the file-discovery copy.)
src/test/ directories aren't excluded. src/intelligence/file-signals.ts:isTestLikeFilePath() already encodes the canonical test-path logic (src/test/, __tests__/, .test., .spec.) but it's used only to deprioritize in the intelligence layer, never to exclude at scan time.
Proposed fix
- Broaden
DEFAULT_IGNORE_PATTERNS test globs to all extensions: **/*.test.*, **/*.spec.*, **/__tests__/**, **/test/**, **/tests/**.
- Add
dist-test and dashboard-dist to file-discovery's HARD_EXCLUDED_SEGMENTS.
- Reconcile the duplicate: delete
src/scanner/path-excludes.ts and repoint src/test/workspace-scanner.test.ts at the file-discovery exports — one source of truth.
- Leave the opt-in
recost-mock-calls.* fixture behavior untouched.
Acceptance criteria
Context
Found while validating the #45 CLI remote path. Pairs with the calibration issue (filed separately) and the CLI provider bug #136. The two together take recost/extension from a fabricated $5,346.94/mo to a defensible $0.02/mo in a dry-run.
Summary
The workspace/CLI scanner counts test fixtures, compiled test output, and other non-production files as real production API endpoints. This dominates the cost estimate — e.g. scanning this repo itself reports $5,346.94/mo, of which $5,310 comes from three Stripe endpoints that only exist in
dist-test/**/*.test.jstest fixtures.Evidence
Local scan of
recost/extension(its own source):dist-test/...test.js,src/test/...).sapling: 74 of 224 endpoints are test-only noise.Root cause
The intent to skip test files already exists but is incomplete and duplicated:
file-discovery.ts:DEFAULT_IGNORE_PATTERNSonly ignores**/*.test.ts/.tsx/.spec.ts/.tsx— so compiled*.test.js/*.spec.jsslip through.file-discovery.ts:HARD_EXCLUDED_SEGMENTSis missingdist-testanddashboard-dist. (A second, drifted copy insrc/scanner/path-excludes.tsdoes list them, but that copy is imported only by a test — production scanning uses the file-discovery copy.)src/test/directories aren't excluded.src/intelligence/file-signals.ts:isTestLikeFilePath()already encodes the canonical test-path logic (src/test/,__tests__/,.test.,.spec.) but it's used only to deprioritize in the intelligence layer, never to exclude at scan time.Proposed fix
DEFAULT_IGNORE_PATTERNStest globs to all extensions:**/*.test.*,**/*.spec.*,**/__tests__/**,**/test/**,**/tests/**.dist-testanddashboard-distto file-discovery'sHARD_EXCLUDED_SEGMENTS.src/scanner/path-excludes.tsand repointsrc/test/workspace-scanner.test.tsat the file-discovery exports — one source of truth.recost-mock-calls.*fixture behavior untouched.Acceptance criteria
recost/extensionreports no endpoints sourced solely fromdist-test/,src/test/, or*.test.*/*.spec.*files.dist-test/anddashboard-dist/are never scanned.path-excludes.tsduplicate).*.test.js,dist-test/x.js,src/test/x.tsare excluded; a normalsrc/services/x.tsis not (and a file likelatest.tsor dircontest/is not falsely excluded).Context
Found while validating the #45 CLI remote path. Pairs with the calibration issue (filed separately) and the CLI provider bug #136. The two together take
recost/extensionfrom a fabricated $5,346.94/mo to a defensible $0.02/mo in a dry-run.