Skip to content

test: stress tests for sync handshake under concurrent mutations#219

Merged
dlqqq merged 1 commit into
jupyter-ai-contrib:mainfrom
xrl:stress-test-sync-handshake
May 4, 2026
Merged

test: stress tests for sync handshake under concurrent mutations#219
dlqqq merged 1 commit into
jupyter-ai-contrib:mainfrom
xrl:stress-test-sync-handshake

Conversation

@xrl
Copy link
Copy Markdown
Contributor

@xrl xrl commented Apr 14, 2026

Summary

Tests

Test What it verifies
test_mutations_before_handshake_not_lost 20 mutations while client is desynced are received after handshake
test_mutations_during_handshake_await Mutations during the SS2 reply await are received
test_no_exception_during_concurrent_handshakes 5 clients + 50 mutations, no crashes
test_concurrent_mutations_stress[N-M] Parametric: 2/5 clients x 10/50/100 mutations all converge

Test plan

  • All 18 tests pass (pytest jupyter_server_documents/tests/test_yroom_sync.py -xvs) — 9 existing + 9 new

Related

Copy link
Copy Markdown
Collaborator

@dlqqq dlqqq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@xrl Looks good, thanks for adding these new tests! I'm holding off on merging this until #218 is merged, but fine to merge it first if you prefer.

Add TestSyncHandshakeStress class with 9 tests (4 named + 6 parametric)
that verify data integrity when mutations occur during the sync handshake.

These cover the scenario from jupyter-ai-contrib#197 where an AI agent rapidly mutates a
document while a second browser tab is connecting:

- test_mutations_before_handshake_not_lost: 20 mutations while desynced
- test_mutations_during_handshake_await: mutations during SS2 reply wait
- test_no_exception_during_concurrent_handshakes: 5 clients + 50 mutations
- test_concurrent_mutations_stress: parametric 2/5 clients x 10/50/100 mutations

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@dlqqq dlqqq force-pushed the stress-test-sync-handshake branch from af4046a to 80d09b7 Compare May 4, 2026 22:58
@dlqqq
Copy link
Copy Markdown
Collaborator

dlqqq commented May 4, 2026

Rebased PR to run CI against #218.

@dlqqq
Copy link
Copy Markdown
Collaborator

dlqqq commented May 4, 2026

CI passes, merging. Thank you for adding these tests!

@dlqqq dlqqq merged commit a3ce910 into jupyter-ai-contrib:main May 4, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants