All nine playtest findings (issue #21) are fixed as client-only… #22
Loading…
Reference in a new issue
No description provided.
Delete branch "osf/200-gameplay-updates-from-real-playtesting"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What was done
How to review
osf/200-gameplay-updates-from-real-playtesting(runnpm installfirst if dependencies are missing).npm test— the whole Vitest suite (rules engine, server, and client) should pass.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 (runnpx playwright install chromiumfirst if the browser is missing).npm startand openhttp://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.packages/client/src/components/Table.tsxandpackages/client/src/components/Card.tsxfirst — 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
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.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.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.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
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 thebatchReact 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.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().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).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".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.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.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.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.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-21y8fdhave 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 bidgame-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 handgame-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 seatgame-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 missinggame-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 oneThe test lint found, in the run's tests on the last check:
Recorded, not decided
packages/client/src/game-table.test.tsx:359B6 indoes 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 topBraid run
gameplay-updates-from-real-playtesting-1-21y8fd(30 steps).forgejo/workflows,.gitea/workflowsor.github/workflows); what only CI tests went unverifiedOpened by Braid.