Repository navigation
Verified snapshot compaction (yrs surrogate-pair bug) - #1
Merged
Merged
Conversation
…hot is stored only if it re-applies to the same document yrs 0.28 splits a string item at a UTF-16 offset inside a surrogate pair by rounding to a whole character, so item length and string length disagree; the GC'd (and sometimes the uncollected) encoding of such a document is wrong. On dev1 data this turned the imported 'everyonesync' canvas (72 shapes) into a snapshot that re-applies to 17 shapes and failed GET digest with 500. - engine::compact: server_doc() (skip_gc) and compact_state(): GC'd copy if it round-trips (state vector + digest, nothing pending) and is smaller, else the uncollected state if it round-trips, else None. - rooms load into server_doc and compact through compact_state (None: keep the log). - import builds a server_doc and stores the verified snapshot; 422 unverifiable_snapshot when none round-trips (nothing stored). - apps load_doc uses server_doc. - digest moved to engine (apps re-exports it unchanged).
…able_snapshot); docs: verified compaction, new 422 code
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.
Server docs never GC in memory; a snapshot (room compaction or import) is stored only if it re-applies to the same document (state vector + digest, nothing pending): GC'd copy if smaller and verified, else uncollected if verified, else none (rooms keep the update log; import → 422 unverifiable_snapshot).
Root cause: yrs 0.28 splits a string item inside a UTF-16 surrogate pair by rounding, so item clock length and string length disagree; the GC'd encoding (and sometimes the uncollected one) is wrong. On real data one canvas (72 shapes) round-tripped to 17 and GET digest returned 500. Exhaustive delete-range test over emoji strings + an import integration test. Digest moved to engine (apps re-exports). Docs updated (architecture, canvas, import-format, v0.1.0 known limitation, CHANGELOG, configuration web_root).