Repository navigation
fix(crdt): finish the sync defects from the Dart port, server and crdt-js - #39
Merged
Merged
Conversation
…get and unsubscribe
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.
This is the rest of the sync fixes from the Dart port's defect list. #35 shipped the first three (old offline edits, hook rejections, multi-table pulls), and #37 did the late-stamp work. This branch has everything after that, on top of
main.Running it
The Dart suite needs the Flutter 3.47 toolchain, and Go for its conformance server.
Server
subscribetakes an optionalsince, and each poll goes out as onechangesframe.presence_getgets apresence_snapshotback andunsubscribestops the stream. Both used to come back as errors. Re-subscribing stops the old poller too, which used to keep running until the connection closed.SubscribePresence(ctx)gives each stream its own channel.PresenceChannel()still works but it's deprecated, because readers on it split the events between them.BeforeInboundChangehook error) comes back as 422, not 500. You can test for it witherrors.Is(err, crdt.ErrPushRejected), and if you serve pushes from your own handler,crdt.PushErrorStatus(err)gives you the status. The error text is the same.json.Marshalbytes everywhere. Go used to key incoming ops by whatever bytes the client sent and its own writes byjson.Marshal, so one value could sit under two keys and a remove could miss it. Sets stored before this get re-keyed when they're read or merged, and their removed markers move with them.crdt-js
SyncEnginestops resending a push the server refused. It pushes that batch one change at a time, keeps what the server takes, drops the rest and reports them throughonPushRejected. Before, one bad change went out again every 30 seconds and held up everything queued behind it. It also recognises the 500 that older servers send for the same rejections.Dart
One conformance test only counted
changeframes. It now takes achangesbatch too. The client and the sync engine already handled both.Things you should know before merging
null, since the wire has no field delete. A record delete can only be undone while its tombstone is still pending. Undo also needs room in the pending queue, and throwsOfflineQueueFullwhen it's full.extensionnow usesSubscribePresenceandPushErrorStatus, andextension/go.modrequires grove v1.7.1 for them. That tag doesn't exist yet. Tag v1.7.1 from a commit that has this branch, orextension/v1.7.1will require a grove without those APIs.