Skip to content

Fix Rebound cast-origin lookup#4555

Open
mike-theDude wants to merge 1 commit into
phase-rs:mainfrom
mike-theDude:fix/terramorph-rebound-origin
Open

Fix Rebound cast-origin lookup#4555
mike-theDude wants to merge 1 commit into
phase-rs:mainfrom
mike-theDude:fix/terramorph-rebound-origin

Conversation

@mike-theDude

@mike-theDude mike-theDude commented Jun 28, 2026

Copy link
Copy Markdown
Collaborator

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.rs
  • crates/engine/tests/integration/consuming_vapors_rebound.rs
  • crates/engine/tests/fixtures/integration_cards.json

CR references

  • CR 601.2a - verified in docs/MagicCompRules.txt
  • CR 702.88a - verified in docs/MagicCompRules.txt

Track

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 production ResolvedAbility.context.cast_from_zone invariant.

Gate A

./scripts/check-parser-combinators.sh - clean; command produced no output and exited 0.

Review

review-impl checklist run locally against the final diff. No findings.

Verification

  • cargo fmt --all - clean
  • cargo fmt --all --check - clean after PR fixture refresh
  • ./scripts/check-parser-combinators.sh - clean
  • python3 scripts/gen-test-fixture.py --check - clean; fixture covers all referenced cards
  • ./scripts/check-test-card-data-load.sh origin/main - clean
  • cargo test -p engine consuming_vapors_rebound - 10 passed, including the fixture-backed Terramorph real-card regression
  • cargo test -p engine msh_wave5a - 5 passed after refreshing fixture cards needed by current main
  • cargo test -p engine inquisitive_glimmer - 1 passed after rebasing onto current main

Scope Expansion

None.

Validation Failures

None.

CI Failures

Earlier CI exposed stale integration fixture contents after main advanced; refreshed integration_cards.json from current card data and verified the failing shard filters locally.

@gemini-code-assist gemini-code-assist 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.

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.

@mike-theDude mike-theDude force-pushed the fix/terramorph-rebound-origin branch 2 times, most recently from c0ec4af to 314bc44 Compare June 28, 2026 19:26
@mike-theDude mike-theDude force-pushed the fix/terramorph-rebound-origin branch from 314bc44 to 810302b Compare June 28, 2026 20:01
@github-actions github-actions Bot added the needs-maintainer AI-contribution PR requires human triage (Non-dev track or unresolved gaps) label Jun 28, 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.

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.

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

Labels

needs-maintainer AI-contribution PR requires human triage (Non-dev track or unresolved gaps)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rebound Mechanic — I believe I've played this card a few times and always forget to throw in the bug report.

3 participants