Skip to content

games_hub: pin chess terms and round robin body bytes - #1677

Merged
aaylward merged 2 commits into
mainfrom
claude/hopeful-ramanujan-uwueor
Oct 19, 2026
Merged

aaylward merged 2 commits into
mainfrom
claude/hopeful-ramanujan-uwueor

Conversation

@aaylward

@aaylward aaylward commented Oct 18, 2026 •

Copy link
Copy Markdown
Collaborator

#1668 phase 1, "pin first". Test-only.

PinnedBytesTest in pg_hub_store_test, compared as jsonb text (keeps key sets and integer vs float):

  • a waiting chess table's {"terms":{…}} in games.state
  • a chess round robin body (no game, empty withdrawn)
  • a pong round robin body (game, variant:"3d", two withdrawn, and today's unused zeroed chess terms)

Each is written from a row and must equal the golden. The golden is also loaded (LoadGame; LoadRoom and LoadSnapshot) and written back, and must come out unchanged. The read side names no row fields, so it survives the terms refactor unchanged. Fixtures cover every pairing shape and unsorted entrants.

Pong's terms key is pinned as written today. When pong's variant folds into its own terms, dropping it from the write is a deliberate golden change; old rows still carry it.

Verified against local Postgres, no skips. scripts/mutation-check filtered to PinnedBytesTest.*: 7/7 killed (renamed terms key on write ×2, float initialMs, init/increment swapped on both reads, forfeit:false written, pong variant dropped on read).

Review panel ran (four lenses); fixups in 739e506. Not acted on: deduping the older ChallengeTermsRide… / ARoundRobinBodyNames… assertions these overlap (they also pin refusals and the started row).

🤖 Generated with Claude Code

https://claude.ai/code/session_01Xae1QBa2qHX32DPVGSq19F

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 18, 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 739e506 Commit Preview URL

Branch Preview URL
Oct 18 2026, 07:41 PM

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 18, 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 739e506 Commit Preview URL

Branch Preview URL
Oct 18 2026, 07:41 PM

@cloudflare-workers-and-pages

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 739e506 Commit Preview URL

Branch Preview URL
Oct 18 2026, 07:41 PM

@cursor

cursor Bot commented Oct 19, 2026

Copy link
Copy Markdown

CI: 739e5067

All checks green (build-and-test, asan, ubsan, tsan included). Approve unchanged.

@cursor

cursor Bot commented Oct 19, 2026

Copy link
Copy Markdown

Review: pin chess terms and round robin body bytes

Verdict: Approve. Right “pin first” for #1668 phase 1: test-only, goldens are the live write shape, and the read side asserts by write-back rather than naming row fields — so the terms refactor can change the C++ shape without rewriting these pins. Tip 739e5067. All checks green.

What works

Waiting chess terms. kWaitingChessState matches TermsJson (setupId / initialMs / incrementMs as integers). Write pin + load-then-rewrite pin; LoadGame path only checks state absent and that the rewrite equals the golden.

Round robin bodies. Chess: no game, empty withdrawn, real terms, entrant order preserved. Pong: game/variant:"3d", unused zeroed chess terms (today’s write), withdrawn sorted as a set (bob,dave). Pairings cover white/black/draw/unplayed and forfeit:true only when set — matches EventBodyJson. Round-trip through LoadRoom and LoadSnapshot.

Comparison. jsonb::text keeps key sets and int-vs-float while dropping key order/whitespace — panel fixup in 739e506; mutation-check claim (7/7) covers the security-critical rename/swap/float mutants.

Disclosed non-acts. Overlap with ChallengeTermsRide… / ARoundRobinBodyNames… left in place (those also pin refusals / started row). Fine.

Tip 739e5067. Part of #1668.

@aaylward
aaylward merged commit 9265024 into main Oct 19, 2026
24 checks passed
@aaylward
aaylward deleted the claude/hopeful-ramanujan-uwueor branch October 19, 2026 12:49
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.

2 participants