Repository navigation
Description
Closes nothing yet; this is a slice of the parked umbrella #3716 (acceptance criterion 5). The owner approved filing it on 2026-10-01; #3716 itself stays parked and is not unparked by this issue.
Problem
scripts/affected-tests.sh rules R3/R4 (reverse lookup) match a changed file to suites by bare basename. A same-named reference file under a different skill gets pulled in. Example from #3716: changing plugins/code-tidying/skills/dissolve-comments/reference/safety.md selected three unrelated suites under plugins/source-control/skills/babysit-prs/scripts/tests/ (test_babysit_merge.py, test_babysit_merge_review_settle.py, test_skill_contract.py), which reference the babysit-prs safety.md.
Fix
Make the R3/R4 reverse lookup path-qualified: at minimum skill plus filename (<skill>/<file>), or the repository-relative path, so a reference to one skill's file no longer selects suites for another skill's same-named file.
Acceptance criteria
- Changing
plugins/code-tidying/skills/dissolve-comments/reference/safety.mddoes not select anybabysit-prssuite. - A regression test covers that case.
- Selection is otherwise behavior-preserving: every suite selected before for a genuine dependency is still selected. Existing suites pass unchanged.
- R5 copy fan-out is kept as is.
affected-tests.sh(the comment near line 234 on origin/main) states that a same-basename match in another directory has to stay a basename rule because R5's fan-out is copies sharing a basename across directories (for examplelib/hook-utils.sh). Path-qualifying R3/R4 must not drop suites R5 reaches. - Selection time does not regress noticeably (the existing batching of basenames into one grep pass is a known performance constraint, see the comments around lines 248-253).
Verification
Run scripts/affected-tests.sh --explain over a diff touching the code-tidying safety.md, before and after, and compare the selected sets. Run the affected-tests suite.
Related
- Umbrella: test-perf: diagnose and cut the wall clock of the local test and gate corpus, especially on Windows Git Bash #3716 (criteria 1-4, 6, 7 stay there, parked)
- Shipped slices: affected-tests.sh: guard diff-base resolution when a merge is in progress #4607, check-changelog-parity.sh: cut wall clock, especially --check-order, on Windows Git Bash #4608
Activity
test(test-selection): pin skill ownership in the reverse lookup
fix(test-selection): rename the ownership array so the spell-check pa…
fix(test-selection): scope R3/R4 reverse lookup to skill ownership (#…
kyle-sexton commentedon Oct 1, 2026
#5718 (merge commit 7bd7d2c) meets all five acceptance criteria on origin/main. I checked this by running
scripts/affected-tests.shon a git-archive snapshot of origin/main (HEAD 0e14fdb) and comparing it with a snapshot of the parent commit 329ea77.--explainonplugins/code-tidying/skills/dissolve-comments/reference/safety.mdnow selects no suite (reported as no-suite, exit 0), so no babysit-prs suite is selected. The parent commit selected the babysit-prs suites plus clause-coverage suites. The babysit-prssafety.mdselection is unchanged.scripts/affected-tests.test.sh(lines 1374-1426). They use a fixture,ownership-probe.md, and cover the same-named-file-in-another-skill case. The suite gives PASS=102 FAIL=0.plugins/knowledge/skills/course-digest/extraction/{register-hook,resolve-hook,run,setup-deps}.mjs. A grep finds them only in SKILL.md,context/workflow.mdand the files themselves. Their old selections came only from same-named video-digest files (including unrelated pixel-art suites), so they were not genuine dependencies. They now report UNMAPPED (exit 1), whichscripts/affected-tests-no-suite.txtdescribes as the intended result for a code file with no test. Across every changed-file seed fix(test-selection): scope R3/R4 reverse lookup to skill ownership #5718 swept (2863 seeds), the new selection gained 0 suites and lost 2175 (seed, suite) pairs. Of the 156 lost pairs where the suite mentions the seed's own basename, every one is a skill citing its own same-named file or a path through another skill.--print-fanout. No lost suite names a copy by basename. The R5 copy fan-out is unchanged.lib/hook-utils.sh875 ms to 911 ms, audit-instructionsfinding-ids.sh326 ms to 418 ms, dissolvesafety.md224 ms to 129 ms, babysit-prssafety.md212 ms to 246 ms. All are sub-second, and the 22-path aggregate fix(test-selection): scope R3/R4 reverse lookup to skill ownership #5718 measured was within noise. The cost is one extra BFS level of about 4 ms.No open PR or duplicate issue covers this.
Separate follow-up, not part of this issue: those four course-digest
.mjsfiles have no test, so a PR that touches them will fail affected-tests selection until a suite covers them or a no-suite entry names a lane.ci.ymllines 2458-2477 already run the course-digestrun-tests.sh test.