Versions
- Client: TypeScript, 1.5.23 and 1.5.24; also reproducible on current
main at 4051e0fd
- Electric: not server-version-specific; reproduced with a deterministic
ShapeStream fetch mock using valid Shape responses
Bug description
When electric_up_to_date_tracker contains a recent cursor for a shape, a fresh ShapeStream enters replay mode. If the cached response contains change messages followed by an up-to-date control message with that same cursor, ReplayingState requests suppression and ShapeStream.#onMessages returns before publishing anything from the batch.
The next live response can advance the cursor and publish an up-to-date control message without repeating the snapshot rows. Consumers therefore observe an up-to-date stream whose local projection is missing rows that were present in the suppressed cached batch.
This is deterministic with the following response sequence:
- Seed the tracker with
cursor-1 for the shape.
- Return a cached batch containing
[insert(row), up-to-date] and electric-cursor: cursor-1.
- Return a live batch containing only
[up-to-date] and electric-cursor: cursor-2.
- The subscriber receives the second up-to-date message but never receives
row.
The negative control, using the exact same first response without a tracker entry, delivers both the row and up-to-date message normally.
Expected behavior
Replay handling should suppress only the duplicate cached up-to-date control message. Every data message in that batch must still be delivered to stream subscribers, and the fresh up-to-date message should be delivered once the cursor advances.
Versions
mainat4051e0fdShapeStreamfetch mock using valid Shape responsesBug description
When
electric_up_to_date_trackercontains a recent cursor for a shape, a freshShapeStreamenters replay mode. If the cached response contains change messages followed by anup-to-datecontrol message with that same cursor,ReplayingStaterequests suppression andShapeStream.#onMessagesreturns before publishing anything from the batch.The next live response can advance the cursor and publish an
up-to-datecontrol message without repeating the snapshot rows. Consumers therefore observe an up-to-date stream whose local projection is missing rows that were present in the suppressed cached batch.This is deterministic with the following response sequence:
cursor-1for the shape.[insert(row), up-to-date]andelectric-cursor: cursor-1.[up-to-date]andelectric-cursor: cursor-2.row.The negative control, using the exact same first response without a tracker entry, delivers both the row and up-to-date message normally.
Expected behavior
Replay handling should suppress only the duplicate cached
up-to-datecontrol message. Every data message in that batch must still be delivered to stream subscribers, and the fresh up-to-date message should be delivered once the cursor advances.