Skip to content

Commit 6935da6

Browse files
committed
test(spec): make the pin enforce the whole sentence its comment promises
The comment said the wrong tool may appear "ONLY as the correction naming it wrong — never as a command to run", but the assertion under it was `not.toMatch(/^\s*pnpm sdui:manifest/m)`, which enforces only the second half. Measured against the real generated text: the original defective claim ("`pnpm sdui:manifest` rewrites it when .objectui-sha moves") is itself MID-LINE, so the line-anchored form does not match it at all — it was caught only by the positive pins beside it. Prose asserting more than the code does, inside a change about prose asserting more than the tree does. The lookahead form enforces the whole sentence and catches the mid-line shape on its own. Measured on all three texts before it was written, via the real manifestPrescription() output rather than a hand-typed fixture: present branch anchored: false lookahead: false (assertion passes) defective anchored: FALSE lookahead: TRUE (only the new form catches it) absent branch anchored: true lookahead: true The absent branch legitimately opens command lines with that spelling, which is why this assertion stays inside the present-branch leg and must not be hoisted; a flat `not.toContain` is unavailable in the other direction, since it would forbid the correction itself. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016N6xmWt5hYm94ffVEwGH8x
1 parent 0e73d7f commit 6935da6

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

packages/spec/scripts/check-react-blocks-declaration-parity.test.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -567,11 +567,17 @@ describe('check:react-declaration-parity — the prescription is probed, not ass
567567
// the wrong one is this card's defect class again: a confident false claim about
568568
// the tree, in the text consulted when deciding what to run.
569569
expect(text).toContain('gen-sdui-manifest-node.mjs');
570-
// The wrong tool may appear ONLY as the correction naming it wrong — never as a
571-
// command to run. Pinning the spelling's absence outright would be the weaker
572-
// test AND would forbid the correction: in the absent branch the same spelling
573-
// legitimately opens a command line, which is exactly what this discriminates.
574-
expect(text).not.toMatch(/^\s*pnpm sdui:manifest/m);
570+
// The wrong tool may appear ONLY inside the correction that names it wrong —
571+
// nowhere else, command line or prose. The LOOKAHEAD is what enforces the whole of
572+
// that sentence, and it was measured before it was written: the original defective
573+
// claim ('`pnpm sdui:manifest` rewrites it when .objectui-sha moves') was itself
574+
// MID-LINE, so a line-anchored form does not match it at all and would have left
575+
// this comment promising more than the code delivers — the same over-claim, one
576+
// layer up, in a card about exactly that. A flat `not.toContain` is not available
577+
// either: it would forbid the correction itself. This assertion belongs to the
578+
// present branch alone — the absent branch legitimately opens command lines with
579+
// that spelling, so it must not be hoisted out of this leg.
580+
expect(text).not.toMatch(/pnpm sdui:manifest(?!` does NOT rewrite)/);
575581
expect(text).toContain('`pnpm sdui:manifest` does NOT rewrite this file');
576582
// …and it says, in words, what the two devs got wrong.
577583
expect(text).toMatch(/NOT MEASURED/);

0 commit comments

Comments
 (0)