Repository navigation
perf(test): move the repo-wide inventory specs off the per-edit path - #304
Conversation
The twelve inventory specs hold no reference to the file that breaks them, so the selector ran all twelve on every edit. That floor was 3.8s of each edit, and 117 of 417 lane sources selected nothing else. `selectFrom` no longer takes `lane.walkers`. `readLane` still reports the set, because the closed-list pin is what notices one joining or leaving it, and the hook needs no edit: it exits before spawning vitest on an empty selection — which also keeps the change out of `.claude/`, a protected path no unattended run can write. Measured on 4 cores, median of three: an edit with no spec of its own goes from 3.8s to 0.12s, `src/config/i18n.ts` from 9.0s to 6.6s, and `src/lib/shape/index.ts` from 7.2s to 5.5s. What it costs is the inner loop's inventory signal, on every edit rather than on a subset: the twelve still run in `pnpm test:run`, the lean gate and CI, so a break surfaces in the same session. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01UCFy62tDxRMU5NtPHrNYVM
The review pass found the new prose claiming more than the assertions hold. The fixture equality fails when `selectFrom` takes the walkers back, by either route, but not when a detector stops matching — that is the closed list's job, and both files now say which guard catches which. Three measured corrections: 117 of 417 lane sources select nothing, not 137; `src/config/i18n.ts` boots four jsdom specs of its twelve, not two, against three of the widest selection's fourteen; and the per-edit inventory signal is lost on every edit, not only on the 117 — the lane is what still covers it. `docs/testing.md` also keeps a breadcrumb for the vitest `projects` split this ticket was filed with, and why it was dropped. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01UCFy62tDxRMU5NtPHrNYVM
Deploying sahajatlas with
|
| Latest commit: |
b1f26ab
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://dfeef6cf.sahajatlas.pages.dev |
| Branch Preview URL: | https://claude-perf-293-per-edit-wal.sahajatlas.pages.dev |
|
🤖 no session running recent dispatchesWritten by the sydevs dispatcher. Sessions never edit this comment. |
sydevs-bot
left a comment
There was a problem hiding this comment.
🧐 Adversarial review
The diff is the ticket and nothing else: one five-line deletion in selectFrom, the two spec changes the acceptance criteria name, and the docs rewrite. I re-derived every figure it claims from the branch tree and all of them hold. No contract surface is touched, so there is no consumer side to follow.
What stands against it is prose. One measured figure in the rewritten section is now wrong and contradicts one above it. The section also states the superseded behaviour three times, in a file AGENTS.md loads into every session here. One question is left open: what the walker detector guards, now that only its own pin reads it.
Findings
should-fix—docs/testing.md:441keeps ascripts/edit at "~3.6s" and "six specs". This change invalidates the first, and the second was already wrong. (file thread)consider— the before-figures are restated three times, and both code files narrate "until #293" (docs/testing.md:422).consider—lane.walkershas one reader, so what does the closed list protect now? (scripts/select-unit-specs.mjs:166)
What was checked
- Read
docs/testing.md:410-488, bothscripts/select-unit-specs*files and.claude/hooks/unit-test.mjswhole, on the branch. The hook exits at:33on an empty selection, so the no-hook-edit claim and the protected-path argument hold. - Ran
readLaneandselectFromover all 417 lane sources of the branch tree: 143 specs, 12 walkers, 117 selecting nothing, widest 14 onsrc/lib/shape/index.ts,i18n.tsat 12 with four jsdom. Every stated figure matched.readLanemeasures ~21ms against the stated 130ms floor, so thewalkerscost dismissal stands. - Nothing outside the three files names the dropped source.
## Previewclaims no deployable change; the diff touchesscripts/anddocs/only. Reviewer profile read.
🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
`listSpecs` returns eight `scripts/` specs, not six, and the ~3.6s was the walker floor this branch removes: a `scripts/` edit now selects at most two specs, and six of the 21 `scripts/` sources select none. Re-measured on 4 cores, median of three. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01RMZoR6cFqLarLRu1LW1qMa
The before-figures were stated at three sites in a file AGENTS.md loads into every session, and both spec comments echoed them. docs/rules/code-comments.md says never narrate the change. The trade paragraph and the #293 breadcrumbs stay; the 3.8s / 9.0s / 7.2s / 24-of-26 restatements go. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01RMZoR6cFqLarLRu1LW1qMa
The list gates nothing now that no edit selects a walker. Its job is to be the register of which specs carry no per-edit signal — the set the trade paragraph in docs/testing.md is scoped by — so say that where its one reader is, rather than leave "notices one joining or leaving" to be read as a gate. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01RMZoR6cFqLarLRu1LW1qMa
|
Three threads adopted, pushed as
Lean gate re-run green: 143 files, 1752 tests, 70s. All three commits are prose, so the body needed no refresh. 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
#303 moved this selector's repo root off `new URL(…, import.meta.url)` and lifted the spec's header comment above its imports, where this branch had rewritten that comment in place. Kept #303's structure and this branch's wording, since the sentence about walkers staying out of the selection is what #293 changes. `repo-source.ts`'s rationale in docs/testing.md rested on walkers running on every edit, which this branch ends. Restated against the new behaviour: a reader importing the walk would now take its callers off the inner loop instead of onto every edit. The module split stands either way. Re-measured the two totals the merge moved: 420 lane sources, not 417, and `translations.test.ts` reaches 7 of them. 117 selecting nothing and the widest at 14 are unchanged. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01GSuT7wgPRVBUbR9bRgHwEP
|
Merged Two things the auto-merge could not see:
Lean gate green on the merge: 145 files, 1755 tests, 71s. 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
Summary
docs/testing.mdcarries the re-measured figures and what the inner loop gives up: the inventory signal on every edit, which the lean gate and CI still catch.Change outline
Flow — what one lane edit pays
PostToolUse Edit|Write .claude/hooks/unit-test.mjs selectSpecs(rel) scripts/select-unit-specs.mjs isLaneSource(rel) → else [] readLane(root) # 143 spec texts, once referenceIndex: resolve every quoted specifier → module it addresses - treeWalkingSpecs: the twelve that enumerate the tree # selected below + treeWalkingSpecs: still reported, for the closed-list pin only co-located Foo.tsx → Foo.test.tsx, Foo.mount.test.tsx referencing index lookup: @/config/api/client · ./client · 'src/App.tsx' - tree-walking always, since nothing in them references the edit - spawn vitest run <10–24 specs> # ≥12 for every lane source + specs.length === 0 → exit 0 # 117 of 417 lane sources + spawn vitest run <1–14 specs> non-zero exit → additionalContext, continue: trueBehaviour — what the spec now pins
Preview
Nothing deployed changes: the diff touches
scripts/anddocs/only, so neither entry graph moves andpnpm sizereads the same bundle. There is no page to open.Test results
lint+typecheck+test:run(143 files, 1752 tests, 76s)scripts/select-unit-specs.test.ts), each new assertion watched failing first — with...lane.walkersrestored inselectFrom(3 red), and with one name dropped fromWALKERS(1 red)Manual verification
src/config/embed.ts) in a session with the hook enabled, and confirm the feedback is immediate and silent — no vitest run at all.src/lib/geo.ts) and confirm the failure still arrives as non-blocking context.Notes for reviewer
The ticket's 1751-test count is now 1752. The new
selectFromcase is the extra one; the 143 files and the twelve inventories are unchanged.Two findings dismissed, both measured.
readLanestill computeswalkerson the hook's path, for a field only the closed-list pin reads. Measured at 1.1–1.2ms against a 130ms no-spawn floor, about 1%. The ticket's approach keeps the field deliberately, so a lazy getter is a follow-up rather than this PR's.src/config/i18n.tsselects 12 with four jsdom specs and takes 6.6s, while the widest selection (14, three jsdom) takes 5.5s. jsdom count tracks the clock better than width does. Pre-existing, and the ticket chose to state it rather than add a second guard —docs/testing.mdand the ceiling's comment now both say width never bounds time.Three figures the review pass corrected, in the second commit: 117 of 417 lane sources select nothing (not 137, which the ticket carried);
i18n.tsboots four jsdom specs of twelve (not two); and the lost inventory signal applies to every edit, not only to the 117 —src/config/translations.test.ts, for one, is now selected for 6 of 417 sources, by reference alone.Fixture pre-mortem. The new fixture source
src/lib/unspoken.tsassumes no other fixture file names it, so the selection is genuinely empty rather than empty by resolution failure — checked against the samebeforeAll's otherwrite()calls, which namething,thing-otherand the shared walk only. The tree's wider assumption, that the lane collectssrc/**andscripts/**specs named*.test.ts(x), is asserted in the same file againstvitest.config.ts's owninclude.Detail
Measured on this branch, 4 cores, median of three, wall clock of the whole hook command. Baselines are the same machine at
2ac15db.src/config/embed.ts(no spec of its own)src/config/i18n.ts(slowest)src/lib/shape/index.ts(widest)Selection width across all 417 lane sources: 117 select nothing, max 14.
Why the one-line change and not a vitest
projectssplit, which the ticket was first filed with: the hook already exits before spawning vitest on an empty selection, so the split buys the identical saving for a config split, a hook flag and CI wiring — and the hook lives under.claude/, a protected path no unattended run can write.docs/testing.mdkeeps that as a breadcrumb so the alternative is not re-derived.What was kept on purpose.
treeWalkingSpecs, theENUMERATESdetector and theSHARED_WALKconstant stay in the selector: the closed-list pin is their reader, and it is now the only thing that notices an inventory joining or leaving the set. Both files say which guard catches which failure — the fixture equality catches the set returning to the selection, the closed list catches a detector that stops matching.Rejected for #285 and not revisited: a node-vs-jsdom project split (~20s and ~15s, neither half fits a budget),
isolate: false(20s and flaky), andvitest related(26s on one leaf module).Closes #293
🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code