fix: the Firestore document id is a bookmark's identity, not stored data (#407) #408
All Vouch review confidence checks passed
Residual risk 0.17 = Change Risk (0.40) × (1 − Review Confidence (0.57)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.40 · 290 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 84% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.339
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #408"
general
weight: 0.35
qwts
Closes #407
What was wrong
Every bookmark created in Firebase mode stored a literal
id: nullfield in its Firestore document, and every read then let that stored field win over the real document id. From there, exactly the reported symptoms:saveBookmarksaw a falsy id and routed the save through create (a second document).remove(null)built a null path segment, which Firestore refuses.id: null.The corruption came from both ends of the same spread:
1. The create forms hand the store objects carrying a transient
id: null(the full app's add form and the popup's quick add), andcreate()spread the whole object intoaddDoc— the local composite store never exposed this because it cherry-picks fields.2.
readAll()and the snapshot handler mapped{ id: d.id, ...d.data() }— the storedidoverroded.id.Documents written by
bulkAdd/bulkReplacewere unaffected (they overwriteidwith the generated reference id), which is why adopted/imported bookmarks behaved.The fix
The document id is the bookmark's identity, never document data:
readAlland the snapshot handler) spread data first:{ ...d.data(), id: d.id }.create()strips the caller's transientidbeforeaddDoc.update()stripsidfrom the patch (defensive — every current caller strips it, but the contract now holds at the store too).The read-side rule also heals the already-corrupted documents: a document carrying a legacy
id: nullreads back with its real document id, so delete and edit work again with no migration. (The stale field stays in those documents, inert; any future update that rewrites them simply doesn't carry it.)Tests
Three new tests in a
firebaseStore document identity (#407)describe: the create form's transient id never becomes document data; a stale stored id loses to the document id in both the snapshot andlist(), and a delete with the healed id reaches the document; a patch'sidfield is never written into the data.npm run cigreen;DESIGN.mdcarries the invariant in the persistence boundary; patch changeset included.<!-- agent-bot-write: ghw_cfe3fe9749181fa5 session=acad26a80cec bot=trueline-zcode-agent[bot] -->