All nine playtest findings (issue #21) are fixed as client-only… #22

Merged
cmoriarty merged 4 commits from osf/200-gameplay-updates-from-real-playtesting into main 2026-11-16 00:07:41 -05:00
Owner

What was done

  • All nine playtest findings (issue #21) are fixed as client-only presentation changes so the table reads as a real card table and the game is easier to follow; the rules, the protocol, and the server are untouched.
  • The waiting room gets a prominent "Fill seats with bots" button, visible to the room creator and disabled when the table is full, replacing the fill action that was buried in the hidden per-seat bot picker — the picker stays for choosing specific bots by hand. (Room.tsx)
  • Card faces now follow a real deck — number cards use pip layouts (a 5 is a quincunx) with the repeated centre rank removed and the corner index hugging the corner, court cards keep their framed monogram centres — and the text turn pill that overlapped the player's bar is replaced with a purely visual cue (a gold ring around the active avatar plus a pulsing seat border) with a screen-reader-only label. (Card.tsx)
  • The hand is a compact, evenly overlapped row centred on the rail at every screen width instead of the wide desktop spread, each player's card is played in a fixed slot aligned with their seat instead of an unexplained cross in the centre, and the trick ending no longer snaps the cards into a horizontal row — the winning card is highlighted in place, then the cards fly to the winner's pile; a test-only trick-hold freeze is added to the app's test surface so the browser test can hold that moment. (Table.tsx)
  • Opponent seats are reduced to the avatar, the name, and a card-back trick pile (one card back per trick won, dealer marker beside the name) so the seats carry only what a player needs, and the player's own slim bar is removed with their tricks shown as a pile above the hand, which becomes the trick-flight landing spot. (Seat.tsx)
  • The help is rewritten as short one-to-two-line sections that still cover every required topic so it is readable, and the "More" menu that held a single option is removed in favour of an always-visible Leave button in the top bar — a text button on desktop and an icon button on narrow screens — keeping the confirm-before-leaving step. (HelpModal.tsx)
  • The unit tests are updated to the new behavior and the Playwright smoke test is extended for the hand, the turn cue, the trick piles, the in-place trick hold, no seat overlap, the fill button, and Leave, and the trick-won event is captured at the socket level so a fast move can't drop it before the table's trick hold reads it — both test lanes passed and a judge opened the served app and passed it. (useGameSocket.ts)
  • Not done: nothing left — all 27 tasks are ticked and no tests were skipped; the one tradeoff is that the test-only trick-hold freeze is part of the existing window.__app test surface, which ships in the production bundle, inert unless called.

How to review

  1. Check out the branch osf/200-gameplay-updates-from-real-playtesting (run npm install first if dependencies are missing).
  2. Run npm test — the whole Vitest suite (rules engine, server, and client) should pass.
  3. Run npx playwright test --config packages/client/e2e/playwright.config.ts — the browser smoke test should pass; it builds the client, starts a seeded zero-delay server, and plays through the table (run npx playwright install chromium first if the browser is missing).
  4. Run npm start and open http://127.0.0.1:3000, then create a game, tap "Fill seats with bots," start, and play a trick to see the real-deck card faces, the compact hand, the per-seat played-card slots, the in-place trick highlight, and the card-back trick piles.
  5. Read packages/client/src/components/Table.tsx and packages/client/src/components/Card.tsx first — the trick ending, the played-card slots, and the card faces are the biggest visual changes.

Code review

Reviewed the change's client code (table/seat/trick-hold rework, lobby fill button, help modal, TopBar Leave) against its delta specs, using reader digests of the specs, components, styles, and tests. Fixed a real bug the e2e caught: with fast bot moves the trick-won event could be coalesced out of the event batch before React rendered, degrading the trick hold to the previous table (1 card instead of 4) — it is now captured at the socket level (useGameSocket.ts) and passed to Table, where the hold consumes it. Also fixed a duplicate SVG pattern id in Card (useId), two aria-labels ignored for lack of a role (TrickPile, Seat), a weak lobby picker test, a dead ledSuit field, and stale comments. Remaining notes (not fixed): the round's last trick is not held (the summary overlay covers it), a coalesced double-trick skips the second hold, launchFlight bails if the landing spot was never measured, and the test-only freeze pops the trick back early. Typecheck, build, 260/260 unit tests, and 15/15 e2e tests pass.

Left for you

  • minor, packages/client/src/components/Table.tsx:545: The round's last trick is never held: the state diff opens the round summary first (history grew) and returns before the trick-won detection, so the final trick's cards are cleared without a hold or flight. The summary overlay covers the felt, so the missing hold is invisible. Pre-existing design; note only.
  • minor, packages/client/src/components/Table.tsx:611: If two tricks complete between renders, the winner loop breaks after the first winner, so only one hold is scheduled; the second trick's cards are never held (its flight falls back to measured rects or the owner's slot). Pre-existing limitation of the one-hold-per-diff design; note only.
  • minor, packages/client/src/components/Table.tsx:679: launchFlight bails silently (if (!root || !to) return) when the winner's newest card back was not measured at detection time: the hold releases without a flight and the trick back never pops. Only reachable if the pile's DOM is missing at detection; note only.
  • minor, packages/client/src/components/Table.tsx:609: While the test-only freeze holds a trick, the winner's newest card back still pops in after its fixed animation-delay (HOLD_MS + sweep + stagger) even though the flight is deferred until release, so the pile briefly shows a back the cards have not yet flown to. Only observable under the test-only freeze; note only.

Fixed before the commit

  • major, packages/client/src/useGameSocket.ts:145: With fast bot moves (SCRATCH_BOT_DELAY_MS=0) the server's per-action events+state messages can coalesce into one client render: the trick-won event was read from the batch React state in Table's diff effect, but a later batch (the next trick's lead) could replace it before React rendered, so the hold degraded to the previous table — 1 card instead of 4 — and the e2e 'holds the trick in place before the flight' failed. Fixed by capturing the trick-won at the socket level (trickWonRef, set synchronously in the events handler, never a render behind) and passing it to Table as new trickWon/onTrickWonConsumed props; the hold consumes it so a stale event can never feed a later trick. useGameSocket.ts is a file the change did not touch — minimal addition, recorded here.
  • minor, packages/client/src/components/Card.tsx:93: Every card back rendered with a hard-coded id; a table holds many backs at once (the trick piles), so ids duplicated in the DOM and the url(#back-lattice) reference could resolve to a detached instance. Now each card gets a unique id via useId().
  • minor, packages/client/src/components/Card.tsx:1: The file header comment described the old card design (a large centre rank pip); rewritten to describe the current face (enlarged corner index, court monogram, real-deck pip layout, four-colour option, gold corner tab).
  • minor, packages/client/src/components/TrickPile.tsx:27: The trick pile's aria-label ("N tricks won this round") was ignored by assistive technology because the div carried no role — aria-label is only exposed on elements with a semantic role. Added role="img".
  • minor, packages/client/src/components/Seat.tsx:48: The seat's aria-label (", …") was ignored without a role, and the seatBlock test helper locates seats by it. Added role="group" so the label is exposed.
  • minor, packages/client/src/game-lobby.test.tsx:284: 'No fill button in the picker' asserted only that the removed old labels ("Fill remaining seats", "Fill empty seats with bots") were absent, which any rewording would satisfy. Now it asserts the picker's actions block contains exactly one button (Close) and no fill control anywhere in the room.
  • minor, packages/client/src/components/Table.tsx: Several comments described the pre-rework design (the row re-layout hold, the Flight landing description, HOLD_MS, TrickHoldData, the hold state, myTurnPulse, the setHold call); rewritten to describe the in-slot hold.
  • minor, packages/client/src/styles.css: Stale comments: styles.test.ts's 'seat bids' comment and styles.css's mobile caption comment described removed or changed markup; corrected to the current in-slot hold and caption placement.
  • minor, packages/client/src/components/Table.tsx:229: TrickHoldData.ledSuit was set (from the first card's suit) but never read — the 'Led ♠' mark renders from the first card directly. Removed the field, the assignment, the now-unused Suit import, and the two test literals.

Tests

All 59 scenarios of gameplay-updates-from-real-playtesting-1-21y8fd have a tagged test.

Left untested on purpose:

  • game-table/Bid shown publicly as it is made: covered by the test tagged game-table/Total updates as bids land (the running total of bids updates as each bid lands) together with the scoreboard tests that show each player's bid
  • game-table/Own seat distinguished: covered by the tests tagged game-table/Own seat as a slim bar and game-table/Own tricks above the hand, which fail if a seat panel or bar is rendered for the player or their pile moves off the hand
  • game-table/Scratch count is self-explanatory: covered by the test tagged game-table/Running totals (scoreboard shows the labelled Scratches row with each player's count) together with the seat tests that assert no scratch count appears in a seat
  • game-table/Trump indicator: covered by the test tagged game-table/Trump badge (game-table.test.tsx), which fails if the labelled trump badge or the face-up trump card beside it is missing
  • game-table/Trump mark in hand: covered by the test tagged game-table/Trump cards marked in the hand (game-table.test.tsx), which fails if a trump card in the hand loses its gold corner tab or a non-trump card gains one

The test lint found, in the run's tests on the last check:

Recorded, not decided

  • packages/client/src/game-table.test.tsx:359 B6 in does not pop the card back on a seat that did not win the trick: test has no // spec: <capability>/<scenario> tag, on itself, its describe or its file's top

Braid run

  • Workflow: Braid's OpenSpec flow, change gameplay-updates-from-real-playtesting-1-21y8fd (30 steps)
  • Issue: cmoriarty/scratch-vllm-fp8#21
  • Model: vLLM · qwen3.8-27b
  • Time: 5 h 55 m from start to this pull request, 5 h 33 m of it in the model
  • Tokens: 74.1M input, 259k output, 822k reasoning, over 972 model calls
  • Pre-flight estimate: fits, p50 492k / p80 708k tokens against a 224k-token step allowance
  • CI: no CI ran on the checked code: the project has no CI (no workflow under .forgejo/workflows, .gitea/workflows or .github/workflows); what only CI tests went unverified
  • Run: run_01M7GQNTCZC95SGDAPW021Y8FD

Opened by Braid.

## What was done - All nine playtest findings (issue #21) are fixed as client-only presentation changes so the table reads as a real card table and the game is easier to follow; the rules, the protocol, and the server are untouched. - The waiting room gets a prominent "Fill seats with bots" button, visible to the room creator and disabled when the table is full, replacing the fill action that was buried in the hidden per-seat bot picker — the picker stays for choosing specific bots by hand. (Room.tsx) - Card faces now follow a real deck — number cards use pip layouts (a 5 is a quincunx) with the repeated centre rank removed and the corner index hugging the corner, court cards keep their framed monogram centres — and the text turn pill that overlapped the player's bar is replaced with a purely visual cue (a gold ring around the active avatar plus a pulsing seat border) with a screen-reader-only label. (Card.tsx) - The hand is a compact, evenly overlapped row centred on the rail at every screen width instead of the wide desktop spread, each player's card is played in a fixed slot aligned with their seat instead of an unexplained cross in the centre, and the trick ending no longer snaps the cards into a horizontal row — the winning card is highlighted in place, then the cards fly to the winner's pile; a test-only trick-hold freeze is added to the app's test surface so the browser test can hold that moment. (Table.tsx) - Opponent seats are reduced to the avatar, the name, and a card-back trick pile (one card back per trick won, dealer marker beside the name) so the seats carry only what a player needs, and the player's own slim bar is removed with their tricks shown as a pile above the hand, which becomes the trick-flight landing spot. (Seat.tsx) - The help is rewritten as short one-to-two-line sections that still cover every required topic so it is readable, and the "More" menu that held a single option is removed in favour of an always-visible Leave button in the top bar — a text button on desktop and an icon button on narrow screens — keeping the confirm-before-leaving step. (HelpModal.tsx) - The unit tests are updated to the new behavior and the Playwright smoke test is extended for the hand, the turn cue, the trick piles, the in-place trick hold, no seat overlap, the fill button, and Leave, and the trick-won event is captured at the socket level so a fast move can't drop it before the table's trick hold reads it — both test lanes passed and a judge opened the served app and passed it. (useGameSocket.ts) - **Not done:** nothing left — all 27 tasks are ticked and no tests were skipped; the one tradeoff is that the test-only trick-hold freeze is part of the existing window.__app test surface, which ships in the production bundle, inert unless called. ## How to review 1. Check out the branch `osf/200-gameplay-updates-from-real-playtesting` (run `npm install` first if dependencies are missing). 2. Run `npm test` — the whole Vitest suite (rules engine, server, and client) should pass. 3. Run `npx playwright test --config packages/client/e2e/playwright.config.ts` — the browser smoke test should pass; it builds the client, starts a seeded zero-delay server, and plays through the table (run `npx playwright install chromium` first if the browser is missing). 4. Run `npm start` and open `http://127.0.0.1:3000`, then create a game, tap "Fill seats with bots," start, and play a trick to see the real-deck card faces, the compact hand, the per-seat played-card slots, the in-place trick highlight, and the card-back trick piles. 5. Read `packages/client/src/components/Table.tsx` and `packages/client/src/components/Card.tsx` first — the trick ending, the played-card slots, and the card faces are the biggest visual changes. ## Code review Reviewed the change's client code (table/seat/trick-hold rework, lobby fill button, help modal, TopBar Leave) against its delta specs, using reader digests of the specs, components, styles, and tests. Fixed a real bug the e2e caught: with fast bot moves the trick-won event could be coalesced out of the event batch before React rendered, degrading the trick hold to the previous table (1 card instead of 4) — it is now captured at the socket level (useGameSocket.ts) and passed to Table, where the hold consumes it. Also fixed a duplicate SVG pattern id in Card (useId), two aria-labels ignored for lack of a role (TrickPile, Seat), a weak lobby picker test, a dead ledSuit field, and stale comments. Remaining notes (not fixed): the round's last trick is not held (the summary overlay covers it), a coalesced double-trick skips the second hold, launchFlight bails if the landing spot was never measured, and the test-only freeze pops the trick back early. Typecheck, build, 260/260 unit tests, and 15/15 e2e tests pass. **Left for you** - minor, `packages/client/src/components/Table.tsx:545`: The round's last trick is never held: the state diff opens the round summary first (history grew) and returns before the trick-won detection, so the final trick's cards are cleared without a hold or flight. The summary overlay covers the felt, so the missing hold is invisible. Pre-existing design; note only. - minor, `packages/client/src/components/Table.tsx:611`: If two tricks complete between renders, the winner loop breaks after the first winner, so only one hold is scheduled; the second trick's cards are never held (its flight falls back to measured rects or the owner's slot). Pre-existing limitation of the one-hold-per-diff design; note only. - minor, `packages/client/src/components/Table.tsx:679`: launchFlight bails silently (if (!root || !to) return) when the winner's newest card back was not measured at detection time: the hold releases without a flight and the trick back never pops. Only reachable if the pile's DOM is missing at detection; note only. - minor, `packages/client/src/components/Table.tsx:609`: While the test-only freeze holds a trick, the winner's newest card back still pops in after its fixed animation-delay (HOLD_MS + sweep + stagger) even though the flight is deferred until release, so the pile briefly shows a back the cards have not yet flown to. Only observable under the test-only freeze; note only. **Fixed before the commit** - major, `packages/client/src/useGameSocket.ts:145`: With fast bot moves (SCRATCH_BOT_DELAY_MS=0) the server's per-action events+state messages can coalesce into one client render: the trick-won event was read from the `batch` React state in Table's diff effect, but a later batch (the next trick's lead) could replace it before React rendered, so the hold degraded to the previous table — 1 card instead of 4 — and the e2e 'holds the trick in place before the flight' failed. Fixed by capturing the trick-won at the socket level (trickWonRef, set synchronously in the events handler, never a render behind) and passing it to Table as new trickWon/onTrickWonConsumed props; the hold consumes it so a stale event can never feed a later trick. useGameSocket.ts is a file the change did not touch — minimal addition, recorded here. - minor, `packages/client/src/components/Card.tsx:93`: Every card back rendered <pattern id="back-lattice"> with a hard-coded id; a table holds many backs at once (the trick piles), so ids duplicated in the DOM and the url(#back-lattice) reference could resolve to a detached instance. Now each card gets a unique id via useId(). - minor, `packages/client/src/components/Card.tsx:1`: The file header comment described the old card design (a large centre rank pip); rewritten to describe the current face (enlarged corner index, court monogram, real-deck pip layout, four-colour option, gold corner tab). - minor, `packages/client/src/components/TrickPile.tsx:27`: The trick pile's aria-label ("N tricks won this round") was ignored by assistive technology because the div carried no role — aria-label is only exposed on elements with a semantic role. Added role="img". - minor, `packages/client/src/components/Seat.tsx:48`: The seat's aria-label ("<name>, …") was ignored without a role, and the seatBlock test helper locates seats by it. Added role="group" so the label is exposed. - minor, `packages/client/src/game-lobby.test.tsx:284`: 'No fill button in the picker' asserted only that the removed old labels ("Fill remaining seats", "Fill empty seats with bots") were absent, which any rewording would satisfy. Now it asserts the picker's actions block contains exactly one button (Close) and no fill control anywhere in the room. - minor, `packages/client/src/components/Table.tsx`: Several comments described the pre-rework design (the row re-layout hold, the Flight landing description, HOLD_MS, TrickHoldData, the hold state, myTurnPulse, the setHold call); rewritten to describe the in-slot hold. - minor, `packages/client/src/styles.css`: Stale comments: styles.test.ts's 'seat bids' comment and styles.css's mobile caption comment described removed or changed markup; corrected to the current in-slot hold and caption placement. - minor, `packages/client/src/components/Table.tsx:229`: TrickHoldData.ledSuit was set (from the first card's suit) but never read — the 'Led ♠' mark renders from the first card directly. Removed the field, the assignment, the now-unused Suit import, and the two test literals. ## Tests All 59 scenarios of `gameplay-updates-from-real-playtesting-1-21y8fd` have a tagged test. Left untested on purpose: - `game-table/Bid shown publicly as it is made`: covered by the test tagged game-table/Total updates as bids land (the running total of bids updates as each bid lands) together with the scoreboard tests that show each player's bid - `game-table/Own seat distinguished`: covered by the tests tagged game-table/Own seat as a slim bar and game-table/Own tricks above the hand, which fail if a seat panel or bar is rendered for the player or their pile moves off the hand - `game-table/Scratch count is self-explanatory`: covered by the test tagged game-table/Running totals (scoreboard shows the labelled Scratches row with each player's count) together with the seat tests that assert no scratch count appears in a seat - `game-table/Trump indicator`: covered by the test tagged game-table/Trump badge (game-table.test.tsx), which fails if the labelled trump badge or the face-up trump card beside it is missing - `game-table/Trump mark in hand`: covered by the test tagged game-table/Trump cards marked in the hand (game-table.test.tsx), which fails if a trump card in the hand loses its gold corner tab or a non-trump card gains one The test lint found, in the run's tests on the last check: **Recorded, not decided** - `packages/client/src/game-table.test.tsx:359` B6 in `does not pop the card back on a seat that did not win the trick`: test has no `// spec: <capability>/<scenario>` tag, on itself, its describe or its file's top ## Braid run - **Workflow:** Braid's OpenSpec flow, change `gameplay-updates-from-real-playtesting-1-21y8fd` (30 steps) - **Issue:** cmoriarty/scratch-vllm-fp8#21 - **Model:** vLLM · qwen3.8-27b - **Time:** 5 h 55 m from start to this pull request, 5 h 33 m of it in the model - **Tokens:** 74.1M input, 259k output, 822k reasoning, over 972 model calls - **Pre-flight estimate:** fits, p50 492k / p80 708k tokens against a 224k-token step allowance - **CI:** no CI ran on the checked code: the project has no CI (no workflow under `.forgejo/workflows`, `.gitea/workflows` or `.github/workflows`); what only CI tests went unverified - **Run:** [run_01M7GQNTCZC95SGDAPW021Y8FD](http://openspecflow.internal.underthere.xyz/run/run_01M7GQNTCZC95SGDAPW021Y8FD) _Opened by Braid._
cmoriarty deleted branch osf/200-gameplay-updates-from-real-playtesting 2026-11-16 00:07:41 -05:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
cmoriarty/scratch-vllm-fp8!22
No description provided.