Skip to content

test(engine): lock chained explore resume after DigChoice (#1151)#3740

Queued
kiannidev wants to merge 7 commits into
phase-rs:mainfrom
kiannidev:fix/issue-1151-jadelight-explore
Queued

test(engine): lock chained explore resume after DigChoice (#1151)#3740
kiannidev wants to merge 7 commits into
phase-rs:mainfrom
kiannidev:fix/issue-1151-jadelight-explore

Conversation

@kiannidev

@kiannidev kiannidev commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add regression test ensuring a chained second Explore resumes only after the first explore's nonland DigChoice completes (Jadelight Ranger pattern).

Test plan

  • cargo test -p engine --lib chained_explore_resumes

Fixes #1151

)

Regression coverage for Jadelight Ranger's double explore: the second explore must stay stashed until the first explore's nonland dig choice resolves.

Co-authored-by: Cursor <cursoragent@cursor.com>
@kiannidev kiannidev requested a review from matthewevans as a code owner June 18, 2026 18:34

@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 adds a unit test to crates/engine/src/game/effects/explore.rs to verify that chained explore abilities resume correctly after a nonland DigChoice resolves. The feedback suggests optimizing the test by matching on a reference to state.waiting_for instead of cloning it, which avoids unnecessary heap allocations.

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.

"first explore should add one +1/+1 counter"
);

let WaitingFor::DigChoice { cards, .. } = state.waiting_for.clone() else {

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.

medium

[MEDIUM] Avoid unnecessary cloning of WaitingFor by matching on a reference.

Why it matters: WaitingFor is a large enum containing heap-allocated collections (like Vec<ObjectId> and Vec<String>). Cloning it just to extract a single ObjectId from the cards vector is inefficient.

Suggested fix: Match on &state.waiting_for instead of state.waiting_for.clone().

Suggested change
let WaitingFor::DigChoice { cards, .. } = state.waiting_for.clone() else {
let WaitingFor::DigChoice { cards, .. } = &state.waiting_for else {

@matthewevans

Copy link
Copy Markdown
Member

VERDICT: approve-pending-CI

Reviewed head ea76fc02249ac59432545731f04d9bcde0f3e593, then pushed maintainer fixup 9686b12c885e117da62ab8953fba7ef862a796b1 to move the new test imports to module scope.

The regression is at the right seam: it drives resolve_ability_chain through the real nonland explore DigChoice pause and then resolves the player action through engine::apply_as_current, so it would fail if the chained second explore were not preserved across the first choice. Local pre-push passed fmt, clippy, card-data validate, parser gate, engine parser tests, and phase-ai tests; it failed only at local oracle-gen because data/mtgjson/AtomicCards.json is absent.

Holding formal approval/enqueue until CI is green on the pushed head and the branch is brought current / passes the normal repush guard.

@matthewevans matthewevans added the test Add tests label Jun 18, 2026
@matthewevans matthewevans self-assigned this Jun 18, 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 after re-review of the current head: this is a test-only regression at the chained explore/DigChoice resume seam, the required test label is present, and GitHub checks are green at 81e137c075b00d3644a5cd7ce8ba7d1666d832a8.

@matthewevans matthewevans added this pull request to the merge queue Jun 18, 2026
@matthewevans matthewevans removed their assignment Jun 18, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jun 18, 2026
@matthewevans matthewevans self-assigned this Jun 18, 2026
@matthewevans matthewevans added this pull request to the merge queue Jun 18, 2026
@matthewevans matthewevans removed their assignment Jun 18, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jun 18, 2026
@matthewevans matthewevans self-assigned this Jun 18, 2026
@matthewevans matthewevans added this pull request to the merge queue Jun 18, 2026
@matthewevans matthewevans removed their assignment Jun 18, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jun 18, 2026
@matthewevans matthewevans self-assigned this Jun 18, 2026
@matthewevans matthewevans added this pull request to the merge queue Jun 18, 2026
@matthewevans matthewevans removed their assignment Jun 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test Add tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Jadelight Ranger — Explore triggers working improperly.

2 participants