Skip to content

Add coordinator v2 adapters bridging to stream-android-core#1737

Open
aleksandar-apostolov wants to merge 3 commits into
develop-v2from
gsd/phase-2-01-adapters
Open

Add coordinator v2 adapters bridging to stream-android-core#1737
aleksandar-apostolov wants to merge 3 commits into
develop-v2from
gsd/phase-2-01-adapters

Conversation

@aleksandar-apostolov

@aleksandar-apostolov aleksandar-apostolov commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Goal

Closes AND-1281

First step of the coordinator socket migration to stream-android-core's StreamClient. This PR only adds the bridging code — the actual swap happens in follow-up PRs. Nothing changes at runtime after this merges; the adapters aren't wired in yet.

Merge order: this PR → wire StreamClient into StreamVideoClient (#1738) → rewrite ConnectionState (#1739).

Implementation

Four new internal adapter classes under stream-video-android-core/socket/coordinator/v2/:

File Purpose
VideoEventSerialization.kt Reuses our existing MoshiVideoParser to plug video events into core's event pipeline
IntegrationStreamTokenProvider.kt Wraps the integration's TokenProvider so core can consume it
GuestStreamTokenProvider.kt Handles guest-user auth by calling the existing createGuest REST endpoint on first token load
ConnectionStateMapper.kt Placeholder — the final StreamConnectionState → ConnectionState mapping lands in a follow-up PR

All four classes are internal. No public API changes.

Also includes four unit tests for the adapters. They fail until the wiring PR lands — that's intentional, they pin the expected behavior contracts.

Guest auth simplification: the existing WritableUserRepository interface is defined inline in GuestStreamTokenProvider for now. A follow-up PR swaps it for the concrete UserRepository once that becomes available on develop-v2.

Testing

  • Full project compiles cleanly.
  • stream-video-android-core:testDebugUnitTest passes.
  • BCV apiCheck shows zero public API diff — the new classes are all internal.
  • spotlessCheck green.

- VideoEventSerialization wraps MoshiVideoParser as StreamEventSerialization<VideoEvent>
- IntegrationStreamTokenProvider adapts video TokenProvider to core StreamTokenProvider
- GuestStreamTokenProvider mints a guest JWT via createGuest and adopts server identity
- ConnectionStateMapper publishes StreamConnectionState -> ConnectionState extension
  (placeholder mapping — a later plan reshapes ConnectionState to mirror core 1:1)
- VideoEventSerializationTest round-trips four VideoEvent subclasses through
  MoshiVideoParser plus a malformed-input negative case
- IntegrationStreamTokenProviderTest asserts delegation and userId being ignored
- GuestStreamTokenProviderTest verifies createGuest single-call and user adoption
- ClientStateConnectionMappingTest is table-driven over StreamConnectionState
  variants; each expected value carries a TODO(02-03) handoff marker
@aleksandar-apostolov aleksandar-apostolov added the pr:new-feature Adds new functionality label Jul 1, 2026
@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

PR checklist ✅

All required conditions are satisfied:

  • Title length is OK (or ignored by label).
  • At least one pr: label exists.
  • Sections ### Goal, ### Implementation, and ### Testing are filled, or the PR is bot-authored.
  • An issue is linked (Linear ticket or GitHub issue), or the PR is bot-authored.

🎉 Great job! This PR is ready for review.

@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

SDK Size Comparison 📏

SDK Before After Difference Status
stream-video-android-core 12.05 MB 12.35 MB 0.30 MB 🟡
stream-video-android-ui-xml 5.68 MB 5.73 MB 0.05 MB 🟢
stream-video-android-ui-compose 6.28 MB 5.86 MB -0.43 MB 🚀

@coderabbitai

coderabbitai Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 40767b9c-09ee-45d4-9c82-a8aede740c71

📥 Commits

Reviewing files that changed from the base of the PR and between a1c66bd and 625bc87.

📒 Files selected for processing (8)
  • stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/socket/coordinator/v2/ConnectionStateMapper.kt
  • stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/socket/coordinator/v2/GuestStreamTokenProvider.kt
  • stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/socket/coordinator/v2/IntegrationStreamTokenProvider.kt
  • stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/socket/coordinator/v2/VideoEventSerialization.kt
  • stream-video-android-core/src/test/kotlin/io/getstream/video/android/core/ClientStateConnectionMappingTest.kt
  • stream-video-android-core/src/test/kotlin/io/getstream/video/android/core/socket/coordinator/v2/GuestStreamTokenProviderTest.kt
  • stream-video-android-core/src/test/kotlin/io/getstream/video/android/core/socket/coordinator/v2/IntegrationStreamTokenProviderTest.kt
  • stream-video-android-core/src/test/kotlin/io/getstream/video/android/core/socket/coordinator/v2/VideoEventSerializationTest.kt
👮 Files not reviewed due to content moderation or server errors (8)
  • stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/socket/coordinator/v2/VideoEventSerialization.kt
  • stream-video-android-core/src/test/kotlin/io/getstream/video/android/core/socket/coordinator/v2/GuestStreamTokenProviderTest.kt
  • stream-video-android-core/src/test/kotlin/io/getstream/video/android/core/socket/coordinator/v2/IntegrationStreamTokenProviderTest.kt
  • stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/socket/coordinator/v2/ConnectionStateMapper.kt
  • stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/socket/coordinator/v2/GuestStreamTokenProvider.kt
  • stream-video-android-core/src/test/kotlin/io/getstream/video/android/core/ClientStateConnectionMappingTest.kt
  • stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/socket/coordinator/v2/IntegrationStreamTokenProvider.kt
  • stream-video-android-core/src/test/kotlin/io/getstream/video/android/core/socket/coordinator/v2/VideoEventSerializationTest.kt

Warning

Walkthrough skipped

File diffs could not be summarized.

✨ 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 gsd/phase-2-01-adapters

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.

Picks up the lenient WS date parsing fix (stream-core-android#71,
AND-1295) - core's internal Moshi now accepts the RFC3339 date strings
the video coordinator sends in connection.ok, unblocking the
coordinator handshake on-device.
@sonarqubecloud

sonarqubecloud Bot commented Jul 7, 2026

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr:new-feature Adds new functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant