Repository navigation
fix(rust): retry join_loro with an empty version on VersionUnknown - #69
Open
petralithic wants to merge 1 commit into
Open
petralithic wants to merge 1 commit into
petralithic wants to merge 1 commit into
Conversation
join_loro returned an error as soon as the receiver answered VersionUnknown, so a plain Loro doc could not rejoin a receiver that no longer recognises its version. Rejoin once with an empty version, as join_with_adaptor and the TS client already do. Refs loro-dev#16
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.
Summary
LoroWebsocketClient::join_lorofails as soon as the receiver answersJoinError(VersionUnknown).join_with_adaptorand the TS client both rejoin with an empty version in that case. So a plain Loro doc cannot rejoin a receiver that no longer recognizes its version, for example after the receiver pruned or reset its history, while the same doc joined throughLoroDocAdaptorcan.This change makes
join_lororesend theJoinRequestonce with an empty version when it getsVersionUnknown. If the empty version is also rejected, the join fails as before. Other join errors are unchanged, and so is the wire format.This covers the first half of #16. It does not pass
receiver_versiontoget_alternative_version, because that would change the publicCrdtDocAdaptortrait. Sending the receiver's own version back as the join version would also be wrong: the receiver would then skip history the client is missing. I'm happy to follow up if you want a specific API for that.Tests
New
rust/loro-websocket-client/tests/join_version_unknown.rsruns a small in-process WebSocket receiver:VersionUnknown, then accepts an empty version and sends its history. The join succeeds and the server text is imported next to the local edit. This test fails onmainwithjoin error: VersionUnknown.mainit sends only one.cargo test --workspaceinrust/passes.cargo clippy -p loro-websocket-client --all-targetsreports nothing in the changed code. I ran rustfmt only on the new test file, becausecargo fmt --checkalready reports diffs onmainin untouched files.This is independent of #67 and #68: it only touches
join_loro.