Skip to content

fix(extension-chrome): skip GitHub round-trip for unmapped update/remove events#15

Merged
paperhurts merged 1 commit into
mainfrom
fix/onchanged-noop-network
May 24, 2026
Merged

fix(extension-chrome): skip GitHub round-trip for unmapped update/remove events#15
paperhurts merged 1 commit into
mainfrom
fix/onchanged-noop-network

Conversation

@paperhurts
Copy link
Copy Markdown
Owner

Summary

When chrome.bookmarks.onChanged or onRemoved fired for a node with no ULID mapping, the event still reached client.update() with a no-op mutate — a wasted GitHub round-trip on every such event.

Extend flushPending's surviving filter to drop update/remove events for unmapped nodes upfront. Creates still survive (the create itself establishes the mapping).

TDD log

  • RED: the existing "onChanged for an unmapped node" test was updated to assert expect(update).not.toHaveBeenCalled(). Watched it fail — update IS called by the current code, matching the bug exactly.
  • GREEN: added idMap.ulidForNode(asNodeId(p.nodeId)) == null checks to the update/remove branches of the surviving filter. Test passes; full suite 69/69.

Test plan

  • pnpm test 69/69 (no count change — existing test became the regression guard)
  • pnpm typecheck clean
  • CI green

Closes #8

…ove events

Previously when chrome.bookmarks.onChanged or onRemoved fired for a
node with no ULID mapping, the event survived the suppression filter
and reached client.update(). The mutate fn correctly no-op'd inside
applyBatch (no matching ULID → continue), but the empty mutation still
went through a read + put round-trip to GitHub.

Filter unmapped update/remove events out of the surviving batch
upfront. Creates always survive (the create itself establishes the
mapping).

The existing 'onChanged for an unmapped node' test was updated to
assert client.update was NOT called — previously it documented the
bug by acknowledging update was called with a no-op mutate.

Closes #8
@paperhurts paperhurts merged commit a746d46 into main May 24, 2026
1 check passed
@paperhurts paperhurts deleted the fix/onchanged-noop-network branch May 24, 2026 00:16
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.

onChanged for an unmapped node still triggers a no-op GitHub round-trip

1 participant