Uh oh!
There was an error while loading. Please reload this page.
fix(scripts): check-engine-double-contract discovers doubles whose write verb is vi.fn(...) - #8650
Conversation
…n 21 newly discovered doubles; ledger the rest as first measurements
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
📓 Docs Drift CheckNo hand-written docs reference the 0 changed package(s). ✅ |
qq9340100
commented
Aug 14, 2026
ACCEPTed on substance — and ⛔ deliberately HELD AS DRAFT. Do not flip, do not enqueue, do not arm auto-merge. ⛔ Merge freeze in force. The maintainer instructed this seat directly at ~07:2xZ: 「changeset 在发版本,现在不要合并任何代码」. This PR is finished and would otherwise be flipped now. It stays draft until the maintainer lifts the freeze. Four things make this an unusually strong round. ① The fix addresses why the bug existed, not just the bug
② The unwrap width was measured, and the criterion refuses to go blind laterA full, untruncated census of all 310 call-initializer members, classified into eight shapes. The resulting criterion is structural and callee-agnostic — one argument which is a function — admitting the 93 that hold an implementation (picking up ⭐ The reasoning for rejecting a callee allowlist is the point: it "would go blind the day someone writes ③ The classification, not the grep count93 newly readable → 56 engine-shaped and discovered, 37 correctly vetoed (24 with fewer than two engine siblings, 8 by the driver veto, 5 low-arity without an engine-only sibling). Discovery 379 → 435, 0 lost. The card's 168-file grep was an upper bound and is explicitly named as such. Reporting it as the answer would have been the truncated-census error in a new costume; this is the measurement the card actually asked for.
④ First measurements, labelled where a future reader will look21 pinned by fixing (four suites green, 8,392 tests) per "fix rather than ledger anything cheap to pin"; 29 baselined, each entry stating individually why a one-line pin cannot reach it. Stated as first measurements in every entry and in the baseline's ⭐ On the fixtures: the class-field spelling has zero occurrences in the corpus, so its fixture "is the only possible evidence the sibling branch works — which is precisely why it is there." Knowing that a fixture is load-bearing because the real corpus cannot exercise it is the difference between a test and a decoration. All eight fixtures were mutation-proven to bite, with predicted and observed matching exactly on all three mutations.
Generated by Claude Code |
qq9340100
commented
Aug 14, 2026
The failing step is Mechanism: that self-test carries a positive control — it refuses to pass unless the repo's real ⭐ Note the irony worth recording rather than "fixing": this is a positive control doing exactly its job. The gate is refusing to report green while its own corpus is empty — which is the discipline this lane has been enforcing all night (a measurement over an empty corpus proves nothing). It is correct behaviour that happens to be inconvenient at this moment. Why nothing is being changed here:
Standing: the PR remains ACCEPTed on substance and held. When the freeze lifts, CI is re-read from a fresh run — ⛔ this red is not carried forward as a verdict on the change, and equally ⛔ it is not waved through: the re-run must be green on its own terms once Reported to the maintainer, since it is their release window and the condition is repo-wide rather than local to this branch. Generated by Claude Code |
Fixes#8639
check-engine-double-contract's discovery could not see an engine double whose write verb isspelled
vi.fn(async …).implOfreturnednullfor a call-expression initializer, soconsider()returned before the sibling and shape tests ever ran and the double reachedneither the
pinnedlisting nor the baseline — absent from both sides of a ledger thatreconciles in both directions.
DISCOVERED != 0catches a scan that breaks entirely; it cannotcatch a scan that quietly skips one spelling.
The change
implOfnow unwraps a call carrying exactly one argument which is a function, via a sharedfnInitializerhelper used by both initializer branches — the object-literal(
PropertyAssignment) and the class-field (PropertyDeclaration) spellings. Sharing one helperis deliberate: the two branches previously carried the same three lines twice, which is how one
spelling got fixed and the other did not.
How wide to unwrap — measured, not assumed
Full census of the scanned corpus (every
delete/updatemember whose initializer is a call,310 of them, untruncated):
vi.fn()vi.fn(fn)vi.fn().mockResolvedValue(value)rec('DELETE')vi.fn().mockImplementation(fn)record('DELETE')on('DELETE')vi.fn().mockRejectedValue(ERR())So the criterion is structural and callee-agnostic: it admits the 93 that hold an implementation
(including
.mockImplementation(fn)for free and correctly) and rejects all 217 that do not,with no allowlist of callee names that would go blind the day someone writes
vitest.fn.Two widenings were declined, both measured at zero occurrences: a function among several
arguments, and a function in a chained receiver (
vi.fn(fn).mockResolvedValue(v)). A barevi.fn()stays undiscovered on purpose — there is no implementation to judge, so nothing couldbe looser than the producer.
Discovery: 379 to 435 doubles (+56, 0 lost)
Measured by building two harnesses from the real gate source differing in
implOfonly.Of the 93 verb members the fix newly makes readable:
5 low-arity with no engine-only sibling
The card's 168-file grep was explicitly an upper bound; 93 / 56 / 37 is the classification.
Both named control files are now discovered — and their
deletewas already routed throughassertEngineDeleteDispatchthe whole time; the gate simply could not see it.21 pinned, 29 entries ledgered as FIRST MEASUREMENTS
Per the "fix rather than ledger anything cheap to pin" rule, every double whose pin was a
single call was pinned: 21 across metadata-protocol, objectql, runtime and plugin-security.
All four suites run green (8,392 tests).
The remaining 29 (file, verb) pairs enter the baseline, and each entry states individually why a
one-line pin does not reach it: an implementation declaring too few parameters to hand the
predicate anything, a deliberate tripwire double whose body opens by throwing, a concise arrow
body, or
@objectstack/mcpwhich depends on neither home of the predicate.These are first measurements, not a raised ratchet — stated in every entry and in the
baseline's
$comment. The doubles were always there; the scan could not reach them. Same act as#5629 and #5480, both already recorded in the script's comments.
Gate:
OK — 238 pinned, 162 in the DEBT ledger, 2 exempt(was 213 / 133 / 2).Self-test fixtures, mutation-verified
Eight fixtures were added, and each was proven to actually bite by mutation — this file's own
comments record that an unfixtured arm stayed green when neutered:
unwrapCallImplPropertyDeclarationbranchPropertyAssignmentbranchThe class-field spelling has zero occurrences in the corpus, so that fixture is the only
possible evidence the sibling branch works — which is precisely why it is there.
Verification
check:engine-double-contractOK;--self-testOKcheck:type-check-coverage --re-measureEXIT=0, nothing above its ceilingcheck:nul-bytes,check:cross-package-test-inputs,check:durability-log-level,check:test-source-alias,check:type-source-resolution,check:query-options-erasure,check:i18n,check-engine-split-ratio— all greenTests and root
scripts/tooling only; nothing publishable changes, so this carriesskip-changeset.Generated by Claude Code