Skip to content

games_hub: rummy dealer's-choice table (#1609) - #1612

Merged
aaylward merged 4 commits into
mainfrom
claude/rummy-dealers-choice
Sep 29, 2026
Merged

aaylward merged 4 commits into
mainfrom
claude/rummy-dealers-choice

Conversation

@aaylward

Copy link
Copy Markdown
Collaborator

Closes #1609. UI: muchq/muchq.github.io PR on branch claude/rummy-dealers-choice.

Every rummy table is dealer's choice:

  • Table libs/cards/rummy/table.{h,cc}: startGame opens it choosing, seat 0 dealing. The dealer's chooseVariant deals; the seat after the dealer opens. A deal won by play credits the winner a hand and passes the deal on. Below two seats the table closes. The dealer's chair follows its holder on leaves, including mid-deal. A dealer the room shows disconnected lets any seat deal.
  • Rule change: seven cards a seat at every table size (was ten at two).
  • Serde table_serde: v2 row. A v1 row (one deal) loads as a one-deal table; ten-card rows still load.
  • Wire model/rummy.smithy: chooseVariant; the view gains variant, dealNumber, standings, choosing, lastDeal; phase choosing. A deal's end rides the view's lastDeal; gameEnded is the table's (standings, dealsPlayed).
  • Hub: each deal is a game to room stats and the event log (game_started on deal, game_finished on its end), credited in the deal-ending commit. The room listing restages on deal start and end.
  • Stats: a member upsert updates presence only; stats move only by a finish's increments. A sibling's stale presence write could erase a remote deal's credit, which rummy now makes common.

Tests:

  • table_test, table_serde_test (frozen payload, v1 rows, hostile rows), game_state* for seven cards.
  • rummy_e2e_test: next dealer's choice and rotation, away dealer, dealer leaving between deals, table close; whole seeded games at 2/3/4 seats against the engine.
  • rummy_wire_test: goldens for the choosing view, refusals, dealt views, a deal's end, the table's end.
  • hub_e2e_test: event log records each deal as a game.
  • Postgres-gated: pg_hub_store_test (PresenceWritesLeaveStatsToTheirIncrements), pg_hub_e2e_test (restart mid-deal). Ran locally against Postgres 16.

Locally: bazel test //domains/games/... 181/181 with Postgres and CI=1; mutation checks on dealer rotation, away dealer, room staging, event log and the empty-turn guard. Played end to end in headless Chromium against a local hub.

Review panel ran on the first push; its survivors are the last commit. Not fixed here:

Gin (#1610) and Rummy 500 (#1611) are next.


Generated by Claude Code

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
ast-lol f922348 Commit Preview URL

Branch Preview URL
Sep 29 2026, 12:07 AM

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
1d4-web f922348 Commit Preview URL

Branch Preview URL
Sep 29 2026, 12:05 AM

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
iili f922348 Commit Preview URL

Branch Preview URL
Sep 29 2026, 12:06 AM

@cursor

cursor Bot commented Sep 29, 2026

Copy link
Copy Markdown

Review panel + Bugbot (7cdf7552)

Four lenses + Bugbot. Bugbot found no bugs. Correctness and resource-safety clean — review-fix commit still holds (mid-deal dealer pass, presence-only upsert). Altitude is right: TableState over one-deal GameState, deal-as-game stats/events with lastDeal vs table gameEnded, Gin/500 correctly underbuilt. Known won’t-fix (#1295 stuck connected, golf-style unknown-fate event lines) accepted as documented. build-and-test / sanitize still running at post time.

Verdict: LGTM with test fold-ins. Design and the presence/stats race fix look solid; leftovers are unpinned hub refusals / standings.

Survivors (verified):

  1. Tests — chooseVariant during a live deal unpinned at hub/wire. Engine has NoChoosingWhileADealIsInPlay (status code only). Wire/e2e pin non-dealer choice and unknown variants, and refuse draws between deals, but never send chooseVariant while phase == "playing". Assert "not between deals" on the stream (and pin the reason in the unit test).

  2. Tests — leave mid-deal never pins non-zero standings on gameEnded. ALeaveMidDealClosesTheTableWithItsStandings / LeavingMidGameAbandonsItWithNoWinner close on deal 1 with handsWon: 0. After a won deal, leave mid-next-deal is untested — zeroing getWins() on close would stay green. Compaction while choosing is covered; close-with-prior-wins is not.

  3. Tests (soft) — between-deals view has no KeysOf / view-level variant pin. Dealt view has a full golden + KeysOf. Deal-end asserts choosing / lastDeal / standings dumps only; dropping or renaming view-level variant between deals would not fail the wire suite the way a dealt-view rename would.

Altitude (named, ship): Seven-card at every seat size is hitchhiking on dealer’s choice (Gin wants ten at two anyway) — fine as the named companion it already is; serde still loads ten-card rows. Presence-only ON CONFLICT is the right altitude for the stats race; Memory still full-replaces (harmless single-writer).

Line comments below. Panel complete.

Comment thread domains/games/libs/cards/rummy/table_test.cc Outdated
Comment thread domains/games/apis/games_hub/rummy_wire_test.cc
@cursor

cursor Bot commented Sep 29, 2026

Copy link
Copy Markdown

Recheck at f922348b

Closed:

  1. Mid-deal chooseVariant — unit pins "not between deals"; e2e refuses it on the stream.
  2. Close with prior wins — bob leaves mid-deal 2; gameEnded keeps alice’s handsWon: 1, dealsPlayed: 2.
  3. Between-deals KeysOf + view-level variant.

LGTM.

@github-actions github-actions Bot added the service:games_hub Changes the games_hub image label Sep 29, 2026
@aaylward
aaylward merged commit a26d296 into main Sep 29, 2026
24 checks passed
@aaylward
aaylward deleted the claude/rummy-dealers-choice branch September 29, 2026 00:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

service:games_hub Changes the games_hub image

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rummy: dealer's-choice table layer

2 participants