Skip to content

fix(parser): parse compound activation conditions#5115

Open
ntindle wants to merge 1 commit into
phase-rs:mainfrom
ntindle:codex/root28-activation-condition-or
Open

fix(parser): parse compound activation conditions#5115
ntindle wants to merge 1 commit into
phase-rs:mainfrom
ntindle:codex/root28-activation-condition-or

Conversation

@ntindle

@ntindle ntindle commented Jul 5, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Parse compound activation restriction conditions whose later branches repeat if, such as Activate only if this land entered this turn or if you control a basic land.
  • Let source-zone shorthand fragments after or parse as source-zone conditions, such as on the battlefield or in your graveyard.
  • Use the shared type-phrase parser for qualified you control a ... restriction conditions so basic land becomes ObjectCount(Land + HasSupertype(Basic), controller You) >= 1 rather than a literal subtype-like string.
  • Remove Hidden Lair and Skyblade's Boon from root chore: update coverage stats and badges #28 in docs/parser-misparse-backlog.md.

Root Cause

parse_connector_split split restriction conditions on or, then parsed each fragment as atomic condition text. That failed when Oracle repeated the condition marker on the second branch (or if you control ...) or used source-zone shorthand (or in your graveyard). After the compound parse failed, the fallback atomic parser kept only the first recognized leaf it could scan.

Parse Audit

Focused before/after export covered all 17 root #28 backlog cards:

  • Fixer, Techno Terror
  • Garenbrig Squire
  • Goremand
  • Grizzled Wolverine
  • Hermit of the Natterknolls
  • Hidden Lair
  • Highspire Bell-Ringer
  • Hurkyl's Final Meditation
  • Ichneumon Druid
  • MACH-1, Swooping Scoundrel
  • Shadowheart, Sharran Cleric
  • Skarrgan Hellkite
  • Skyblade's Boon
  • Tomb Tyrant
  • Trade Caravan
  • Uthros Research Craft
  • Uthros, Titanic Godcore

Raw changed card keys:

  • hidden lair
  • skyblade's boon

Intentional deltas:

  • Hidden Lair: second mana ability restriction changes from SourceEnteredThisTurn only to Or(SourceEnteredThisTurn, ObjectCount(basic land you control) >= 1).
  • Skyblade's Boon: activated ability restriction changes from SourceInZone(Graveyard) only to Or(SourceInZone(Battlefield), SourceInZone(Graveyard)).

coverage-parse-diff on the focused exports reported no signature-level card-parse changes, which is expected for this internal activation-condition shape.

Verification

  • cargo fmt --all
  • ./scripts/check-parser-combinators.sh
  • cargo test -p engine --features cli --lib parses_compound_or_if_restriction_fragments -- --nocapture
  • cargo test -p engine --features cli --lib parses_compound_source_zone_shorthand -- --nocapture
  • cargo test -p engine --features cli --lib restriction_condition -- --nocapture
  • target/debug/card-data-validate /tmp/phase-root28-after.json
  • target/debug/coverage-parse-diff /tmp/phase-root28-base.json /tmp/phase-root28-after.json --markdown /tmp/phase-root28-diff.md --json /tmp/phase-root28-diff.json
  • cargo clippy -p engine --all-targets -- -D warnings
  • git diff --check

@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!

@ntindle ntindle marked this pull request as ready for review July 5, 2026 01:21
@ntindle ntindle requested a review from matthewevans as a code owner July 5, 2026 01:21
@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!

@github-actions

github-actions Bot commented Jul 5, 2026

Copy link
Copy Markdown

Parse changes introduced by this PR

✓ No card-parse changes detected.

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.

2 participants