cr733(p2): journal information-boundary commands#6524
Conversation
|
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 (9)
🚧 Files skipped from review as they are similar to previous changes (7)
📝 WalkthroughWalkthroughThe PR adds journaled reveal-information commands with audience and lifetime semantics, routes reveal and cleanup paths through them, validates replay invariants, and clears zone-exit information by object incarnation. ChangesReveal Information Journaling
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant RevealEffect
participant GameState
participant ResolvedRulesJournal
participant Engine
RevealEffect->>GameState: Apply controller and public reveal information
GameState->>ResolvedRulesJournal: Record Information commands
Engine->>ResolvedRulesJournal: Inspect current action journal window
Engine->>GameState: Apply unpublished public reveals
Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
crates/engine/src/types/resolved_commands.rs (1)
1464-1481: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winCentralize the audience/lifetime compatibility rule.
information_command_is_invalidre-encodes the exact(Controller, UntilActionBoundary) | (Public, UntilZoneChange)pairing thatGameState::apply_information_edit(game_state.rs:15454-15463) already checks. Two independent copies of a CR-derived invariant can silently diverge. Extract a single predicate (e.g. an inherentResolvedInformationAudience::permits(lifetime)) and call it from both sites.As per coding guidelines: "Do not duplicate logic: centralize reveal/hide bookkeeping ... rather than re-implementing card-visibility rules."
♻️ Suggested shared predicate
impl ResolvedInformationAudience { pub fn permits(self, lifetime: ResolvedInformationLifetime) -> bool { matches!( (self, lifetime), ( ResolvedInformationAudience::Controller(_), ResolvedInformationLifetime::UntilActionBoundary ) | ( ResolvedInformationAudience::Public, ResolvedInformationLifetime::UntilZoneChange ) ) } }🤖 Prompt for 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. In `@crates/engine/src/types/resolved_commands.rs` around lines 1464 - 1481, Centralize the audience/lifetime compatibility rule by adding an inherent predicate on ResolvedInformationAudience, such as permits, that accepts ResolvedInformationLifetime and matches the two valid pairings. Replace the duplicated matches! logic in information_command_is_invalid and GameState::apply_information_edit with this shared predicate, preserving all existing invalid-command and edit behavior.Source: Coding guidelines
🤖 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.
Nitpick comments:
In `@crates/engine/src/types/resolved_commands.rs`:
- Around line 1464-1481: Centralize the audience/lifetime compatibility rule by
adding an inherent predicate on ResolvedInformationAudience, such as permits,
that accepts ResolvedInformationLifetime and matches the two valid pairings.
Replace the duplicated matches! logic in information_command_is_invalid and
GameState::apply_information_edit with this shared predicate, preserving all
existing invalid-command and edit behavior.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 96a879de-db77-4215-9142-7e42a6491c38
📒 Files selected for processing (8)
crates/engine/src/game/effects/reveal_hand.rscrates/engine/src/game/effects/reveal_until.rscrates/engine/src/game/engine.rscrates/engine/src/game/engine_resolution_choices.rscrates/engine/src/game/engine_tests.rscrates/engine/src/game/zones.rscrates/engine/src/types/game_state.rscrates/engine/src/types/resolved_commands.rs
b7988fd to
9d65c15
Compare
Parse changes introduced by this PR✓ No card-parse changes detected. |
9d65c15 to
9d08741
Compare
9d08741 to
ddb59c1
Compare
Summary by CodeRabbit
New Features
Bug Fixes
Tests