match main firebase behavior; fix contract + mismatches
Contract rewritten to match main prod truth:
- require id injection in all doc/collection results
- honor setDoc({merge:true}) (main L1624 + 4 activeDisplay sites)
- drop invented bare<->prefixed cross-lookup tests (main never does this)
- add setDoc{merge}, batch set-only/update-only contract coverage
Fix mismatches vs main:
- subscribeCollection hook now forwards queryConstraints (was dropped;
LOG_QUERY sort+limit honored again). Mock onSnapshot honors orderBy+limit.
2 new contract tests prove the chain.
- subscribeDoc/subscribeCollection adapters now forward errCb. App hooks +
DisplayView propagate subscribe errors to UI (match main onSnapshot 3rd arg).
- ws adapter signatures accept queryConstraints + errCb (interface match).
activeDisplay writes match main:
- 5 unguarded sites -> setDoc({merge:true}) (create-if-missing, not updateDoc)
- 3 guarded sites stay updateDoc
Delete memory adapter: third storage system added complexity, zero value.
firebase-mock covers fast tests, ws covers server path. Factory throws on
unknown mode now.
Delete phantom 'Phase A/B' comment in firebase.js header.
Tests updated to assert setDoc{merge} (not updateDoc) for activeDisplay writes.
83/83 green.
This commit is contained in:
@@ -13,6 +13,25 @@ TODO: combat.scenario doesnt do 100 rounds it does 100 turns. recover from kill
|
||||
|
||||
|
||||
|
||||
TODO: death saves wrong
|
||||
|
||||
TODO: custom condition field
|
||||
|
||||
|
||||
|
||||
|
||||
ws = YOUR SQLite server. server/db.js = better-sqlite3. src/storage/ws.js = client that talks to it (REST +
|
||||
websocket). Name bad. Should be "sqlite-adapter" or "server". You right.
|
||||
|
||||
memory = in-process JS Map. Useless? Mostly yes for prod. Value: fast contract tests, no server spinup. If
|
||||
you skip memory, contract test still runs vs firebase-mock + live ws-server. Memory = optional convenience.
|
||||
|
||||
Memory = optional convenience. === extra complication.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### feat - add all characters to participants list
|
||||
|
||||
@@ -196,6 +215,31 @@ TODO: combat.scenario doesnt do 100 rounds it does 100 turns. recover from kill
|
||||
- Related: FEAT-3 (initiative first-class field).
|
||||
|
||||
## Pipeline (bugs only --- milestones live in REWORK_PLAN.md)
|
||||
|
||||
### BUG-16: subscribeCollection hook drops queryConstraints
|
||||
- SS `useFirestoreCollection` (App.js ~L233) calls
|
||||
`storage.subscribeCollection(collectionPath, cb)` --- NO constraints passed.
|
||||
- main (L251-253): `const q = query(collection(db,collectionPath), ...queryConstraints); onSnapshot(q, ...)`.
|
||||
- Effect: `LOG_QUERY = [orderBy('timestamp','desc'), limit(500)]` IGNORED. Logs
|
||||
unsorted + unbounded. Other collections unaffected (no constraints passed
|
||||
elsewhere) but interface broken.
|
||||
- firebase adapter `subscribeCollection(path, cb, queryConstraints=[])` HAS the
|
||||
param, hook just doesn't forward it.
|
||||
- Fix: hook pass `queryConstraints` as 3rd arg. RED first.
|
||||
|
||||
### BUG-17: dead SDK imports in App.js
|
||||
- L5 imports `doc,setDoc,collection,onSnapshot,writeBatch,query,getDocs` from
|
||||
`./storage` but App never calls them raw (all via `storage.*`). Only used as
|
||||
re-export passthrough. `getFirestore`,`initializeApp` still used in init flow.
|
||||
- Noise, not behavioral. Cleanup: trim dead imports OR keep for adapter test
|
||||
instrumentation. Decide after audit.
|
||||
|
||||
### BUG-18: stale comments reference deleted memory adapter + phantom Phase B
|
||||
- `src/storage/firebase.js` header had Phase A/B comment (DELETED this session).
|
||||
- `src/storage/index.js` L3: "per-group refactor pending" --- stale.
|
||||
- `src/tests/StorageEsm.test.js`, `storage.factory.test.js` referenced memory
|
||||
(FIXED this session). Re-audit for stragglers.
|
||||
|
||||
- [ ] BUG-4: fix setDoc→updateDoc for all 5 activeDisplay sites
|
||||
- [x] BUG-5: fixed (1-list model, 500 rounds clean)
|
||||
- [x] BUG-6: fixed structurally (1-list model)
|
||||
|
||||
Reference in New Issue
Block a user