You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(devx): anchor the self-test floor probe on the real definition
`injectEarlyReturn` took the FIRST match of `function <name>(` against RAW
source, so a docblock sentence or a fixture string won a definition. In
`scripts/pm/dispatch-gates.mjs` both stand ahead of the real one, and the
injection landed inside a template literal: the copy is then a SyntaxError,
which exits non-zero AND prints a stack, so the verdict reads HELD — a hold
awarded to a gate for the probe having broken its own copy of it. That was
recorded as an `ENTRY_BY_HAND` null describing the FILE, and read for months as
a property of it.
Two rules now make the anchor the definition, and the control fixture carries
one decoy of each kind ahead of its real definition so neither rule can be
dropped silently:
MASKED the match is taken over `maskCommentsAndLiterals(src)` — the
existing `scanSource` flags, comments and literals blanked,
offsets and line numbers preserved.
LINE-START the match must begin a line (`export` / `async` prefixes kept).
⛔ The POPULATION criterion keeps reading `maskComments`: every `--self-test`
dispatch names the flag with a string literal, so masking literals there would
empty the census rather than shrink it. A control pins the two masks to their
opposite answers on the same fixture.
Measured: the census is byte-identical to main (178 files, `--json` diff empty),
and over all 171 mechanically anchored rows the injection offset does not move —
the new rules pick the same byte in every one.
Ledger: the `scripts/pm/dispatch-gates.mjs` null becomes `'selfTest'`. Its copy
now parses and runs (measured by hand: exit 1, `selfTest() returned without
reaching its verdict`), so the row's remaining NOT MEASURED is the BASELINE
precondition — the probe writes its copy under `scripts/`, where that gate's own
single-site sweep finds the near-duplicate and refuses (#15515, a separate card,
not worked around here) — and the row now states that reason instead of a false
one about this file. Two stale counts in the same ledger corrected:
`check-platform-checklist` dispatches SIX self-test functions, and the
docblock's "nine files" is TEN rows.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012zGPuVVX3deAx9LdjK8jCk
'CONTROL FAILED: the code-only mask that the injection anchor reads still admits a dispatch to the population; the two masks no longer answer differently, and whichever of them the census ends up reading, one of the two questions is being answered with the wrong text');
713
+
714
+
// The ANCHOR, against every text that reads like a definition without being
715
+
// one. What is at stake is not a classification but a WRONG READING: an
716
+
// injection into a fixture string makes the copy a SyntaxError, whose non-zero
717
+
// exit and stack trace this file's verdict scores HELD (#14963).
'CONTROL FIXTURE INVALID: the three decoys no longer all stand AHEAD of the real definition, so a first-match anchor would reach the definition however it was spelled and every verdict below passes for the wrong reason');
725
+
say(decoyFlags.comment[commentDecoy]===1,
726
+
'CONTROL FIXTURE INVALID: the first decoy is not comment content, so it no longer tests the comment half of the mask');
727
+
say(decoyFlags.literal[literalDecoy]===1,
728
+
'CONTROL FIXTURE INVALID: the second decoy is not literal content, so it no longer tests the string/template half of the mask -- the half whose failure produces a SyntaxError and a false HELD');
'CONTROL FIXTURE INVALID: the third decoy is masked away as comment or literal, so it tests the mask a second time instead of the LINE-START rule it is there for');
'CONTROL FIXTURE INVALID: masking alone no longer lands on the mid-line decoy, so the LINE-START rule is not what the anchor verdict below is reading -- masking would be carrying it on its own');
'ANCHOR CONTROL FAILED: the early return was not injected at the REAL definition; a text that merely READS like one -- in a comment, in a fixture string, or mid-line in code -- was preferred over the function the dispatch calls');
`POSITIVE CONTROL FAILED: the unrunnable fixture no longer produces the measured shape (baseline exit ${u.baselineExit}, ${u.baselineBytes} byte(s)); the NOT MEASURED verdict above would then be passing for the wrong reason`);
820
+
// The anchor, ON DISK. The static assertions above read WHERE the injection
821
+
// went; this one reads what the copy then DID -- so it also says the copy
822
+
// parsed and ran. Anchored on the fixture string instead, the copy dies in
823
+
// the parser: non-zero exit, a stack trace on stderr, verdict HELD.
824
+
say(dc.verdict==='DEFEATED',
825
+
`POSITIVE CONTROL FAILED: a known-holed gate whose real definition is preceded by three definition-shaped decoys was read as ${dc.verdict} (${dc.why??''}); anchored on the fixture string this reads HELD, a hold awarded for the probe breaking its own copy`);
826
+
say(dc.mutatedBytes===0,
827
+
`POSITIVE CONTROL FAILED: the decoy gate printed ${dc.mutatedBytes} byte(s) when defeated; the copy anchored on the real definition returns before its verdict line and says NOTHING, so anything printed here is the copy failing rather than the gate being silent`);
679
828
// The HELPER handshake spelling, both directions, differing by ONE line: the
680
829
// dispatch asking `requireReachedVerdict`. Until this fixture the probe had
681
830
// read that shape in NEITHER direction -- its single carrier in the tree is
@@ -707,7 +856,7 @@ export function runControls() {
0 commit comments