Skip to content

perf: batch fixed opponent life-loss triggers - #6297

Merged
matthewevans merged 2 commits into
mainfrom
ship/batch-opponent-life-loss
Jul 21, 2026
Merged

perf: batch fixed opponent life-loss triggers#6297
matthewevans merged 2 commits into
mainfrom
ship/batch-opponent-life-loss

Conversation

@matthewevans

@matthewevans matthewevans commented Jul 21, 2026

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • New Features

    • Improved resolution of repeated opponent life-loss effects by processing eligible consecutive triggers together.
    • Preserves resolution-time condition checks and safely stops batching when conditions or effect details differ.
  • Bug Fixes

    • Prevents batch processing when life-loss observers or other effects could change the outcome.
    • Ensures triggers with differing prerequisites, targets, timing, or optionality continue to resolve individually.

@matthewevans
matthewevans enabled auto-merge July 21, 2026 19:47
@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: b3e07d1e-7b85-4e45-8bb6-2d36768c84cf

📥 Commits

Reviewing files that changed from the base of the PR and between e06df32 and ffbfbe8.

📒 Files selected for processing (1)
  • crates/engine/src/game/stack.rs

📝 Walkthrough

Walkthrough

Adds Tier-3 batching for eligible fixed opponent life-loss triggered abilities, preserving intervening-if checks and resolved-context invariants through the proven-inert batch framework. Tests cover batching, rechecks, run boundaries, and observer-triggered fallback.

Changes

Opponent life-loss batching

Layer / File(s) Summary
Fixed opponent life-loss batch implementation
crates/engine/src/game/stack.rs
Adds strict eligibility checks, contiguous-run detection, batch keys, and proven-inert batch resolution for fixed opponent life-loss abilities.
Tier-3 resolution dispatch
crates/engine/src/game/stack.rs
Routes eligible runs of at least two entries through the new batch resolver.
Batch construction and runtime validation
crates/engine/src/game/stack.rs
Adds trigger helpers and tests for provenance, intervening-if reevaluation, differing conditions, and life-lost observer fallback.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant StackResolver
  participant RunDetector
  participant BatchResolver
  participant ProvenInertFramework
  StackResolver->>RunDetector: inspect top contiguous opponent life-loss run
  RunDetector-->>StackResolver: return eligible run length
  StackResolver->>BatchResolver: resolve run when length is at least two
  BatchResolver->>ProvenInertFramework: prove and commit entries
  ProvenInertFramework-->>BatchResolver: apply entries passing intervening-if checks
Loading

Suggested reviewers: lgray, andriypolanski, nornagon

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: batching fixed opponent life-loss triggers for performance.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ship/batch-opponent-life-loss

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

@matthewevans

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@github-actions

Copy link
Copy Markdown

Parse changes introduced by this PR

✓ No card-parse changes detected.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant