Repository navigation
Description
Summary
Nine unit specs each roll their own readdirSync walk of src/ to assert an inventory over the
source. They read and parse the tree nine times per lane run, and they have already drifted into
three different walk shapes — so a tenth inherits whichever one its author copied.
Approach
The nine, from grep -rln readdirSync src/:
| Spec | Walk shape |
|---|---|
src/Widget.standalone.test.ts:145 |
recursive + encoding: 'utf8' |
src/config/responsive.test.ts:32 |
recursive + encoding: 'utf8' |
src/hooks/use-map-controller.test.ts:29 |
recursive + encoding: 'utf8' |
src/lib/overlay.popper.test.ts:39 |
recursive + encoding: 'utf8' |
src/lib/shape/href.test.ts:144 |
recursive + withFileTypes |
src/config/api/reads.inventory.test.ts:60 |
recursive + withFileTypes |
src/components/atoms/Icons/Icons.usage.test.tsx:35 |
hand-rolled recursion |
src/config/translations.test.ts:41 |
hand-rolled recursion |
src/lib/announce-site.test.ts:30 |
hand-rolled recursion |
Two routes, neither chosen here:
- A shared helper, co-located under
src/perdocs/testing.md's conventions, exporting the
source list and a memoisedts.SourceFileper path. Only two specs parse through the
typescriptAPI today (href.test.ts,reads.inventory.test.ts); the rest read raw text, so
the helper has to serve both without forcing a parse nobody asked for. no-restricted-syntaxineslint.config.jsfor the claims that are expressible as syntax.
⚠ It cannot replace all of them:reads.inventory.test.ts's checks resolve an identifier to a
number through an import hop, andhref.test.tsasserts an exact count of call sites. Those
stay specs whatever happens to the walk.
The per-file exclusions differ on purpose and must survive: reads.inventory.test.ts skips
types/payload/ (generated declarations, the slowest thing under src/ to parse), and the specs
differ on whether .test. and .stories. files are in scope. A helper that flattens those
exclusions would change what each spec asserts.
Acceptance criteria
- One walk implementation serves every spec that inventories
src/, or a lint rule replaces
the spec outright. - Each spec's file scope and exclusions are unchanged — same files in, same files out.
- Every migrated spec still fails when its own defect is reintroduced at the causing site.
Verification checklist
-
grep -rln readdirSync src/lists only the shared helper -
pnpm lint && pnpm typecheck && pnpm test:rungreen -
time pnpm test:runbefore and after, median of three on 4 cores (see perf(test): give the unit lane a per-edit budget it is actually under #285)
Notes
Raised by the adversarial review on #284 as an aggregate not belonging in that PR. The lane-cost
half is #285.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Hold Until
Projects
- StatusShow more project fieldsDone
Activity
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.
fix(build): lint bans a tenth walk of `src/`
fix(test): count a spec that imports the shared walk as tree-walking