Skip to content

fix(lib-rt-ws-registry): tell the other clients when one of them has gone - #201

Merged
fr3shw3b merged 1 commit into
mainfrom
fix/ws-registry-lost-event-send
Aug 19, 2026
Merged

fr3shw3b merged 1 commit into
mainfrom
fix/ws-registry-lost-event-send

Conversation

@fr3shw3b

@fr3shw3b fr3shw3b commented Aug 19, 2026 •

Copy link
Copy Markdown
Contributor

Description

A lost message notification goes to every client the sender named, and two of the three places that sent one gave up as soon as a write failed. The ack worker unwrapped its send, so a client that could no longer be written to took the worker down and every acknowledgement pending on the node with it. The local path used the question mark operator, so the first failure returned a write error in place of the lost message error and the clients named after it heard nothing.

Neither is unusual enough to treat as impossible. A connection can go at any moment, and a message being declared lost is itself a sign that something is already wrong with the connections involved.

Both now go through the helper that was sitting between them, which logs a write that failed and carries on to the rest.

The test names the gone client first, so an implementation that stops at the first failure never reaches the client still listening. Its socket is built by hand with a zero linger so that dropping it resets the connection rather than closing it, because a write into a half closed socket succeeds and the first version of the test passed against the unfixed code three times over.

Summary by CodeRabbit

  • Bug Fixes
    • Improved message-loss notifications when a connection is unavailable or a delivery attempt fails.
    • Ensured notification failures for one connection no longer prevent other connected clients from receiving updates.
    • Enhanced reliability and resilience of real-time messaging during connection interruptions.

…gone

A lost message notification goes to every client the sender named, and
two of the three places that sent one gave up as soon as a write failed.
The ack worker unwrapped its send, so a client that could no longer be
written to took the worker down and every acknowledgement pending on the
node with it. The local path used the question mark operator, so the
first failure returned a write error in place of the lost message error
and the clients named after it heard nothing.

Neither is unusual enough to treat as impossible. A connection can go at
any moment, and a message being declared lost is itself a sign that
something is already wrong with the connections involved.

Both now go through the helper that was sitting between them, which logs
a write that failed and carries on to the rest.

The test names the gone client first, so an implementation that stops at
the first failure never reaches the client still listening. Its socket is
built by hand with a zero linger so that dropping it resets the
connection rather than closing it, because a write into a half closed
socket succeeds and the first version of the test passed against the
unfixed code three times over.
@coderabbitai

coderabbitai Bot commented Aug 19, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 779578dd-2f9a-4d2b-8a75-5f865d501415

📥 Commits

Reviewing files that changed from the base of the PR and between 4974bfa and 3117080.

📒 Files selected for processing (1)
  • libs/runtime/ws/ws-registry/src/registry.rs

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The WebSocket registry now uses inform_clients_of_loss for message-loss notifications. The notification path handles missing connections and send failures. Tests verify that later clients receive notifications after an earlier connection fails.

Changes

Message-loss notifications

Layer / File(s) Summary
Shared loss notification handling
libs/runtime/ws/ws-registry/src/registry.rs
start_ack_worker and send_message use inform_clients_of_loss. Missing connections are skipped, and send failures are logged without panics.
Disconnected-client notification test
libs/runtime/ws/ws-registry/src/registry.rs
Test helpers keep an unwatched connection registered. Integration coverage verifies notification delivery to later clients and preserves the MessageLost return path.

Estimated code review effort: 2 (Simple) | ~15 minutes

Merge Risk: ⚪ Minimal · up to 31170

This localized change improves notification handling for disconnected clients, and no actionable merge-blocking risk remains after normal checks and review.

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes notifying other clients when one WebSocket client disconnects.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/ws-registry-lost-event-send

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.

@sonarqubecloud

Copy link
Copy Markdown

@fr3shw3b
fr3shw3b merged commit 233333a into main Aug 19, 2026
10 checks passed
@fr3shw3b
fr3shw3b deleted the fix/ws-registry-lost-event-send branch August 19, 2026 22:41
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