Repository navigation
fix(go): scope a bare testdata reference to the reading package - #334
adityankale190895 merged 2 commits into
Conversation
A go-reported package runs with its own directory as the working directory, so a bare "testdata" in a sibling's filepath.Join("testdata", name) names that sibling's tree, not the changed one. Drop that one token for package readers; keep it for readers outside package discovery, whose working directory is unknown. Slash-bearing paths and the bare ancestor package name stay, so a split filepath.Join("..", "p", "testdata") still disqualifies.
Also memoize the directory-level verdict per testdata directory for one analysis run; the file-specific basename/path check stays per changed file, and a disqualified directory short-circuits every file under it.
New fixtures: two packages each reading their own testdata stay selective; a split relative reference and an outside reader's bare testdata still fall back; several changed files under one tree all select the owner. npm run typecheck, npm run audit:boundary and the go-runtime-inputs suite (59 tests) are green; the one full-suite failure in action-verify.test.ts reproduces on base.
Signed-off-by: Shounak Joshi <[email protected]>
|
Thanks, this is a clean follow-up: the per- One case regresses, though: a package below the owner that reads the owner's testdata through
Without the bare A bare const below = (pkg: string) => owner === "." || pkg.startsWith(`${owner}/`);and use Could you add that, plus a regression test with a |
|
Good catch, and thanks for the precise diagnosis and the suggested I kept the unfiltered patterns for readers in packages below the owner, using The fixture now registers a Ready for another look whenever you are. |
|
Thanks @shounakjoshi88-a11y, this matches the scope in #90. The sibling-package, split-reference and outside-reader fixtures are exactly what I hoped for. One thing to fix before merge: The cause is the nested test("a package below the owner reading testdata through .. keeps full validation", async (t) => {
// ...readers...
for (const [name, source] of Object.entries(readers)) {
await t.test(`below owner: ${name}`, async () => {
// ...unchanged...
});
}
});Once Node 22 is green, could you check the Windows jobs too? They were cancelled in this run, so they never tested the change. On running DiffCI against a corpus clone: yes please, that would be useful data. The Community result form works for that too. |
A sub-package of the owner also runs with its own working directory, so a bare 'testdata' there can still reach the owner's tree through '..'. Use the unfiltered patterns for readers in packages below the owner, in both the directory and per-file scans, so ../testdata reaches the path resolver again. Adds a p/sub fixture package and three regression cases (filepath.Join, os.ReadDir, filepath.Glob). All three fail on the previous head and pass here; the Go runtime-inputs suite is 63/63, typecheck and boundary audit are clean. Signed-off-by: Shounak Joshi <[email protected]>
fbc9dfa to
4fbf976
Compare
|
CI caught a problem in my regression test: three Fixed in The remaining "Awaiting approval" is just GitHub holding fork workflows until a maintainer approves them. |
|
Merged, thanks @shounakjoshi88-a11y! Packages that read their own That's your second Go fix after #85. If you want to chat about DiffCI or what to pick up next, the project Discord is here: https://discord.gg/vAftSVeYgk And yes to the corpus-clone run whenever you have time. Results go in the Community result form, and misses are just as useful as wins. |
Usage pings carry selection counts (mode, tests selected, tests total, path-rule comparator). Moves the CLI's Core pin to 2304f70 so #333 and #334 ship. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: adityankale190895 <[email protected]>
Both follow-ups from #90, in one PR as you said was fine.
1. Bare
testdataresolves inside the reading packagegoReportedpackages run with their own directory as the working directory, sofilepath.Join("testdata", name)in packageqnamesq/testdata, notp/testdata. I drop only the baretestdatatoken from the patterns used forgoReadersByPackage. Everything else is unchanged:p/testdata,../p/testdata) and the bare ancestorpstay, so a splitfilepath.Join("..", "p", "testdata")still disqualifies;2. Directory-level verdict memoized per
dataDirThe verdict from the directory tokens is cached for one analysis run alongside the rest of the Go testdata state. A disqualified directory short-circuits every changed file under it; the basename/full-path check is still done per file. One
readRepositoryFilecall per reader is preserved (the analyzer already dedupes those reads).Fixtures
testdata→ selective route for a change under either tree (fails on the base);filepath.Join("..", "p", "testdata")→ full validation still;testdata→ full validation still;Validation
npm run typecheck— cleannpm run audit:boundary— clean (450 files, no new files added)npx tsx --test tests/repo/go-runtime-inputs.test.ts— 59/59 passnpm test— one pre-existing failure inaction-verify.test.ts(repository output cannot close the summary fence) that reproduces identically on the unmodified baseCloses #90.