Skip to content

test(parser): give the U20 role walk-backs their only witness#5635

Merged
matthewevans merged 1 commit into
mainfrom
ship/u20-role-witness-tests
Jul 12, 2026
Merged

test(parser): give the U20 role walk-backs their only witness#5635
matthewevans merged 1 commit into
mainfrom
ship/u20-role-witness-tests

Conversation

@matthewevans

Copy link
Copy Markdown
Member

DamageDealer and DigLook bind the nearest def OF THEIR ROLE, walking past
an intervening non-member. That walk-back is the entire reason they are roles
and not AntecedentSelector::LastEmitted — and NOTHING proved it.

The card pool cannot: all 19 fires across the full pool (4 ExcessDamage +
11 ExileLookedAt + 4 ExileOneOfThem, measured) land at depth 0 with exactly
one candidate. LastEmitted is output-identical on every printed card today.
So the walk-back shipped as a capability with no witness, and the first card
to print an intervening clause between an anchor and its rider would have
been its first-ever exercise — in production, silently.

Three synthetic tests, one per consumer (two of them share DigLook, which
also makes the shared-role decision empirical rather than asserted): put a
non-member def AFTER the anchor and assert the binding still lands on index 0
— the answer LastEmitted gets WRONG.

Verified discriminating, not just passing: with both roles collapsed to
LastEmitted, all three go RED. Two of them fail inside the unreachable!()
arms this unit introduced (the binding hands back the intervening def, whose
effect is the wrong shape), so the hardening turns what would have been a
silent misbind into a loud panic; the third fails its own assertion, with the
un-rewritten Dig printed.

Also fixes one CR miscitation, in both places it appears in this class:

CR 701.16a is "Investigate" — "Create a Clue token." It does not govern
private looks. The rule for "look at one or more cards" is CR 701.20e
(both grep-verified against docs/MagicCompRules.txt).

ExileLookedAtCard's arm comment (sequence.rs) has cited 701.16a since it was
written, and my first draft of the test doc COPIED that number into a new line
— verifying only that the rule EXISTS, never that it GOVERNS. Both are now
CR 701.20e. The same arm already cited 701.20e correctly two lines further
down ("reveal stays false — the look was private"), which is what makes the
miscitation unambiguous rather than a judgement call.

Deliberately NOT a sweep: three more 701.16a instances remain in this file and
~22 across engine/src, spanning look-at, reveal-vs-look, and sacrifice
contexts. They are a separate unit with its own audit, and double-fixing them
here would collide with it. Only the line this test's doc points AT is touched,
so the test and the code it describes agree.

No production logic changes (the only non-test edit is a comment), so the U20
byte-identical full-pool export result is untouched.

`DamageDealer` and `DigLook` bind the nearest def OF THEIR ROLE, walking past
an intervening non-member. That walk-back is the entire reason they are roles
and not `AntecedentSelector::LastEmitted` — and NOTHING proved it.

The card pool cannot: all 19 fires across the full pool (4 ExcessDamage +
11 ExileLookedAt + 4 ExileOneOfThem, measured) land at depth 0 with exactly
one candidate. `LastEmitted` is output-identical on every printed card today.
So the walk-back shipped as a capability with no witness, and the first card
to print an intervening clause between an anchor and its rider would have
been its first-ever exercise — in production, silently.

Three synthetic tests, one per consumer (two of them share `DigLook`, which
also makes the shared-role decision empirical rather than asserted): put a
non-member def AFTER the anchor and assert the binding still lands on index 0
— the answer `LastEmitted` gets WRONG.

Verified discriminating, not just passing: with both roles collapsed to
`LastEmitted`, all three go RED. Two of them fail inside the `unreachable!()`
arms this unit introduced (the binding hands back the intervening def, whose
effect is the wrong shape), so the hardening turns what would have been a
silent misbind into a loud panic; the third fails its own assertion, with the
un-rewritten `Dig` printed.

Also fixes one CR miscitation, in both places it appears in this class:

  CR 701.16a is "Investigate" — "Create a Clue token." It does not govern
  private looks. The rule for "look at one or more cards" is CR 701.20e
  (both grep-verified against docs/MagicCompRules.txt).

`ExileLookedAtCard`'s arm comment (sequence.rs) has cited 701.16a since it was
written, and my first draft of the test doc COPIED that number into a new line
— verifying only that the rule EXISTS, never that it GOVERNS. Both are now
CR 701.20e. The same arm already cited 701.20e correctly two lines further
down ("reveal stays false — the look was private"), which is what makes the
miscitation unambiguous rather than a judgement call.

Deliberately NOT a sweep: three more 701.16a instances remain in this file and
~22 across engine/src, spanning look-at, reveal-vs-look, and sacrifice
contexts. They are a separate unit with its own audit, and double-fixing them
here would collide with it. Only the line this test's doc points AT is touched,
so the test and the code it describes agree.

No production logic changes (the only non-test edit is a comment), so the U20
byte-identical full-pool export result is untouched.
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@matthewevans
matthewevans enabled auto-merge July 12, 2026 04:24
@matthewevans
matthewevans added this pull request to the merge queue Jul 12, 2026
@github-actions

Copy link
Copy Markdown

Parse changes introduced by this PR

✓ No card-parse changes detected.

Merged via the queue into main with commit 950c667 Jul 12, 2026
13 checks passed
@matthewevans
matthewevans deleted the ship/u20-role-witness-tests branch July 12, 2026 04:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant