feat: blockMatchNodes + y-prosemirror suggestion-mode E2E tests#2856
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
7789e2e to
112f3ce
Compare
5d2ce5c to
76dd095
Compare
112f3ce to
0f329f2
Compare
0f329f2 to
e1a4baf
Compare
|
Summary
Adds a
matchNodescallback for the y-prosemirrorsyncPlugindiff and a comprehensive E2E test suite for suggestion-mode collaboration scenarios.Changes
Core:
blockMatchNodesnode-pairing policypackages/core/src/y/extensions/blockMatchNodes.ts(new) — schema-specificmatchNodescallback passed tolib0/delta.diffvia@y/prosemirror. AblockContainerwhose first block-content child changes type (e.g. paragraph → heading) is treated as a different node, so the diff replaces the whole container instead of producing two block-contents in one container (which would be schema-invalid).packages/core/src/y/extensions/YSync.ts— wiresblockMatchNodesinto thesyncPluginoptions.Core: suggestion mark attribution improvements
packages/core/src/extensions/tiptap-extensions/Suggestions/SuggestionMarks.ts— suggestion marks (y-attributed-insert,y-attributed-delete,y-attributed-format) now carryuserIds: string[],timestamp: number, and (for format marks)formatmetadata instead of a single numericid. Addsdata-descriptiontooltip attributes with human-readable "Inserted/Deleted/Modified by X on Y" strings.Core: UniqueID fix for suggestion-deleted nodes
packages/core/src/extensions/tiptap-extensions/UniqueID/UniqueID.ts— nodes carrying they-attributed-deletemark (suggestion-mode tombstones from type changes) are now excluded from duplicate-ID detection so the surviving block keeps its original ID.Patches
patches/lib0@1.0.0-rc.14.patch(new) — patcheslib0/delta.diffto accept an optionalmatchNodescallback, forwarded throughapplyChangesetToDeltato control node pairing during diffing.patches/@y__prosemirror@2.0.0-2.patch(updated) — threads thematchNodesoption fromsyncPluginconfig through to thelib0/delta.diffcall.patches/@y__y@14.0.0-rc.16.patchandpatches/lib0@1.0.0-rc.13.patch(superseded by lib0 rc.14 upgrade + new patch).Versioning: YHub adapter
packages/core/src/y/versioning/yhub.ts(new) —createYHubVersioningEndpoints()factory that implementsVersioningEndpointsagainst the YHub HTTP API (activity listing, changeset retrieval, rollback, snapshot naming).E2E test suite (
tests/src/end-to-end/y-prosemirror/)12 new test files covering suggestion-mode collaboration with screenshot assertions:
basicText.test.tsxbasicText.concurrent.test.tsxaddRemoveBlocks.test.tsxmoveBlocks.test.tsxnesting.test.tsxnesting.concurrent.test.tsxpropChanges.test.tsxpropChanges.concurrent.test.tsxtypeChanges.test.tsxtypeChanges.concurrent.test.tsxtables.test.tsxtables.concurrent.test.tsxTest fixtures in
fixtures/provide reusable suggestion-mode and concurrent-suggestion-mode editor setups.Example: multi-doc versioning demo
examples/07-collaboration/14-multi-doc-versioning/— full working example demonstrating the YHub versioning adapter with document listing, history sidebar, and version restore.Impact
matchNodespolicy prevents schema-invalid states when changing block types under suggestion mode — this was a correctness bug.id→userIds/timestamp), which is a breaking change for any code inspecting suggestion mark attributes directly.lib0patch target changed fromrc.13torc.14.