Sitelet https://github.com/GetStream/stream-chat-android/pull/6736
Skip to content

Migrate the channel watchers and channel and thread creators to the generated UserResponse - #6736

Merged
gpunto merged 2 commits into
developfrom
migrate/channel-users
Sep 28, 2026
Merged

gpunto merged 2 commits into
developfrom
migrate/channel-users

Conversation

@gpunto

@gpunto gpunto commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Goal

Parse the channel watchers and the channel and thread created_by with the generated UserResponse, and
keep two user keys in extraData that the generated user models had started dropping.

Part of AND-1291

Implementation

  • Point watchers (channel response and channel), the channel created_by and the thread and thread-info
    created_by at the generated UserResponse. The existing UserResponse mapper handles them.
  • Keep deleted_at and revoke_tokens_issued_before in User.extraData for every UserResponse, as
    the event user models already did. The generated model declares both, so they stopped reaching
    extraData on every path that moved to it, while the hand-written user DTO left them there.
  • Remove the unused queryDraftMessages(offset, limit) API call and its request model. Nothing called it;
    drafts are queried through queryDrafts.

Notes

The mute response's own_user stays on the hand-written DTO. The E2E mock server builds it without
invisible and the unread counters, which the generated OwnUserResponse requires.

Testing

UserResponseParityTest parses the same user JSON through the hand-written DTO and the generated model and
requires the same User, with a user carrying every optional field and custom data.

Device-probed a channel and a thread created with a custom field set on the user: the channel
created_by, the watcher list and the thread created_by each matched the same user read through
getMessage field by field, custom field included.

Summary by CodeRabbit

  • Bug Fixes
    • Improved handling of user information in channel and thread data, including custom fields, for more consistent results.
    • Draft messages can still be queried through the existing draft query options; the separate draft-message query option has been removed.

@gpunto gpunto added the pr:internal Internal changes / housekeeping label Sep 25, 2026
@github-actions

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

Copy link
Copy Markdown
Contributor

SDK Size Comparison 📏

SDK Before After Difference Status
stream-chat-android-client 6.09 MB 6.09 MB 0.00 MB 🟢
stream-chat-android-ui-components 11.39 MB 11.39 MB 0.00 MB 🟢
stream-chat-android-compose 13.07 MB 13.07 MB 0.00 MB 🟢

@gpunto
gpunto force-pushed the migrate/channel-users branch from 9928394 to 8552279 Compare September 25, 2026 13:06
@sonarqubecloud

Copy link
Copy Markdown

@gpunto
gpunto marked this pull request as ready for review September 25, 2026 13:49
@gpunto
gpunto requested a review from a team as a code owner September 25, 2026 13:49
@gpunto
gpunto enabled auto-merge September 25, 2026 13:51
@coderabbitai

coderabbitai Bot commented Sep 25, 2026

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 4ecc9e7a-f0f7-434c-b2f8-c53edfc37fd2

📥 Commits

Reviewing files that changed from the base of the PR and between 48ceaf3 and dbd3ef8.

📒 Files selected for processing (17)
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api/ChatApi.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/MoshiChatApi.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/endpoint/MessageApi.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/model/dto/ChannelDtos.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/model/dto/ThreadDtos.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/model/requests/QueryDraftMessagesRequest.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/model/response/ChannelResponse.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/client/parser2/adapters/EventUserAdapters.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/client/parser2/adapters/UserResponseAdapter.kt
  • stream-chat-android-client/src/test/java/io/getstream/chat/android/client/EventChatJsonProvider.kt
  • stream-chat-android-client/src/test/java/io/getstream/chat/android/client/Mother.kt
  • stream-chat-android-client/src/test/java/io/getstream/chat/android/client/api2/MoshiChatApiTest.kt
  • stream-chat-android-client/src/test/java/io/getstream/chat/android/client/api2/mapping/DomainMappingTest.kt
  • stream-chat-android-client/src/test/java/io/getstream/chat/android/client/parser/EventArguments.kt
  • stream-chat-android-client/src/test/java/io/getstream/chat/android/client/parser2/UserResponseParityTest.kt
  • stream-chat-android-client/src/test/java/io/getstream/chat/android/client/parser2/testdata/ChannelDtoTestData.kt
  • stream-chat-android-client/src/test/java/io/getstream/chat/android/client/parser2/testdata/ThreadDtoTestData.kt
