Mirror ConnectionState onto core StreamConnectionState (breaking)#1739
Draft
aleksandar-apostolov wants to merge 2 commits into
Draft
Mirror ConnectionState onto core StreamConnectionState (breaking)#1739aleksandar-apostolov wants to merge 2 commits into
aleksandar-apostolov wants to merge 2 commits into
Conversation
Contributor
PR checklist ✅All required conditions are satisfied:
🎉 Great job! This PR is ready for review. |
Contributor
SDK Size Comparison 📏
|
This was referenced Jul 1, 2026
Contributor
|
Caution Review failedAn error occurred during the review process. Please try again later. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
33c2ece to
eda7d6c
Compare
Rewrite the public ConnectionState sealed interface to a five-variant 1:1 mirror of core's StreamConnectionState: - Idle (replaces PreConnect) - Connecting.Opening(userId), Connecting.Authenticating(userId) - Connected(connectedUser, connectionId) — was data object - Disconnected(cause: Throwable?) — absorbs Failed + Reconnecting Add ClientState.handleStreamState(StreamConnectionState) and delete ClientState.handleError(Error). Close the Plan 02-02 TODO(02-03) shim in StreamVideoClient by wiring streamClientListener.onState directly to handleStreamState. Update ConnectionStateMapper to the final five-branch mapping (replacing the Plan 02-01 placeholder). Add ClientStateTest covering every branch of handleStreamState. Update consumer tests (ClientAndAuthTest, RtcSessionTest, AndroidDeviceTest) to the new Connected/Idle payload shapes.
Reflects the new ConnectionState sealed interface (Idle, Connecting.Opening, Connecting.Authenticating, Connected, Disconnected) mirroring core's StreamConnectionState. Removed: PreConnect, Loading, Reconnecting, Failed, ClientState.handleError. Added: Connected(user, connectionId), Disconnected(cause) and Connecting subtype payloads.
eda7d6c to
5b4832d
Compare
|
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
Closes AND-1283
⚠ Breaking public API change. Replaces
ConnectionStatewith a new sealed hierarchy that matchesstream-android-core'sStreamConnectionStateshape 1:1. This removes the translation layer between core's connection state and ours — from now on we expose whatever core exposes.Depends on #1738 (StreamClient wiring). Merge after parent.
Merge order: adapters (#1737) → StreamClient wiring (#1738) → this PR → merge to
develop-v2.Migration for integrators
ConnectionState.PreConnectConnectionState.IdleConnectionState.LoadingConnectionState.Connecting.Opening(userId)(or.Authenticating)ConnectionState.ReconnectingDisconnected(cause)followed byConnecting.*— core drives the reconnect flowConnectionState.Failed(error)ConnectionState.Disconnected(cause = error.toThrowable())ConnectionState.Disconnected(data object)ConnectionState.Disconnected(cause = null)(now a data class)Implementation
New sealed hierarchy:
ClientState.handleError(error: Error)is removed — errors surface viaDisconnected.causeinstead.ClientState.handleState(VideoSocketState)replaced withhandleStreamState(StreamConnectionState).StreamVideoClient's connection-state routing now goes end-to-end through core — closing the shim left by the parent PR.ConnectionStateMapperfinalized: bijectiveStreamConnectionState → ConnectionStateconversion with full unit-test coverage.ClientState.handleEvent: the redundant_connection.value = Connectedassignment in theConnectedEventbranch is removed.StreamClientdrives connection state end-to-end now.Consumer sweep.
A repo-wide grep for the removed variants outside legacy paths returned zero hits after fixes. All internal consumers were rewritten to the new shape — no deferred cleanups elsewhere in the SDK. Three test files needed one- to two-line adjustments (
ClientAndAuthTest,RtcSessionTest,AndroidDeviceTest).External integrators who read
ConnectionState.ReconnectingorConnectionState.Failed(error)in their apps will need to migrate per the table above.Testing
stream-video-android-core:testDebugUnitTestsuite green in ~2m30s. Includes newClientStateTestand rewrittenClientStateConnectionMappingTest.@Ignorecount unchanged at 21.spotlessCheckgreen.apiCheckgreen afterapiDumpregen.Manual verification pending before merge:
GuestStreamTokenProviderpath works end-to-end.adb logcatclean ofFATAL,ClassCastException,UnsatisfiedLinkError, and noise-cancellation errors during the smoke.BCV .api diff
The diff below is intentional and limited to
ConnectionState-family symbols. No unrelated public symbols changed.