Built the whole app from an empty repo: a multiplayer online version… #1
Loading…
Reference in a new issue
No description provided.
Delete branch "osf/174-build-scratch-a-multiplayer-online-card"
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
npm test) passed after the fix, and a judge played a complete game in the browser — create room, play all rounds to a winner, accept a rematch — and confirmed it works end to end.How to review
npm install(the repo pins Node 26 in.nvmrc;nvm useselects it).npm test— it should report all green (rules-engine unit tests, server integration tests, and client tests).npm startand openhttp://127.0.0.1:3000— it typechecks and builds the client first, then printsScratch server listening on http://127.0.0.1:3000.packages/shared/src/engine.tsfor the rules andpackages/server/src/gameServer.tsfor the authoritative session — these two hold the core of the change.Code review
Reviewed the full Scratch monorepo (shared rules engine, Socket.IO server, React client, tests, README, Dockerfile) against the proposal, delta specs, design, and tasks. The engine, server, and client are clean, well-tested, and match the spec: no secrets, no build artifacts committed (dist/node_modules are gitignored), no debug leftovers, and the tests assert the spec scenarios. I made two small fixes: renamed the live lobby socket event from
lobbytolobby:updateto match the name documented in the design and task 2.9, and made the server emit a readable error for malformed bid/play payloads instead of silently dropping them. I left two minor, intentional items in place (a documentedfill:botstest hook and the by-design no-timer room lifecycle) and recorded them as findings.Left for you
packages/shared/src/protocol.ts:41: The protocol includes afill:botsintent that is not in task 2.9's intent list or any spec. It is an intentional, documented test/judge hook (README, the window.__app surface, and the server integration tests all use it) that seats auto-played bot players. Harmless and in use by the change's own tests, so left in place rather than removed.packages/server/src/gameServer.ts:226: A room in the playing phase whose players all disconnect auto-plays itself to game-over (advanceAuto) and then remains in memory indefinitely if nobody reconnects, since rejoin is supported and the design deliberately avoids timers. This is a slow, small memory leak in a long-running process rather than a correctness bug; left as-is to stay consistent with the no-timer design.Fixed before the commit
packages/shared/src/protocol.ts:47: The live open-rooms push was emitted/listened to as the socket eventlobby, but the design doc and task 2.9 document it aslobby:update. Renamed the event across protocol.ts, gameServer.ts (both emits), useGameSocket.ts (listener), and rooms.test.ts (three waits) so the wire protocol matches the documented name.packages/server/src/gameServer.ts:385: Agame:bidwith a non-numeric bid and agame:playwith an unparseable card id were silently ignored with no response. Now each emits a readableerror("Bids must be whole numbers" / "That is not a valid card"), consistent with the spec's "reject with a readable error" and the other illegal-action paths. State was already unchanged in both cases.Tests
89 of 96 scenarios of
build-scratch-a-multiplayer-online-card-w17hrvhave a tagged test. No test carries thespec:tag of these:game-lobby/Selecting an entry joinsgame-table/Consistent card designgame-table/Deal animationgame-table/Play and trick sweepgame-table/Portrait playgame-table/Scratch effectgame-table/Trump flipThe test lint found, in the run's tests on the last check:
Recorded, not decided
packages/shared/src/createGame.test.ts:107B3 inrejects games with fewer than 2 or more than 5 players: bare toThrow(): require toThrow(TypeName) or toThrow(/message/)packages/shared/src/createGame.test.ts:108B3 inrejects games with fewer than 2 or more than 5 players: bare toThrow(): require toThrow(TypeName) or toThrow(/message/)Braid run
build-scratch-a-multiplayer-online-card-w17hrv(38 steps, 1 retried).forgejo/workflows,.gitea/workflowsor.github/workflows); what only CI tests went unverifiedOpened by Braid.