fix(engine): Consuming Vapors gains life from sacrificed toughness (#5925)#6350
Conversation
…in (phase-rs#5925) Consuming Vapors / Tribute to Hunger resolve life gain from that creature's toughness via Toughness{Demonstrative}. Harden sacrifice referent capture and re-stamp before draining the GainLife continuation on the EffectZoneChoice path. Add cast-pipeline coverage for choice and auto-sacrifice. Co-authored-by: Cursor <cursoragent@cursor.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThis change preserves sacrificed-creature referents when LKI lookup is unavailable, propagates them through sacrifice continuations, adds a characteristic lookup fallback, and tests toughness-based life gain for selected and automatic sacrifices. ChangesSacrifice referent flow
Estimated code review effort: 4 (Complex) | ~45 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
matthewevans
left a comment
There was a problem hiding this comment.
Blocked — the cache-miss sacrifice path lacks discriminating coverage, and its continuation stamp is duplicated.
🔴 Blocker
crates/engine/src/game/effects/mod.rs:1826 adds the ZoneChanged-record fallback specifically for an absent lki_cache entry, but crates/engine/tests/integration/consuming_vapors_life_gain_5925.rs:25 only exercises an ordinary sacrifice. It neither removes the cache entry nor creates the record-only event shape, so it cannot demonstrate that the new fallback works. This leaves the stated redirected/cache-gap behavior unproved. Add a focused record-only/cache-miss test (with the production-pipeline coverage retained) that fails if snapshot_for_sacrificed_object falls back to None.
crates/engine/src/game/effects/mod.rs:6769 already resolves and stamps parent_referent_context_from_events when propagate_parent_context is enabled; crates/engine/src/game/engine_resolution_choices.rs:4655 repeats the same scan and recursive continuation mutation for the same EffectZoneChoice path. This creates two authorities that can drift when the snapshot ladder changes. Keep the stamp at the sacrifice-completion seam and remove the duplicate outer mutation.
🟡 Required proof
The PR body leaves all three verification items unchecked, including both proposed tests. With the required proof gate active for this head, provide current-head evidence for the fixed cache-miss branch and the real cast pipeline before reconsideration.
Recommendation: request changes for one authoritative stamp, a cache-miss discriminator, and completed current-head verification.
…-rs#5925) Keep Demonstrative LKI stamping only at the sacrifice-completion seam and add a record-only/cache-miss referent test that fails without the ZoneChanged fallback (extra move + empty LKI cache). Co-authored-by: Cursor <cursoragent@cursor.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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/tests/integration/consuming_vapors_life_gain_5925.rs`:
- Around line 21-44: Extend the test function
consuming_vapors_gains_life_equal_to_chosen_sacrificed_toughness with a creature
whose battlefield toughness is modified, then cast Consuming Vapors, choose that
creature through the effect-zone selection, and assert life gain equals its
modified toughness rather than printed toughness. Ensure the scenario exercises
the cache-gap/LKI fallback and verifies the creature is sacrificed.
🪄 Autofix (Beta)
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: a2c1fa03-d1a6-4df8-be5a-5f3b8afa577a
📒 Files selected for processing (6)
crates/engine/src/game/effects/mod.rscrates/engine/src/game/effects/sacrifice.rscrates/engine/src/game/engine_resolution_choices.rscrates/engine/src/game/quantity.rscrates/engine/tests/integration/consuming_vapors_life_gain_5925.rscrates/engine/tests/integration/main.rs
Parse changes introduced by this PR✓ No card-parse changes detected. |
matthewevans
left a comment
There was a problem hiding this comment.
Maintainer review: the current head keeps sacrificed-object provenance at the sacrifice-completion seam, covers the cache-miss record fallback and the cast pipeline, and resolves the prior blocking feedback. Enqueued to let required checks complete in the merge queue.
Summary
effect_context_objectonly at the sacrifice-completion seam (perform_player_scope_sacrificeswhenpropagate_parent_context); removed the duplicate EffectZoneChoice re-scan.snapshot_for_sacrificed_objectfalls back to the same-span battlefield→publicZoneChangedrecord when LKI cache is absent.Test plan
effect_zone_choice_sacrifice_then_gain_life_reads_sacrificed_toughness,auto_sacrifice_then_gain_life_reads_sacrificed_toughness)sacrificed_referent_binds_zone_changed_record_on_lki_cache_miss) — empty LKI + extra ZoneChanged so moved-object multi-guard cannot rescueconsuming_vapors_life_gain_5925cast-pipeline tests (choice + auto-sacrifice)e7ce34fc8(local MSVC linker unavailable; evidence from this push)Closes #5925
Summary by CodeRabbit