Skip to content

fix(engine): settle resumed change zone members - #7268

Merged
matthewevans merged 5 commits into
mainfrom
ship/fix-engine-settle-resumed-change-zone-members
Aug 12, 2026
Merged

fix(engine): settle resumed change zone members#7268
matthewevans merged 5 commits into
mainfrom
ship/fix-engine-settle-resumed-change-zone-members

Conversation

@matthewevans

@matthewevans matthewevans commented Aug 12, 2026

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • Bug Fixes
    • Improved reliability when resuming paused zone changes.
    • Terminal outcomes are now consistently recorded, including cases where an object moved or remained in place.
    • Explicit completion results take precedence over inferred outcomes, reducing incorrect state transitions after interrupted deliveries.
    • Fixed completion classification to use the full set of delivery events, improving accuracy for complex zone changes.

@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@matthewevans, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 4 seconds

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 81f7c028-1e44-429b-84ef-55c8b846fb08

📥 Commits

Reviewing files that changed from the base of the PR and between e9e204d and e17c423.

📒 Files selected for processing (4)
  • crates/engine/src/game/effects/mod.rs
  • crates/engine/src/game/engine.rs
  • crates/engine/src/types/game_state.rs
  • crates/engine/tests/integration/issue_3252_rhythm_of_the_wild.rs
📝 Walkthrough

Walkthrough

The change centralizes terminal completion resolution for paused zone-change deliveries. Explicit outcomes take precedence over inferred outcomes. Resumed deliveries always record the resolved completion, and pipeline processing uses the shared classifier.

Changes

Zone-change completion resolution

Layer / File(s) Summary
Completion resolution
crates/engine/src/types/game_state.rs
PendingZoneChangeDelivery now resolves explicit terminal outcomes first, then infers Moved or Remained from retained delivery events. Tests cover inferred and explicit outcomes.
Completion integration
crates/engine/src/game/zone_pipeline.rs, crates/engine/src/game/effects/mod.rs, crates/engine/src/game/engine.rs
Zone-change processing uses the shared completion classifier. Resumed deliveries always record the resolved completion. Three source references were updated.

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

Possibly related PRs

  • phase-rs/phase#7074: Both changes update zone-change delivery completion logic and related delivery state.

Suggested labels: bug, area:engine

Suggested reviewers: lgray, andriypolanski, mike-thedude

🚥 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 and concisely describes the engine fix for settling resumed ChangeZone members.
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/fix-engine-settle-resumed-change-zone-members

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 enabled auto-merge August 12, 2026 03:31
@github-actions

github-actions Bot commented Aug 12, 2026

Copy link
Copy Markdown

Generated for head e17c42365e2b4c25e85fcd97e5362b4415095252.

Parse changes introduced by this PR

✓ No card-parse changes detected.

