Repository navigation
Description
Summary
The per-edit hook (.claude/hooks/unit-test.mjs) runs the specs one edit can break, under the 12-second budget docs/testing.md:417 states. Twelve of those specs enumerate the source tree instead of importing from it, so nothing in them references the edited file and the selector runs all twelve on every edit. That floor is 4.0s, and 137 of 417 lane sources select nothing else — the floor, not the selection, is most of what each edit pays.
Dropping the walkers from the per-edit selection takes an edit with no spec of its own from 4.0s to 0.09s, and the slowest edit in the tree from 9.1s to 5.8s. The inventories keep running in pnpm test:run, the lean gate and CI, so what this trades is per-edit immediacy, not coverage.
Approach
No vitest projects split, and no hook edit. The hook passes explicit spec paths and already exits before spawning vitest on an empty selection (.claude/hooks/unit-test.mjs:32), so removing the walker source from selectFrom is the whole mechanism. That matters beyond simplicity: .claude/ is a protected path, so the projects-and-hook approach this ticket was filed with could not have been built by an unattended run at all.
- Delete
...lane.walkersfromselectFrom(scripts/select-unit-specs.mjs:190). KeeptreeWalkingSpecsandreadLane'swalkers(:163,:176) and both detectors —ENUMERATES(:48) andSHARED_WALK(:55) — since the closed-list pin reads them. - Invert the one fixture expectation that asserts the opposite (
scripts/select-unit-specs.test.ts:133): the walker specs must be absent fromselectFrom's result, by both routes. It goes red on step 1 as written, which is the guard working rather than a problem to route around. - Leave the closed-list pin at
:178alone.WALKERSis what stops a walker silently leaving the set, and it must keep biting once the hook no longer runs them. - Restate the width ceiling at
:223against the new widest selection — 14, onsrc/lib/shape/index.ts, down from 24 onsrc/config/i18n.ts. ⚠ The widest is no longer the slowest:src/config/i18n.tsselects 12 and measures 5.8s, because two of them boot jsdom. The ceiling pins width, so say in the comment there that time is measured separately. - Rewrite
docs/testing.md's budget section (:417): the three figures, the tree-walking bullet (:446), and the "lever left here" paragraph (:453) that this ticket closes. State what per-edit coverage is given up and where it is still caught.
Acceptance criteria
- The hook spawns no vitest run for a lane source with no co-located and no referencing spec.
- The twelve inventory specs still run in
pnpm test:runand in CI — the lane's counts are unchanged at 143 files and 1751 tests. - A spec fails when an inventory spec is added to, or drops out of, the walker set.
- A spec fails if the walkers are put back into
selectFrom. -
docs/testing.md's budget section carries the re-measured figures and names the per-edit coverage traded. The "lever left here" paragraph is gone, not reworded.
Verification checklist
All timings are the hook's own wall clock, on 4 cores, median of three. Baselines are main at f4da303, measured 2026-10-15.
-
echo "{\"tool_input\":{\"file_path\":\"$PWD/src/config/embed.ts\"}}" > /tmp/edit.json && time CLAUDE_PROJECT_DIR=$PWD node .claude/hooks/unit-test.mjs < /tmp/edit.json— a lane source with no spec of its own. Under 0.5s, against 4.0s. - Same command for
src/config/i18n.ts— the slowest edit. Under 6.5s, against 9.1s. - Same command for
src/lib/shape/index.ts— the widest selection after the change, 14 specs. -
pnpm test:run— 143 files, 1751 tests. -
pnpm vitest run scripts/select-unit-specs.test.ts— green. Then re-add...lane.walkerstoselectFromand confirm it goes red. - Delete one entry from
WALKERSand confirm the same spec goes red.
Notes
Measured on main at f4da303, 4 cores, median of three, 2026-10-15. The second column is the one-line selectFrom change applied locally and reverted.
| Edited file | specs on main |
hook on main |
specs after | hook after |
|---|---|---|---|---|
src/config/embed.ts (no spec of its own) |
12 | 4.0s | 0 | 0.09s |
src/config/i18n.ts |
24 | 9.1s | 12 | 5.8s |
src/lib/shape/index.ts |
24 | — | 14 | 4.8s |
the 12 walkers alone, as one vitest run |
12 | 3.9s | — | — |
#286 and #290 both landed, and the WALKERS reconciliation landed with them. The detector finds a walker two ways now — an ENUMERATES call, or an import of the shared walk — so the ten specs this ticket was filed against are twelve: the nine src/ inventories, source-tree.test.ts, and two scripts/ specs. scripts/select-unit-specs.test.ts and the lean gate are both green on f4da303, so nothing is outstanding from that merge. The ⚠ this ticket carried about doing the work after #286 is spent.
Per-edit coverage is the real cost, and it is bounded. After the change, 117 of 417 lane sources run nothing per edit, so adding an unregistered viewport read or JSX anchor to one of them gets no immediate signal. The lean gate (.claude/skills/pr-prep/check.sh, 77s whole) runs the full lane before every PR, and CI runs it again, so the break still surfaces in the same session. That is the answer to the coverage question raised on 2026-10-13: it is a latency-versus-immediacy trade with a gate behind it, not an uncovered path.
Rejected, measured: a vitest projects split, which this ticket was filed with. It buys nothing the one-line selectFrom change does not, needs an edit to a protected path under .claude/, and has to keep scripts/select-unit-specs.test.ts:203's regex parse of vitest.config.ts's top-level include and exclude arrays working.
Rejected for #285 and not revisited here: a node-vs-jsdom project split (~20s and ~15s, neither half fits a budget), isolate: false (20s and flaky), and vitest related (26s on one leaf module).
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Hold Until
Projects
- StatusShow more project fieldsDone
Activity
docs(test): correct the lane counts and record what the hook now covers
Ardnived commentedon Oct 13, 2026
@sydevs-bot implement
sydevs-bot commentedon Oct 13, 2026
🤖 no session running
recent dispatches
Written by the sydevs dispatcher. Sessions never edit this comment.
sydevs-bot commentedon Oct 13, 2026
Stopped. This ticket's premise is gone from
main, and its mechanism now buys nothing.Measured on
main(a5565b6, #288 landed) with #290's own selector:src/#288 moved all ninesrc/inventories ontosourceFiles().src/lib/report.ts, the 4.5s floor case: 11 specs, no inventory among them.src/config/i18n.ts, the 9.7s widest: 12 specs, was 22.The per-edit floor this ticket removes is already gone, because the detector silently stopped matching. A projects split now buys nothing.
Nothing here exists on
maineither:select-unit-specs.mjs,selectFrom, theWALKERSlist and the 12s budget all live only in #290, approved and unmerged.#290's
WALKERSlist fails oncemainmerges into it, 1 of 10 — the handoff its body predicted.The open question is coverage, not speed: should the ten inventories still run on every edit? That is a decision, so I did not guess it.
Recommend landing #290 with its
WALKERSlist reconciled, then@sydevs-bot revisehere against the new numbers.🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
11 remaining items
sydevs-bot commentedon Oct 16, 2026
The session for this item did not finish after 3 attempts. I have stopped retrying. A
@sydevs-botverb or mention from you starts me again.🤖 sydevs dispatcher
fix(docs): drop the superseded per-edit figures
Merge origin/main into claude/perf-293-per-edit-walkers