Skip to content

fix(engine): validate complete flashback costs#5780

Merged
matthewevans merged 3 commits into
phase-rs:mainfrom
nishu-builder:fix/flashback-nonmana-payability
Jul 14, 2026
Merged

fix(engine): validate complete flashback costs#5780
matthewevans merged 3 commits into
phase-rs:mainfrom
nishu-builder:fix/flashback-nonmana-payability

Conversation

@nishu-builder

Copy link
Copy Markdown
Contributor

Summary

Checks the whole nonmana flashback cost before advertising a graveyard cast. This keeps spells such as Group Project out of legal actions when the player cannot tap enough creatures, while preserving payable flashback casts and other graveyard-cast permissions.

Files changed

  • crates/engine/src/game/casting.rs
  • crates/engine/tests/integration/flashback_nonmana_payability.rs
  • crates/engine/tests/integration/main.rs

CR references

  • CR 702.34a — flashback uses its printed alternative cost.
  • CR 118.3 — every resource required by a cost must be available.
  • CR 601.2f — the selected alternative cost is part of the total cost.
  • CR 601.2h — a cost cannot be paid partially.

Implementation method (required)

Method: /engine-implementer

Track

Developer

LLM

Model: codex-5
Thinking: high
Tier: Standard

Verification

  • Required checks ran clean, or the exact CI-owned alternative is stated below.

  • Gate A output below is for the current committed head.

  • Final review-impl below is clean for the current committed head.

  • Both anchors cite existing analogous code at the same seam.

  • cargo fmt --all -- --check — passed.

  • cargo test -p engine --test integration flashback_nonmana_payability -- --nocapture — 3 passed, 0 failed.

  • cargo clippy-strict — passed for the workspace and all targets.

  • cargo test -p engine — 16,554 unit tests and 3,012 integration tests passed.

  • ./scripts/gen-card-data.sh — generated and validated 35,397 card faces; 31,851 of 34,626 cards fully implemented.

  • cargo coverage — 31,346 of 35,397 cards supported (88.6%).

  • cargo semantic-audit — 32,417 cards audited; 294 existing findings.

  • Tilt was unavailable in this checkout, so the documented direct Developer-track fallback was used.

Gate A

Gate A PASS head=9ccaf70f7aebe19e7193d27c42c25c6d07a4d218 base=8e424583e9167324bdcd77667a6bee0469ebfe70

Anchored on

  • crates/engine/src/game/casting.rs:1032 — Escape delegates its complete residual cost to AbilityCost::is_payable.
  • crates/engine/src/game/casting.rs:9572 — Evoke checks the complete nonmana residual before offering the variant.

Final review-impl

Final review-impl PASS head=9ccaf70f7aebe19e7193d27c42c25c6d07a4d218

Claimed parse impact

None.

Validation Failures

Initial ./scripts/setup.sh --agent did not complete its optional WASM bootstrap when the shared disk filled. The casting-stack-conditions reference check also reports two stale function-name anchors already absent on upstream (pay_and_push and pay_ability_cost); all other references and every required gate above passed.

CI Failures

None.

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@github-actions github-actions Bot added the needs-maintainer AI-contribution PR requires human triage (Non-dev track or unresolved gaps) label Jul 14, 2026
@github-actions

Copy link
Copy Markdown

Parse changes introduced by this PR

✓ No card-parse changes detected.

@matthewevans matthewevans self-assigned this Jul 14, 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.

Approved — complete non-mana flashback costs now gate legal actions at the prepared-cast authority.

✅ Clean

  • crates/engine/src/game/casting.rs:12039-12046 delegates to AbilityCost::is_payable, the established recursive non-mana cost gate already used by the Escape and Evoke prechecks in this module.
  • crates/engine/tests/integration/flashback_nonmana_payability.rs:82-96 reaches the legal-action surface for both the unpayable and payable Group Project cases; :101-117 drives payment and resolution; :125-150 keeps Festival of Embers' independent graveyard permission available.
  • crates/engine/tests/integration/main.rs:129 registers the integration module. The current-head parse-diff reports no card-parse changes, and the required Rust and Frontend checks are green.

Recommendation: approve and enqueue.

@matthewevans matthewevans added the bug Bug fix label Jul 14, 2026
@matthewevans
matthewevans added this pull request to the merge queue Jul 14, 2026
@matthewevans matthewevans removed their assignment Jul 14, 2026
Merged via the queue into phase-rs:main with commit 78dec82 Jul 14, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Bug fix 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.

2 participants