fix(parser): retain target for counter instead overrides - #6843
Conversation
📝 WalkthroughWalkthroughThe parser now preserves selected targets across conditional ChangesConditional counter target reuse
Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
matthewevans
left a comment
There was a problem hiding this comment.
Changes requested — the current implementation still misses one member of the stated replacement class.
🔴 Blocker
[MED] The new rewrite only rebinds an instead-counter body when its immediate PutCounter antecedent has TargetFilter::Typed; it returns false for every other antecedent target. Evidence: crates/engine/src/parser/oracle_effect/lower.rs:2406-2419. The same stated “it … instead” class includes Emiel the Blessed: resolve_it_pronoun maps any non-self trigger subject to TriggeringSource (crates/engine/src/parser/oracle_effect/mod.rs:221-238), and Emiel’s “another creature you control enters” is that case. The lowering guard then returns false for TriggeringSource, so the override’s bare it remains SelfRef and puts counters on Emiel rather than the entering Unicorn. The linked #6677 lists Emiel as the same root cause, while tests only cover typed Wakandan/Elder forms (tests.rs:19091-19132; issue_6677_wakandan_royal_guard.rs:14-103).
Recommendation: preserve valid already-bound object antecedents, including ParentTarget/TriggeringSource where applicable, and add an Emiel runtime regression with an entering Unicorn and distinct source/other creature.
Parse changes introduced by this PR · 3 card(s), 6 signature(s) (baseline: main
|
matthewevans
left a comment
There was a problem hiding this comment.
Changes requested — the current-head Emiel regression fails in CI.
🔴 Blocker
[MED] The new runtime regression does not establish the required behavior: issue_6677_wakandan_royal_guard.rs:140 expects the entering Unicorn to have two +1/+1 counters, but the CI run observed left: 0, right: 2. The terminal job is Rust tests (shard 2/2). The change therefore does not yet prove or deliver the Emiel trigger path it adds.
Recommendation: Trace the accepted optional-payment trigger through its counter/"instead" branches, correct the unresolved binding or execution path, and update the regression so it passes with a reach guard for the optional paid path.
Evidence: current-head CI output and the linked regression test. Confidence: high. I have not inferred a root cause beyond the failing production-path assertion.
|
Maintainer hold — current-head verification is pending. I merged the branch cleanly with the current
No action is required from the contributor. This is a maintainer verification hold; I will not approve or enable auto-merge until the updated checks and artifact are live. |
matthewevans
left a comment
There was a problem hiding this comment.
Maintainer sign-off: current-head CI, parse-diff, and implementation review are clean.
Summary
Fix the optional-payment form of a conditional
insteadoverride: after “you may pay … If you do, X”, a later “Y instead” now replaces the paid continuationX, rather than the payment itself. This completes the Emiel the Blessed path while retaining the existing target/event-context rebinding work for #6677.Closes #6677.
Files changed
crates/engine/src/parser/oracle_effect/assembly.rscrates/engine/src/parser/oracle_effect/lower.rscrates/engine/src/parser/oracle_effect/tests.rscrates/engine/tests/integration/issue_6677_wakandan_royal_guard.rscrates/engine/tests/integration/main.rsTrack
Developer
LLM
Model: gpt-5-6
Tier: Frontier
Thinking: high
Implementation method (required)
Method: /engine-implementer
CR references
Verification
Required checks ran clean, or the exact CI-owned alternative is stated below.
Gate A output below is for the current committed head.
Final review-impl below is clean for the current committed head.
Both anchors cite existing analogous code at the same seam.
cargo fmt --all— passed.git diff --check— passed../scripts/check-skill-doc.sh— passed../scripts/check-parser-combinators.sh— Gate G PASS; Gate A PASS below.cargo clippy --all-targets -- -D warnings— infrastructure-inconclusive: the runner completed engine compilation without a Rust diagnostic but dropped the final Cargo status.cargo test -p phase-engine --test integration issue_6677_wakandan_royal_guard::emiel_the_blessed_doubles_counters_on_the_entering_unicorn -- --exact --nocapture— infrastructure-inconclusive: the runner terminated before the integration binary linked or ran; no Rust diagnostic../scripts/gen-card-data.sh— infrastructure-inconclusive: the runner terminated after refreshing MTGJSON inputs and before invoking the generator; no tracked output changed.cargo coverage/cargo semantic-audit— CI-owned: generateddata/card-data.jsonis absent locally, so these audits cannot run before card-data generation completes.Gate A
Gate A PASS head=453876adc9287a4b0602aee22807236b2b838adf base=02760f58841457847f535a6f54aa480ae8e22af5
Anchored on
crates/engine/src/parser/oracle_effect/lower.rs:2388— existing counter-override antecedent rebinding authority.crates/engine/src/game/effects/mod.rs:2693— existingOptionalEffectPerformedcontinuation resolution authority.Final review-impl
Final review-impl PASS head=453876adc9287a4b0602aee22807236b2b838adf
Claimed parse impact
Pending current-head coverage parse-diff. The prior artifact predates this commit and covered only Elder Cathar and Wakandan Royal Guard; this repair is expected to add Emiel the Blessed’s paid-continuation shape.
Scope Expansion
None.
Validation Failures
CI Failures
The prior current-head CI failure in Emiel’s regression is addressed by this commit. Current-head CI is pending.
Summary by CodeRabbit
Bug Fixes
Tests