Skip to content

fix(tests): the per-edit hook times out and reports a false failure - #1009

Merged
Ardnived merged 8 commits into
mainfrom
claude/fix-993-unit-hook-selection
Oct 21, 2026
Merged

Ardnived merged 8 commits into
mainfrom
claude/fix-993-unit-hook-selection

Conversation

@Ardnived

@Ardnived Ardnived commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • The unit hook runs only the specs that name the edited file, and spawns nothing when none does. A Markdown doc a spec pins counts as named.
  • Both PostToolUse hooks report a timeout, a signal or a missing binary as "no result", never as a failure.

Change outline

Flow — one Edit/Write, through the unit hook

The hook used to run all 222 spec files under a 30 s timeout that the lane always exceeded. It now builds a reference index of the specs and runs only what names the file.

 .claude/hooks/unit-test.mjs
-  execSync('pnpm test:unit', { timeout: 30000 })   # whole lane, 19–78 s
-  catch → "Unit tests failed after editing <file>"  # every timeout, every edit
+  respond(readStdin, runHook, 'unit-test hook')     scripts/hook-run.mjs
+    runHook({ filePath, projectDir })               scripts/unit-test-hook.mjs
+      toRepoPath(filePath)                          # null outside the repo → nothing
+      selectSpecs(rel)                              scripts/select-unit-specs.mjs
+        not a module or doc, or generated → []      # payload-types.ts, migrations/**
+        readLane(): every quoted string in tests/unit/**/*.spec.ts
+          @/… and @payload-config → src/…
+          ./ ../ → joined against the spec's dir
+          anything else → read from the repo root   # as tsconfig's baseUrl does
+        keys for rel: path · path without ext · folder of an index file
+      [] → null                                     # no vitest spawned (399 of 664 src modules)
+      runForHook(node_modules/.bin/vitest run --project unit … <specs>)

Behaviour — how a finished run is reported

runForHook is the one classifier both hooks use, and only a numeric non-zero exit counts as a failure.

 runForHook({ command, args, … })                    scripts/hook-run.mjs
+  spawnSync(…, { timeout: 30 s, maxBuffer: 64 MB, NO_COLOR })
+  status 0                → null (silent)
+  error.code ETIMEDOUT    → "timed out after N s <doing>, so there is no result"
+  signal set              → "saw <program> killed by <signal> while <doing>, so there is no result"
+  error, no signal        → "could not start <program> (ENOENT), so there is no result"
+  numeric non-zero status → "<failure>:" + stdout's last 15 lines + stderr's last 25

Files — where hook logic lives

The two files under .claude/ are now one respond() call each. The logic moved to scripts/, which is unit-tested and writable without an attended session.

 .claude/hooks/
-├── unit-test.mjs              # path rules, execSync, error wording
-├── payload-types-gen.mjs      # path rules, execSync, error wording
+├── unit-test.mjs              # respond(…, runHook)
+├── payload-types-gen.mjs      # respond(…, runTypesHook)
 scripts/
+├── hook-run.mjs               # REPO_ROOT, toRepoPath, runForHook, respond
+├── select-unit-specs.mjs      # the reference index; also a CLI: node scripts/select-unit-specs.mjs <path>
+├── unit-test-hook.mjs         # runHook: select, then run vitest
+├── payload-types-hook.mjs     # runTypesHook: schema path → pnpm generate:types

Preview

No preview link: the diff changes only Claude Code hooks, scripts, specs and docs, so a Railway preview shows nothing new.

Test results

Measured on the branch with main merged in (4be2dfb).

  • Lean gate (.claude/skills/pr-prep/check.sh): ✓ lint, typecheck, typecheck:tests, unit lane, 222 files / 2843 tests
  • pnpm format:check: clean
  • Targeted specs: hook-run, unit-test-hook, payload-types-hook, select-unit-specs, perf-figures-pinned, doc-citations: 62 passed
  • The issue's repro: src/lib/richEditor/index.ts prints nothing, in 0.12 s on 4 cores (was "Unit tests failed…" after 30 s)
  • grep -rn "fast unit\|under 5 sec" .claude/ docs/ tests/ returns nothing
  • Build: N/A (no app code changed)

