The games ledger peeks without waking a single room

The 45-second myGames poll called getRoom per held seat — every open
browser kept its whole game history warm and dragged sleeping rooms
back out of their ledgers, hollowing the eviction it ran beside.
peekSummary answers live rooms without touching their clocks and
sleeping rooms from a stub snapped at eviction (a sleeping room cannot
change, so the stub stays true until a real join or watch wakes it).
Bad tokens void as before; tokenMatches takes any token map.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015RCWSTnb1KYTPyL4GmhGnF
This commit is contained in:
Eric Wagoner
2026-08-30 15:03:28 -04:00
co-authored by Claude Fable 5
parent 9aac790e71
commit e8a7fa1b73
4 changed files with 84 additions and 27 deletions
+9 -7
View File
@@ -52,11 +52,10 @@ import {
redactFor,
roomCount,
runCommand,
seatTokenValid,
SPECTATOR,
type CatchUpStep,
startGame,
summarize,
peekSummary,
viewForPlayer,
type Room,
kickSeat,
@@ -846,14 +845,17 @@ wss.on("connection", (socket) => {
const voided: string[] = [];
for (const seat of seats) {
if (typeof seat !== "object" || seat === null) continue;
const room = getRoom(String(seat.roomId ?? ""));
if (!room) continue;
const roomId = String(seat.roomId ?? "").toUpperCase();
const name = String(seat.name ?? "");
if (!seatTokenValid(room, name, typeof seat.token === "string" ? seat.token : null)) {
voided.push(`${room.id}:${name}`);
// A peek, never a wake: the 45-second poll must not keep every
// held room warm or drag sleeping ones out of their ledgers.
const result = peekSummary(roomId, name, typeof seat.token === "string" ? seat.token : null);
if (result === null) continue;
if (result === "badToken") {
voided.push(`${roomId}:${name}`);
continue;
}
games.push(summarize(room, name));
games.push(result);
}
send(socket, { type: "games", games, voided });
break;