Backport compaction processing fix that can cause user YDocs to diverge#11716
Backport compaction processing fix that can cause user YDocs to diverge#11716alecgeatches wants to merge 4 commits intoWordPress:trunkfrom
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
|
Also see suggested changes to @peterwilsoncc's branch #11599 in this comment. |
There was a problem hiding this comment.
LGTM. Ported the same fix to #11256. Nice catch on the silent drop. Storing as type=update instead makes sense since Yjs handles the overlap.
|
Ported this fix to #11256 — thanks @alecgeatches. |
peterwilsoncc
left a comment
There was a problem hiding this comment.
This looks good to me and is testing well following the reproduction steps on the upstream repository.
I've taken the liberty of pushing some coding standards fixes for multiline comments, there are no source code changes in my commits.
|
It'd be handy to get this backport in - it's blocking the Gutenberg CI. Thanks! Edit: Apologies, I misread. WordPress/gutenberg#77986 unblocks it. Thanks folks, as you were. |
Backport WordPress/gutenberg#77980 to core. This PR fixes an issue that can happen when two offline users reconnect to the same document:
chaos-merge.mov
When two users edit the same post offline and reconnect at roughly the same time, the second reconnecter's changes silently disappear from the server. Their local state still shows their changes, but no other client ever sees it, and the server-side document is the first reconnecter's state. Because of this, the second user is stuck in a non-convergent local
YDoc.The root cause is in
process_sync_update()'s compaction handling. On reconnection, both clients push with the same cursor (the last position they saw before disconnecting). The server applies the first one and then seeshas_newer_compaction=truefor the second, and drops the second compaction. Because the polling provider resets its queue to a single compaction when updates are present on every poll failure, the second user to reconnect has their local changes dropped and becomes divergent.We'll also want to merge these same changes into the RTC Table PR or any other RTC table PRs that are finalized.
Trac ticket: https://core.trac.wordpress.org/ticket/64622
Use of AI Tools
AI assistance: Yes
Tool(s): Claude
Model(s): Opus 4.7
Used for: Diagnosing the silent-drop branch, drafting the fix.