Skip to content

RTC: add WebSocket e2e tests that do not run in CI#77920

Closed
danluu wants to merge 2 commits into
WordPress:trunkfrom
danluu:codex/rtc-websocket-e2e-tests-20260502
Closed

RTC: add WebSocket e2e tests that do not run in CI#77920
danluu wants to merge 2 commits into
WordPress:trunkfrom
danluu:codex/rtc-websocket-e2e-tests-20260502

Conversation

@danluu

@danluu danluu commented May 4, 2026

Copy link
Copy Markdown
Contributor

This is part of an AI fuzzing project, where an AI wrote a fuzzer and then triages bugs from the fuzzer and creates fixes. See #77716 for the tracking issue.

What?

This ports existing RTC e2e tests to use WebSockets and adds an additional test.

Why?

I tried adding WebSockets support to the #77716 fuzzer because the world's largest deployment of Gutenberg RTC uses WebSockets. On adding WS support, the fuzzer immediately found what appear to be a large number of distinct bugs. Users are reporting issues and some of the bugs the fuzzer turned up have symptoms that are very similar to issues users have reported. It's likely that some of the bugs that are turned up are issues users are seeing (although we can't tell for sure with the instrumentation we have).

I then tried porting (that is, had my AI agent port) the existing HTTP e2e tests to WS and found that two failed. On applying all outstanding fixes from #77716, this fixed 1.95 of the tests (one test would fail 1 in 20 times in what seems to be a real failure that's non-determinstic for timing reasons).

I'd like to a submit a PR to fix the bug causing that failure, but I think it makes sense to have all of these tests available to run and this is a large enough diff that, although I don't know what the standards/norms are for Gutenberg, my inclination would be to split it out into a separate diff and then have that PR fix this PR.

These tests do not attempt to run in CI because I'm presuming there's some kind of "Chesterton's Fence" reason we don't have WS RTC support in CI today. If that's an incorrect assumption, this PR could be modified to try to run WS tests in CI. I don't know if WS is blocked in CI, but Storybook CI seems to run a TCP server and talk to it and WS runs over TCP, so it seems like it should be do-able?

Testing Instructions

npm run test:e2e:rtc-websocket

Setup, if necessary:

  npm install
  composer install
  npm run wp-env status
  npm run wp-env start   # only if wp-env is not already running
  npm run build

Run non-determistically failing test many times:

  npm run test:e2e:rtc-websocket -- --project=chromium \
    test/e2e/specs/editor/collaboration/websocket/collaboration-same-user-title-reload-loss.spec.ts \
    test/e2e/specs/editor/collaboration/websocket/collaboration-stress.spec.ts \
    --grep "keeps an unsaved same-user title|two users concurrently move list items" \
    --repeat-each=50

As noted above, this PR is test only and doesn't include the fix for the e2e WS tests, so these tests are expected to fail.

Use of AI Tools

As noted above, this is an AI generated PR for an AI fuzzing project.

@danluu danluu requested review from ajitbohra, nerrad and ntwb as code owners May 4, 2026 20:13
@github-actions

github-actions Bot commented May 4, 2026

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: danluu <danluu@git.wordpress.org>
Co-authored-by: alecgeatches <alecgeatches@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@github-actions

github-actions Bot commented May 4, 2026

Copy link
Copy Markdown

Warning: Type of PR label mismatch

To merge this PR, it requires exactly 1 label indicating the type of PR. Other labels are optional and not being checked here.

  • Required label: Any label starting with [Type].
  • Labels found: [Package] Core data, [Package] Sync.

Read more about Type labels in Gutenberg. Don't worry if you don't have the required permissions to add labels; the PR reviewer should be able to help with the task.

@github-actions github-actions Bot added [Package] Core data /packages/core-data [Package] Sync and removed [Package] Core data /packages/core-data [Package] Sync labels May 4, 2026
@danluu danluu force-pushed the codex/rtc-websocket-e2e-tests-20260502 branch 2 times, most recently from 2252bf4 to 2dc0f29 Compare May 4, 2026 20:47
@alecgeatches

Copy link
Copy Markdown
Contributor

@danluu Great idea getting the Gutenberg tests running with WebSockets! I'd like to make a change to this branch to use the official y-websocket-server as a backend instead of the bespoke server implemented in rtc-test-ws-sync-server.mjs. I'll follow up with a link to that PR. I'm not sure if it will improve test results, but it will better match the VIP implementation, and handle things like the Yjs sync handshake and awareness updates in the same way we'd expect in production.

@alecgeatches

Copy link
Copy Markdown
Contributor

I've opened up a follow-up PR in #78179 with the official Yjs transport and some config simplifications.

@alecgeatches

Copy link
Copy Markdown
Contributor

I'm closing this, as the follow-up PR #78179 includes your commits and has been merged.

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.

2 participants