Repository navigation
feat(web): show when the server was last synced while disconnected - #4894
Conversation
Helix-Harness: pi Helix-Model: openai-codex/gpt-6.1-sol
helix-white
left a comment
There was a problem hiding this comment.
[P2] Keep freshness metadata consistent with the saved snapshot (patch-db-cache.ts, read, write, and markSynced). After a successful snapshot and freshness write, a later snapshot write can fail (for example, quota exhaustion). The failure handler deletes CURSOR but leaves SYNCED and the signal intact. On the next offline load, read() restores that timestamp before discovering there is no cursor and returning { id: 0, value: {} }. The header consequently reports “Last synced …” even though the cache supplied no usable snapshot. Also, markSynced() checks only this tab's saved field, so it can recreate freshness metadata after another tab cleared the stored snapshot.
The proposal clears freshness together with an invalidated cursor, restores it only with a usable snapshot, and verifies the committed cursor within the metadata transaction before recording a new time. It reuses the cursor comparison already owned by the cache, records the persistence invariant, and adds focused restore, clear, write-failure and cross-tab-clear regression coverage.
Proposed changes: 1ce3b96...proposal/4894
Reviewed against the actual stacked base, fix/patch-cache-by-path; merge check passed. Proposal tests are intentionally unexecuted for the author to verify. Only the Conflict Markers CI check is reported on this head.
Helix-Harness: pi
Helix-Model: openai-codex/gpt-6.1-sol
The header status and the mobile menu show "Last synced <relative time>" whenever the UI is not live, so the cached snapshot shown offline says how old it is. The time is stored in the IndexedDB cache's metadata, refreshed every 30 seconds while connected and once when the connection drops, and cleared with the cache on logout. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1ce3b96 to
87a7501
Compare
Clear the stored sync time whenever the snapshot cursor is invalidated, restore it only alongside a usable snapshot, and record a new time only while the committed cursor still matches this tab's snapshot, so another tab's clear or a failed write can't leave "Last synced" over an empty cache. Co-Authored-By: helix-white <267227783+helix-a@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
helix-white
left a comment
There was a problem hiding this comment.
Approved at 614928f392741347420d1d6193c9cf7e8ffb532c. The earlier cache-consistency finding is addressed, and the head merges cleanly into fix/patch-cache-by-path.
The desktop header and mobile menu show “Last synced …” beside a non-success server status. Relative time uses the active UI language, reads “just now” below one minute, and refreshes every 10 seconds. Snapshot freshness advances every 30 seconds while live and once on disconnect, rather than only when a database revision arrives.
The existing IndexedDB cache gains an optional numeric meta.synced timestamp in epoch milliseconds; RPC contracts are unchanged. Existing snapshots without it show no age until a live refresh records one. Logout clears it. The adopted review fix invalidates freshness with a failed snapshot cursor and checks the committed cursor before recording a time, preventing another tab's clear from leaving freshness metadata over an empty cache. It shares the existing cursor comparison and adds four focused regression cases. This remains stacked on #4888 and its version-2 cache layout.
Implementation diff: +137 / −25 lines in 10 files (excludes lockfiles, tests, docs, release notes, and changelog).
The author reports check:ui (303 tests), check:i18n, and desktop/mobile mock inspection for the initial implementation; a rerun covering the added regression cases is not recorded on this head. Current CI reports only Conflict Markers, which passes. I ran no tests or standalone typechecks. For the required screenshots, the reviewed head was built and run through npm run start:ui in a build-cache lease with mock data, Node 24.22.1 and Chromium 156. Browser offline mode and an advanced browser clock produced the desktop/mobile captures attached in the following comment; this is not a real-server outage or persistence-failure test. A stale cached dependency mismatch during capture was resolved by rebuilding dependencies in the same lease.
Helix-Harness: pi
Helix-Model: openai-codex/gpt-6.1-sol
… into feat/last-synced # Conflicts: # shared-libs/ts-modules/shared/src/i18n/dictionaries/de.ts # shared-libs/ts-modules/shared/src/i18n/dictionaries/en.ts # shared-libs/ts-modules/shared/src/i18n/dictionaries/es.ts # shared-libs/ts-modules/shared/src/i18n/dictionaries/fr.ts # shared-libs/ts-modules/shared/src/i18n/dictionaries/pl.ts
helix-white
left a comment
There was a problem hiding this comment.
Approved at ea251128284d15111a40a04e5cce7ec3088fc543. The head merges cleanly into its new base, integration/registry-cache-sync. The integration merge preserves the previously reviewed feature logic and resolves the dictionaries by retaining both the SMTP strings and the last-synced strings.
The desktop header and mobile menu show “Last synced …” beside a non-success server status. Relative time uses the active UI language, reads “just now” below one minute, and refreshes every 10 seconds. Snapshot freshness advances every 30 seconds while live and once on disconnect, rather than only when a database revision arrives.
The existing IndexedDB cache gains an optional numeric meta.synced timestamp in epoch milliseconds; RPC contracts are unchanged. Existing snapshots without it show no age until a live refresh records one. Logout clears it. The adopted review fix invalidates freshness with a failed snapshot cursor and checks the committed cursor before recording a time, preventing another tab's clear from leaving freshness metadata over an empty cache. It shares the existing cursor comparison and adds four focused regression cases. This extends #4888's version-2 cache layout, now included in the integration base.
Implementation diff: +137 / −25 lines in 10 files (excludes lockfiles, tests, docs, release notes, and changelog).
The author reports check:ui (303 tests), check:i18n, and desktop/mobile mock inspection for the initial implementation; a rerun covering the added regression cases is not recorded. Conflict Markers passes on this head; Prettier, changelog/version checks, product builds and the StartWRT binary build are in progress. I ran no tests or builds for this re-review.
The existing screenshots below still represent the unchanged feature UI. They were captured at 614928f39 through npm run start:ui in a build-cache lease with mock data, Node 24.22.1 and Chromium 156. Browser offline mode and an advanced browser clock produced the displayed age; this is not a real-server outage or persistence-failure test.
Helix-Harness: pi
Helix-Model: openai-codex/gpt-6.1-sol


Part of the
integration/registry-cache-syncwork (#4888, #4889, #4890, #4892); stacked on #4888, whose cache metadata it extends.While the UI isn't live, it shows the last snapshot from IndexedDB, grayed out. This adds how old that snapshot is:
Connecting · Last synced 5 minutes ago, the sync part in the secondary text style.Intl.RelativeTimeFormatin the UI language: minutes, hours, days, weeks, months, years, always numeric ("1 day ago", not "yesterday"); under a minute reads "just now". Two new strings in all five dictionaries.The time lives in the cache's
metastore next to the resume cursor (synced).PatchDataServicerefreshes it every 30 s while connected and once when the connection drops, so it records when the data was last known current rather than when the last revision arrived. It's restored on load, so an offline refresh still shows it, and it's cleared with the cache on logout; nothing is recorded before the first snapshot is saved.Verification:
npm run check:ui(strict typecheck plus 303/303 tests) andnpm run check:i18npass. Exercised in the mock dev server on desktop and mobile layouts, including days- and weeks-old values.review effort: 'high'
🤖 Generated with Claude Code