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

Migrate the message mentioned groups to the generated UserGroupResponse - #6705

Merged
gpunto merged 2 commits into
developfrom
migrate/user-groups
Sep 17, 2026
Merged

gpunto merged 2 commits into
developfrom
migrate/user-groups

Conversation

@gpunto

@gpunto gpunto commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Goal

Parse the user groups mentioned on a message with the generated UserGroupResponse, retiring
DownstreamUserGroupDto and DownstreamUserGroupMemberDto.

Part of AND-1291

Implementation

  • Point DownstreamMessageDto.mentioned_groups at the generated model. This was the last main-source
    in-edge on the hand-written pair: the user group endpoints already returned UserGroupResponse through
    their response wrappers, so UserGroupResponse.toDomain() already existed and was already exercised.
  • Delete both hand-written DTOs with their two mappers, and the two mapper tests that duplicated the
    generated model's own.
  • Drop the members block from the mentioned_groups fixture in MessageTestData.kt. Messages hydrate
    groups with commonpayloads.UserGroupResponse, which declares no Members field at all; the endpoints
    use a separate type that embeds it and adds members. The fixture described a payload the backend cannot
    send, and the generated UserGroupMember requires app_pk, so it stopped parsing.

Notes

The element type now matches the end state: the generated MessageResponse declares
mentioned_groups as List<UserGroupResponse>?. The container stays non-null here. thread_participants,
mentioned_groups and mentioned_roles share a documented explicit-null rejection on
DownstreamMessageDto, each with its own test, and loosening one of the three ahead of its siblings would
change null handling for a payload the wire never produces, since the Go tag is
json:"mentioned_groups,omitempty" on a slice. The three flip together when DownstreamMessageDto becomes
MessageResponse.

Three fields go from optional to required: created_at and updated_at on the group, which are plain
non-omitempty tags on the payload struct the wire serializes, so they always arrive.

No mutation sweep: this slice writes no mapper. UserGroupResponse.toDomain() is already on develop, so a
sweep would mutate code this PR does not touch.

Testing

Device-probed every path that carries mentioned_groups: the sendMessage response, the getMessage
re-read, and the message nested in a queryChannel response. All three returned the group with
created_at and updated_at populated and members empty, confirming the slim payload. The write path
still sends mentioned_group_ids and is unchanged by the swap.

Summary by CodeRabbit

  • Bug Fixes

    • Updated mentioned-group message data to use the current user-group response format.
    • Improved handling of group metadata, including creation and update timestamps.
    • Removed obsolete group-member details from mentioned-group message data.
  • Tests

    • Updated parsing, mapping, and test fixtures to reflect the current user-group response structure.

@gpunto gpunto added the pr:internal Internal changes / housekeeping label Sep 16, 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

github-actions Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

SDK Size Comparison 📏

SDK Before After Difference Status
stream-chat-android-client 6.08 MB 6.08 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.06 MB -0.00 MB 🚀

@gpunto
gpunto marked this pull request as ready for review September 16, 2026 11:36
@gpunto
gpunto requested a review from a team as a code owner September 16, 2026 11:36
@coderabbitai

coderabbitai Bot commented Sep 16, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

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: f2f01838-d22e-4ed0-8af7-8564a931eb08

📥 Commits

Reviewing files that changed from the base of the PR and between 929fd8c and 7fb3eeb.

📒 Files selected for processing (7)
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/mapping/DomainMapping.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/model/dto/MessageDtos.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/model/dto/UserGroupDtos.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/parser2/testdata/MessageDtoTestData.kt
  • stream-chat-android-client/src/test/java/io/getstream/chat/android/client/parser2/testdata/MessageTestData.kt
💤 Files with no reviewable changes (3)
  • stream-chat-android-client/src/test/java/io/getstream/chat/android/client/parser2/testdata/MessageTestData.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/model/dto/UserGroupDtos.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/mapping/DomainMapping.kt

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


Walkthrough

The message DTO now represents mentioned groups with UserGroupResponse. The older downstream user-group DTOs, mappers, factories, tests, and fixture fields were removed or updated.

Changes

User group response migration

Layer / File(s) Summary
Response contract and mapper cleanup
stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/model/dto/MessageDtos.kt, stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/mapping/DomainMapping.kt, stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/model/dto/UserGroupDtos.kt
DownstreamMessageDto.mentioned_groups now uses UserGroupResponse. The older user-group DTO classes and their domain mappers were removed.
Test data and mapping coverage
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/parser2/testdata/*
Test factories, mapping tests, and message fixtures now use UserGroupResponse and timestamp fields instead of the removed DTOs and member arrays.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Refactor

Suggested reviewers: velikovpetar

Merge Risk: ⚪ Minimal · up to 7fb3e

The migration is covered by updated parsing and mapping paths, with no demonstrated production compatibility failure; it is mergeable.

🚥 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 6 functions across 4 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 and concisely describes the main change: migrating message mentioned groups to the generated UserGroupResponse model.
Description check ✅ Passed The description includes the goal, implementation details, testing coverage, issue reference, wire-format rationale, and scope notes. The UI, checklist, reviewer checklist, and GIF sections are not co…
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 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch migrate/user-groups

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

A rabbit hops through groups anew
With response fields in tidy view
Old DTOs rest beneath the hay
Tests follow the cleaner way
Mentioned groups now parse true

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

@andremion andremion left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Two small things inline, both optional.

@sonarqubecloud

Copy link
Copy Markdown

@gpunto
gpunto enabled auto-merge September 17, 2026 15:08
@gpunto
gpunto added this pull request to the merge queue Sep 17, 2026
Merged via the queue into develop with commit 2aa561e Sep 17, 2026
19 checks passed
@gpunto
gpunto deleted the migrate/user-groups branch September 17, 2026 15:54
@stream-public-bot stream-public-bot added the released Included in a release label Sep 24, 2026
@stream-public-bot

Copy link
Copy Markdown
Contributor

🚀 Available in v7.12.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