Skip to content

chore(repo): land cardshed blueprint and reconcile prp turnstate (#137)#138

Merged
w7-mgfcode merged 2 commits into
masterfrom
feat/reliquary-bootstrap
May 20, 2026
Merged

chore(repo): land cardshed blueprint and reconcile prp turnstate (#137)#138
w7-mgfcode merged 2 commits into
masterfrom
feat/reliquary-bootstrap

Conversation

@w7-mgfcode
Copy link
Copy Markdown
Owner

@w7-mgfcode w7-mgfcode commented May 20, 2026

Summary

After PR #135 squash-merged the reliquary bootstrap and the CARD SHED PRP bundle onto master, this PR carries the two remaining net-new doc deliverables:

  • a551a4d (chore(repo): reconcile cardshed prp turnstate vocabulary #136) — reconcile PRPs/02-deterministic-core.md and PRPs/03-experience-distribution.md onto the canonical TurnState vocabulary the executed blueprint locked. Replaces the older TurnPhase shared-contract block in both PRPs and renames pseudocode tokens (WaitingForAttackAwaitingAttack, RoundOverRoundEnded, etc.). GameEvent and WebSocket message enums are intentionally untouched — they share a namespace boundary with TurnState and are not part of this rename.
  • a47bf5a (chore(repo): land cardshed strategy blueprint deliverable #137) — land PRPs/cardshed-01-blueprint.md, the executed output of PRPs/01-strategy-blueprint.md. Locks the upstream decisions sibling PRPs consume: Rust+Axum backend, TS+React+Vite frontend, hybrid snapshot+event sync model, 9-module taxonomy, 20-section deliverable outline with PRP-2/PRP-3 ownership tags, and 10 cross-PRP implications.

Closes #136.
Closes #137.

Note: this branch was rebased onto master to drop three commits already absorbed by #135 (reliquary bootstrap + cardshed PRP bundle). Net PR = just the two commits above.

Zone(s) touched

  • @ops
  • @dev
  • @prod
  • @lab
  • .shared / .bin / root platform
  • repo (CI, hygiene, tooling)

Test plan

  • rg -n "TurnPhase|WaitingForAttack|WaitingForDefense|ResolvingDefense|RoundOver|MatchOver" PRPs → zero matches
  • rg -n "TurnState" PRPs/02-deterministic-core.md PRPs/03-experience-distribution.md → both contain the canonical block
  • Diff the TurnState shared-contract blocks across PRP-2 and PRP-3 — they are byte-identical
  • PRPs/cardshed-01-blueprint.md self-check: §10 Validation Self-Check ticks all three levels (Coherence, Round-trip with siblings, Authoritative-spec round-trip)

w7 verify result

n/a — documentation-only change; no stack touched.

Checklist

  • Commit messages follow type(scope): description (#issue)
  • No AI co-author trailers
  • Issue is referenced in every commit
  • CI is green (compose validate, policy, lint, tests, security, dependency-review) — pending check run
  • No new privileged: true outside @lab/

Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @w7-mgfcode, your pull request is larger than the review limit of 150000 diff characters

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 20, 2026

📝 Walkthrough

Walkthrough

This PR reconciles the CARD SHED PRP bundle's turn-state vocabulary and lands the comprehensive technical blueprint. PRP-02 and PRP-03 are updated to use the canonical TurnState type, and the blueprint document is committed to formalize the upstream decisions for stack, architecture, synchronization, and roadmap.

Changes

TurnState Vocabulary Reconciliation

Layer / File(s) Summary
TurnState type definition
PRPs/02-deterministic-core.md, PRPs/03-experience-distribution.md
TurnState type replaces TurnPhase with states Dealing, AwaitingAttack, AwaitingDefense, Resolving, RoundEnded, MatchEnded, ensuring shared vocabulary across both PRPs.
RoundState and rules engine control flow
PRPs/02-deterministic-core.md
RoundState.phase is typed to TurnState; submitAttack and stopDefending transitions are reordered so the win check occurs before defense phase switch, and defense resolution cycles back to AwaitingAttack.
Test expectations and validation
PRPs/02-deterministic-core.md, PRPs/03-experience-distribution.md
Turn-flow test, integration test scripts, smoke assertions, and UI coherence validation are updated to expect TurnState phases and RoundEnded terminal events.

CARD SHED Technical Blueprint

Layer / File(s) Summary
Backend and frontend stack selection
PRPs/cardshed-01-blueprint.md
Rust + Axum chosen for server (vs. Go); TypeScript + React + Vite pinned with Tailwind, Radix, Zustand, TanStack Query, Vitest, RTL, Playwright for frontend MVP.
Game state entities and visibility model
PRPs/cardshed-01-blueprint.md
Entity taxonomy (Card, Deck, Player, MatchState, RoundState, Action, GameEvent) defined with per-player view redaction rules and opponent hidden-hand summary expectations.
Synchronization, anti-cheat, and deterministic replay
PRPs/cardshed-01-blueprint.md
Hybrid snapshot + event sourcing with monotonic seq; server-authoritative validation and redaction-based secrecy; reconnection resume/resnapshot rules; deterministic replay via (matchSeed, actions[]); clientSeq idempotency and rate limiting.
Modular architecture and deployment scaling
PRPs/cardshed-01-blueprint.md
Architecture diagram and module responsibilities; deployment matrix showing how to scale from hot-seat (local) to online multiplayer by swapping EventBus/Persistence and mirroring deterministic core.
Implementation roadmap and cross-PRP integration
PRPs/cardshed-01-blueprint.md
20-section deliverable outline; M1–M4 phases (hot-seat MVP, bot + replay, online + anti-cheat, scale/observability); cross-PRP implications (seq envelopes, seeded RNG, action idempotency, TurnState vocabulary, TS/Rust core parity); validation checklist.

🎯 3 (Moderate) | ⏱️ ~25 minutes

🐰 A blueprint now locked, turn-states aligned,
Rules and UI speak the same refrain,
From hot-seat thrills to multiplayer's reign—
CARD SHED's path is now designed! 🎮✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed All three linked issues are addressed: #133 (reliquary bootstrap with compose, planning docs, design-system seed), #136 (TurnPhase→TurnState vocabulary reconciliation in PRP-2/3), and #137 (cardshed blueprint addition).
Out of Scope Changes check ✅ Passed All changes are within scope: reliquary bootstrap files, PRP vocabulary reconciliation, and cardshed blueprint addition directly support the three linked issues.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the two main changes: landing the cardshed blueprint and reconciling the TurnState vocabulary across PRPs.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/reliquary-bootstrap

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Align PRPs/02-deterministic-core.md and PRPs/03-experience-distribution.md
with the canonical TurnState vocabulary locked in PRPs/cardshed-01-blueprint.md:

  TurnState = "Dealing" | "AwaitingAttack" | "AwaitingDefense"
            | "Resolving" | "RoundEnded" | "MatchEnded"

Replaces the older TurnPhase shared-contract block in both PRPs and renames
pseudocode tokens (WaitingForAttack -> AwaitingAttack, RoundOver -> RoundEnded,
etc.). GameEvent and WebSocket message enums are intentionally untouched —
they share a namespace boundary with TurnState and are not part of this rename.

Blueprint already canonical, no edit required there.
Adds PRPs/cardshed-01-blueprint.md — the executed output of
PRPs/01-strategy-blueprint.md. Locks the upstream decisions that the
sibling PRPs (02-deterministic-core.md, 03-experience-distribution.md)
consume:

  - Backend: Rust + Axum (over Go) — sum-type modelling of the rule space
  - Frontend: TS + React + Vite + Tailwind v4 + Radix (W7 ecosystem)
  - Sync model: hybrid (per-player redacted snapshot + ordered events, seq-keyed)
  - 9-module taxonomy + deployment-target matrix for local -> online jump
  - 20-section deliverable outline with [Self]/[PRP-2]/[PRP-3] ownership tags
  - 10 cross-PRP implications (seq numbers, seeded RNG, redaction, etc.)

Canonical TurnState vocabulary in this file matches the #136 reconciliation.
@w7-mgfcode w7-mgfcode force-pushed the feat/reliquary-bootstrap branch from cf86209 to a47bf5a Compare May 20, 2026 22:49
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

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

Inline comments:
In `@PRPs/cardshed-01-blueprint.md`:
- Around line 129-130: The blueprint is ambiguous about whether clients send
server seq or clientSeq; standardize the contract so the server is the sole
emitter of a monotonic seq and clients never send server seq: update the
wire-shape for Action and Resume to require clients to send clientSeq (for
Action) and lastSeenSeq (for Resume) while removing any use of seq from
client-to-server messages, and document that ActionResult from server includes
the authoritative seq plus StateDelta and GameEvent[]; change references around
the Action, ActionResult, Resume, seq, clientSeq, and lastSeenSeq symbols to
reflect this single canonical rule to avoid PRP-2/PRP-3 drift.
- Around line 212-249: The markdown code fence containing the ASCII architecture
diagram is unlabeled which triggers markdownlint MD040; update the opening fence
from ``` to include a language hint such as ```text so the block is explicitly
labeled. Locate the unlabelled fence surrounding the diagram that includes
symbols like GameManager, Deck, TurnController, ActionValidator, RulesEngine,
StateReducer, EventBus, and UIHandler and change the fence to ```text (or
another appropriate tag) to silence the linter.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a54fe650-7821-4bc2-b6df-6e9db41aa3ca

📥 Commits

Reviewing files that changed from the base of the PR and between 1e9fd6b and a47bf5a.

📒 Files selected for processing (3)
  • PRPs/02-deterministic-core.md
  • PRPs/03-experience-distribution.md
  • PRPs/cardshed-01-blueprint.md

Comment on lines +129 to +130
| `Action` | public once applied; private while in-flight from a single client | wire envelope `{playerId, kind, payload, clientSeq}` | client → server |
| `ActionResult` | public | `Ok(StateDelta + GameEvent[])` \| `Err(RulesError)` | server → all |
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Resolve seq vs clientSeq contract ambiguity before PRP handoff.

The blueprint currently conflicts on whether clients send seq (Action/Resume) or only clientSeq + lastSeenSeq. This will cause PRP-2/PRP-3 wire-shape drift. Define one canonical rule explicitly: server emits monotonic seq; clients send clientSeq (actions) and lastSeenSeq (resume), not server seq.

Suggested doc patch
-1. **Hybrid sync requires `seq: u64` on every message.** → [PRP-3] must include `seq` in every WebSocket envelope (`Snapshot`, `Event`, `Action`, `Resume`).
+1. **Hybrid sync requires server-issued `seq: u64` on all server→client envelopes.**  
+   → [PRP-3] must include `seq` on `Snapshot` and `Event` (and any other server-originated envelope).  
+   → Client-originated envelopes use `clientSeq` (`Action`) and `lastSeenSeq` (`Resume`) for idempotency/recovery.
-- **Seq-number monotonicity** detects replay attacks; non-monotonic `seq` is rejected.
+- **Client idempotency monotonicity** detects replay/retry abuse; non-monotonic `clientSeq` is rejected per `(matchId, playerId)`.

Also applies to: 195-200, 333-334

🤖 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 `@PRPs/cardshed-01-blueprint.md` around lines 129 - 130, The blueprint is
ambiguous about whether clients send server seq or clientSeq; standardize the
contract so the server is the sole emitter of a monotonic seq and clients never
send server seq: update the wire-shape for Action and Resume to require clients
to send clientSeq (for Action) and lastSeenSeq (for Resume) while removing any
use of seq from client-to-server messages, and document that ActionResult from
server includes the authoritative seq plus StateDelta and GameEvent[]; change
references around the Action, ActionResult, Resume, seq, clientSeq, and
lastSeenSeq symbols to reflect this single canonical rule to avoid PRP-2/PRP-3
drift.

Comment on lines +212 to +249
```
┌──────────────────────────────┐
│ GameManager │
│ (lifecycle orchestrator) │
└─────────────────┬────────────┘
┌───────────────────────────────┼───────────────────────────────┐
▼ ▼ ▼
┌────────────────┐ ┌─────────────────────┐ ┌────────────────────┐
│ Deck │ │ TurnController │ │ PersistenceAdapter │
│ (cards+trump) │ │ (roles + rotation) │ │ (snapshot + events)│
└────────┬───────┘ └──────────┬──────────┘ └─────────┬──────────┘
│ │ │
│ ┌───────────────▼──────────────┐ │
│ │ ActionValidator │ │
│ │ (schema-level gating) │ │
│ └───────────────┬──────────────┘ │
│ ▼ │
│ ┌──────────────────────────────┐ │
│ │ RulesEngine │ │
│ │ (pure: state, action → res) │ │
│ └───────────────┬──────────────┘ │
│ ▼ │
│ ┌──────────────────────────────┐ │
└───────────►│ StateReducer │◄──────────────┘
│ (state' = apply(state, Δ)) │
└───────────────┬──────────────┘
┌──────────────────────────────┐
│ EventBus │
│ (ordered GameEvent stream) │
└───────────────┬──────────────┘
┌──────────────────────────────┐
│ UIHandler │
│ (subscribes + dispatches) │
└──────────────────────────────┘
```
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Add a language hint to the architecture code fence.

The fenced block is unlabeled; markdownlint MD040 will keep warning. Add a language tag (e.g., text) to stabilize docs lint.

Suggested doc patch
-```
+```text
 ...
</details>

<details>
<summary>🧰 Tools</summary>

<details>
<summary>🪛 markdownlint-cli2 (0.22.1)</summary>

[warning] 212-212: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

</details>

</details>

<details>
<summary>🤖 Prompt for AI Agents</summary>

Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @PRPs/cardshed-01-blueprint.md around lines 212 - 249, The markdown code
fence containing the ASCII architecture diagram is unlabeled which triggers
markdownlint MD040; update the opening fence from to include a language hint such astext so the block is explicitly labeled. Locate the unlabelled fence
surrounding the diagram that includes symbols like GameManager, Deck,
TurnController, ActionValidator, RulesEngine, StateReducer, EventBus, and
UIHandler and change the fence to ```text (or another appropriate tag) to
silence the linter.


</details>

<!-- fingerprinting:phantom:triton:hawk -->

<!-- This is an auto-generated comment by CodeRabbit -->

@w7-mgfcode w7-mgfcode changed the title feat(reliquary,repo): reliquary bootstrap + cardshed prp bundle (#133) chore(repo): land cardshed blueprint and reconcile prp turnstate (#137) May 20, 2026
@w7-mgfcode w7-mgfcode merged commit 074c41a into master May 20, 2026
14 checks passed
@w7-mgfcode w7-mgfcode deleted the feat/reliquary-bootstrap branch May 20, 2026 22:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

chore(repo): land cardshed strategy blueprint deliverable chore(repo): reconcile cardshed prp turnstate vocabulary

1 participant