fix: list only the tests each package command can actually run#98
Merged
Conversation
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>
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.
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:
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
After
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 cigreen, all three evaluation suites byte-identical.🤖 Generated with Claude Code