Skip to content

fix(engine): atomically install optional effect prompts - #7294

Merged
matthewevans merged 2 commits into
mainfrom
ship/fix-engine-atomically-install-optional-effect-prompts
Aug 12, 2026
Merged

fix(engine): atomically install optional effect prompts#7294
matthewevans merged 2 commits into
mainfrom
ship/fix-engine-atomically-install-optional-effect-prompts

Conversation

@matthewevans

@matthewevans matthewevans commented Aug 12, 2026

Copy link
Copy Markdown
Member

Closes #6867

Installs optional-effect direct-choice frames together with their matching prompt, validating the pair before either reaches live state. Adds a regression for atomic rejection of a second optional direct-choice owner.

Summary by CodeRabbit

  • Bug Fixes
    • Improved handling of optional-effect choices during game resolution.
    • Invalid or conflicting choice transitions now fail safely without changing the active prompt or resolution state.
    • Preserved pending event information when resuming interrupted effect resolution.
  • Tests
    • Added coverage for conflicting optional-choice owners and confirmed that game state remains unchanged when such conflicts occur.

@matthewevans
matthewevans enabled auto-merge August 12, 2026 11:40
@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: 35 minutes

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: 78d64a3c-00b6-433b-b1b6-0bc7c5c96d0f

📥 Commits

Reviewing files that changed from the base of the PR and between a17cec8 and 0e9d93a.

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

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 1bfe6715-3660-4acc-977b-32f3c493698d

📥 Commits

Reviewing files that changed from the base of the PR and between ad7ba57 and a17cec8.

📒 Files selected for processing (3)
  • crates/engine/src/game/effects/mod.rs
  • crates/engine/src/types/game_state.rs
  • crates/engine/tests/integration/cr733_resolved_frame_transition.rs

📝 Walkthrough

Walkthrough

The engine adds atomic installation for direct-choice resolution frames. Optional effects use this method and convert installation failures to EffectError::InvalidParam. Integration tests verify that duplicate direct-choice owners preserve the existing stack and prompt.

Changes

Direct-choice installation

Layer / File(s) Summary
Frame installation contract
crates/engine/src/types/game_state.rs
GameState::install_direct_choice_frame validates direct-choice frames, updates WaitingFor, applies the transition, and restores the previous prompt on failure.
Optional-effect integration and regression coverage
crates/engine/src/game/effects/mod.rs, crates/engine/tests/integration/cr733_resolved_frame_transition.rs
Optional effects use atomic frame installation and preserve continuation context. Tests verify rejection of a second direct-choice owner with unchanged state.

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

Possibly related PRs

Suggested labels: bug, quality

Suggested reviewers: jacobwoodson, lgray

🚥 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 summarizes the main change: atomic installation of optional-effect prompts.
Linked Issues check ✅ Passed The PR addresses issue #6867 by preventing OptionalEffect PromptMismatch states through atomic frame and prompt installation.
Out of Scope Changes check ✅ Passed The implementation and regression test directly support the linked crash fix and contain no unrelated changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ 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-atomically-install-optional-effect-prompts

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 force-pushed the ship/fix-engine-atomically-install-optional-effect-prompts branch from 5a2d992 to 0e9d93a Compare August 12, 2026 12:04
@matthewevans
matthewevans added this pull request to the merge queue Aug 12, 2026
@github-actions

Copy link
Copy Markdown

Generated for head 0e9d93adcce778aec66da2ed165aa8d1b50bab47.

Parse changes introduced by this PR

✓ No card-parse changes detected.

Merged via the queue into main with commit 25ea946 Aug 12, 2026
15 checks passed
@matthewevans
matthewevans deleted the ship/fix-engine-atomically-install-optional-effect-prompts branch August 12, 2026 12:49
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.

Crash Report — Not much to report, check the attached file.

1 participant