MM-68540: Stop pushing sidebar data over cluster WS; refetch via REST#1002
MM-68540: Stop pushing sidebar data over cluster WS; refetch via REST#1002
Conversation
📝 WalkthroughWalkthroughThe refresh event flow was simplified by shifting responsibility from server to client. The server now sends a minimal refresh event containing only ChangesRefresh Event Flow Simplification
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Comment |
| p.client.Frontend.PublishWebSocketEvent( | ||
| wsEventRefresh, | ||
| contentMap, | ||
| map[string]any{"user_id": userID}, |
There was a problem hiding this comment.
Do we even need to emit this at all, given the receiving client knows to fetch their own updated data?
There was a problem hiding this comment.
Thank you for your question, its still needed becase it's the only signal the client has that a webhook arrived. Without it the sidebar wouldn't update until reconnect or a manual refresh.
There was a problem hiding this comment.
Sorry, the websocket is expected, but telling the user their own user_id is not.
There was a problem hiding this comment.
You're right followup PR to drop it #1004
Summary
This change makes sendRefreshEvent ship just {user_id}, and the webapp's handleRefresh dispatches the existing refetch action instead of consuming the embedded payload.
Net wire payload drops from ~250 KB to ~50 bytes.
Verified on test server https://github-test.test.mattermost.cloud/test-github/ that the new payload is minimal:
Ticket Link
https://mattermost.atlassian.net/browse/MM-68540
Change Impact: 🟡 Medium
Reasoning: The PR modifies a critical user-facing sidebar refresh mechanism that is triggered by multiple webhook events across the system. While the changes successfully reduce wire payload from ~250KB to ~50 bytes, the conversion from synchronous embedded-data delivery to asynchronous REST-based fetching introduces a new failure mode where REST timeouts or errors could silently leave sidebar content stale—a regression from the previous guaranteed-delivery semantics.
Regression Risk: The handler parameter change from
(msg) => {}to() => {}is safe in isolation, but the underlying shift from receiving data over WebSocket to fetching it via REST removes built-in resilience. IfgetSidebarContent()REST calls fail, encounter timeouts, or experience rate-limiting, users will see no sidebar updates—whereas the old embedded-payload approach guaranteed delivery within the WebSocket frame. Theconnectedstate check provides some mitigation but doesn't handle REST-specific failures. The function is called frequently from 6+ webhook event handlers, so any issues will affect multiple user workflows.QA Recommendation: Moderate-to-full manual QA is recommended. Test scenarios should include: sidebar refresh under poor network conditions, REST endpoint slowness/timeouts, server errors during REST calls, rapid consecutive refresh triggers (webhook storms), and recovery after transient failures. Verify sidebar doesn't appear frozen or stale if REST calls fail. All webhook event types that trigger
sendRefreshEventshould be manually tested. The localized nature of the change allows for targeted testing rather than full regression, but the importance of the sidebar feature warrants comprehensive QA coverage. Adding unit tests for error paths inhandleRefreshandsendRefreshEventwould significantly reduce ongoing risk.Generated by CodeRabbitAI