fix(go): drop test-binary pseudo-packages from inferred relationships - #2
Closed
jonpoole-fluidstack wants to merge 1 commit into
Closed
Conversation
`go list -deps -test` reports a synthetic `pkg.test` package for every tested package. Its bare `.test` suffix meant it never matched the package under test, so it fell through to the nearest enclosing project — usually the module root — and produced a phantom development edge (e.g. `lib-x -> root`). Reduce the `pkg.test` line to its real package path so ownership filtering claims it, and add a regression test covering a tested package nested under a single-module root that is itself a project. Co-Authored-By: Claude Opus 4.8 <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.
Stacks on #1 (import-path relationship inference).
With test inference on (
inferRelationshipsFromTests), Go projects were picking up a phantom development edge to the module-root project.go list -deps -testreports a syntheticpkg.testpackage for every tested package; its bare.testsuffix means it never matches the package under test (pkg.testisn't nested underpkg/), so it fell through prefix matching to the nearest enclosing project — usually the repo root — as a spuriouslib-x -> root [development]edge.The existing
pkg [pkg.test]space form was already handled; the barepkg.testline was not.Fix: reduce the
pkg.testline to its real package path, so ownership filtering recognises it as the project's own test and drops it..../libs/b(has_test.go)b -> root [dev]Added a regression test (
doesnt_infer_edges_to_root_from_test_binary_pseudo_packages) with alibs/b/lib_test.gofixture and a root project in sources; it fails on the bare-suffix bug and passes with the fix. Fullgo-toolchainsuite green.