Skip to content

test(engine): Halving Season opponent token halving runtime#3497

Merged
matthewevans merged 1 commit into
phase-rs:mainfrom
kiannidev:feat/issue-3481-halving-token-runtime
Jun 16, 2026
Merged

test(engine): Halving Season opponent token halving runtime#3497
matthewevans merged 1 commit into
phase-rs:mainfrom
kiannidev:feat/issue-3481-halving-token-runtime

Conversation

@kiannidev

Copy link
Copy Markdown
Contributor

Summary

  • Add halving_season_halves_opponent_token_creation replacement test

Test plan

  • cargo test -p engine --lib halving_season_halves_opponent

Closes #3496. Depends on parser PR #3495.

Made with Cursor

Verify CreateToken replacement with Half + Opponent scope reduces count 5→2.

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

@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 new unit test, halving_season_halves_opponent_token_creation, to crates/engine/src/game/replacement.rs. The test verifies that a replacement effect configured to halve token creation for an opponent correctly reduces a proposed batch of five tokens to two (rounding down), in accordance with CR 614.1a and CR 111.1. No review comments were provided, and the changes are idiomatic and compliant with the repository's style guide, so there is no additional 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.

@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.

Maintainer review — ENQUEUE-READY (test PR)

Verdict: looks good. This is a runtime test that drives the real replacement pipeline and discriminates.

Test discrimination — PASS

halving_season_halves_opponent_token_creation constructs a ReplacementDefinition::new(ReplacementEvent::CreateToken).quantity_modification(Half).token_owner_scope(Opponent), then calls the actual replace_event(...) with a ProposedEvent::CreateToken { count: 5, owner: PlayerId(1) } and asserts the surviving count == 2. If the Half halving (replacement.rs:1922 / 2058, count / 2) or the token_owner_scope applicability gate (replacement.rs:3655) were reverted, the count would stay 5 and the assertion would fail. This is a genuine pipeline test, not an AST-shape assertion.

Notes

  • The engine logic under test (QuantityModification::Half halving + token_owner_scope(Opponent) enforcement) already exists on main — the test constructs the ReplacementDefinition directly, so it is independent of the parser PR #3495 at the engine layer. The body's "Depends on #3495" is a parser-side dependency (parsing the Oracle text into this definition), not a compile/run dependency for this test. Confirmed it compiles against current main.
  • 5 / 2 = 2 round-down is correct per integer division; the comment ("rounded down") matches.
  • CR annotation CR 614.1a + CR 111.1 is appropriate (replacement effect modifying a token-creation event).

Clean, discriminating, no production behavior change. Approving.

@matthewevans matthewevans added the test Add tests label Jun 16, 2026
@matthewevans matthewevans self-assigned this Jun 16, 2026
@matthewevans matthewevans added this pull request to the merge queue Jun 16, 2026
@matthewevans matthewevans removed their assignment Jun 16, 2026
Merged via the queue into phase-rs:main with commit f253c81 Jun 16, 2026
10 checks passed
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.

test(engine): Halving Season opponent token halving runtime

2 participants