Repository navigation
test(i18n): pin that the two defaults-population walks agree (#7904) - #8135
Conversation
`packages/test-support/src/defaults-table-scan.ts` and `scripts/check-i18n-call-site-keys.mjs` each discover the `createSafeTranslation` defaults tables with their own AST walk. They agree exactly today and nothing asserted it, so the day one learns a new table shape and the other does not, one gate goes on reporting full coverage of a population the other has already grown past. This is the pin, not a merge: the scripts lane runs under bare node and cannot import the TypeScript-source module, and giving it a loader is a capability expansion with no pull beyond this one gate. The comparison partitions like with like — the shared scan appends every declared hand-rolled table into one `rows`/`tables` pair while the script keeps `factory*` and `handRolled*` counters separate, and de-duplicates the one registry table that also reaches the factory. The file's header states the mapping counter by counter, the two preconditions today's tree supplies, and the two known definitional differences it does not exercise. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FhBNJcLRZLe8M87VcUgpKr
|
Standing down on
Every other check on Generated by Claude Code |
|
Armed — squash auto-merge enabled and the PR is in the merge queue,
On MERGED: content probe on re-fetched Generated by Claude Code |
|
LANDED — merged at 2026-09-06T18:45:15Z as Content probe on re-fetched
#7904 closed by the Generated by Claude Code |
Fixes #7904
One new test,
scripts/__tests__/defaults-population-parity-7904.test.ts. Neither walk moves; nothing else in the tree changes.What it pins
Two independently written AST walks discover the same
createSafeTranslationdefaults-table population —scanDefaultsTablesinpackages/test-support/src/defaults-table-scan.ts(objectui#7884, read by the two vitest gates) and the script's ownscanFactorySites/resolveFactoryTablebehindanalyze()inscripts/check-i18n-call-site-keys.mjs(objectui#7567). They agree exactly today and nothing asserted it, so the day one of them learns a new table shape and the other does not, one gate goes on reporting full coverage of a population the other has already grown past.This is the pin, not a merge.
scripts/*.mjsrun under bare node and cannot import the TypeScript-source module the vitest gates share, and giving the scripts lane a loader or a build step is a capability expansion with no pull beyond this one gate. Shape followsscripts/__tests__/placeholder-spelling-parity.test.ts(objectui#7310): floors first, then equality, plus the "is asking two different implementations" guard so a future merge of the walks must delete this file rather than leave it reading as a guarantee.The numbers are read through the script's exported
analyze(root).counters, not off its prose census line — no spawn, no regex.The mapping — comparing like with like
The trap the card names:
scanDefaultsTableswalks the factory call sites AND THEN appends every declared hand-rolled table into ONErows/tablespair, while the script keepsfactory*andhandRolled*counters deliberately separate. Comparing the scan's totals against the script's factory counters would compare 1072 rows against 841 and be red for a reason that is not drift. So the scan side is partitioned first:NAME (file), derived from the sameHAND_ROLLED_TABLESboth sides read (objectui#7877 put the data in one JSON file, so this is one declaration, not two copies). A factory label always carries a line number,NAME (file:LINE), so the two label shapes cannot collide.TIMELINE_DEFAULT_TRANSLATIONSis in the registry AND reaches the factory. The script de-duplicates on the literal's own position and counts it ashandRolledAlreadyFactoryCovered; the scan double-lists it on purpose and tells callers to de-duplicate onwherepluskey. This test is that caller.Counter by counter, as asserted:
defaults-table-scan.ts)analyze().counters)factorySitesfactoryTablesfactoryRowsHAND_ROLLED_TABLES.lengthhandRolledDeclaredhandRolledTableshandRolledAlreadyFactoryCoveredhandRolledRowsscan.unreadableis emptyTwo of those rows hold only because of a property of today's tree, and the file asserts both before the equalities rather than assuming them:
factorySitescounts invocations including ones whose table never resolves (equal to the label count only whilefactoryUnreadableTablesis 0), andfactoryTablescounts distinct literals while the scan pushes one label per site (distinct literals are recovered from each table's row signature, which needs every factory table to contribute at least one row — asserted, since two empty tables would share the empty signature). The header records both, and records the two known definitional differences this tree does not exercise: the scan descends into nested object literals where the script deliberately counts one as an unreadable row, and the scan accepts a property-access callee where the script requires a bare identifier.Floors before equality, so the pin cannot pass over two empty walks: 1591 source files walked, more than 25 factory sites, more than 700 factory rows on both sides, more than 150 overlap-free hand-rolled rows on both sides (the same 150 the script's own collapse floor uses), and zero unreadable entries on both sides.
Today's readings, both sides
node scripts/check-i18n-call-site-keys.mjsated4a1f810, its census lines quoted as the control that the numbers asserted are the numbers it prints:Scan side, measured in the same process as the assertions: 35 table labels total, of which 32 factory (32 distinct literals) and 3 hand-rolled; 1072 rows, of which 841 factory and 231 hand-rolled, 215 of them once the 16 rows of the overlapping
TIMELINE_DEFAULT_TRANSLATIONSliteral are attributed to the factory half where the script already counts them;unreadableempty; 1591 runtime source files walked. The card's numbers (32 / 841 / 0) were re-measured on this base rather than inherited, and the hand-rolled half was measured for the first time here.Cost:
scanDefaultsTablesabout 0.5s,analyzeabout 3s, both in the collection phase so neither sits inside a test's timeout budget. The whole file runs in 4.4s.Positive control — proof the pin can go red
Narrowed the SCRIPT's recogniser in the working tree so its factory walk stops seeing the one
createSafeTranslationHookcall site (packages/plugin-detail/src/useDetailTranslation.ts), leaving the shared scan's recogniser intact. Probe only — neither walk is in this PR's file surface.Anchor observed before and after the edit (canonical spelling 1 then 0, narrowed spelling 0 then 1), mutated blob hash
2d34345cdifferent from the HEAD blobdea6c08d, so the mutation demonstrably reached disk. The pin went red, exit 1, three of four cases failing and the equality case naming the counters:The recogniser guard failed alongside it (
createSafeTranslation, createSafeTranslationHookagainstcreateSafeTranslation), and so did the row floor (666 is not greater than 700) — three independent alarms for one narrowing.Restore proven, not assumed:
git checkout HEAD -- scripts/check-i18n-call-site-keys.mjsunder atrapwith absolute paths, then the restored blob hash read back asdea6c08d, byte-equal to the HEAD blob, andgit diff HEADempty.Gates, all at
ed4a1f810Exit codes captured by redirect-then-capture, never through a pipe.
pnpm exec vitest run scripts/__tests__/defaults-population-parity-7904.test.ts— exit 0, 4 passed.pnpm exec vitest run scripts/__tests__/placeholder-spelling-parity.test.ts scripts/__tests__/check-i18n-call-site-keys.test.ts— exit 0, 141 passed. Neither file changes.pnpm exec vitest run scripts/__tests__/— exit 0, 114 files, 3376 tests passed.node scripts/check-i18n-call-site-keys.mjs— exit 0, census quoted above.pnpm type-check:scripts— exit 0. Both package-owned imports are relative, asscripts/__tests__/scripts-type-check.test.tspins.pnpm lint:root— exit 0 (32 pre-existing warnings, none in the new file).pnpm check:control-bytes— exit 0, 6505 tracked text files scanned; plus a targetedgrep -naPself-scan of the new file, no hits.node scripts/check-changeset-presence.mjs— exit 0, none owed (1 file changed, 0 published source).node scripts/check-governed-queue-guard.mjs --test scripts/__tests__/defaults-population-parity-7904.test.ts— exit 0, NOT GOVERNED.pnpm check:entry-guard— exit 0.Live E2E (informational)is red on every branch today for an upstream reason (objectui#7990 / objectstack#16186), unrelated to this change.🤖 Generated with Claude Code
https://claude.ai/code/session_01FhBNJcLRZLe8M87VcUgpKr
Generated by Claude Code