Skip to content

Calls v1: Fix silent handleReconnect failures [MM-70184] - #1283

Open
bgardner8008 wants to merge 1 commit into
mainfrom
MM-70184-handle-reconnect
Open

Calls v1: Fix silent handleReconnect failures [MM-70184]#1283
bgardner8008 wants to merge 1 commit into
mainfrom
MM-70184-handle-reconnect

Conversation

@bgardner8008

Copy link
Copy Markdown
Contributor

Summary

  • Publishes wsEventError back to the client when handleReconnect fails, so the client can fall back to a clean rejoin instead of silently retrying until its 30s reconnect budget expires and the session is orphaned.
  • Switches getCallState in handleReconnect to read from the writer DB (fromWriter=true), fixing the replica-lag variant of the failure ("no call ongoing" / "session not found") that was the most common cause observed on the community hub during rolling deploys.

See MM-70184 for the full analysis, hub log evidence, and companion ticket MM-70185.

Test plan

  • New TestHandleReconnect (5 subtests) covers the handleReconnect error paths directly: forbidden, no call ongoing, session not found, session belonging to a different user, and already-reconnected.
  • New TestWebSocketMessageHasBeenPostedReconnectError verifies that wsEventError is published to the client's connection ID when the reconnect goroutine fails.
  • make golangci-lint clean; full go test ./server/... passes.

When handleReconnect fails, the client now receives wsEventError so it
can fall back to a clean rejoin instead of silently retrying until its
30s reconnect budget expires.

Also switches getCallState to read from the writer DB (fromWriter=true),
matching MM-69201's fix for the same replica-lag class of failure that
caused "no call ongoing" / "session not found" errors during pod rolls.
@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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 7978eaa9-9b32-4ec8-adbb-5f867647ed79

📥 Commits

Reviewing files that changed from the base of the PR and between c39546a and cddd0ac.

📒 Files selected for processing (2)
  • server/websocket.go
  • server/websocket_test.go

Included review availability: 2 reviews are currently available. Your included PR review attempts over the past 7 days set your current allowance at 5 reviews per hour.


📝 Walkthrough

Walkthrough

Reconnect handling now loads enabled call state. Invalid reconnect requests are tested. Reconnect failures now send reliable wsEventError events to the affected connection.

Changes

Reconnect handling

Layer / File(s) Summary
Reconnect state validation
server/websocket.go, server/websocket_test.go
handleReconnect loads enabled call state. Tests cover denied access, missing calls or sessions, ownership mismatches, and duplicate reconnections.
Reconnect error reporting
server/websocket.go, server/websocket_test.go
Reconnect failures publish reliable wsEventError events with the error text and connection ID. An integration test verifies the event.

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

Merge Risk: ⚪ Minimal · up to cddd0

The change reports reconnect failures to clients and reads reconnect state from the writer database, improving recovery behavior without any supplied current-head merge-blocking risk; no actionable merge-blocking risk remains.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the API area and the main fix for silent handleReconnect failures.
Description check ✅ Passed The description directly explains the reconnect error notification, writer database change, and related tests.
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 MM-70184-handle-reconnect

Comment @coderabbitai help to get the list of available commands.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 25.00000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 35.50%. Comparing base (eb708b4) to head (cddd0ac).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
server/websocket.go 25.00% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1283      +/-   ##
==========================================
+ Coverage   28.26%   35.50%   +7.24%     
==========================================
  Files         240      250      +10     
  Lines       13862    14294     +432     
  Branches     1643     1730      +87     
==========================================
+ Hits         3918     5075    +1157     
+ Misses       9501     8598     -903     
- Partials      443      621     +178     
Files with missing lines Coverage Δ
server/websocket.go 33.40% <25.00%> (+5.73%) ⬆️

... and 78 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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