Fifth review round. It recommends KEEPING the guard as narrowed, and blocks on two
things, both one-line-shaped and both real.
THE FALSE GREEN. `isProductionSource` excluded `*.test.ts` and nothing else, while
vitest's own include is `**/*.{test,spec}.*` (`web/vite.config.ts`) — so a
`*.spec.ts` file was a TEST to the runner and PRODUCTION to this predicate.
Measured by the reviewer at the previous head: strip `Complete<>` from
`MultiCollectionsScreen.toItemRequest` (the only production site for
`MultiCollectionItemRequest`, and the exact pre-#807 form), add a `.spec.ts`
holding a `Complete<MultiCollectionItemRequest>` fixture, and typecheck plus all
1309 tests stayed green with the real builder unprotected. `src/setupTests.ts` did
the same. This is the bypass an earlier round blocked on, closed only for the
`.test.` spelling — and the guarantee is stated in four places, so it had to be
true in every spelling vitest accepts. Both bypasses now redden; witnessed.
THE DOC CLAIMS. The record's residue paragraph still said the guard "derives the
write wrappers from the SPA AST, so reverting a wrapper now reddens" — machinery
deleted last commit, and the claim measured false. Already fixed in 2cb7bd0d6,
which the review predates; what survived it was the paragraph five lines above,
opening "Since #820 the WRAPPER half is checked". It is the SCHEMA half. Also a
duplicated clause in the frontmatter `mechanics:` left by the narrowing — the copy
that gets mirrored out of context — and a stale ordinal in the guard-inventory
prose.
ALSO CLOSED, from the same review:
- An `allOf` schema emits as an intersection, which `scanOptionalSchemaMembers`
skipped silently. That is the one non-object shape that HIDES members rather
than having none, so it now throws, matching what the surrounding code already
did for computed and duplicate keys. The 54 enum-shaped schemas it legitimately
skips have nothing to drop; a fixture pins both halves.
- The Python cross-check floored the TS parse but not its own table, so an empty
Python table would collect zero parametrised cases and pass having compared
nothing. It was covered only by the neighbour file's floor — borrowing the
property rather than holding it.
- The population ratio floor was 0.9 against an actual 0.985, admitting a silent
~22-file narrowing. Now 0.95.
- Recorded the residual this guard shares with its sibling: every population here
derives from `trackedSources.tracked`, so a narrowing inside the Vite plugin
cancels out of every comparison, and it is the sibling guard that polices that.
Verified: web 1311 tests green, scripts/tests 1241 green (2 skipped), typecheck +
eslint + ruff clean, decisions-validate OK, inventory counts machine-checked.
Decisions-Edit: yes
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UYNbVwgVszv6Pum7ZuGd75