Skip to content

fix(parser): scope another-opponent attack triggers - #8919

Merged
matthewevans merged 1 commit into
mainfrom
capy/scope-another-opponent-attack
Sep 16, 2026
Merged

matthewevans merged 1 commit into
mainfrom
capy/scope-another-opponent-attack

Conversation

@ntindle

@ntindle ntindle commented Sep 16, 2026

Copy link
Copy Markdown
Collaborator

Summary

Karazikar's second ability lost its defending-player restriction because the shared attack-target grammar recognized one of your opponents but not another one of your opponents. Extend that composable noun phrase so these triggers retain both existing constraints: the attacker is an opponent, and the attacked player is also an opponent of the ability's controller.

Add parser-shape and three-player production regressions covering both sides of the rule: an opponent attacking the controller does not trigger Karazikar, while that opponent attacking another opponent does. The separately unsupported compound effect body remains explicitly Unimplemented and outside this change.

Addresses #7189.

Verification

  • cargo fmt --all
  • ./scripts/check-parser-combinators.sh HEAD
  • cargo clippy --all-targets -- -D warnings
  • cargo test -p phase-engine (21,403 unit tests, 7,071 integration tests, doc tests)
  • MTGJSON_SKIP_REFRESH=1 ./scripts/gen-card-data.sh (35,977 faces validated)
  • Mutation check: disabling only the new another grammar makes the P1→P0 regression fail with one spurious trigger; restoring it makes both multiplayer cases pass

Open in Capy

Summary by CodeRabbit

  • Bug Fixes

    • Improved recognition of attack triggers involving “one of your opponents,” including optional “another” wording.
    • Corrected attack-target parsing for multi-player scenarios.
    • Ensured Karazikar’s attack trigger is created only when one opponent attacks another opponent.
  • Tests

    • Added coverage for Karazikar’s attack-trigger behavior and opponent targeting.

@coderabbitai

coderabbitai Bot commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 072d0668-fc88-4705-bc56-60240e8abb5f

📥 Commits

Reviewing files that changed from the base of the PR and between cb58ef5 and ced328b.

📒 Files selected for processing (4)
  • crates/engine/src/parser/oracle_trigger.rs
  • crates/engine/src/parser/oracle_trigger_tests.rs
  • crates/engine/tests/integration/karazikar_attack_scope_7189.rs
  • crates/engine/tests/integration/main.rs

Included review availability: Your plan provides up to 2 included reviews per hour; 1 remains after this review.


📝 Walkthrough

Walkthrough

The parser now shares handling for “one of your opponents,” including an optional “another ” prefix. Parser and integration tests verify Karazikar’s attack-trigger scope in a three-player scenario.

Changes

Opponent attack triggers

Layer / File(s) Summary
Shared opponent phrase parser
crates/engine/src/parser/oracle_trigger.rs
Added parse_one_of_your_opponents. Referenced-player, attack-target, and attack-source parsing now use this function with explicit leading-space matching where required.
Karazikar attack scope validation
crates/engine/src/parser/oracle_trigger_tests.rs, crates/engine/tests/integration/karazikar_attack_scope_7189.rs, crates/engine/tests/integration/main.rs
Added parser and integration coverage for opponent attackers, player targets, and trigger counts in a three-player scenario. Registered the integration test module.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to ced32

The scoped parser and regression-test changes have no identified merge-blocking risk.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 2 files. (2 skipped: 2… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the parser fix and the corrected scope for another-opponent attack triggers. It matches the main change and is concise.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 2 files. (2 skipped: 2 too large.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch capy/scope-another-opponent-attack

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@matthewevans matthewevans self-assigned this Sep 16, 2026
@matthewevans matthewevans added the bug Bug fix label Sep 16, 2026
@matthewevans

matthewevans commented Sep 16, 2026

Copy link
Copy Markdown
Member

Generated for head ced328b84113c842b7db6917de5a623fa42604ac.

Parse changes introduced by this PR · 1 card(s), 2 signature(s) (baseline: main cb58ef5dde00)

🟡 Modified fields (2 signatures)

  • 1 card · 🔄 trigger/Attacks · changed field attack target: a player
    • Affected (first 3): Karazikar, the Eye Tyrant
  • 1 card · 🔄 trigger/Attacks · changed field valid target: opponent
    • Affected (first 3): Karazikar, the Eye Tyrant

@matthewevans matthewevans removed their assignment Sep 16, 2026
@capy-ai

capy-ai Bot commented Sep 16, 2026

Copy link
Copy Markdown

@matthewevans Re-requesting review: all Rust shards are terminal and green, and the current-head parse-diff receipt is now published for ced328b84113c842b7db6917de5a623fa42604ac. It shows exactly the intended one-card impact for Karazikar: attack target changes from none to player and valid target changes from none to opponent.

@matthewevans matthewevans self-assigned this Sep 16, 2026

@matthewevans matthewevans left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved at ced328b84113c842b7db6917de5a623fa42604ac: the current parse-diff is limited to Karazikar's intended player attack-target and opponent-valid-target fields, and all required checks are green.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants