Skip to content

feat: blockMatchNodes + y-prosemirror suggestion-mode E2E tests#2856

Merged
nperez0111 merged 5 commits into
y-prosemirror-v14from
y-prosemirror-tests-matchnodes
Jun 17, 2026
Merged

feat: blockMatchNodes + y-prosemirror suggestion-mode E2E tests#2856
nperez0111 merged 5 commits into
y-prosemirror-v14from
y-prosemirror-tests-matchnodes

Conversation

@nperez0111

@nperez0111 nperez0111 commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a matchNodes callback for the y-prosemirror syncPlugin diff and a comprehensive E2E test suite for suggestion-mode collaboration scenarios.

Changes

Core: blockMatchNodes node-pairing policy

  • packages/core/src/y/extensions/blockMatchNodes.ts (new) — schema-specific matchNodes callback passed to lib0/delta.diff via @y/prosemirror. A blockContainer whose 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 — wires blockMatchNodes into the syncPlugin options.

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 carry userIds: string[], timestamp: number, and (for format marks) format metadata instead of a single numeric id. Adds data-description tooltip 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 the y-attributed-delete mark (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) — patches lib0/delta.diff to accept an optional matchNodes callback, forwarded through applyChangesetToDelta to control node pairing during diffing.
  • patches/@y__prosemirror@2.0.0-2.patch (updated) — threads the matchNodes option from syncPlugin config through to the lib0/delta.diff call.
  • Removes obsolete patches/@y__y@14.0.0-rc.16.patch and patches/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 implements VersioningEndpoints against 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:

Test file Coverage
basicText.test.tsx Insert text, add/remove bold/italic, concurrent edits
basicText.concurrent.test.tsx Concurrent bold-vs-italic, typo-fix-vs-delete
addRemoveBlocks.test.tsx Add/remove paragraphs, headings, images, nested blocks
moveBlocks.test.tsx Move paragraphs up, move with children
nesting.test.tsx Indent/unindent blocks
nesting.concurrent.test.tsx Concurrent indent cascades
propChanges.test.tsx Change heading level, image source/width, text alignment
propChanges.concurrent.test.tsx Concurrent textColor vs backgroundColor
typeChanges.test.tsx Change block type (paragraph ↔ heading)
typeChanges.concurrent.test.tsx Concurrent type changes
tables.test.tsx Add/remove rows/columns, edit cells, merge/split, cell colors
tables.concurrent.test.tsx Concurrent table row+column operations

Test 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

  • The matchNodes policy prevents schema-invalid states when changing block types under suggestion mode — this was a correctness bug.
  • Suggestion mark metadata is richer (multiple user IDs, timestamps, format details) but the attribute shape changed (iduserIds/timestamp), which is a breaking change for any code inspecting suggestion mark attributes directly.
  • The lib0 patch target changed from rc.13 to rc.14.

@coderabbitai

coderabbitai Bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 48baae1c-9799-4825-89b6-c1b48811b1ec

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch y-prosemirror-tests-matchnodes

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@vercel

vercel Bot commented Jun 15, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
blocknote Error Error Jun 17, 2026 8:01am
blocknote-website Error Error Jun 17, 2026 8:01am

Request Review

@nperez0111 nperez0111 force-pushed the y-prosemirror-tests-matchnodes branch from 0f329f2 to e1a4baf Compare June 17, 2026 08:01
@nperez0111 nperez0111 merged commit 6c0f1e1 into y-prosemirror-v14 Jun 17, 2026
4 of 14 checks passed
@nperez0111 nperez0111 deleted the y-prosemirror-tests-matchnodes branch June 17, 2026 08:38
@github-actions

Copy link
Copy Markdown
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-06-17 08:38 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant