fix(parser): parse repeated named control clauses#5114
Conversation
There was a problem hiding this comment.
Code Review
This pull request enhances the condition parser in crates/engine/src/parser/oracle_nom/condition.rs to support disjunctions in 'you control [type] named [Name1] or a [type] named [Name2]' phrases, resolving backlog issues for cards like High Marshal Arguel and Liu Bei. The feedback suggests expanding the list of condition terminators in parse_control_named_condition_terminator to prevent name parser overruns, and adding mandatory CR annotations to the new rules-touching helper functions per Rule R6.
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.
Parse changes introduced by this PR✓ No card-parse changes detected. |
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
…named-clauses # Conflicts: # docs/parser-misparse-backlog.md
matthewevans
left a comment
There was a problem hiding this comment.
Thanks for the update. I found three remaining parser/scope blockers:
[MED] Comma-led add effects now overrun into the second named card. Evidence: crates/engine/src/parser/oracle_nom/condition.rs:745 terminator list lacks add , while Tower Worker has If you control creatures named Mine Worker and Power Plant Worker, add {C}{C}{C} instead. Why it matters: the new guarded comma boundary regresses a printed shared-type named-control clause that the old comma stop would have split. Suggested fix: terminate on , add and add a discriminating Tower Worker-style parser test.
[MED] The named-control parser still materializes exactly two named predicates, so three-name lists collapse names. Evidence: crates/engine/src/parser/oracle_nom/condition.rs:692 returns only (first, second); Helm of Kaldra has Equipment named Helm of Kaldra, Sword of Kaldra, and Shield of Kaldra. Why it matters: the touched seam handles the class as a pair parser, leaving a same-class printed clause misparsed. Suggested fix: parse a named-member list into N predicates, preserving shared-type and repeated-typed members.
[MED] The sticky parse-diff contains an unexplained out-of-scope parser change. Evidence: the coverage-parse-diff sticky reports Say Its Name added cost/two other cards named Say Its Name from your graveyard, while the PR body claims only High Marshal Arguel and Liu Bei changed. Why it matters: parser PRs need the card-level diff reconciled; unexplained gained/changed signatures are possible blast radius. Suggested fix: reconcile the full sticky diff by explaining/regenerating the baseline or eliminating the unrelated Say Its Name change.
# Conflicts: # docs/parser-misparse-backlog.md
|
Updated against latest origin/main and pushed 4c9667c. Addressed review feedback by adding the comma/add terminator path, generalizing named-control lowering from two names to N named members, preserving the repeated-typed member path, and adding Tower Worker plus Helm of Kaldra regressions. I also narrowed the broad CR comments to verified CR 201.2 where the parser is only grounding card names. Verification: cargo fmt --all; git diff --check; WSL cargo test -p engine --lib control_named; WSL cargo test -p engine --lib shared_type_named_serial_list; WSL cargo test -p engine --lib repeated_typed_named. Current branch diff is condition.rs plus the upstream backlog merge cleanup, so the older Say Its Name parse-diff note does not correspond to a current code/data delta in this PR. |
|
Follow-up: origin/main advanced with #5116 after my review-fix push, so I merged latest main into this PR and pushed 6889b89. Post-merge verification: cargo fmt --all; git diff --check; WSL cargo test -p engine --lib control_named; WSL cargo test -p engine --lib shared_type_named_serial_list; WSL cargo test -p engine --lib repeated_typed_named. |
# Conflicts: # crates/engine/src/parser/oracle_nom/condition.rs
|
Updated this branch onto current main ( Verified:
|
matthewevans
left a comment
There was a problem hiding this comment.
Maintainer review: prior parser blockers are resolved on this head. Parse-diff is scoped to High Marshal Arguel and Liu Bei; shared-type N-name lists, repeated typed named clauses, and comma-led add effects are covered by parser regressions.
Summary
you control ... named ...condition parser so repeated typed named clauses keep their own type/name pairs.Root cause
parse_control_named_pairhandledyou control artifacts named A and Bby sharing one parsed type across both names. That same path over-consumed repeated typed clauses:Enchantmentnamed"a land named temple of aclazotz".Namedstring.Parse audit
Focused before/after export for root #30 changed exactly these cards:
high marshal arguelliu bei, lord of shuRaw JSON deltas are intentional:
Landnamed"temple of aclazotz"instead ofEnchantmentnamed"a land named temple of aclazotz".Or(IsPresent permanent named Guan Yu, IsPresent permanent named Zhang Fei)instead of one overrunNamedvalue.coverage-parse-diffon the same focused exports reported no card-parse changes detected.Review cleanup
Addressed current Gemini review comments in
9b89e5533:CR 201.2,CR 603.4).Verification
cargo fmt --all./scripts/check-parser-combinators.shcargo test -p engine --features cli --lib control_named -- --nocapturecargo test -p engine --features cli --lib repeated_typed_named_pair -- --nocapturecargo clippy -p engine --all-targets -- -D warningsoracle-genbefore/after export for root chore: update coverage stats and badges #30coverage-parse-diff /tmp/phase-root30-search-named-or-before.json /tmp/phase-root30-control-named-after.jsoncargo fmt --all,./scripts/check-parser-combinators.sh,cargo test -p engine --features cli --lib control_named -- --nocapture,cargo test -p engine --features cli --lib repeated_typed_named_pair -- --nocapture,cargo clippy -p engine --all-targets -- -D warnings,git diff --checkNote: full workspace
cargo clippy --all-targets -- -D warningsis blocked on this host by missingpkg-config/OpenSSL for non-engine targets; the engine crate clippy gate passed.