💤 Files with no reviewable changes (5)
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/model/requests/QueryDraftMessagesRequest.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/MoshiChatApi.kt
  • stream-chat-android-client/src/test/java/io/getstream/chat/android/client/api2/MoshiChatApiTest.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api/ChatApi.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/endpoint/MessageApi.kt

Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review.


Walkthrough

The client removes the offset-and-limit draft query API. Channel and thread DTO user fields now use UserResponse, with corresponding parser adapter and test updates.

Changes

Draft Query API

Layer / File(s) Summary
Remove offset-and-limit draft query
stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api/ChatApi.kt, stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/MoshiChatApi.kt, stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/endpoint/MessageApi.kt, stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/model/requests/QueryDraftMessagesRequest.kt, stream-chat-android-client/src/test/java/io/getstream/chat/android/client/api2/MoshiChatApiTest.kt
The queryDraftMessages declarations, endpoint request type, implementation, and test are removed. The separate queryDrafts method remains.

UserResponse DTO and Parsing

Layer / File(s) Summary
Use UserResponse in channel and thread DTOs
stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/model/dto/ChannelDtos.kt, stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/model/dto/ThreadDtos.kt, stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/model/response/ChannelResponse.kt, stream-chat-android-client/src/test/java/io/getstream/chat/android/client/Mother.kt, stream-chat-android-client/src/test/java/io/getstream/chat/android/client/api2/mapping/DomainMappingTest.kt, stream-chat-android-client/src/test/java/io/getstream/chat/android/client/EventChatJsonProvider.kt, stream-chat-android-client/src/test/java/io/getstream/chat/android/client/parser/EventArguments.kt, stream-chat-android-client/src/test/java/io/getstream/chat/android/client/parser2/testdata/ChannelDtoTestData.kt, stream-chat-android-client/src/test/java/io/getstream/chat/android/client/parser2/testdata/ThreadDtoTestData.kt
Channel watcher and creator fields and thread creator fields now use UserResponse. Matching test fixtures and mapping inputs use the same type.
Retain generated user fields in extra data
stream-chat-android-client/src/main/java/io/getstream/chat/android/client/parser2/adapters/EventUserAdapters.kt, stream-chat-android-client/src/main/java/io/getstream/chat/android/client/parser2/adapters/UserResponseAdapter.kt, stream-chat-android-client/src/test/java/io/getstream/chat/android/client/parser2/UserResponseParityTest.kt
User response adapters use the generated user extra-data key set. A parity test compares fields produced by the hand-written and generated mappings.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Refactor

Suggested reviewers: velikovpetar

Merge Risk: ⚪ Minimal · up to dbd3e

No actionable issue is established from the reviewed changes; merge after normal checks.

Security Architecture Review

Security architecture risk: 🔵 Low · up to dbd3e

The changed user parsing preserves the existing domain data path, and no new security boundary or weakened control was established. Compatibility with less-complete server responses remains uncertain.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The assessed exposure is client-side decoding of channel and thread responses into domain users. The supplied impact map identifies one changed client system and no confirmed cross-system dependency change.

Trust Boundaries and Controls

  • inferred — The changed fields pass through the existing response parser and User conversion. The examined paths establish data preservation, not a newly introduced authorization or token-enforcement path.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 10 functions across 12 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the primary change: migrating channel watchers and channel and thread creators to the generated UserResponse.
Description check ✅ Passed The description explains the goal, implementation, related cleanup, compatibility note, and testing. The omitted UI and checklist sections are not critical for this non-UI change.
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.
  • 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

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

I’m a rabbit with a parsing plan,
I nibble fields where DTOs began.
Draft queries hop away,
UserResponse fields stay.
My tests compare each mapping span.

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

@gpunto
gpunto added this pull request to the merge queue Sep 28, 2026
Merged via the queue into develop with commit d8b0950 Sep 28, 2026
21 checks passed
@gpunto
gpunto deleted the migrate/channel-users branch September 28, 2026 11:21
@stream-public-bot stream-public-bot added the released Included in a release label Sep 30, 2026
@stream-public-bot

Copy link
Copy Markdown
Contributor

🚀 Available in v7.13.0

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

Labels

pr:internal Internal changes / housekeeping released Included in a release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants