Skip to content

fix(ext): reconcile on setup so existing bookmarks import (#54)#55

Merged
paperhurts merged 1 commit into
mainfrom
fix/reconcile-on-setup
Jun 19, 2026
Merged

fix(ext): reconcile on setup so existing bookmarks import (#54)#55
paperhurts merged 1 commit into
mainfrom
fix/reconcile-on-setup

Conversation

@paperhurts

Copy link
Copy Markdown
Owner

Closes #54.

Problem

Existing browser bookmarks weren't imported after setup. reconcile() only ran from top-level void maybeReconcile() on service-worker eval — which on install sees null settings and bails — and saving settings never re-triggered it. Nothing tied reconcile to setup completed, so existing bookmarks only reached GitHub if the browser happened to cold-start later. (Confirmed from a user's popup screenshot: no error banner → reconcile never ran, not an auth failure.)

Fix

Top-level-registered lifecycle triggers in background.ts:

  • storage.onChanged on the settings key → clear the staleness stamp and reconcile immediately (setup completed / repo switched). Registered at top level so the SW wakes for the event even when terminated. Gated by a pure isSettingsChange() predicate so reconcile's own lastReconciledAt/etag writes don't self-trigger a loop.
  • runtime.onInstalled + runtime.onStartupmaybeReconcile() (more reliable than top-level eval alone).

runMaybeReconcile's 1-hour staleness guard still applies to the eval/startup paths.

Tests

+4 isSettingsChange cases — extension-shared 115 → 119, monorepo total 306 → 310. Typecheck + both shell builds clean.

Docs (per 'document everything / show ALL FEATURES')

  • README: restructured into a complete categorized Features rundown (browser extension + web UI + foundation) and a new Importing existing bookmarks section (auto-on-setup + the Netscape-HTML round-trip).
  • CLAUDE.md + both shell READMEs: document the new reconcile triggers; added an import-on-setup smoke step.

🤖 Generated with Claude Code

…ld-start (#54)

Existing browser bookmarks weren't imported after setup: reconcile only ran
from top-level `void maybeReconcile()` on SW eval, which on install sees null
settings and bails — and saving settings didn't re-trigger it. Nothing tied
reconcile to "setup completed", so existing bookmarks never reached GitHub
unless the browser happened to restart.

Add top-level-registered lifecycle triggers in background.ts:
- storage.onChanged on the settings key → clear the staleness stamp and
  reconcile immediately (setup completed / repo switched) so bookmarks import
  within seconds. Gated by a pure `isSettingsChange()` predicate to avoid a
  self-trigger loop (reconcile's own lastReconciledAt/etag writes are other
  keys).
- runtime.onInstalled + runtime.onStartup → maybeReconcile (more reliable than
  top-level eval alone).

Export SETTINGS_KEY from settings.ts for the storage listener. runMaybeReconcile's
1h staleness guard still applies to the eval/startup paths.

Tests: +4 isSettingsChange cases (extension-shared 115 → 119; total 306 → 310).
Docs: README gets a full categorized Features rundown (extension + web UI +
foundation) and an "Importing existing bookmarks" section; CLAUDE.md + both
shell READMEs document the new reconcile triggers and an import smoke step.

Closes #54

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@paperhurts paperhurts merged commit aceb706 into main Jun 19, 2026
1 check passed
@paperhurts paperhurts deleted the fix/reconcile-on-setup branch June 19, 2026 21:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Existing browser bookmarks not imported after setup (reconcile only runs on SW cold-start)

1 participant