The stub path checks the room id, as the ledger path does

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Jm2auWk6RP71CjaAb4FMoG
This commit is contained in:
Eric Wagoner
2026-09-05 22:10:03 -04:00
co-authored by Claude Fable 5.1
parent 6293c36add
commit dc4d2a1221
+4 -1
View File
@@ -150,7 +150,10 @@ export function ledgerStat(roomId: string): { bytes: number; mtimeMs: number } |
// the room's whole truth and the room stays asleep, unreplayed. // the room's whole truth and the room stays asleep, unreplayed.
const stubDir = () => join(DATA_DIR, "..", "stubs"); const stubDir = () => join(DATA_DIR, "..", "stubs");
const stubFor = (roomId: string) => join(stubDir(), `${roomId}.json`); function stubFor(roomId: string): string {
if (!safeRoomId(roomId)) throw new Error(`unsafe room id: ${JSON.stringify(roomId)}`);
return join(stubDir(), `${roomId}.json`);
}
export function readStubFile<T>(roomId: string): { bytes: number; stub: T } | null { export function readStubFile<T>(roomId: string): { bytes: number; stub: T } | null {
if (!safeRoomId(roomId)) return null; if (!safeRoomId(roomId)) return null;