Skip to content

feat(cardshed): implement S02 PlayerSetup + matchStore (M4)#160

Merged
w7-mgfcode merged 1 commit into
masterfrom
feat/cardshed-player-setup
May 21, 2026
Merged

feat(cardshed): implement S02 PlayerSetup + matchStore (M4)#160
w7-mgfcode merged 1 commit into
masterfrom
feat/cardshed-player-setup

Conversation

@w7-mgfcode
Copy link
Copy Markdown
Owner

Summary

Closes second half of #149 (M3 closed via #159 / #148 closed via #156). Implements PRP 3 §A M4 — the PlayerSetup screen (S02) plus the matchStore that bridges the UI to @cardshed/core.startNewRound.

  • New screen apps/ui/src/features/lobby/PlayerSetup.tsx — Stitch-origin (DS-1 propagated via designSystem param), 3–4 name inputs, optional Player 4 remove, Advanced disclosure showing the real RNG seed + Randomize, accessibility wired (single <h1>, <label htmlFor>, role="status" aria-live="polite", aria-disabled + aria-describedby on the Start button while invalid).
  • New store apps/ui/src/state/matchStore.ts — zustand. startMatch({ players, seed }) calls @cardshed/core.startNewRound(null, seed, { matchId, players }). Seed is generated via generateMatchSeed() — one crypto.getRandomValues(new Uint32Array(1))[0] call outside the core (per PRP 3 M4 common-bug warning).
  • Router apps/ui/src/App.tsxmainmenuplayer-setuptable-placeholder (M5 owns the real Table). Back-to-menu also calls matchStore.reset().
  • Provenance docs/SCREENS/player-setup.md + docs/DECISIONS/2026-05-21-stitch-run-3.md + .stitch/designs/S02-player-setup.{html,png}.
  • Tests apps/ui/src/state/matchStore.test.ts — 7/7 vitest green (3-player, 4-player, <3 reject, >4 reject, replay invariant, seed sanity).
  • Dogfood dogfood-output/20260521T202659Z/m4-setup/ — 7 screenshots at 1440 × 900 + report.md covering: empty disabled → 3 names enabled → 4 names + Advanced → Start → placeholder → back → 1-name disabled.

Acceptance gates (PRP 3 §M4 lines 776–793)

Gate Result
Stitch-origin screen committed
MatchState valid for 3 names ✅ (unit test + dogfood)
MatchState has 4 players for 4 names ✅ (unit test + dogfood)
< 3 or > 4 → Start disabled / rejected ✅ (unit test + 0-name and 1-name dogfood)
Seed via crypto.getRandomValues once, outside core
Match state localStorage-throttled ⏭️ Deferred to M5+ (round-boundary observability)
agent-browser dogfood captured ✅ 7 screenshots + report

Test plan

  • npm run lint — clean (eslint --max-warnings 0)
  • npm run build — green (12.16 kB CSS / 178.69 kB JS / 0 warnings)
  • npm test — 7/7 green (matchStore engine integration + replay invariant)
  • agent-browser at 1440 × 900 — 7 screenshots covering 0/1/3/4 name states + Start nav + back nav
  • Zero console errors (only Vite HMR debug + React-DevTools info)
  • CodeRabbit + CI green (gated on push)

Out of scope

  • M5 Table render (S03) — the Start click lands on a labelled placeholder.
  • Persistence (M5+ when round boundaries exist).
  • Mobile viewport (M13).
  • Material Symbols Outlined font (deferred to S09/S10 / M11).

Decisions (docs/DECISIONS/2026-05-21-stitch-run-3.md)

  • Header CARD SHED caption from Stitch removed (single h1 per route).
  • Material Symbols swapped for Unicode (, , ) — consistent with M3.
  • Ornamental © 2024 CARD SHED v1.0.4-beta footer line removed.
  • DS-1 token consumption stays inline style={{ var(--color-…) }} — same pattern as M3 MainMenu; the wrapper-vs-utility decision lands before M5 (Table).

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, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 21, 2026

Warning

Rate limit exceeded

@w7-mgfcode has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 10 minutes and 21 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d1969dc2-4c17-4535-acff-85a312ed9666

📥 Commits

Reviewing files that changed from the base of the PR and between 748d164 and e65b902.

⛔ Files ignored due to path filters (8)
  • @lab/ll-CARDSHED/.stitch/designs/S02-player-setup.png is excluded by !**/*.png
  • @lab/ll-CARDSHED/dogfood-output/20260521T202659Z/m4-setup/01-mainmenu-1440x900.png is excluded by !**/*.png
  • @lab/ll-CARDSHED/dogfood-output/20260521T202659Z/m4-setup/02-player-setup-empty-1440x900.png is excluded by !**/*.png
  • @lab/ll-CARDSHED/dogfood-output/20260521T202659Z/m4-setup/03-player-setup-3-names-1440x900.png is excluded by !**/*.png
  • @lab/ll-CARDSHED/dogfood-output/20260521T202659Z/m4-setup/04-player-setup-4-names-advanced-1440x900.png is excluded by !**/*.png
  • @lab/ll-CARDSHED/dogfood-output/20260521T202659Z/m4-setup/05-table-placeholder-1440x900.png is excluded by !**/*.png
  • @lab/ll-CARDSHED/dogfood-output/20260521T202659Z/m4-setup/06-back-to-mainmenu-after-start-1440x900.png is excluded by !**/*.png
  • @lab/ll-CARDSHED/dogfood-output/20260521T202659Z/m4-setup/07-player-setup-1-name-disabled-1440x900.png is excluded by !**/*.png
📒 Files selected for processing (8)
  • @lab/ll-CARDSHED/.stitch/designs/S02-player-setup.html
  • @lab/ll-CARDSHED/apps/ui/src/App.tsx
  • @lab/ll-CARDSHED/apps/ui/src/features/lobby/PlayerSetup.tsx
  • @lab/ll-CARDSHED/apps/ui/src/state/matchStore.test.ts
  • @lab/ll-CARDSHED/apps/ui/src/state/matchStore.ts
  • @lab/ll-CARDSHED/docs/DECISIONS/2026-05-21-stitch-run-3.md
  • @lab/ll-CARDSHED/docs/SCREENS/player-setup.md
  • @lab/ll-CARDSHED/dogfood-output/20260521T202659Z/m4-setup/report.md
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/cardshed-player-setup

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.

@w7-mgfcode w7-mgfcode merged commit a4b6546 into master May 21, 2026
14 checks passed
@w7-mgfcode w7-mgfcode deleted the feat/cardshed-player-setup branch May 21, 2026 20:36
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.

1 participant