Skip to content

fix: list only the tests each package command can actually run#98

Merged
aryamthecodebreaker merged 1 commit into
mainfrom
fix/scope-test-routes
Jul 26, 2026
Merged

fix: list only the tests each package command can actually run#98
aryamthecodebreaker merged 1 commit into
mainfrom
fix/scope-test-routes

Conversation

@aryamthecodebreaker

Copy link
Copy Markdown
Owner

The bug

Every test route carried the same repository-wide related-files list. ran once and its result was assigned to all of them, so a report claimed:

npm --prefix packages/core run test  →  Related: packages/action/test/runner.test.ts, ...

That command never reaches packages/action. On this repository all three routes listed an identical eight files spanning three packages — the report was stating something the commands cannot do.

Before

- npm --prefix packages/action run test: Related: core/repo-scan.test.ts, action/runner.test.ts, cli/cli-runner.test.ts, cli/mcp.test.ts, core/explain.test.ts, ... (8 files)
- npm --prefix packages/cli run test:    Related: ...the same 8 files
- npm --prefix packages/core run test:   Related: ...the same 8 files

After

- npm --prefix packages/action run test: Related: packages/action/test/runner.test.ts
- npm --prefix packages/cli run test:    Related: packages/cli/test/cli-runner.test.ts, packages/cli/test/mcp.test.ts
- npm --prefix packages/core run test:   Related: packages/core/test/repo-scan.test.ts, ... (core only)

Related files are scoped to the route's package directory. A repository-root script has no such boundary and still covers everything, which a second test pins.

The checked-in workspace example shows the same correction, so the improvement is visible in a reviewed artifact rather than only in prose.

Provenance

Reported by an external reviewer as "three test routes also contained numerous unrelated tests from other packages." Reproduced here, where it turned out every route was affected rather than one — the lists were identical, not merely noisy.

Verification

117 core tests, npm run ci green, all three evaluation suites byte-identical.

🤖 Generated with Claude Code

Every test route carried the same repository-wide related-files list, because
findRelatedTests ran once and its result was assigned to all of them. A
report therefore claimed that

  npm --prefix packages/core run test

would exercise packages/action/test/runner.test.ts, which that command never
reaches. On this repository all three routes listed an identical eight files
spanning three packages.

Related files are now scoped to the route's package directory. A repository
root script has no such boundary and still covers everything.

Found by an external reviewer as "numerous unrelated tests from other
packages" and reproduced here, where it turned out every route was affected
rather than one.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@aryamthecodebreaker
aryamthecodebreaker merged commit 1abcb23 into main Jul 26, 2026
2 checks passed
@aryamthecodebreaker
aryamthecodebreaker deleted the fix/scope-test-routes branch July 26, 2026 10:59
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.

1 participant