Manual verification

These hooks run from the main checkout's .claude/, so they take effect once this branch is checked out there.

  1. Edit src/plugins/login/index.ts. The hook should stay silent, in about 7 s on 4 cores.
  2. Make a spec fail and edit its subject. The context should start Unit tests failed after editing … and end with the exact pnpm exec vitest run … command.
  3. Edit a collection under src/collections/. src/payload-types.ts should regenerate, with no message.
  4. Edit tests/PERF.md. perf-figures-pinned.spec.ts should run, in about 1 s.

Notes for reviewer

  • The selection follows names, not imports. richEditor/index.ts selects nothing, though 40 specs reach it through a collection. Following imports selects up to 86 of 222 specs for one edit. The lean gate and CI still run the whole lane, and docs/rules/testing-reqs.md says so.
  • Tier 1 stays < 12 s, as chore(tests): re-measure the unit lane against its stated Tier 1 budget #994 set it. It is now pinned to the widest selection in the tree, measured on 4 cores: 9 specs naming tests/utils/importGraph.ts, 8.0 s median. The widest is also the slowest there, so tests/PERF.md no longer owes a measurement.
  • A doc is a lane source. 14 of the repo's 109 Markdown files are named by a spec; the widest is README.md at 3 specs, 1.1 s. This is what makes perf-figures-pinned.spec.ts run on an edit to one of the four docs it pins — the pin this PR leans on hardest.
  • The types hook's fix is in scope here, as you asked. payload-types-gen.mjs had the same timeout-as-failure catch-all.
Detail: dismissed review findings, and measurements

Dismissed /code-review high findings

  • Moving hook logic out of .claude/ defeats the protected-path guard. An unattended run could already change what runs on every edit. The old hook ran pnpm test:unit, so editing package.json, vitest.config.mts or any spec changed the code it executed. The entry points stay under .claude/.
  • 384 src/ modules now get no per-edit feedback. This is the design: selection is direct only, for the reason above. The trade is documented in testing-reqs.md and tests/PERF.md.
  • A symlinked CLAUDE_PROJECT_DIR (/tmp vs /private/tmp) silences the hook. Not handled. The old hook had the same prefix check. The trailing-slash case is handled.

Dismissed adversarial-review finding

  • Four new scripts/ modules, two of them one function with one caller. Folding unit-test-hook.mjs and payload-types-hook.mjs into one module needs an edit to both .claude/hooks/ entry points, a protected path no unattended run may write. Each is also the unit its own spec drives. An attended session can still fold them.

Skipped /simplify findings

  • A per-edit prefilter before reading specs: saves about 6 ms.
  • Calling vitest.mjs directly instead of the .bin shim: saves about 25 ms. A missing file would then exit 1 and read as a test failure.
  • Reading the aliases from tsconfig.json at runtime: the hard-coded list is pinned against it, and that pin now runs when tsconfig.json is edited.
  • Reusing the selector's spec list in perf-figures-pinned.spec.ts: a file outside this change.

Hook wall-clock, 4 cores (Intel Xeon 2.80 GHz), median of three after one warm-up (tests/PERF.md)

Edit Specs Median
src/lib/richEditor/index.ts 0 0.12 s
README.md 3 1.1 s
src/plugins/login/index.ts 8 7.5 s
tests/utils/importGraph.ts 9 8.0 s

An M3 Pro laptop (11 cores) runs the same five selections in 0.18 to 3.09 s; tests/PERF.md carries both tables.

pnpm generate:types through the new types hook took 5.7 s.

Fixture pre-mortem. select-unit-specs.spec.ts assumes the unit project collects tests/unit/**/*.spec.ts and that the aliases are @/, @payload-config and tests/. Both are asserted against vitest.config.mts and tsconfig.json. The outcome specs drive node's real spawnSync with a node -e stand-in (tests/utils/spawnStandIn.ts), so the result shapes are node's own.

