Cards on the table and in the hand are larger and the table is sized… #7

Merged
cmoriarty merged 4 commits from osf/176-ui-fixes into main 2026-11-06 18:58:18 -05:00
Owner

What was done

  • Cards on the table and in the hand are larger and the table is sized so no card is ever clipped at the bottom of the screen, on desktop or phone portrait.
  • The hand is laid out in a straight, evenly overlapped row instead of a fanned arc, and it stays full color while you choose a bid — only illegal cards are dimmed, on your own play turn.
  • Every seat box is the same fixed size and the seats are spread out, so each player's area is clearly their own regardless of name length, bid, or scratch count.
  • Each seat now shows tricks won in the current round as a row of small card backs and the scratch count as a labeled number (for example "Scratches: 2") instead of unlabeled tally marks.
  • Players pick an avatar on the landing screen from about a dozen options (remembered on the device), and each of the four named bots has its own fixed, hand-made avatar shown in every seat.
  • Bots now act after a short randomized server-side delay (roughly 0.8–2.5 s) instead of instantly, so a table of bots feels human-paced and every player sees the same pacing.
  • The unit suite (npm test) passed, and a judge served the app and drove it through browser checks on desktop and phone portrait, confirming no card is clipped, seats are uniform, the hand is a straight full-color row, and a full game plays to the end screen.
  • Not done: the exact bot delay range and card sizes are adjustable values, deliberately left for review to tune without changing the spec.

How to review

  1. Check out the work branch osf/176-ui-fixes so your tree matches the pull request (it diffs against main).
  2. Run npm test and npm run typecheck from the repository root; both should pass with no failures.
  3. Run npm start, open the printed http://127.0.0.1:3000 URL, and play a full game against four bots (seat them with Fill remaining seats in the waiting room); you should see bot moves arrive one at a time with a visible randomized delay, larger unclipped cards, a straight full-color hand row, uniform seat boxes, per-player trick card backs, and labeled scratch counts.
  4. Read packages/server/src/gameServer.ts and packages/client/src/components/Seat.tsx first — the server-side bot pacing and the new seat display (avatars, trick card backs, labeled scratches) live there.

Code review

Reviewed the avatar + server-side bot-pacing + table-layout change against its proposal, delta specs, and tasks. Every requirement is implemented and covered by a test, and the commit carries no generated, cached, or secret files (node_modules/dist are gitignored; .osf/ and openspec/ are meant to be committed). Found and fixed one blocking bug: the room:rejoin handler cleared the room's single pending auto-move timer without rescheduling, so a tab reload during a bot's turn (the normal rejoin path) dropped the bot's move and stalled the game, violating the game-bots requirement that a game with bots never stalls; added a regression test that times out without the fix. Also tightened botAvatarId's parameter type to remove a dead null-fallback that would have rendered a bot's face for a non-bot.

Fixed before the commit

  • blocking, packages/server/src/gameServer.ts:482: The room:rejoin handler called clearAutoTimer(room) unconditionally but never rescheduled. The pending timer usually belongs to a bot's move (the rejoining player is normally not the current actor), so a human reloading their tab during a bot's turn lost the bot's pending move and the game stalled on the bot's turn forever. This violates the game-bots spec ('a game with bots never stalls') and is the common production reload path. Fixed by calling maybeScheduleAuto(room) after clearAutoTimer(room) so the move is rescheduled when the current actor is still automatic; added a regression test in session.test.ts that times out without the fix and passes with it.
  • minor, packages/shared/src/avatars.ts:54: botAvatarId accepted BotPersona | null | undefined and fell back to BOT_AVATARS.cautious for null/undefined — dead code (all call sites pass a non-null persona) and a footgun that would render Cautious Carl's face for a non-bot. Tightened the parameter type to BotPersona and removed the arbitrary fallback.

Tests

All 26 scenarios of ui-fixes-1-the-cards-on-the-table-are-to-cm8884 have a tagged test.

