fix(extension-chrome): propagate remote title/URL edits to local tree#16
Merged
Conversation
Previously applyRemoteChanges early-returned when a remote bookmark
was already in the local id map ('assume in sync; next reconcile
fixes drift'). A remote title or URL edit on Device B was invisible
on Device A for up to an hour, until the periodic reconcile re-walked
both sides.
When a remote bookmark already has a mapping, fetch the current local
node via chrome.bookmarks.get, compare title/url, and call
chrome.bookmarks.update with only the changed fields. Suppress both
the old URL (in case it's being changed away) and the new URL so the
resulting onChanged echo doesn't bounce back to GitHub.
The 5-minute poll cycle now propagates edits in seconds, not hours.
TDD: 3 new tests in apply-remote.test.ts (title change → update, URL
change → update, no-op when matching → no update). Watched 2/3 fail
RED (skip-no-op already passed because original code never called
update). Implementation added a new applyRemoteEdit helper; all
12 apply-remote tests + full suite (72) pass GREEN.
Closes #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When a remote bookmark already has a local mapping,
applyRemoteChangespreviously early-returned ("assume in sync; next reconcile fixes drift"). Remote title/URL edits made on Device B were invisible on Device A for up to an hour. The 5-min poll cycle now propagates them in seconds.The fix: fetch the current local node via
chrome.bookmarks.get, compare title/url against the remote entry, callchrome.bookmarks.updatewith only the changed fields. Both old and new URL are suppressed so the resultingonChangedecho doesn't bounce back to GitHub.TDD log
apply-remote.test.ts:chrome.bookmarks.update(nodeId, { title })calledchrome.bookmarks.update(nodeId, { url })calledupdateNOT calledupdateat all). Failures matched the documented bug exactly.applyRemoteEdithelper that does the get → compare → suppress → update flow. All 12 apply-remote tests pass; full suite 72/72.Test plan
pnpm test72/72 (3 new for this fix)pnpm typecheckcleanCloses #1