Not done. No walker register as a closed list, as SahajAtlasWeb keeps. Nothing here ever added the tree-walking specs to every selection, so that list would guard nothing.

Closes #993

🤖 Generated with Claude Code

Ardnived and others added 5 commits October 20, 2026 15:02
`.claude/hooks/unit-test.mjs` ran the whole unit lane after every edit
under a 30 s `execSync` timeout. The lane takes 19–78 s, so the timeout
fired on most machines, and the catch branch reported `Unit tests failed
after editing <file>` with a tail holding no failure — only Vitest's banner.

Two changes, matching the ticket's two defects:

- Only a numeric non-zero exit is a test failure now. A timeout
  (`ETIMEDOUT`), a signal, and a vitest that never started (`ENOENT`) each
  say what happened and that it is not a test result. The spec drives each
  through the real `spawnSync` with a stand-in binary, so the result shapes
  are node's own rather than assumed.
- The hook runs only the specs whose text names the edited file
  (`scripts/select-unit-specs.mjs`), resolving `@/`, `@payload-config`,
  `tests/`, relative and quoted repo paths. An empty selection spawns no
  vitest: 384 of 633 `src/` modules select nothing and cost 0.18 s. The
  widest selection in the tree is 9 specs, 3.1 s on an M3 Pro.

Selection follows names, not imports. Following the import graph selects up
to 81 of 206 specs for one edit, most of the lane, so that coupling is left
to the lean gate and CI, and `docs/rules/testing-reqs.md` says so.

The logic lives in `scripts/unit-test-hook.mjs`, not under `.claude/`, so it
is unit-tested and the next change to it needs no attended session. The
hook file is now a thin stdin-to-stdout wrapper.

Docs: Tier 1's row reads as met and names the new command, the
false-failure paragraph is gone, `tests/PERF.md` records the per-edit cost
with its machine and date, and the two new specs bump the pinned counts to
206 files and 2676 tests.

Closes #993

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- `resolveSpecifier` reads any non-alias, non-relative specifier from the
  repo root, as tsconfig's `baseUrl` does, instead of a hard-coded
  `src|tests|scripts|seeds` list. A package name becomes a key no edited
  path matches, and editing `tsconfig.json` or `vitest.config.mts` now runs
  the spec that pins both.
- `readLane` indexes each spec under its own path, so selection is one
  lookup with no self-selection special case. `toRepoPath` returns null
  outside the repo, which drops three path checks from `isLaneSource`.
- The hook's three "not a test result" messages share one template, and
  internal-only exports and defaults are gone.
- Specs build each lane once, write only the spec files selection reads,
  compute the four run outcomes once, and time out after 50 ms, not 200.
- The thin `.claude/` wrapper no longer restates what the scripts own.

Test count is now 2677 in PERF.md and its consumers.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…neration

`.claude/hooks/payload-types-gen.mjs` carried #993's defect verbatim: an
`execSync` catch-all under a 30 s timeout, so a timeout read "Failed to
regenerate Payload types" with a tail holding no failure. It runs in the
same PostToolUse group as the unit hook, so on a collection edit the two
compete for CPU, which makes a timeout likelier for both.

The outcome classifier moves from `unit-test-hook.mjs` into a shared
`scripts/hook-run.mjs` (`runForHook`, with the repo root and `toRepoPath`),
and both hooks use it. The types hook's path rule moves to
`scripts/payload-types-hook.mjs`, leaving `.claude/hooks/payload-types-gen.mjs`
as thin as the unit hook's wrapper — so neither needs an attended session
to change again.

`hook-run.spec.ts` now owns the four outcomes, driven through the real
`spawnSync`. The two hook specs pin only what each hands it: which edits
spawn, the command, and the wording of their own failure.