Left untested on purpose:

  • game-bots/A full table of bots plays to completion: Covered by session.test.ts 'plays a full table of bots to completion without stalling' (now run with the zero-delay injection).
  • game-bots/A game with one bot plays to completion: Covered by session.test.ts 'plays a game with one bot to completion, with the bot playing its named style' (now run with the zero-delay injection).
  • game-bots/Disconnected humans keep the safe fallback: Covered by session.test.ts 'auto-plays a disconnected human with the safe fallback, not a bot style' and 'auto-plays for a disconnected player and resumes control on reconnect'.
  • game-bots/Every style stays legal: Covered by bots.test.ts 'cautious bids the lowest legal bid...', 'aggressive bids the hand size (or the highest legal bid)...', and 'bluffer always picks a legal bid and card...'; a new test would restate the same legality checks.
  • game-bots/Roster offers four named styles: Covered by bots.test.ts 'offers at least four named bots with distinct personas and names, one presented as hard to beat' and game-lobby.test.tsx 'shows the creator the bot roster with each bot's name and style blurb'.
  • game-bots/The hard-to-beat bot beats the other styles: Covered by fullGame.test.ts 'four roster bots play a full seeded game with the dealer restriction on; master scratches less than the other three average'.
  • game-bots/The hard-to-beat bot plays to its bid: Covered by bots.test.ts 'bids trumps plus aces of the other suits, clamped to the legal bids' and 'takes tricks with the cheapest winning card while behind, and dumps when level or ahead'.
  • game-table/Consistent card design: Covered by game-table.test.tsx Card 'identifies the %s suit by glyph, not color alone'; this change does not alter the card face or back design, so a new test would restate the existing one.
  • game-table/Own seat distinguished: Covered by game-table.test.tsx 'marks the player's own seat and only that seat'; the change does not alter how the own seat is marked.
  • game-table/Tap to select, tap to play: Covered by game-table.test.tsx 'exposes cards, bids, and the top controls as named, focusable buttons with a selection state'; the select-then-play interaction is unchanged by this change.

The test lint recorded nothing in the run's tests.

Braid run

  • Workflow: Braid's OpenSpec flow, change ui-fixes-1-the-cards-on-the-table-are-to-cm8884 (29 steps)
  • Issue: cmoriarty/scratch-vllm-fp8#6
  • Model: vLLM · qwen3.8-27b
  • Time: 1 h 40 m from start to this pull request, 1 h 53 m of it in the model
  • Tokens: 41.4M input, 125k output, 268k reasoning, over 480 model calls
  • Pre-flight estimate: fits, p50 152k / p80 238k tokens against a 240k-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_01M6SF1DHS26CJTXCQZNCM8884

Opened by Braid.

