← Back to Pull requests

fix(sync): show live Cloud Sync indicator and stream pulled bookmarks (#432) #433

Merged
trueline-antigravity-agent[bot] merged 19 files (1803 lines) on Dec 02, 2026 23:09 UTC
View on GitHub
trueline-antigravity-agent[bot] trueline-antigravity-agent[bot] commented on Dec 02, 2026 22:52 UTC
Author

Summary

  • Stream pulled/adopted bookmarks incrementally to the UI:

  • - localCompositeStore: explicit writes (create, bulkAdd, update, updateMany, remove, removeMany, bulkReplace, reorderBookmarks, persistSortedOrder) flush subscribers immediately (flushNotify / emitNow), bounded by a 150ms maxWait on scheduleNotify so external Chrome bursts never starve UI updates, while isolating notification read errors (emitSeq ordering + notifySafely in chromeBookmarksStore) so post-write read failures cannot reject already-completed writes.
    - cloudSyncOverlay & syncEngine / syncPlan: batch cloud pulls and legacy cloud doc adoptions into slices (LOCAL_CREATE_BATCH_SIZE = 25) using bulkAdd (with partial-failure settledNodes metadata preservation in chromeBookmarksStore/localCompositeStore and retrySliceCreates per-item fallback so partially failing batches never duplicate bookmarks), coalesce duplicate "local"/"cloud" triggers in drainQueue with per-source error isolation, and emit structured { status: "syncing", progress: { phase, done, total } } events (chunking bulk pushes > 25 items without flashing progress on routine single edits).
  • Live Cloud Sync indicator (CloudSyncBar):

  • - Added progress state to useCloudSyncOverlay and cloudSyncBar.* copy in enWizard.js (including indeterminate connecting animation + reduced-motion fallback in index.css).
    - Mounted CloudSyncBar in BookmarkApp.jsx (hidden during non-blocking signIn notices) with accessible status live announcements and labeled progressbar, plus StorageSection "syncing" pill mapping.
  • PR #430 follow-up fixes:

  • - Preserve explicit patch.createdAt in localCompositeStore.js writePatch.
    - Track direct chrome.bookmarks.onRemoved events on the bookmarkit root folder (chromeBookmarksStore.js) so deleting the root folder records tombstones cleanly while keeping rootCreatedWithoutData latched on transient missing reads.

    Testing & Verification

  • npm run format </dev/null && npm run ci </dev/null passed (144 test files, 1748 tests passing, ESLint 0 errors, Chrome build + chunk laziness + Storybook build green).

  • Pre-push review gate (claude -p --model sonnet): APPROVED.
  • Closes #432

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

    Diff: 1803 lines (+1465 / -338) across 19 files Reviewer: qwts Review duration: 17m
    All Vouch review confidence checks passed
    Residual risk 0.26 = Change Risk (0.72) × (1 − Review Confidence (0.63)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.72 · 1803 lines diff across 19 files
    0.72
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.82 · 5 substantive comment(s)
    0.82
    Model 3 · Review Timing & Attention
    Session adequacy: 39% · Reviewer familiarity: 50%
    63%
    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.400
    Mass File Touch mass_file_touch
    0.080
    Real PR Conversation Timeline
    11 items
    chatgpt-codex-connector[bot] chatgpt-codex-connector[bot] commented on Dec 02, 2026 22:52 UTC
    Bot

    <!-- codex-pull-request-review-summary -->
    <!-- codex-review-state:v1 {"code_review":{"commit_sha":"1628ad30549f1d4c31f403d987d3d74822ddb79c","has_any_findings":false,"has_unresolved_findings":false,"status":"completed"},"security_review":{"commit_sha":null,"has_any_findings":null,"has_unresolved_findings":null,"status":null}} -->

    <details>
    <summary><strong>Codex Review Summary</strong>: ✅ Completed</summary>

    This comment shows the latest Codex review activity on this pull request.

    | Review | Status | Commit | Review trigger |
    | --- | --- | --- | --- |
    | 📝 Code Review | ✅ Completed <relative-time datetime="2026-12-02T23:01:33.993995Z">2026-12-02T23:01:33.993995Z</relative-time> | 1628ad3 | Manual request |

    <details> <summary>ℹ️ About Codex in GitHub</summary>
    <br/>

    Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review

  • Mark a draft as ready

  • Comment "@codex review" or "@codex security review".
  • Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

    </details>

    </details>

    github-code-quality[bot] github-code-quality[bot] commented on code on Dec 02, 2026 22:53 UTC
    Code Review
    src/components/CloudSyncBar.stories.jsx:1
    @@ -0,0 +1,58 @@
    +import React from "react";

    Unused variable, import, function or class

    Unused import React.

    ---

    <p>Remove the unused <code>React</code> import from <code>src/components/CloudSyncBar.stories.jsx</code>.</p>
    <ul>
    <li>General fix: delete imports that are not referenced in the file.</li>
    <li>Best fix here: remove line 1 (<code>import React from "react";</code>) and keep the <code>CloudSyncBar</code> import and story exports unchanged.</li>
    <li>Scope: only edit <code>src/components/CloudSyncBar.stories.jsx</code>; no functional logic changes are needed.</li>
    <li>Additional requirements: no new methods, definitions, or dependencies.</li>
    </ul>

    chatgpt-codex-connector[bot] chatgpt-codex-connector[bot] commented on code on Dec 02, 2026 22:54 UTC
    Code Review
    src/stores/syncEngine.js:1
    @@ -301,6 +175,44 @@ async function loadCloudSnapshot({
       return indexed;
     }
     
    +async function loadReconcileInputs({
    +  local,
    +  cloud,
    +  tombstones,
    +  tombstoneTtlMs,
    +  shouldPrune,
    +  syncedBase,
    +  source,
    +  nowMs,
    +  isActive,
    +}) {
    +  let localList = await local.list();
    +  if (!isActive()) return null;
    +  let localTombs = new Map(Object.entries(tombstones.read()));
    +  const snapshot = await loadCloudSnapshot({
    +    cloud,
    +    ttlMs: tombstoneTtlMs,
    +    nowMs,
    +    expireOld: shouldPrune,
    +    syncedBaseSize: syncedBase.size,
    +    source,
    +    isActive,
    +  });
    +  if (!snapshot) return null;
    +  if (shouldPrune && snapshot.expiredIds.length > 0 && cloud.removeMany) {
    +    await cloud.removeMany(snapshot.expiredIds).catch(() => {});
    +    if (!isActive()) return null;
    +  }
    +  const latestTombs = new Map(Object.entries(tombstones.read()));
    +  if (tombstonesChanged(localTombs, latestTombs)) {
    +    localList = await local.list();
    +    if (!isActive()) return null;
    +    localTombs = latestTombs;

    <sub><sub>!P1 Badge</sub></sub> Re-read tombstones after the guarded local list

    When one deletion changes the tombstone map while cloud.list() is pending, this branch performs a second asynchronous local.list() but then installs the tombstone snapshot captured before that read. If another bookmark is deleted while the second list is awaiting, the returned list can omit it while localTombs omits its new tombstone; the planner consequently treats the still-live cloud copy as cloud-only, recreates the bookmark, and local.create() clears the tombstone, permanently undoing the user's deletion. Read tombstones.read() again after the awaited list, as the previous implementation did.

    Useful? React with 👍 / 👎.

    <!-- codex-code-review-finding:v1 -->

    chatgpt-codex-connector[bot] chatgpt-codex-connector[bot] commented on Dec 02, 2026 22:54 UTC
    Reviewer

    <!-- codex-review-receipt:v1 -->

    💡 Codex Review

    Here are some automated review suggestions for this pull request.

    Reviewed commit: 5e0f40e9eb

    <details> <summary>ℹ️ About Codex in GitHub</summary>
    <br/>

    Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review

  • Mark a draft as ready

  • Comment "@codex review".
  • If Codex has suggestions, it will comment; otherwise it will react with 👍.

    When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

    </details>

    chatgpt-codex-connector[bot] chatgpt-codex-connector[bot] commented on code on Dec 02, 2026 22:54 UTC
    Code Review
    src/stores/cloudSyncOverlay.js:1
    @@ -39,12 +40,48 @@ function buildLegacyLocalPayload(doc) {
       return payload;
     }
     
    +export { LOCAL_CREATE_BATCH_SIZE };
    +
    +async function applyLegacyBatch({ local, batch, useBulkAdd, failedDocs }) {
    +  const payloads = batch.map(buildLegacyLocalPayload);
    +  let remaining = batch;
    +  let remainingPayloads = payloads;
    +  let preAdopted = 0;
    +
    +  if (useBulkAdd) {
    +    try {
    +      await local.bulkAdd(payloads);
    +      return batch.length;
    +    } catch {
    +      const currentLocal = await local.list().catch(() => null);
    +      if (Array.isArray(currentLocal)) {

    <sub><sub>!P2 Badge</sub></sub> Abort partial adoption when the verification read fails

    If bulkAdd() partially succeeds and the follow-up local.list() also fails transiently, this catch converts the read failure to null and leaves the entire batch in remaining. The subsequent per-item retry therefore creates second copies of every bookmark that already landed in the partial bulk write. Since the successes cannot be identified without that read, propagate the read error or otherwise defer the retry rather than retrying the whole batch.

    Useful? React with 👍 / 👎.

    <!-- codex-code-review-finding:v1 -->

    trueline-antigravity-agent[bot] trueline-antigravity-agent[bot] commented on Dec 02, 2026 22:58 UTC
    Author

    @codex review

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

    chatgpt-codex-connector[bot] chatgpt-codex-connector[bot] commented on Dec 02, 2026 23:01 UTC
    Bot

    <!-- codex-review-receipt:v1 -->

    Codex Review: Didn't find any major issues. Keep them coming!

    Reviewed commit: 1628ad3054

    <details> <summary>ℹ️ About Codex in GitHub</summary>
    <br/>

    Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review

  • Mark a draft as ready

  • Comment "@codex review".
  • If Codex has suggestions, it will comment; otherwise it will react with 👍.

    When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

    </details>

    qwts qwts approved these changes on Dec 02, 2026 23:08 UTC
    Approved Reviewer

    Approved these changes.

    trueline-antigravity-agent[bot] trueline-antigravity-agent[bot] commented on code on Dec 02, 2026 23:09 UTC
    Code Review
    src/stores/syncEngine.js:1
    @@ -301,6 +175,44 @@ async function loadCloudSnapshot({
       return indexed;
     }
     
    +async function loadReconcileInputs({
    +  local,
    +  cloud,
    +  tombstones,
    +  tombstoneTtlMs,
    +  shouldPrune,
    +  syncedBase,
    +  source,
    +  nowMs,
    +  isActive,
    +}) {
    +  let localList = await local.list();
    +  if (!isActive()) return null;
    +  let localTombs = new Map(Object.entries(tombstones.read()));
    +  const snapshot = await loadCloudSnapshot({
    +    cloud,
    +    ttlMs: tombstoneTtlMs,
    +    nowMs,
    +    expireOld: shouldPrune,
    +    syncedBaseSize: syncedBase.size,
    +    source,
    +    isActive,
    +  });
    +  if (!snapshot) return null;
    +  if (shouldPrune && snapshot.expiredIds.length > 0 && cloud.removeMany) {
    +    await cloud.removeMany(snapshot.expiredIds).catch(() => {});
    +    if (!isActive()) return null;
    +  }
    +  const latestTombs = new Map(Object.entries(tombstones.read()));
    +  if (tombstonesChanged(localTombs, latestTombs)) {
    +    localList = await local.list();
    +    if (!isActive()) return null;
    +    localTombs = latestTombs;

    Fixed in 1628ad30549f1d4c31f403d987d3d74822ddb79c.

    Re-reading tombstones.read() after the second guarded local.list() in loadReconcileInputs (src/stores/syncEngine.js) and added a regression test in src/stores/syncEngine.test.js.

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

    trueline-antigravity-agent[bot] trueline-antigravity-agent[bot] commented on code on Dec 02, 2026 23:09 UTC
    Code Review
    src/stores/cloudSyncOverlay.js:1
    @@ -39,12 +40,48 @@ function buildLegacyLocalPayload(doc) {
       return payload;
     }
     
    +export { LOCAL_CREATE_BATCH_SIZE };
    +
    +async function applyLegacyBatch({ local, batch, useBulkAdd, failedDocs }) {
    +  const payloads = batch.map(buildLegacyLocalPayload);
    +  let remaining = batch;
    +  let remainingPayloads = payloads;
    +  let preAdopted = 0;
    +
    +  if (useBulkAdd) {
    +    try {
    +      await local.bulkAdd(payloads);
    +      return batch.length;
    +    } catch {
    +      const currentLocal = await local.list().catch(() => null);
    +      if (Array.isArray(currentLocal)) {

    Fixed in 1628ad30549f1d4c31f403d987d3d74822ddb79c.

    Aborted the per-item retry and skipped legacy cleanup in applyLegacyBatch (src/stores/cloudSyncOverlay.js) whenever the local.list() verification read fails after a partial bulkAdd, and added a regression test in src/stores/cloudSyncOverlay.test.js.

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

    Reviewers
    Assignees
    trueline-antigravity-agent[bot] trueline-antigravity-agent[bot]
    Labels
    risk: low confidence: 63.3% 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: 71.5% (HIGH) · Higher = larger blast radius
    71.5%
    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: 63.3% · Lower = rushed or shallow review
    63.3%
    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: 26.3% · Safe to merge
    26.3%