Two new spec files bring the pinned counts to 208 files and 2693 tests.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- `runForHook` raises `maxBuffer` to 64 MB. At node's 1 MB default, a
  failing run with a large diff is killed with `ENOBUFS` and `SIGTERM`, and
  was reported as "killed by SIGTERM, no result" — a real failure hidden.
- The failure tail keeps stdout's last 15 lines and stderr's last 25,
  stdout first. One combined tail cut vitest's summary and every failure
  but the last.
- `QUOTED` closes a match on the quote that opened it, so `"it's"` earlier
  on a line no longer swallows a specifier's opening quote.
- `toRepoPath` resolves the root first, so a `CLAUDE_PROJECT_DIR` with a
  trailing slash no longer silences every edit. `listSpecs` no longer
  swallows a read error, so an unlistable lane surfaces as a hook error.
- Both `.claude/hooks/` entry points are now one `respond()` call, which
  moves their stdin parsing and error handling into `hook-run.mjs`, under
  test. The spawn stand-in the three hook specs shared moves to
  `tests/utils/spawnStandIn.ts`.
- PERF.md's pinned Tier 1 row was labelled the widest selection, which it
  no longer is. It is now the slowest timed on 4 cores, the pin reads that
  label, and the widest (9 specs, untimed on 4 cores) is flagged as owed.
- `testing-reqs.md`'s command block no longer calls `pnpm test:unit`
  Tier 1.

Counts: 208 files, 2700 tests.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ook-selection

# Conflicts:
#	AGENTS.md
#	docs/rules/testing-reqs.md
#	tests/AGENTS.md
#	tests/PERF.md
@railway-app
railway-app Bot temporarily deployed to sahajcloud / SahajCloud-pr-1009 October 21, 2026 01:37 Destroyed
@railway-app

railway-app Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

🚅 Deployed to the SahajCloud-pr-1009 environment in sahajcloud

Service Status Web Updated
SahajCloud ✅ Success (View Logs) Web Oct 21, 2026 at 1:40 am UTC
1 service not affected by this PR
  • mailpit

@Ardnived
Ardnived marked this pull request as ready for review October 21, 2026 01:39
@Ardnived

Copy link
Copy Markdown
Contributor Author

@sydevs-bot review

@sydevs-bot

Copy link
Copy Markdown
Contributor

I could not request a reviewer here, so this is the step left for you.

  • request a reviewer — GitHub said: Review cannot be requested from pull request author. - https://docs.github.com/rest/pulls/review-requests#request-reviewers-for-a-pull-request

🤖 sydevs dispatcher

@sydevs-bot sydevs-bot added bot:working Lock: a cloud session is running on this item. Removed when it ends. and removed awaiting labels Oct 21, 2026
@sydevs-bot

sydevs-bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

🤖 no session running

recent dispatches
  • 15:26Z address-review · attempt 1 · session · done
  • 15:26Z address-review · attempt 1 · session
  • 01:39Z review-pr · attempt 1 · session · done
  • 01:39Z review-pr · attempt 1 · session

Written by the sydevs dispatcher. Sessions never edit this comment.

@sydevs-bot sydevs-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧐 Adversarial review

Both defects #993 names are fixed, and I reproduced each: the richEditor edit now prints nothing in 0.085 s, and a timeout, a signal, an ENOENT and a real failure each carry their own wording. The selector is sound — I enumerated all 1,100 lane sources, the widest selection is 9 against the spec's ceiling of 10, and vitest collects exactly the files passed, with no substring widening. The diff is larger than the ticket and mostly defensibly so: the types hook is named as joined, and .claude/ being protected is a real reason the logic moved to scripts/. My one shape question is the aggregate — four new modules there, two of them a single function with a single caller, where the prior art this copies does the job in one.

Findings, all consider:

  • Two of the four new scripts are single-caller middle layers — scripts/unit-test-hook.mjs:24.
  • The .md gate stops perf-figures-pinned.spec.ts running on the four docs it pins — scripts/select-unit-specs.mjs:107.
  • PERF.md's owed 4-core measurement, taken — tests/PERF.md:165.

