You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Keep the websocket connected when an event fails to parse after connecting - #6831
A websocket event that fails to parse made the client disconnect, reconnect and sync. When the same malformed event kept coming, the connection looped through reconnects. Drop and log such an event instead, as iOS does.
Once the connection event has been parsed, a frame that fails to parse and isn't an error is logged at error level (its event type and the parse error, never its content) and dropped. The connection stays up.
Before the connection, such a frame still fails the connect. Error frames are handled as before.
A dropped event's update is lost until the next sync.
Testing
StreamWebSocketTest covers a frame that fails to parse after connecting (dropped, the next event is delivered) and an error frame after connecting (still delivered). The existing case for a frame that fails before connecting is unchanged.
Summary by CodeRabbit
Bug Fixes
Improved handling of malformed real-time events: after connection, unrecognized events are ignored so they don’t prevent subsequent valid events from being delivered.
Server error events continue to be reported, including after connection.
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.
📝 Walkthrough
StreamWebSocket now tracks whether it has received a ConnectedEvent. It emits recognized socket errors when parsing fails. Before connection, other parse failures produce CANT_PARSE_EVENT. After connection, those malformed frames are logged and dropped. The message callback emits only non-null parse results. New tests cover malformed and recognized error events after connection.
Priority: ➖ Normal
Merge Risk:⚪ Minimal · up to 3cc4d
The change is ready to merge after normal checks. No issue was found that would prevent malformed frames from being dropped while the connection continues.
Pre-merge checks: 4 · 1
Failed checks: 1 warning
Check name
Status
Explanation
Resolution
Docstring Coverage
Docstring coverage is 18.18% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 11 functions across 2 files.
Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed checks: 4 passed
Check name
Status
Explanation
Description check
The description includes the required Goal, Implementation, and Testing sections. It explains the behavior before and after connection, error handling, logging, dropped updates, linked issue, and test…
Title check
The title clearly and concisely describes the main change: keeping the websocket connected when an event fails to parse after connection.
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Fix all pre-merge checks with AI
✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
Commit to this branch
Create a new PR
🧪 Generate unit tests (beta)
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
A rabbit taps the socket frame, ConnectedEvent marks the state by name. A known error hops into the stream, A bad frame after connection leaves unseen. The next good event arrives on cue, The rabbit thumps: “The tests came through!”
Comment @coderabbitai help to get the list of available commands.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Goal
A websocket event that fails to parse made the client disconnect, reconnect and sync. When the same malformed event kept coming, the connection looped through reconnects. Drop and log such an event instead, as iOS does.
Closes AND-1660
Implementation
Testing
StreamWebSocketTestcovers a frame that fails to parse after connecting (dropped, the next event is delivered) and an error frame after connecting (still delivered). The existing case for a frame that fails before connecting is unchanged.Summary by CodeRabbit