Extend SearchFound with bound exile-play permissions#6059
Conversation
…t-integration # Conflicts: # crates/engine/src/game/casting_costs.rs
…t-found-card-permission
There was a problem hiding this comment.
Code Review
This pull request updates the MTG game engine to correctly track and propagate library ownership during searches, ensuring compliance with CR 701.23a, and implements CR 611.2b and CR 601.3 to grant casting permissions only after a card is successfully delivered to exile. These changes are supported by comprehensive unit tests covering various mixed-zone and muzzled search scenarios. The review feedback identifies a violation of style guide rule R6, noting a missing mandatory CR annotation on a rules-touching line of engine code in crates/engine/src/game/replacement.rs.
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.
| } | ||
|
|
||
| let canonical_shell = AbilityDefinition::new(execute.kind, execute.effect.as_ref().clone()); | ||
| let grant = match execute.sub_ability.as_deref() { |
There was a problem hiding this comment.
[MEDIUM] Missing mandatory CR annotation. Evidence: crates/engine/src/game/replacement.rs:3940. Why it matters: Under rule R6 of the repository style guide, every rules-touching line of engine code must carry a comment of the form CR <number>: <description>. Suggested fix: Add a CR annotation such as // CR 611.2b: Bind the lasting casting permission from the resolving SearchFound replacement effect.
| let grant = match execute.sub_ability.as_deref() { | |
| // CR 611.2b: Bind the lasting casting permission from the resolving SearchFound replacement effect. | |
| let grant = match execute.sub_ability.as_deref() { |
References
- Every rules-touching line of engine code must carry a comment of the form CR : (regex CR \d{3}(.\d+[a-z]?)?). (link)
Resolve maintainer-caused conflict from phase-rs#6057 while preserving the serialized SearchFound grant payload and its post-delivery permission installation.\n\nCo-authored-by: parthmishra <parthmishra@users.noreply.github.com>
Parse changes introduced by this PR✓ No card-parse changes detected. |
matthewevans
left a comment
There was a problem hiding this comment.
Approved — maintainer port preserves both contracts.
The current head retains the contributor's post-delivery permission grant and the batch-move completion contract introduced by main. The deferred-delivery regression reaches the relevant continuation boundary, and the current CI and no-change parse artifact are clean.
Summary
Extends the engine-owned
SearchFoundpipeline with the next two reusable Opposition Agent prerequisites:CantSearchLibraryfiltering and carries it through standard/scoped choices, serialized batches, and every found-card event;ChangeZone-to-exile plusGrantCastingPermissionreplacement chain, then installs the snapshotted play/AnyColorpermission only after the card actually reaches exile.This is intentionally an engine-authority slice, not a full card-support claim. Search-scoped player control and parser/card-data integration remain separate follow-up work.
Context:
SearchFoundreplacement pipeline.PlayFromExile/AnyColorpermission authority and cleanup behavior.Files changed
crates/engine/src/types/proposed_event.rscrates/engine/src/types/game_state.rscrates/engine/src/game/effects/search_library.rscrates/engine/src/game/effects/scoped_library_search.rscrates/engine/src/game/engine_resolution_choices.rscrates/engine/src/game/replacement.rscrates/engine/src/game/visibility.rscrates/engine/src/game/elimination.rscrates/engine/src/game/effects/mod.rscrates/engine/src/ai_support/candidates.rscrates/engine/src/ai_support/mod.rscrates/phase-ai/src/search.rsCR references
AnyColorpayment concessionImplementation 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— passcargo check -p engine --tests— passcargo test -p engine search_found --lib— 18 passedcargo test -p engine library_provenance --lib— 4 passedcargo clippy -p engine --tests -- -D warnings— passrepository pre-push hook — pass: workspace clippy, release card-data validation, parser gate, 584 parser tests, 1,281 phase-ai tests, Oracle generation, card-data validation, coverage regression check (0 engine regressions), frontend lint (0 errors), and frontend type-check
Gate A
Gate A PASS head=58dc89f96e6b481731bb3c4ca361565d7b2d3542 base=cea140e85006c3452731f8ca03fdd59149598e94
Anchored on
crates/engine/src/game/replacement.rs:4040— existing frozenSearchFoundcandidate snapshot authority for CR 616 resumes.crates/engine/src/game/zone_pipeline.rs:932— existing typed deferred-completion seam for paused zone deliveries.crates/engine/src/game/effects/grant_permission.rs:29— canonical resolver that stamps and installs casting-permission authority.Final review-impl
Final review-impl PASS head=58dc89f96e6b481731bb3c4ca361565d7b2d3542
Claimed parse impact
None.
Validation Failures
None.
CI Failures
None.