[codex] fix(parser): split repeated named spell conditions#5123
Conversation
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
Parse changes introduced by this PR · 1 card(s), 2 signature(s) (baseline: main
|
matthewevans
left a comment
There was a problem hiding this comment.
[MED] The new repeated named-spell helper cites the wrong Comprehensive Rule for this spell-resolution condition. Evidence: crates/engine/src/parser/oracle_nom/condition.rs adds parse_repeated_named_spells_this_turn with CR 201.2 + CR 603.4, but docs/MagicCompRules.txt defines CR 603.4 as the intervening-if triggered-ability rule, and the parse-diff shows this helper is lowering Sift Through Sands' spell-resolution "If you've cast..." condition. Why it matters: this repo treats verified CR comments as review evidence, and a wrong CR citation is worse than no citation around rules-sensitive parser code. Suggested fix: keep the CR 201.2 named-object grounding here and either remove CR 603.4 from this helper comment or replace/split it with a rule that actually applies to conditional spell resolution.
Summary
Fixes the Root #30 subcluster for
Sift Through Sands: repeated named-spell cast conditions of the formyou've cast a spell named A and a spell named B this turn.Root cause: the generic single-spell-history parser treated the whole phrase after the first
spell namedas one literalNamedvalue, producing a filter namedpeer through depths and a spell named reach through mists. The condition therefore checked for one impossible card name instead of requiring both spells to have been cast.This PR adds a nom combinator before the generic single-spell parser that recognizes repeated
a spell named ...items and lowers them toStaticCondition::And/Orover existingSpellsCastThisTurnquantity checks. The effect-condition bridge already maps that toAbilityCondition::Andfor the optional search clause.Backlog update: removes
Sift Through Sandsfromdocs/parser-misparse-backlog.mdRoot #30, changing the branch-local count from 12 to 11.Parsed-card diff audit
Targeted baseline/after exports:
/tmp/phase-root30-sift-baseline.json/tmp/phase-root30-sift-after.jsonSift Through SandsRaw parsed card keys in both exports:
sift through sandsExpected parse movement:
SpellsCastThisTurnhad oneNamedfilter:peer through depths and a spell named reach through mists.Andof twoSpellsCastThisTurn >= 1checks, namedpeer through depthsandreach through mists.Sibling scan against current MTGJSON found exactly one repeated named-spell condition text:
jq -r '.data | to_entries[] | .key as $name | .value[] | select(.text? and (.text | test("spell named .* (and|or|and/or) a spell named"; "i"))) | $name + " :: " + (.text | gsub("\\n"; " / "))' data/mtgjson/AtomicCards.jsoncoverage-parse-diffreported no support-signature clusters (oracle_changed: 0), so the expected raw AST repair is confined to the audited card.Validation
grep -n "^201.2" docs/MagicCompRules.txtgrep -n "^603.4" docs/MagicCompRules.txtcargo fmt --all./scripts/check-parser-combinators.shgit diff --checkcargo test -p engine --features cli --lib youve_cast_repeated_named_spells_this_turn_is_compound -- --nocapturecargo test -p engine --features cli --lib sift_through_sands_condition_requires_both_named_spells -- --nocapturecargo test -p engine --features cli --lib spell_this_turn -- --nocapturecargo run -p engine --features cli --bin oracle-gen -- data --filter "Sift Through Sands" --output /tmp/phase-root30-sift-after.jsoncargo run -p engine --features cli --bin card-data-validate -- /tmp/phase-root30-sift-after.jsoncargo run -p engine --features cli --bin coverage-parse-diff -- /tmp/phase-root30-sift-baseline.json /tmp/phase-root30-sift-after.json --markdown /tmp/phase-root30-sift-parse-diff.md --json /tmp/phase-root30-sift-parse-diff.jsonTilt was not running in this checkout (
No tilt apiserver found: tilt-default), so I used the direct cargo fallback allowed by the repo instructions.