Skip to content

fix(sync): stop resending tombstones that predate a full sync - #15

Merged
bwees merged 1 commit into
mainfrom
fix/sync-excess-tombstones
Nov 14, 2026
Merged

bwees merged 1 commit into
mainfrom
fix/sync-excess-tombstones

Conversation

@bwees

@bwees bwees commented Nov 14, 2026

Copy link
Copy Markdown
Member

Problem

The first incremental sync after a full sync resent every tombstone newer than the stream's newest upserted row. On prod that was 1,304 TimetableDeleteV1 lines, none for a row the client had received.

A full sync gives the client no delete ack, so the next sync used the upsert ack as the delete floor. Timetable prunes (DeleteTimetablesBefore) and syncAll deletes write tombstones after the last upsert, so they all landed above that floor. Every stream does this; timetables just prune the most.

Fix

When a client has no upsert ack for a stream, send only the newest tombstone before nowId, ahead of the upserts. Its ack becomes the client's delete floor.

  • The floor is a row id, like every other ack, so an uncommitted write during the full sync is still picked up next time.
  • The app applies it as a no-op delete. A full sync wipes local tables first, and deletes come before upserts.

The other option was to use the SyncCompleteV1 ack as the delete floor. I didn't, because it skips tombstones from writes still in flight during the sync, and from streams the client left out of its last request.

Tests

  • New: a tombstone newer than every upserted row is not sent after a full sync. It failed before the fix with deletes on every stream.
  • Two existing specs now expect the one newest-tombstone line on a full sync.

@bwees
bwees merged commit 088cd01 into main Nov 14, 2026
4 checks passed
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.

1 participant