Fix Rebound cast-origin lookup#4555
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates the rebound resolution logic in crates/engine/src/game/stack.rs to comply with CR 601.2a and CR 702.88a. Because resolving stack entries are already popped, the pre-announcement zone is now read from the local ResolvedAbility context, falling back to spell_cast_origin for placeholder or permanent paths. Additionally, an integration test using the real card database has been added to verify that 'Terramorph' correctly rebounds after searching for a basic land. There are no review comments, and I have no feedback to provide.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
c0ec4af to
314bc44
Compare
314bc44 to
810302b
Compare
matthewevans
left a comment
There was a problem hiding this comment.
Requesting changes for one fixture-scope blocker.
[MED] The integration fixture rewrite is much broader than the Rebound regression. Evidence: crates/engine/tests/fixtures/integration_cards.json:1; compared structurally against origin/main, this PR adds 497 fixture keys and removes 266, while the new test at crates/engine/tests/integration/consuming_vapors_rebound.rs:165 only needs Terramorph plus an already-present Forest. Why it matters: this changes hundreds of unrelated integration-card fixtures in a one-line generated file, making the Rebound fix hard to review and potentially changing coverage for unrelated tests. Suggested fix: keep the stack-origin fix and Terramorph regression, but regenerate or edit the integration fixture so the diff is limited to the cards required by this test.
Summary
Fixes #1536 by preserving the real cast origin for resolving Rebound instants/sorceries after the stack entry has been popped.
Files changed
crates/engine/src/game/stack.rscrates/engine/tests/integration/consuming_vapors_rebound.rscrates/engine/tests/fixtures/integration_cards.jsonCR references
CR 601.2a- verified indocs/MagicCompRules.txtCR 702.88a- verified indocs/MagicCompRules.txtTrack
Developer
LLM
Model: codex-5
Thinking: medium
Tier: Standard
Anchored on
crates/engine/src/game/stack.rs:576- existing Rebound on-resolve hook that owns the exile/delayed-trigger decision.crates/engine/src/game/casting.rs:1071- existing cast-origin authority documents the ability-context vs object-stamped origin split.crates/engine/tests/integration/consuming_vapors_rebound.rs:82- existing Rebound tests model the productionResolvedAbility.context.cast_from_zoneinvariant.Gate A
./scripts/check-parser-combinators.sh- clean; command produced no output and exited 0.Review
review-implchecklist run locally against the final diff. No findings.Verification
cargo fmt --all- cleancargo fmt --all --check- clean after PR fixture refresh./scripts/check-parser-combinators.sh- cleanpython3 scripts/gen-test-fixture.py --check- clean; fixture covers all referenced cards./scripts/check-test-card-data-load.sh origin/main- cleancargo test -p engine consuming_vapors_rebound- 10 passed, including the fixture-backed Terramorph real-card regressioncargo test -p engine msh_wave5a- 5 passed after refreshing fixture cards needed by current maincargo test -p engine inquisitive_glimmer- 1 passed after rebasing onto current mainScope Expansion
None.
Validation Failures
None.
CI Failures
Earlier CI exposed stale integration fixture contents after main advanced; refreshed
integration_cards.jsonfrom current card data and verified the failing shard filters locally.