ship/cr733 p2 counters ledgers - #6521
Merged
Merged
Conversation
…reen The SpellCast arm of ledger_edit_is_invalid destructured expected_turn_count (u8) but never used it — the u32::MAX sentinel screen only applies to the u32 count fields. A u8 advanced via saturating_add treats 255 as a legitimate saturated value, not a reserved sentinel, so the field has no invalid state to pre-screen. Drop it from the pattern (already covered by ..) and document why. Fixes -D unused-variables clippy failure on the counters/ledgers tranche.
The TriggerFired ledger test qualified TriggerDefinitionOccurrenceRef and TriggerBaseSetInstanceRef as super::ability::* from inside #[cfg(test)] mod tests, where super resolves to resolved_commands (no ability submodule) rather than crate::types. Import both siblings alongside the already-imported TriggerDefinitionRef and reference them bare, matching the test's own usage. This E0433 was masked by the disk-full failure that aborted Run 7's test-engine gate before the test binary compiled.
TriggerDefinitionOccurrenceRef and TriggerBaseSetInstanceRef are used only by the TriggerFired ledger test, so importing them at module scope tripped -D unused-imports in the non-test lib build. Move them into mod tests alongside the existing crate::types::* test imports; TriggerDefinitionRef stays top-level since production code uses it too.
matthewevans
enabled auto-merge
July 22, 2026 23:16
Contributor
|
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 (11)
📝 WalkthroughWalkthroughAdds journaled object-counter and ledger-edit commands with strict replay validation. Counter mutations now use an exact applier, while spell casts, abilities, triggers, and once-per-turn permissions route through centralized ledger helpers with expanded replay tests. ChangesResolved command replay
Estimated code review effort: 4 (Complex) | ~60 minutes Sequence Diagram(s)sequenceDiagram
participant GameRules
participant Ledger
participant CounterApplier
participant GameState
participant ResolvedRulesJournal
GameRules->>Ledger: record spell, ability, trigger, or permission fact
Ledger->>GameState: validate ledger preconditions and mutate state
Ledger->>ResolvedRulesJournal: append ledger command
GameRules->>CounterApplier: apply resolved counter command
CounterApplier->>GameState: validate incarnation and counter predecessor
CounterApplier->>ResolvedRulesJournal: append counter command
Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Parse changes introduced by this PR✓ No card-parse changes detected. |
This was referenced Jul 23, 2026
jsdevninja
pushed a commit
to jsdevninja/phase
that referenced
this pull request
Jul 24, 2026
* cr733(p2): apply resolved counter and ledger commands * cr733(p2): record counter and ledger tranche * cr733(p2): drop unused u8 turn-count binding in ledger invalid pre-screen The SpellCast arm of ledger_edit_is_invalid destructured expected_turn_count (u8) but never used it — the u32::MAX sentinel screen only applies to the u32 count fields. A u8 advanced via saturating_add treats 255 as a legitimate saturated value, not a reserved sentinel, so the field has no invalid state to pre-screen. Drop it from the pattern (already covered by ..) and document why. Fixes -D unused-variables clippy failure on the counters/ledgers tranche. * cr733(p2): fix test-module path for trigger occurrence refs The TriggerFired ledger test qualified TriggerDefinitionOccurrenceRef and TriggerBaseSetInstanceRef as super::ability::* from inside #[cfg(test)] mod tests, where super resolves to resolved_commands (no ability submodule) rather than crate::types. Import both siblings alongside the already-imported TriggerDefinitionRef and reference them bare, matching the test's own usage. This E0433 was masked by the disk-full failure that aborted Run 7's test-engine gate before the test binary compiled. * cr733(p2): scope trigger-occurrence ref imports to the test module TriggerDefinitionOccurrenceRef and TriggerBaseSetInstanceRef are used only by the TriggerFired ledger test, so importing them at module scope tripped -D unused-imports in the non-test lib build. Move them into mod tests alongside the existing crate::types::* test imports; TriggerDefinitionRef stays top-level since production code uses it too. --------- Co-authored-by: matthewevans <matthewevans@users.noreply.github.com>
This was referenced Jul 26, 2026
Merged
This was referenced Aug 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary by CodeRabbit
New Features
Bug Fixes