You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Follow-ups from the review of #85 (both noted as non-blocking there — this issue tracks them). Neither is a safety problem: both currently fail safe by disqualifying the selective route more often than necessary, they just limit how much of #83 the GO_TESTDATA route delivers in real repos.
1. The bare "testdata" reference token over-disqualifies the route
In goPackageTestDataOwnerFor (src/repo/impact.ts), the disqualification check builds its patterns from referenceTokens(dataDir) for p/testdata, and that token list includes the bare testdata literal. With ancestors: true, contentNamesPath matches a path-less word, so any other package containing the very common idioms
disqualifies p's route — even though in package q, a bare testdata resolves to q/testdata, which has nothing to do with p/testdata.
In a repo where two or more packages each use their own testdata, the selective route would rarely be chosen (always falling back), failing safe but wasting the analysis.
Suggested direction (from the review of #85): resolve a bare testdata token against the reader's own package directory and treat it as a reference to that package's testdata only. A slash-bearing reference (p/testdata/…) should keep its current treatment, since that genuinely names another package's tree.
2. Reader scans are repeated per changed file — memoize per dataDir
Every changed file under the same testdata directory runs the same disqualifies scan over goReadersByPackage and goOutsideReaders again: same readers, same contents, same result. On a golden-file refresh that touches many files in one tree, the scan is repeated for each.
Suggested direction: cache the scan outcome keyed by the owning dataDir (valid for one analysis run, keeping the current readRepositoryFile single-read semantics), so a large refresh only pays once per tree.
Happy to take these in a separate PR if a maintainer confirms scope.
Thanks for writing these up, @shounakjoshi88-a11y. Confirmed on both, and yes, please take them. One PR covering both is fine, or two if that's easier to review.
1. Bare testdata token. Agreed. Today referenceTokens(dataDir) includes the bare testdata literal, so filepath.Join("testdata", name) in any other package disqualifies p's route. Some things to keep the fix safe:
Resolve the bare token against the reader's own package directory only for readers in goReadersByPackage. Those run with the package as their working directory. For goOutsideReaders (nested modules, non-Go tests, discovery-excluded .go files) we don't know the working directory, so keep the current conservative behaviour there.
Slash-bearing references (p/testdata/..., ../p/testdata) keep their current treatment, as you said.
Please add a regression test for the split-argument form, filepath.Join("..", "p", "testdata"). It's still caught by the bare p ancestor token, and the fix shouldn't lose that.
A test with two packages that each read their own testdata, with the selective route chosen for a change under either one, would show the intended win.
2. Per-dataDir memo. Agreed, with one caveat: filePattern adds file-specific tokens (the basename and the full path) on top of dirPattern. So cache the directory-level verdict per dataDir, but keep the file-specific check per changed file. A disqualified dataDir can short-circuit every file under it. Scope the cache to one analysis run, like goPackageTestDataOwner.
Please run npm run audit:boundary before pushing if the PR adds any new files.
Separately, and no pressure: if you have a Go project of your own, I'd love to hear how DiffCI's test selection does on it. The Community result form is the easiest way to share, and misses are just as useful as wins. And if the project has been useful to you, a star helps other people find it.
The bare testdata token is dropped only for goReadersByPackage; outside readers keep it, and the slash-bearing path plus the bare ancestor p are untouched so the split filepath.Join("..", "p", "testdata") case still disqualifies. The directory verdict is cached per dataDir for one analysis run, with the file-specific basename/path check left per file.
Fixtures cover the two-package win (fails on base), the split reference, the outside-reader case, and multiple changed files under one tree. npm run typecheck, npm run audit:boundary and the Go runtime-inputs suite (59 tests) are green; the single full-suite failure reproduces on base. Commits are DCO signed as CONTRIBUTING.md asks.
I don't have a Go project of my own to run DiffCI on, but I can point it at one of the corpus clones on this machine if that would be useful data.
Activity
adityankale190895 commentedon Nov 10, 2026
Thanks for writing these up, @shounakjoshi88-a11y. Confirmed on both, and yes, please take them. One PR covering both is fine, or two if that's easier to review.
1. Bare
testdatatoken. Agreed. TodayreferenceTokens(dataDir)includes the baretestdataliteral, sofilepath.Join("testdata", name)in any other package disqualifiesp's route. Some things to keep the fix safe:goReadersByPackage. Those run with the package as their working directory. ForgoOutsideReaders(nested modules, non-Go tests, discovery-excluded.gofiles) we don't know the working directory, so keep the current conservative behaviour there.p/testdata/...,../p/testdata) keep their current treatment, as you said.filepath.Join("..", "p", "testdata"). It's still caught by the barepancestor token, and the fix shouldn't lose that.testdata, with the selective route chosen for a change under either one, would show the intended win.2. Per-
dataDirmemo. Agreed, with one caveat:filePatternadds file-specific tokens (the basename and the full path) on top ofdirPattern. So cache the directory-level verdict perdataDir, but keep the file-specific check per changed file. A disqualifieddataDircan short-circuit every file under it. Scope the cache to one analysis run, likegoPackageTestDataOwner.Please run
npm run audit:boundarybefore pushing if the PR adds any new files.Separately, and no pressure: if you have a Go project of your own, I'd love to hear how DiffCI's test selection does on it. The Community result form is the easiest way to share, and misses are just as useful as wins. And if the project has been useful to you, a star helps other people find it.
shounakjoshi88-a11y commentedon Nov 20, 2026
Thanks for the detailed scope — both are in #334.
The bare
testdatatoken is dropped only forgoReadersByPackage; outside readers keep it, and the slash-bearing path plus the bare ancestorpare untouched so the splitfilepath.Join("..", "p", "testdata")case still disqualifies. The directory verdict is cached perdataDirfor one analysis run, with the file-specific basename/path check left per file.Fixtures cover the two-package win (fails on base), the split reference, the outside-reader case, and multiple changed files under one tree.
npm run typecheck,npm run audit:boundaryand the Go runtime-inputs suite (59 tests) are green; the single full-suite failure reproduces on base. Commits are DCO signed as CONTRIBUTING.md asks.I don't have a Go project of my own to run DiffCI on, but I can point it at one of the corpus clones on this machine if that would be useful data.