Skip to content

fix(client): preserve data during replay suppression#4723

Open
joshdchang wants to merge 1 commit into
electric-sql:mainfrom
ai-sapien:josh/preserve-replayed-shape-data
Open

fix(client): preserve data during replay suppression#4723
joshdchang wants to merge 1 commit into
electric-sql:mainfrom
ai-sapien:josh/preserve-replayed-shape-data

Conversation

@joshdchang

Copy link
Copy Markdown

Summary

  • preserve row-bearing messages when a cached response is replayed for a previously acknowledged cursor
  • suppress only the duplicate up-to-date control message while the tracker advances to the live cursor
  • add a regression test and document the replay invariant in the TypeScript client specification

Root cause

The replay transition was represented as suppressBatch, and the client returned before publishing the entire response. A valid replay response can contain both data messages and the duplicate up-to-date marker, so this discarded rows together with the marker.

Fix

Represent the transition as suppressUpToDate, run the normal snapshot-tracker filtering, and remove only up-to-date messages before notifying subscribers. The client still avoids an empty subscriber callback when the response contains only the suppressed marker.

Fixes #4722.

Verification

  • regression test fails on current main before the fix and passes after it
  • corepack pnpm exec vitest --config vitest.unit.config.ts --run (438 tests)
  • corepack pnpm run typecheck
  • corepack pnpm run stylecheck
  • Prettier check and git diff --check

@joshdchang
joshdchang marked this pull request as ready for review July 15, 2026 21:43
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.

ShapeStream replay suppression can discard data messages

1 participant