fix(parser): recover multi-target spec for tap/untap up-to phrases#3752
Merged
matthewevans merged 3 commits intoJun 18, 2026
Merged
Conversation
Contributor
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
eb1c82c to
ccc45fe
Compare
matthewevans
approved these changes
Jun 18, 2026
matthewevans
left a comment
Member
There was a problem hiding this comment.
VERDICT: approve
Parser/runtime regression reviewed clean, maintainer/contributor clippy fix is limited to the test pattern, CI is green, and the current head is labeled bug.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Elder Deep-Fiend's "When you cast this spell, tap up to four target permanents" was parsed as a single-target tap effect because the imperative parser stripped the
"up to four target"quantifier but never stampedMultiTargetSpeconto the ability. At cast time the engine surfaced a malformedTriggerTargetSelection(one mandatory slot instead of up to four optional slots), which could crash the React client with a blank blue screen.This PR adds two post-parse recovery helpers in
oracle_effect/lower.rs, mirroring the existingextract_exact_target_multi_target/extract_bounded_target_multi_targetpattern:extract_optional_target_multi_target— recovers"tap up to four target permanents"and the fullMULTI_TARGET_VERBSclass (exile,tap,untap,goad,return,destroy,choose).extract_verb_up_to_multi_target— recovers non-target-word shapes like"untap up to five lands"(Peregrine Drake class) via the existingstrip_any_number_quantifierbuilding block.Closes #3274
Root cause
The Fight imperative path already preserved
multi_targetthroughTargetedImperativeAst::Fightand alower_imperative_family_astintercept. Tap/Untap imperatives calledstrip_optional_target_prefixbut discarded the returned spec. The ability lowerer only recovered exact-count and bounded-count phrases, not"up to N target …".Changes
crates/engine/src/parser/oracle_effect/lower.rsextract_optional_target_multi_target,extract_verb_up_to_multi_target; wire into ability-definition lowering; unit testscrates/engine/tests/integration/issue_3274_elder_deep_fiend.rscrates/engine/tests/integration/main.rsTest plan
extract_optional_target_multi_target_recovers_tap_up_to_four(unit)extract_verb_up_to_multi_target_recovers_untap_lands(unit)elder_deep_fiend_cast_trigger_parses_up_to_four_multi_target— AST carriesMultiTargetSpec::up_to(4)elder_deep_fiend_cast_trigger_surfaces_four_optional_target_slots— casting with ≥4 legal permanents yields four optionalTriggerTargetSelectionslotsCloses
Fixes #3274