Skip to content

Remove duplicate cells on document change#555

Open
jordanhboxer wants to merge 3 commits intojupyterlab:mainfrom
jordanhboxer:jupyter-server-ydoc-2.2.1+hrt1
Open

Remove duplicate cells on document change#555
jordanhboxer wants to merge 3 commits intojupyterlab:mainfrom
jordanhboxer:jupyter-server-ydoc-2.2.1+hrt1

Conversation

@jordanhboxer
Copy link

@jordanhboxer jordanhboxer commented Mar 24, 2026

Summary

  • Add _remove_duplicate_cells to DocumentRoom, triggered when cells change via _on_document_change
  • Prevents duplicate cells from accumulating when multiple clients sync notebook content concurrently
  • Extends rtc_create_mock_document_room fixture with file_format and file_type params to support notebook-type rooms in tests

Test plan

  • Existing tests pass
  • New test in tests/test_rooms.py verifies duplicate cell removal
  • Manual verification with concurrent notebook editing

Related

#545
jupyter-server/jupyter_ydoc#376
jupyter-server/jupyter_ydoc#385

…ange

Add _remove_duplicate_cells to DocumentRoom, triggered when cells change
via _on_document_change. This prevents duplicate cells from accumulating
when multiple clients sync notebook content concurrently.

Also extends rtc_create_mock_document_room fixture with file_format and
file_type params to support notebook-type rooms in tests.

PY-1190

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Contributor

Binder 👈 Launch a Binder on branch jordanhboxer/jupyter-collaboration/jupyter-server-ydoc-2.2.1%2Bhrt1

@jordanhboxer
Copy link
Author

@davidbrochart @krassowski another couple of changes related to cell duplication (also #556). unfortunately this has been a bit of a thorn in our sides but with the amazing help of @pablogsal we've been able to reproduce a situation where concurrent out-of-band updates cause things to blow up so these two commit will guard against that

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