## What was done - Cards on the table and in the hand are larger and the table is sized so no card is ever clipped at the bottom of the screen, on desktop or phone portrait. - The hand is laid out in a straight, evenly overlapped row instead of a fanned arc, and it stays full color while you choose a bid — only illegal cards are dimmed, on your own play turn. - Every seat box is the same fixed size and the seats are spread out, so each player's area is clearly their own regardless of name length, bid, or scratch count. - Each seat now shows tricks won in the current round as a row of small card backs and the scratch count as a labeled number (for example "Scratches: 2") instead of unlabeled tally marks. - Players pick an avatar on the landing screen from about a dozen options (remembered on the device), and each of the four named bots has its own fixed, hand-made avatar shown in every seat. - Bots now act after a short randomized server-side delay (roughly 0.8–2.5 s) instead of instantly, so a table of bots feels human-paced and every player sees the same pacing. - The unit suite (`npm test`) passed, and a judge served the app and drove it through browser checks on desktop and phone portrait, confirming no card is clipped, seats are uniform, the hand is a straight full-color row, and a full game plays to the end screen. - **Not done:** the exact bot delay range and card sizes are adjustable values, deliberately left for review to tune without changing the spec. ## How to review 1. Check out the work branch `osf/176-ui-fixes` so your tree matches the pull request (it diffs against `main`). 2. Run `npm test` and `npm run typecheck` from the repository root; both should pass with no failures. 3. Run `npm start`, open the printed `http://127.0.0.1:3000` URL, and play a full game against four bots (seat them with **Fill remaining seats** in the waiting room); you should see bot moves arrive one at a time with a visible randomized delay, larger unclipped cards, a straight full-color hand row, uniform seat boxes, per-player trick card backs, and labeled scratch counts. 4. Read `packages/server/src/gameServer.ts` and `packages/client/src/components/Seat.tsx` first — the server-side bot pacing and the new seat display (avatars, trick card backs, labeled scratches) live there. ## Code review Reviewed the avatar + server-side bot-pacing + table-layout change against its proposal, delta specs, and tasks. Every requirement is implemented and covered by a test, and the commit carries no generated, cached, or secret files (node_modules/dist are gitignored; .osf/ and openspec/ are meant to be committed). Found and fixed one blocking bug: the room:rejoin handler cleared the room's single pending auto-move timer without rescheduling, so a tab reload during a bot's turn (the normal rejoin path) dropped the bot's move and stalled the game, violating the game-bots requirement that a game with bots never stalls; added a regression test that times out without the fix. Also tightened botAvatarId's parameter type to remove a dead null-fallback that would have rendered a bot's face for a non-bot. **Fixed before the commit** - blocking, `packages/server/src/gameServer.ts:482`: The room:rejoin handler called clearAutoTimer(room) unconditionally but never rescheduled. The pending timer usually belongs to a bot's move (the rejoining player is normally not the current actor), so a human reloading their tab during a bot's turn lost the bot's pending move and the game stalled on the bot's turn forever. This violates the game-bots spec ('a game with bots never stalls') and is the common production reload path. Fixed by calling maybeScheduleAuto(room) after clearAutoTimer(room) so the move is rescheduled when the current actor is still automatic; added a regression test in session.test.ts that times out without the fix and passes with it. - minor, `packages/shared/src/avatars.ts:54`: botAvatarId accepted BotPersona | null | undefined and fell back to BOT_AVATARS.cautious for null/undefined — dead code (all call sites pass a non-null persona) and a footgun that would render Cautious Carl's face for a non-bot. Tightened the parameter type to BotPersona and removed the arbitrary fallback. ## Tests All 26 scenarios of `ui-fixes-1-the-cards-on-the-table-are-to-cm8884` have a tagged test. Left untested on purpose: - `game-bots/A full table of bots plays to completion`: Covered by session.test.ts 'plays a full table of bots to completion without stalling' (now run with the zero-delay injection). - `game-bots/A game with one bot plays to completion`: Covered by session.test.ts 'plays a game with one bot to completion, with the bot playing its named style' (now run with the zero-delay injection). - `game-bots/Disconnected humans keep the safe fallback`: Covered by session.test.ts 'auto-plays a disconnected human with the safe fallback, not a bot style' and 'auto-plays for a disconnected player and resumes control on reconnect'. - `game-bots/Every style stays legal`: Covered by bots.test.ts 'cautious bids the lowest legal bid...', 'aggressive bids the hand size (or the highest legal bid)...', and 'bluffer always picks a legal bid and card...'; a new test would restate the same legality checks. - `game-bots/Roster offers four named styles`: Covered by bots.test.ts 'offers at least four named bots with distinct personas and names, one presented as hard to beat' and game-lobby.test.tsx 'shows the creator the bot roster with each bot's name and style blurb'. - `game-bots/The hard-to-beat bot beats the other styles`: Covered by fullGame.test.ts 'four roster bots play a full seeded game with the dealer restriction on; master scratches less than the other three average'. - `game-bots/The hard-to-beat bot plays to its bid`: Covered by bots.test.ts 'bids trumps plus aces of the other suits, clamped to the legal bids' and 'takes tricks with the cheapest winning card while behind, and dumps when level or ahead'. - `game-table/Consistent card design`: Covered by game-table.test.tsx Card 'identifies the %s suit by glyph, not color alone'; this change does not alter the card face or back design, so a new test would restate the existing one. - `game-table/Own seat distinguished`: Covered by game-table.test.tsx 'marks the player's own seat and only that seat'; the change does not alter how the own seat is marked. - `game-table/Tap to select, tap to play`: Covered by game-table.test.tsx 'exposes cards, bids, and the top controls as named, focusable buttons with a selection state'; the select-then-play interaction is unchanged by this change. The test lint recorded nothing in the run's tests. ## Braid run - **Workflow:** Braid's OpenSpec flow, change `ui-fixes-1-the-cards-on-the-table-are-to-cm8884` (29 steps) - **Issue:** cmoriarty/scratch-vllm-fp8#6 - **Model:** vLLM · qwen3.8-27b - **Time:** 1 h 40 m from start to this pull request, 1 h 53 m of it in the model - **Tokens:** 41.4M input, 125k output, 268k reasoning, over 480 model calls - **Pre-flight estimate:** fits, p50 152k / p80 238k tokens against a 240k-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_01M6SF1DHS26CJTXCQZNCM8884](http://openspecflow.internal.underthere.xyz/run/run_01M6SF1DHS26CJTXCQZNCM8884) _Opened by Braid._
cmoriarty deleted branch osf/176-ui-fixes 2026-11-06 18:58:18 -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!7
No description provided.