M3: stub db sentinel in ws/memory mode so legacy guards pass

ws/memory storage mode never set the module-level `db` variable. 24 handlers
guarded with `if (!db) return` early-exited, silently dropping all writes
(create campaign, add encounter, participant CRUD, combat, logs).

db stays a truthy sentinel object { __localStub: true } in non-firebase mode.
All real reads/writes route through storage.*; db only used by guards.

56 frontend tests green. Verified via headed browser: create campaign flow
works end-to-end (modal closes, campaign appears via WS realtime push).
This commit is contained in:
david raistrick
2026-06-29 11:30:08 -04:00
parent b095e37bfe
commit a5a4df78f0
+3
View File
@@ -122,10 +122,13 @@ const initializeStorage = () => {
} }
// ws / memory mode: stub auth so App's anon-sign-in path works. // ws / memory mode: stub auth so App's anon-sign-in path works.
// db stays a truthy sentinel object so legacy `if (!db) return` guards pass;
// all real reads/writes route through `storage.*`, never the SDK `db`.
const FAKE_USER = { uid: 'local-user', isAnonymous: true }; const FAKE_USER = { uid: 'local-user', isAnonymous: true };
auth = { auth = {
currentUser: FAKE_USER, currentUser: FAKE_USER,
}; };
db = { __localStub: true };
storage = getStorage(); storage = getStorage();
return true; return true;
}; };