Skip to content

fix(cli): affected shares the tool's one notion of a test file (#1507) - #1803

Merged
colbymchenry merged 1 commit into
mainfrom
forge/fix-1507-affected-test-conventions
Sep 8, 2026
Merged

fix(cli): affected shares the tool's one notion of a test file (#1507)#1803
colbymchenry merged 1 commit into
mainfrom
forge/fix-1507-affected-test-conventions

Conversation

@colbymchenry

Copy link
Copy Markdown
Owner

Summary

  • Land upstream #1688 (@danusha2345): codegraph affected drops its six JS/TS-only regexes and uses shared isTestPath from search/query-utils, so Go *_test.go, Python test_*.py, and JVM *Test.kt are reported.
  • Preserves --filter override; leaves default --depth 5 unchanged (secondary over-reporting residual noted on the issue).
  • Cherry-pick of 995b6f1f with 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' finds math_test.go.

PASS on this branch (bc8ff11e): affected math.go lists math_test.go; custom filters still override.

Vitest: 36 passed across cli-affected-test-conventions, cli-affected-paths, graph.

Test plan

`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.
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.

Go: codegraph affected never matches *_test.go — the CLI-local isTestFile duplicates and diverges from search/query-utils.ts

1 participant