Repository navigation
fix(test-infra): require the spread operand to BE the obtained module - #8406
Conversation
`holdsObtainedModule()` asked whether the obtained token appeared ANYWHERE
inside the spread's text, not whether the module IS the thing being spread.
So a spread of an object literal that merely NESTS the obtained module read
as `inherits`, and the gate quoted the evasion back in its own reason line:
...({ _: await importOriginal() })
That object carries exactly ONE inherited key, so the next export any module
in the file's import graph reads at module scope still resolves to
`undefined` -- the objectui#6849 failure the gate exists to stop, wearing the
accepted spelling's clothes.
Replace the mention test with `operandDenotes()`, which reads the operand as
ONE whole expression through a small grammar whose every production preserves
the invariant that makes a spread inherit: the operand's KEY SET is the real
module's, so it grows when the real module grows. `await`, parentheses,
`as`/`satisfies` and `!` are transparent; calling the obtainer produces the
module; a property read keeps a key set the module owns; an object literal or
an array does not.
Measured on 47053c9 by running the gate's own `scan()` before and after and
diffing PER SITE: 625 judged / 625 inherit / 0 frozen both ways, all 625 rows
byte-identical in verdict AND reason. A ratchet, so no sweep is owed.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FhBNJcLRZLe8M87VcUgpKr
|
ACCEPT — The fences held, checked mechanically rather than readThe diff is 2 files, The repair is the right shape, and the reason is in what it refuses without being told to
The load-bearing measurement is the one this dispatch demanded, and it is honest about its own scope625 judged / 625 inherit / 0 frozen before and after, with all 625 rows diffed PER SITE on verdict and reason string against the base gate — byte-identical. That is the "prove no false refusal by census, ⛔ not by inspection" requirement met exactly. The nine distinct operand shapes the tree actually writes are enumerated and each pinned as its own case, so the accept side is defended by construction and not by the aggregate count. ⭐ And the dev caught two of its own implementation bugs with that census before delivering — the first ⭐ The report's most valuable line is the one that limits its own claim
⇒ The acceptance criterion "reverting your change turns your new pins red" is satisfied by the pins, ⛔ not by the gate's exit code, and the dev says so instead of letting the green stand in for proof. Same shape as #8383's non-vacuity leg this afternoon: an assertion is only worth what its ability to say no is worth. The ablation proves the mutation landed on disk (blob
|
|
Armed: PR #8406 flipped ready at 2026-09-07T17:11:18Z on head Landing probe on merge, on re-fetched ⇒ #6892 becomes dispatchable when this lands — it is the last card queued on Generated by Claude Code |
|
LANDED — merged into Content probe on re-fetched
Control — taken from the gate RUNNING on merged ⇒ 625 judged / 625 inherit / 0 frozen on main after the change — byte-for-byte the census the dev measured before it. Zero false refusals landed. ⭐ That is the reading that matters here: the whole risk of this PR was tightening a recogniser too far, the dev's own first attempt did exactly that (625 → 41 inherit), and the merged tree is measured — by the gate itself, in CI, on Incidentally the same line re-confirms #8391 an hour on: the verdict reads Generated by Claude Code |
Fixes #8183
Note on notation: generic argument lists and other angle-bracket shapes are written out in words below, because GitHub's body sanitizer eats tag-shaped fragments even inside backticks (objectui#6970).
The defect
holdsObtainedModule()inscripts/check-vi-mock-inherit.mjsasked whether the obtained token appeared ANYWHERE inside the spread's text, not whether the module IS the thing being spread:So a spread of an object literal that merely NESTS the obtained module satisfied it, and the gate quoted the evasion back in its own reason line:
That object carries exactly ONE inherited key —
_, holding the module object — so the next export any module in the file's import graph reads at module scope still resolves toundefined. The file dies during COLLECTION, the suite goes red with zero failed assertions and reads like flake. That is the failure objectui#6849 built this gate to stop, wearing the accepted spelling's clothes.Re-derivation FIRST — the table, on today's tree
Re-derived through the gate's own exported
findCallSites()on47053c9f6(the post-merge tree, after objectui#8141 landed as PR #8391), not from the card's table:...(await importOriginal())inheritsinheritsfrozen(never spreads it)frozen(never spreads it)...({ _: await importOriginal() })inherits← false negativefrozen...({ _: actual })inherits← false negativefrozenC and D are still false negatives on today's tree, so the brief's premise holds. The card's
576 judged / 0 using the C–D shapeis stale as the brief warned; today's baseline is stated below and measured, not inherited.The repair
operandDenotes()reads the spread's operand as ONE whole expression through a deliberately small grammar. The invariant every production preserves is the one that makes a spread inherit: the operand's KEY SET is the real module's, so it still GROWS when the real module grows.await, parentheses,as/satisfiesand the non-null assertion are transparent;(orig as any)()); the bare name does not — it is a FUNCTION;(await importOriginal()).default, the interop shape);OBTAIN_TOKENalready stands for a completedvi.importActualcall;The same function decides binding propagation, so
const wrapper = { _: await importOriginal() }no longer enters the inherited set either; without that, C walks back in one level up.⛔ Untouched, as the dispatch required:
isCovered,coveredPrefixes,COVERED_SPECIFIERSand the verdict line — all of them objectui#8141's surface.Census — before and after, proved per site rather than by inspection
A false refusal reds correct code, which is how a gate gets deleted rather than fixed, so this is measured, not argued.
Per-site diff over all 625 judged sites, verdict AND reason string, base gate vs. patched gate driven from the same
scan():The nine distinct operand shapes the tree actually writes, each now pinned as its own case: a parenthesised awaited call with a generic argument list (367), a bare binding
actual(169), the same with atypeof importgeneric (55),mod(22), theimportActualparameter spelling (6),real(2), the plain(await importOriginal())(2),(await importActualwith ananygeneric())(1), and one nested-parenthesis-plus-assertion form inObjectTree.rowCeiling-7210.test.tsx(1). Population unmoved: 625 judged / 625 inherit / 0 frozen, before and after. A ratchet — no sweep owed.Pins, and their non-vacuity control
scripts/__tests__/check-vi-mock-inherit.test.tsgains 10 cases: 6 in the POSITIVE control block (the file's own name for its "this must read frozen" block, which is where C and D belong by its own vocabulary — the brief called it the negative-control block) and 4 accept-side counterweights in the negative control block (the eleven). The suite goes 74 tests to 84.Non-vacuity: each new refusal is paired with the SAME fixture minus the object-literal wrapper, and that twin must read
inherits. The two differ by the wrapper alone, so afrozenverdict cannot come from the gate bailing out early (indirect,unreadable, "never obtains the real module") — it can only come from the gate having READ the operand. The reason string is pinned to the one the gate emits AFTER collecting spreads, for the same purpose.Ablation — the mutation is proved on disk before any result is read
The fix was committed first, then reverted in place (
holdsObtainedModulerestored byte-for-byte to its pre-fix body), with anEXIT INT TERMtrap holding an absolute-pathgit checkout HEAD --restore:Two readings recorded as they came out rather than as a template predicts:
...(importOriginal)— was alreadyfrozenbefore this change, because the old mention test also required a(after the token and there is none. It is a regression guard against the new grammar losing that, not new-behaviour evidence, and is reported as such rather than counted in the ablation.Checks run
The five test files are every reader of
check-vi-mock-inheritin the tree (git grep -l): its own pin suite,check-readme-exports.test.ts,js-comment-mask-jsx-6891.test.ts,check-vi-mock-specifiers.test.tsandConversationsSidebar.test.tsx. Exit codes were captured before any pipe.No changeset: the diff is
scripts/**only, which publishes from no package —check-changeset-presence.mjsagrees and is the authority.Session:
https://claude.ai/code/session_01FhBNJcLRZLe8M87VcUgpKr