← Back to Pull requests

feat(sync): add tombstones, field-level conflict merge, and sync-only cleanup (#409) #430

Closed
unknown closed this pull request without merging on Dec 02, 2026 22:12 UTC
View on GitHub
unknown unknown commented on Dec 02, 2026 21:44 UTC
Author

Summary


Completes Phase 4 of #409 (multi-device conflicts, deletion tombstones, store-selection cleanup, and documentation):

  • Deletion tombstones & persisted baseline (src/stores/syncTombstones.js):

  • - Tracks deleted bookmark UUIDs in bm_tombstones (TOMBSTONE_TTL_MS = 30 days) with monotonic timestamp rules (or exact force overrides from remote tombstones), pruning, and storage/memory adapters.
    - Persists the last settled sync baseline in bm_sync_base (readSyncBase/writeSyncBase/clearSyncBase) and clears bm_sync_base on explicit Disconnect while retaining bm_tombstones across pauses/disconnects.
  • Tombstone capture & empty-read guards (src/stores/localCompositeStore.js, src/stores/cloudSyncOverlay.js, src/hooks/useCloudSyncOverlay.js):

  • - Captures tombstones on remove, removeMany, bulkReplace, and direct Chrome Bookmark Manager deletions detected in list() (with replacing and empty-list transient guards), clears tombstones on restore/create/bulkAdd, and skips tombstoned docs in adoptLegacyCloudBookmarks.
  • 3-way field-level merge & incoming payload hardening (src/stores/syncMerge.js, src/stores/syncEngine.js):

  • - Merges concurrent offline or live field edits against persisted bm_sync_base (mergeBookmarks), breaking same-field ties with clock-skew-bounded updatedAt (MAX_CLOCK_SKEW_MS = 5 minutes) and preserving the earliest valid createdAt.
    - Validates incoming cloud payloads (sanitizeIncomingBookmark) for safe HTTP(S) URLs, allowed urlStatus / normalized urlStatusReason, and bounded strings/tags/ratings.
    - Overwrites deleted Firestore docs with content-free { uuid, deleted: true, deletedAt, updatedAt } tombstones, supports edit-after-delete resurrection, prunes expired local and cloud tombstones on startup and hourly-gated reconciles, guards against transient empty reads, and commits partial-write outcomes safely.
  • Cleanup & documentation:

  • - Removes remaining standalone Firebase store-mode UI fallbacks (StorageSection, StorageWizard, StorageWizardMergeStep) and unused quickAdd.signInRequired copy.
    - Updates README.md, DESIGN.md, and src/stores/FIREBASE_SETUP.md, and adds a changeset.

    Verification


  • npm run ci </dev/null (version policy 0.22.0, THIRD-PARTY-NOTICES.md check, Prettier, ESLint, Vitest 143 passed (143) / 1722 passed (1722), chunk laziness check, Chrome & Storybook builds).
  • Closes #409

    <!-- agent-bot-write: ghw_a2ebe90cc15334a6 session=210bdd5e08f0 bot=trueline-antigravity-agent[bot] conversation_id=e99b26b3-53f9-4d7f-8337-fb33257bb240 conversation_id_source=self-reported -->

    Diff: 333 lines (+249 / -84) across 4 files Reviewer: qwts Review duration: 27m
    All Vouch review confidence checks passed
    Residual risk 0.17 = Change Risk (0.42) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.42 · 333 lines diff across 4 files
    0.42
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    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.348
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #430"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 42.1% (MEDIUM) · Higher = larger blast radius
    42.1%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 16.7% · Safe to merge
    16.7%