fix(parser): stop named filters before origin zones - #5101
Conversation
There was a problem hiding this comment.
Code Review
This pull request resolves a parser issue where card names containing the word 'from' (such as 'Extract from Darkness') were incorrectly split, or where origin-zone suffixes (such as 'from your graveyard') were not properly parsed as terminators. It introduces the parse_named_filter_origin_zone_terminator helper using nom combinators to correctly identify origin-zone suffixes, updates the named filter terminator parser, and adds corresponding unit tests. Additionally, the parser misparse backlog documentation is updated to reflect the fix. No review comments were provided, and we have no further feedback as the implementation is highly idiomatic and conforms to the repository's architectural rules.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
…igin-zone # Conflicts: # docs/parser-misparse-backlog.md
Parse changes introduced by this PR · 4 card(s), 4 signature(s) (baseline: main
|
matthewevans
left a comment
There was a problem hiding this comment.
Maintainer review: the current head matches the parse-diff boundary, stays within the existing parser seams, and has green required checks. Enqueuing via merge queue.
Summary
named <card>target filters before a followingfrom <zone>origin suffix.Extract from Darkness.Deathpact Angelfrom root chore: update coverage stats and badges #30 indocs/parser-misparse-backlog.md.Card-data audit
I audited the all-face MTGJSON candidate class matching
named .* fromand generated filtered base/head exports for that set. The filter exported 23 cards including substring false positives such asTrivia Contest; rawcard-data.jsoncomparison changed exactly these 8 cards:calim, djinn emperordeathpact angeldemigod of revengegroffskithurmyr servitorozox, the clattering kingpass the torchrekindling phoenixAll 8 changes are the intended same-class correction:
FilterProp::Nameddrops the origin-zone phrase (from your/their graveyard) while the zone-change effect still carries the origin zone.Trivia Contestwas included in the candidate export and did not change.Backlog note: only
Deathpact Angelis removed from root #30.Demigod of RevengeandGroffskithurappear elsewhere in the backlog under different root causes, so this PR leaves those entries in place.Local
coverage-parse-diffreportedoracle_changed: 0; the raw filteredcard-data.jsondiff above was manually inspected.Verification
cargo fmt --all./scripts/check-parser-combinators.shgit diff --checkcargo test -p engine --features cli --lib named_filter_terminates_at_clause_boundarycargo clippy -p engine --all-targets -- -D warningsoracle-genexports for all-facenamed .* fromcandidatescard-data.jsonchanged-key comparisoncargo run -p engine --features cli --bin card-data-validate -- /tmp/phase-root30-class-head.json(OK: 23 cards parsed)cargo run -p engine --features cli --bin coverage-parse-diff -- ...(oracle_changed: 0)