fix(cli): affected shares the tool's one notion of a test file (#1507) - #1803
Merged
Merged
Conversation
`codegraph affected` kept six regexes of its own — `.test.`, `.spec.`, `/tests/`… — so a Go `foo_test.go`, a Python `test_foo.py` or a JVM `FooTest.kt` beside the changed file was never reported, and "no tests affected" read as "no coverage". Use isTestPath from search/query-utils, the same predicate search and the MCP tools already rank by. Cherry-picked from danusha2345's upstream PR #1688 (commit 995b6f1). Preserve main's CLI imports and Unreleased entries, and credit the contributor in the changelog. The default affected depth remains 5. Fixes #1507. Supersedes #1688. Verified on Linux with Node 22.19.0: npm run build; the Go fixture changes from no affected tests to math_test.go; matching and nonmatching custom filters still override. Vitest: 3 files, 36 tests passed, including the upstream Go/Python/Kotlin suite and affected path/dependency coverage.
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.
Summary
codegraph affecteddrops its six JS/TS-only regexes and uses sharedisTestPathfromsearch/query-utils, so Go*_test.go, Pythontest_*.py, and JVM*Test.ktare reported.--filteroverride; leaves default--depth 5unchanged (secondary over-reporting residual noted on the issue).995b6f1fwith CHANGELOG conflict resolved against current Unreleased.Fixes #1507.
Supersedes #1688.
Linux verify (fail → pass)
FAIL on
origin/main(9181dd1e):affected math.go→ "No test files affected";--filter '*_test.go'findsmath_test.go.PASS on this branch (
bc8ff11e):affected math.golistsmath_test.go; custom filters still override.Vitest: 36 passed across
cli-affected-test-conventions,cli-affected-paths,graph.Test plan
npx vitest runfocused affected suites