Skip to content

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

Closed
danusha2345 wants to merge 16 commits into
colbymchenry:mainfrom
danusha2345:fix/1507-affected-test-conventions
Closed

fix(cli): affected shares the tool's one notion of a test file#1688
danusha2345 wants to merge 16 commits into
colbymchenry:mainfrom
danusha2345:fix/1507-affected-test-conventions

Conversation

@danusha2345

Copy link
Copy Markdown
Contributor

Fixes #1507.

Problem

codegraph affected kept six regexes of its own — .test., .spec., /tests/, /__tests__/, /e2e/, /spec/ — 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 test files affected" read as "no coverage", while search and the MCP tools counted those very files as tests.

Change

Drop the local list and use isTestPath from search/query-utils — the narrow "a suite that exercises other code" predicate, not the wide isTestFile that also covers examples and fixtures. --filter still overrides.

Verification

New __tests__/cli-affected-test-conventions.test.ts against the built binary: Go _test.go, Python test_*.py, Kotlin *Test.kt are reported; --filter still wins. Full suite green (221 files; the 16 skipped are the usual Windows/perf gates).

🤖 Generated with Claude Code

danusha2345 added 3 commits September 4, 2026 12:07
…mchenry#1507)

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

Copy link
Copy Markdown
Contributor Author

Merged current main (3adf067, post-#1770) into this branch: head 499fd40. The only conflict was the CHANGELOG entry; no source conflict. tsc clean, the branch's tests pass.

@danusha2345

Copy link
Copy Markdown
Contributor Author

Merged current main (43271f3) into this branch: head ee32259. The only conflict was the CHANGELOG entry; no source conflict. tsc clean, the branch's tests pass.

@danusha2345

Copy link
Copy Markdown
Contributor Author

Merged current main (85550eb) into this branch: head 99648cf. The only conflict was the CHANGELOG entry; no source conflict. tsc clean, the branch's tests pass.

@danusha2345

Copy link
Copy Markdown
Contributor Author

Merged current main (8733c28) into this branch: head a528b3b. The only conflict was the CHANGELOG entry; no source conflict. tsc clean, the branch's tests pass.

@danusha2345

Copy link
Copy Markdown
Contributor Author

Merged current main (8c04734) into this branch: head aff5275. The only conflict was the CHANGELOG entry; no source conflict. tsc clean, the branch's tests pass.

@danusha2345

Copy link
Copy Markdown
Contributor Author

Merged current main (ee83636) into this branch: head beba144. The only conflict was the CHANGELOG entry; no source conflict. tsc clean, the branch's tests pass.

@danusha2345

Copy link
Copy Markdown
Contributor Author

Merged current main (e720f6c) into this branch: head 2ce421f. The only conflict was the CHANGELOG entry; no source conflict. tsc clean, the branch's tests pass.

@danusha2345

Copy link
Copy Markdown
Contributor Author

Merged current main (de5adba) into this branch: head df4df7d. The only conflict was the CHANGELOG entry; no source conflict. tsc clean, the branch's tests pass.

@danusha2345

Copy link
Copy Markdown
Contributor Author

Merged current main (cece072) into this branch: head 7b9320c. The only conflict was the CHANGELOG entry; no source conflict. tsc clean, the branch's tests pass.

@danusha2345

Copy link
Copy Markdown
Contributor Author

Merged current main (040ba38) into this branch: head 3e85595. The only conflict was the CHANGELOG entry; no source conflict. tsc clean, the branch's tests pass.

@danusha2345

Copy link
Copy Markdown
Contributor Author

Merged current main (374b3b4) into this branch: head da1416f. The only conflict was the CHANGELOG entry; no source conflict. tsc clean, the branch's tests pass.

@danusha2345

Copy link
Copy Markdown
Contributor Author

Merged current main (71d049c) into this branch: head f94f585. The only conflict was the CHANGELOG entry; no source conflict. tsc clean, the branch's tests pass.

…t-conventions

# Conflicts:
#	src/bin/codegraph.ts
@danusha2345

Copy link
Copy Markdown
Contributor Author

Merged current main (8c9c476, post-#1801) into this branch: head 5f03121. The only conflict was the import block in src/bin/codegraph.ts#1801's symbol-lookup imports beside this branch's isTestPath; both kept, no behaviour change. tsc clean; the branch's tests pass.

@danusha2345

Copy link
Copy Markdown
Contributor Author

Merged current main (9181dd1) into this branch: head 8c93554. The only conflict was the CHANGELOG entry; no source conflict. tsc clean, the branch's tests pass.

@colbymchenry

Copy link
Copy Markdown
Owner

Superseded by #1803 — Forge cherry-picked your fix commit (995b6f1f) onto current main as Colby McHenry (author preserved), verified fail→pass on Linux for the Go *_test.go case, and closed #1507.

Thank you @danusha2345 — closing this PR as superseded (agency pattern; we do not merge contributor branches directly onto main from Forge).

@colbymchenry

Copy link
Copy Markdown
Owner

Superseded by #1803.

colbymchenry added a commit that referenced this pull request Sep 8, 2026
#1803)

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

Co-authored-by: danusha2345 <ewidusoc498@gmail.com>
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

2 participants