QuantStack / QuantStack/yjs-widgets

Properly separate ydoc-sync from custom comm messages

Open
#31 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
10
Forks
10
PR merge metrics
No merged PRs in 30d

Description

In yCommProvider, _onMsg treats any message with binary buffers as a ydoc sync message and everything else as a custom message. This is unfortunate, as we wouldn't be able to send custom comm messages that contain binary buffers — they'd be trapped here and processed as ydoc sync messages.

For now this is fine, since we're only partially supporting custom comms. But we should consider a breaking change in both ypywidgets and yjs-widgets to properly define a comm protocol with ydoc sync messages properly separated, e.g. branching on msg.type === 'ydoc-sync' instead of the buffers check.

Originally raised by @martinRenou in https://github.com/QuantStack/yjs-widgets/pull/30#discussion_r3587111607.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/notebookrenderer/yCommProvider.ts at _onMsg and trace how messages with binary buffers are dispatched. Review the related ypywidgets comm handling before defining a protocol that distinguishes ydoc-sync messages from custom messages. Done means custom comm messages containing binary buffers are no longer processed as ydoc sync messages, with the breaking change coordinated across both projects.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api, frontend
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.