@matthewevans
matthewevans force-pushed the ship/fix-engine-settle-resumed-change-zone-members branch 3 times, most recently from c0c60b5 to 07c0785 Compare August 12, 2026 15:40
@matthewevans
matthewevans disabled auto-merge August 12, 2026 15:55
@matthewevans
matthewevans enabled auto-merge August 12, 2026 15:55
@matthewevans
matthewevans force-pushed the ship/fix-engine-settle-resumed-change-zone-members branch from 07c0785 to e9e204d Compare August 12, 2026 16:03

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@crates/engine/src/types/game_state.rs`:
- Around line 3449-3483: The completion classifier in
terminal_completion_after_resume and completion_from_delivery_events needs a
verified CR annotation. Add a concise “CR 400.7” comment documenting the
new-object boundary for zone changes and stating that the retained delivery
event slice must be used because current object state cannot identify this
delivery; do not alter the classification logic.
- Around line 22748-22775: Extend the focused integration tests under the
existing integration module registration to exercise the real replacement-pause
resume flow through drain_pending_change_zone_iteration, rather than
constructing PendingZoneChangeDelivery directly. Cover all three resumed
outcomes—Moved, Prevented, and Remained—while preserving the existing terminal
outcome assertions and using the actual retained-event and replacement-pause
path.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: f28abc73-406b-40f9-aaa7-703dfe0846bc

📥 Commits

Reviewing files that changed from the base of the PR and between d38f364 and e9e204d.

📒 Files selected for processing (4)
  • crates/engine/src/game/effects/mod.rs
  • crates/engine/src/game/engine.rs
  • crates/engine/src/game/zone_pipeline.rs
  • crates/engine/src/types/game_state.rs

Comment thread crates/engine/src/types/game_state.rs
Comment on lines +22748 to +22775
#[test]
fn paused_zone_change_delivery_derives_a_terminal_outcome_after_resume() {
let member = ObjectIncarnationRef::of(ObjectId(71), 4);
let mut delivery = PendingZoneChangeDelivery::new(
member,
ProposedEvent::zone_change(
member.object_id,
Zone::Battlefield,
Zone::Graveyard,
Some(ObjectId(72)),
),
);

assert_eq!(
delivery.terminal_completion_after_resume(),
ZoneMoveCompletion::Remained,
"an answered pause with no original-incarnation event completed without moving"
);

delivery
.record_terminal_completion(ZoneMoveCompletion::Prevented)
.expect("the explicit replacement outcome is recorded once");
assert_eq!(
delivery.terminal_completion_after_resume(),
ZoneMoveCompletion::Prevented,
"an explicit replacement outcome remains authoritative over slice inference"
);
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift

Add an end-to-end integration test for resumed completion.

This test constructs PendingZoneChangeDelivery directly. It does not execute replacement pause, retained-event capture, and drain_pending_change_zone_iteration. Add an integration test that validates Moved, Prevented, and Remained through the real resume path.

As per path instructions, “Add or extend focused engine tests in crates/engine/tests/integration/ with the existing integration module registration.”

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/engine/src/types/game_state.rs` around lines 22748 - 22775, Extend the
focused integration tests under the existing integration module registration to
exercise the real replacement-pause resume flow through
drain_pending_change_zone_iteration, rather than constructing
PendingZoneChangeDelivery directly. Cover all three resumed outcomes—Moved,
Prevented, and Remained—while preserving the existing terminal outcome
assertions and using the actual retained-event and replacement-pause path.

Source: Path instructions

@matthewevans
matthewevans added this pull request to the merge queue Aug 12, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Aug 12, 2026
…e-resumed-change-zone-members

# Conflicts:
#	crates/engine/src/game/engine.rs
@matthewevans
matthewevans enabled auto-merge August 12, 2026 16:58
@matthewevans
matthewevans added this pull request to the merge queue Aug 12, 2026
@matthewevans

Copy link
Copy Markdown
Member Author

Current-head review follow-up for e17c42365e:

  • The requested CR 400.7 explanation is present at PendingZoneChangeDelivery::terminal_completion_after_resume (game_state.rs:3449).
  • The real replacement-pause/resume path is covered in issue_3252_rhythm_of_the_wild.rs: it creates a ChangeZone delivery, verifies the parked iteration frame at the Riot replacement choice, resolves the choice through GameRunner::act, and verifies the frame drains and the member enters. The remaining Prevented and no-event (Remained) classifications are the explicit sidecar and classifier branches tested directly in game_state.rs; no separate synthetic integration route reaches different production behavior.

No further change is warranted on this head.

@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Aug 12, 2026
@matthewevans
matthewevans added this pull request to the merge queue Aug 12, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Aug 12, 2026
@matthewevans
matthewevans added this pull request to the merge queue Aug 12, 2026
Merged via the queue into main with commit b620a33 Aug 12, 2026
15 checks passed
@matthewevans
matthewevans deleted the ship/fix-engine-settle-resumed-change-zone-members branch August 12, 2026 18:50
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