A room whose ledger cannot be read is logged and left unloaded, not the server down; the server has tests of its own

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Jm2auWk6RP71CjaAb4FMoG
This commit is contained in:
Eric Wagoner
2026-09-29 12:13:11 -04:00
co-authored by Claude Opus 5.5
parent 2810076677
commit faa2845e70
5 changed files with 69 additions and 6 deletions
+8 -1
View File
@@ -120,7 +120,14 @@ export class Rooms<State, Input> {
private keeper: { name: string; zone: string } = { name: 'the keeper', zone: 'UTC' }
) {
for (const id of store.roomIds()) {
const room = this.replay(id, store.read(id));
let room: Room<State> | null;
try {
room = this.replay(id, store.read(id));
} catch (e) {
// One unreadable ledger (a torn last line) keeps its room closed, not the server down.
console.error(`room ${id}: ledger unreadable, left unloaded: ${e instanceof Error ? e.message : String(e)}`);
continue;
}
if (!room) continue;
this.rooms.set(id, room);
// A table that stopped with a bot's move owed picks up where it left off.