What was checked. #993 against the diff; the reviewer profile; the four new scripts and four new specs read whole; .claude/settings.json wiring; SahajAtlasWeb's hook and selector as prior art. Ran on 4 cores: the five touched specs (58 passed), typecheck:tests (clean), the hook end to end on five paths, and the timings above. Confirmed 220 spec files and PERF.md's "399 of 664" (398/663 off git ls-files). No contractSync source is touched, so no consumer side to follow. ESLint ignores scripts/ and tsconfig's include takes no .mjs, so these 319 lines are covered by their specs alone — unchanged from .claude/, not a regression.

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

Comment thread scripts/unit-test-hook.mjs Resolved
Comment thread scripts/select-unit-specs.mjs Resolved
Comment thread tests/PERF.md Resolved
@sydevs-bot sydevs-bot added awaiting and removed bot:working Lock: a cloud session is running on this item. Removed when it ends. labels Oct 21, 2026
sydevs-bot pushed a commit that referenced this pull request Oct 21, 2026
`perf-figures-pinned.spec.ts` compares PERF.md's recorded file count
against the specs on disk, and it read 215 against 216. The lane is
otherwise green: 2787 of 2788 passed, this pin the only failure.

The extra file came in with `a99aae9` (#1008), which added
`tests/unit/signin-token.spec.ts` without re-measuring. So the same
assertion is red on `main`, and fixing it here is what gets this PR
green — PERF.md's own rule is that the Files / tests row carries "the
current tree's" counts while every timing stays with the session that
measured it, so the counts move and the 77.9 s median does not.

Re-measured on this head, 4 cores: 216 files / 2788 tests, the figure
CI reported on `5394892`. The three consumer docs that quote the counts
move with it, which is the coupling the spec's second and third claims
exist to enforce.

#1009 carries 220 / 2835 for its own tree — it adds four spec files of
its own, so its numbers cannot stand in for this branch's.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WcsBbMS7ZqEP272YZNHXYk
sydevs-bot pushed a commit that referenced this pull request Oct 21, 2026
#996 landed `tests/unit/textbox-block-conditions.spec.ts` on `main` and
re-counted the unit lane with it. This branch carried #1009's re-count of the
same four docs, so both sides rewrote one line in each.

Took `main`'s figures — 217 files / 2792 tests — in all four. The counts are a
fact about the merged tree, and this branch adds no unit spec, so `main`'s
number already includes everything either side contributes. Measured on the
merge: 217 files, 2792 tests, which is what `perf-figures-pinned` reads.

Nothing else overlapped. `main` dropped `buildTranslationTabs` from the
`@/fields` barrel; `AppCards.ts` takes `mediaField`, `scheduleFields` and
`urlField` from it, none of them affected. No migration landed on `main` since
the merge base, so the snapshot parent is unchanged.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01AWC3mSf6HECsDNvRiGBmjN
@Ardnived

Copy link
Copy Markdown
Contributor Author

@sydevs-bot address and also merge main into this PR

@sydevs-bot sydevs-bot added bot:working Lock: a cloud session is running on this item. Removed when it ends. and removed awaiting labels Oct 21, 2026
github-merge-queue Bot pushed a commit that referenced this pull request Oct 21, 2026
…sh fallback (#997)

* fix(status): Launch Readiness answers about the locale, not the English fallback

Every non-English locale carries `fallbackLocale: 'en'`, so a section read
that named no `fallbackLocale` resolved the English value and a check
described "for this locale" passed on it. Six of the seven sections read
that way, which made "Meditation assigned" and "Article translated" green
for 18 locales in which no Path Step has been translated at all.

Each section's `prepare` now passes `fallbackLocale: false` wherever one of
its checks reads a localized field, and every read in the global hands the
Local API a `localeIsolatedReq` copy. `createLocalReq` assigns `locale` and
`fallbackLocale` onto the request it is given, so forwarding the shared one
let a section decide what the sections after it resolved — in whichever
order Payload runs the virtual fields' `afterRead` hooks.

Lectures keeps the fallback, and says why: no check there reads a localized
field, so it resolves only the row labels. Pages and User Choices do read
one, so their labels get their own fallback read rather than degrading to
`#42` on a screen an operator acts on.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01QaWaWVrTnDo4vJWqYfUi2m

* refactor(status): the request copy moves into runSection, and labels onto the row

Review pass over the locale-scoping fix. Four changes, none of them a
behaviour change to what the report answers:

- `runSection` copies the caller's request once per section. Payload awaits
  every virtual field's `afterRead` in one `Promise.all`, so the sections
  run concurrently on one request, and `find` destructures `locale` and
  `fallbackLocale` off it after its own await — a sibling read can land an
  assignment inside that window. The invariant belongs to the machinery; a
  section's own reads still copy wherever they differ from each other.
- The fallback title is merged onto the row in `prepare` instead of being
  threaded as a second channel. `labelOf` then needs no argument it did not
  already have, and no group evaluator carries a label map it only indexes
  by an id it holds.
- Both label reads select `title` alone and run beside the read they used to
  wait for. The user-choices one dropped a `where` built from its sibling's
  rows, which was the only thing forcing it to wait.
- `getWmAppConfig` uses the shared `memoizeOnRequest` rather than its own
  copy of that logic, including the rationale.

`DocumentReport.label` now owns why a check and a label want opposite
locale policies, so neither section restates it.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01QaWaWVrTnDo4vJWqYfUi2m

* docs(status): a concurrent sibling read needs the copy too

The nested-read rule said to skip the `req` copy when the nested call uses
the caller's own locale. That is the case #982 bit: concurrent reads on one
request repoint each other between `createLocalReq` and the operation's own
read of the flags, whatever locale each names.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01QaWaWVrTnDo4vJWqYfUi2m

* fix(ci): lessons title and panels are localized now

`main` moved under this branch: #978 made `lessons.title` and `lessons.panels`
localized. The merge therefore turns two of this PR's own assertions false, and
CI failed on `expect(fr['panels-set']).toBe(true)`.

Both changed checks are now right to report red at a locale with no panels and
no title of its own, so the spec says so. The label is the part that needed
code: `labelOf` reads `title`, which the section's `fallbackLocale: false` read
now nulls, so every Path Step row rendered as `#42` at an untranslated locale —
the defect this PR fixes for Pages and User Choices, arriving in a third
section. `lessons` joins `readFallbackTitles`, and the fallback title stays out
of the documents the checks read so `lesson-title-set` keeps answering per
locale.

Watched failing first: with the label taken from the per-locale read, the case
reports `expected '#1' to be 'English-only lesson'`.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016kz4f18hn5u39scrC3FDut

* fix(status): one request copy, at the read that makes it

`runSection` copied the caller's request per section and every read inside
a section copied again. Only the second is load-bearing: reads within one
section differ from each other, so a single copy at the seam could never
cover them, and no group `evaluate` reads anything for it to guard.

The machinery copy also made the isolation spec vacuous. It asserts the
caller's locale and fallback survive every section in
`WeMeditateAppStatusSpec.sections`, and passed off `runSection`'s copy
whether or not a section's own reads took one. With it gone, dropping
`isolatedReq` from `translations`' read reports `translations repointed
req.fallbackLocale` — watched failing, then restored.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01VuvbQcWhFEViZCoZvbJMsQ

* fix(status): the core-pages group stops naming a page count

The group read "All ten required app pages" while `APP_PAGE_FIELDS` holds
14, so the figure it showed an operator was wrong by four. A count in that
sentence drifts with the list and the group already shows one row per page,
so it names none. Its subtle-system sibling keeps "twelve": that set is
closed and a migration seeds exactly those slugs.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01VuvbQcWhFEViZCoZvbJMsQ

* fix(ci): re-measure the pinned unit spec count

`perf-figures-pinned.spec.ts` compares PERF.md's recorded file count
against the specs on disk, and it read 215 against 216. The lane is
otherwise green: 2787 of 2788 passed, this pin the only failure.

The extra file came in with `a99aae9` (#1008), which added
`tests/unit/signin-token.spec.ts` without re-measuring. So the same
assertion is red on `main`, and fixing it here is what gets this PR
green — PERF.md's own rule is that the Files / tests row carries "the
current tree's" counts while every timing stays with the session that
measured it, so the counts move and the 77.9 s median does not.

Re-measured on this head, 4 cores: 216 files / 2788 tests, the figure
CI reported on `5394892`. The three consumer docs that quote the counts
move with it, which is the coupling the spec's second and third claims
exist to enforce.

#1009 carries 220 / 2835 for its own tree — it adds four spec files of
its own, so its numbers cannot stand in for this branch's.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WcsBbMS7ZqEP272YZNHXYk

---------

Co-authored-by: Claude <[email protected]>
…ook-selection

Asked for on #1009. Six files conflicted, all of them documentation this
branch rewrites and prettier 3.9.10 reformatted on `main` (#998). Each hunk
keeps both sides:

- `AGENTS.md`, `tests/AGENTS.md`, `scripts/AGENTS.md`: `main`'s reformatted
  tables and its new `pnpm format:check` line, with this branch's figures and
  its four new `scripts/` rows carried into them.
- `docs/rules/testing-reqs.md`: this branch's Tier 1 row, which now names the
  narrowed hook command rather than the whole lane, plus `main`'s addition of
  `format:check` to the Tier 3 row.
- `tests/PERF.md`: both sides added a session row, so the table keeps all six.
  The laptop row is the sixth, not the fourth, and the prose above it counts
  five container sessions.
- `perf-figures-pinned.spec.ts`: this branch's row label, read with `main`'s
  whitespace-tolerant pattern — prettier pads those cells now, and the
  single-space form would stop matching.

Counts are the merged tree's, measured: 222 files, 2843 tests.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01FTwAMymw7ohTvrEkV3ocww
`MODULE_EXT` refused every `.md` path, so `perf-figures-pinned.spec.ts` — the
one spec that holds `tests/PERF.md`, `docs/rules/testing-reqs.md`, `AGENTS.md`
and `tests/AGENTS.md` in agreement — never ran on an edit to any of the four
it pins. This PR rewrites all four, so that was the pin it leaned on hardest.

A doc is now a lane source. 14 of the repo's 109 Markdown files are named by a
spec; the widest is `README.md` at 3 specs, 1.1 s measured on 4 cores. The
other 95 read the index and spawn nothing, as an unnamed module already did.

Selection still follows names, never imports, and generated paths are still
refused. The real-tree width guard now walks `docs/` and the repo root too,
since both hold docs a spec can name.

Addresses #1009 (comment)

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01FTwAMymw7ohTvrEkV3ocww
The widest selection in the tree — the 9 specs naming
`tests/utils/importGraph.ts` — was timed only on an 11-core laptop, so Tier 1's
`< 12 s` was held to a 7-spec selection instead and `tests/PERF.md` carried the
measurement as owed.

Timed on 4 cores (Intel Xeon @ 2.80 GHz), one warm-up then three:
importGraph's 9 at 8.0 s median, login's 8 at 7.5 s, `README.md`'s 3 at 1.1 s,
and an unnamed module at 0.12 s. So the widest is the slowest on 4 cores too,
8.0 s is the figure Tier 1 is now held to, and the ⚠ closes.

Two earlier sessions timed the login selection at 6.9 s and 6.1 s on the same
container spec, which is the spread this file already documents for the lane,
not a regression. `tests/AGENTS.md`'s per-edit bound moves to 9 s to stay
above the measurement it quotes.

Addresses #1009 (comment)

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01FTwAMymw7ohTvrEkV3ocww
@sydevs-bot

Copy link
Copy Markdown
Contributor

Merged main and answered all three threads. Pushed 4be2dfb.

The merge. Six files conflicted, all docs this branch rewrites and prettier 3.9.10 reformatted on main. Each hunk keeps both sides. Two choices were not forced:

  • tests/PERF.md — both sides added a session row, so the table keeps all six and the laptop becomes the sixth, not the fourth.
  • perf-figures-pinned.spec.ts — this branch's row label, read with main's whitespace-tolerant pattern. Prettier pads those cells now, so the single-space form would have stopped matching.

Threads. The .md gate adopted in e418ea1: a doc a spec pins now runs it. The owed 4-core timing taken in 4be2dfb — 8.0 s, re-measured here, slower than the 6.45 s reported. The four-module split stands: folding it needs a protected-path edit.

Lean gate green: 222 files, 2843 tests.

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

@sydevs-bot sydevs-bot added awaiting and removed bot:working Lock: a cloud session is running on this item. Removed when it ends. labels Oct 21, 2026
@Ardnived
Ardnived merged commit 454e710 into main Oct 21, 2026
48 of 50 checks passed
@Ardnived
Ardnived deleted the claude/fix-993-unit-hook-selection branch October 21, 2026 15:56
@sydevs-bot sydevs-bot moved this from Revising to Done in SYDevelopers Technical Roadmap Oct 21, 2026
sydevs-bot pushed a commit that referenced this pull request Oct 21, 2026
Four conflicts, all in the unit-lane figures: tests/PERF.md and the three
docs quoting it. Unlike the previous merge, the two sides were not the same
sentence with different numbers — main rewrote the prose as well.

Main's side is taken for every block, counts aside. #1009 re-set Tier 1's
measurement from "18 specs naming @/payload-types, 7.8 s" to "9 specs
naming tests/utils/importGraph.ts, 8.0 s", and the merged
perf-figures-pinned.spec.ts captures that row by its new label — this
branch's older wording would red the spec it was written against. Taking
this branch's side anywhere would have dropped that re-measurement.

The counts are neither side's: 222 files on main, 219 here, because each
side had refreshed the row against its own tree. Measured on the merged
tree instead, which is what the spec pins to disk: 223 / 2855, the lane
in 52.93 s.

tests/PERF.md's session table had a "sixth" row from each side, measured
on different machines. Both are kept and renumbered, as the file asks —
this branch's container run stays sixth, main's M3 Pro row (#993) becomes
seventh, and this merge's run is recorded as eighth. The intro no longer
says the first five were containers, since six of eight now are.

Main carried no src/plugins/access change, so nothing interacts with this
branch's work. Gate green on the merge: lint, both typechecks, 223 files /
2855 tests, prettier clean, and role-based-access.int.spec.ts 81 passed.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Er8YBa7CSaBUq9JhGpXWMY
sydevs-bot pushed a commit that referenced this pull request Oct 21, 2026
…etention-registry

#1009 rewrote the four docs this branch had re-pinned, so every conflict was a
test-count pin against a prose change.

Took `main`'s wording throughout: it describes the narrowed per-edit hook
(`scripts/select-unit-specs.mjs`), which this branch does not touch, and its
Tier 1 figures are measurements this branch cannot restate. Then re-pinned the
counts to the merged tree, since `perf-figures-pinned.spec.ts` holds PERF.md,
`testing-reqs.md`, `AGENTS.md` and `tests/AGENTS.md` in agreement with what is
on disk: 223 files, 2852 tests — `main`'s 222/2843 plus this branch's
`retention-registry.spec.ts`.

PERF.md's session table keeps both sides' new row, as that table asks: #1009's
sixth is the M3 Pro laptop, and this branch's becomes the seventh, re-measured
on the merged tree at 58.08 s. Its intro no longer says the first five are the
container runs, because the seventh is one too.

The merge brings no `src/` change, so no migration or integration lane is
affected.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01JDGg1hB12Fu1W8EmMtZoNz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

fix(tests): the per-edit hook times out and reports a false failure

3 participants