fix(parser): parse source-exile play durations#5116
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✓ No card-parse changes detected. |
matthewevans
left a comment
There was a problem hiding this comment.
[MED] The new duration parser misses the with this ability half of the claimed card class. Evidence: crates/engine/src/parser/oracle_nom/duration.rs:72 only accepts tag("you exile another card with ~"), and the added regression test at crates/engine/src/parser/oracle_effect/tests.rs:34607 only covers the with ~ spelling. The local card reference data for this class includes Superior Foes of Spider-Man and Unstable Amulet as UntilAPlayerExilesACardWithThisAbility, while SELF_REF_TYPE_PHRASES/SELF_REF_PARSE_ONLY_PHRASES do not normalize this ability to ~ (crates/engine/src/parser/oracle_util.rs:866). Why it matters: the PR claims the Furious Rise / Superior Foes / Unstable Amulet class, but two of the named examples still won't reach Duration::UntilSourceExilesAnotherCard, so the fix is narrower than its coverage and tests imply. Suggested fix: compose the duration grammar over both source-reference forms (with ~ / with this ability) and add a regression test using the literal with this ability wording.
Summary
Fix root #25 subcluster for source-linked impulse draw durations: cards that say "you may play that card/it until you exile another card with this [source]" were parsed as
PlayFromExile { duration: UntilEndOfTurn }.This adds a
Duration::UntilSourceExilesAnotherCardgrammar arm, expires matching source-linked durations when the same source exiles another card, and removes the fixed cards fromdocs/parser-misparse-backlog.md.Fixed cards removed from backlog:
Root Cause
The impulse
PlayFromExileparser usedstrip_trailing_duration, but the duration grammar had no representation for "until you exile another card with ~", so these permissions fell back to the impulse defaultUntilEndOfTurn.Changed-Card Audit
Focused before/after export against
origin/mainfor:Furious Rise|Superior Foes of Spider-Man|Unstable AmuletRaw JSON changed exactly these three cards:
furious risesuperior foes of spider-manunstable amuletFor each card, the only parsed value change was:
PlayFromExile.duration: UntilEndOfTurn -> UntilSourceExilesAnotherCardcoverage-parse-diffreported no card-parse signature changes, which is expected here because the support surface did not add/remove abilities; the raw JSON audit above is the discriminating check for this duration-field fix.Validation
cargo fmt --all./scripts/check-parser-combinators.shgit diff --checkcargo test -p engine --features cli --lib play_from_exile_until_source_exiles_another_card_uses_source_exile_duration -- --nocapturecargo test -p engine --features cli --lib source_exile_duration_expires_previous_permission_on_next_source_exile -- --nocapturecargo test -p engine --features cli --lib duration_roundtrip -- --nocapturecargo clippy -p engine --features cli --all-targets -- -D warningscargo run -p engine --features cli --bin oracle-gen -- data --filter "Furious Rise|Superior Foes of Spider-Man|Unstable Amulet" --output /tmp/phase-root25-after.jsoncargo run -p engine --features cli --bin card-data-validate -- /tmp/phase-root25-after.jsoncargo run -p engine --features cli --bin coverage-parse-diff -- /tmp/phase-root25-base.json /tmp/phase-root25-after.json --markdown /tmp/phase-root25-diff.md --json /tmp/phase-root25-diff.json