Skip to content

Migrate user request bodies (partialUpdateUser, getGuestUser, updateUsers) to generated models - #6613

Merged
gpunto merged 3 commits into
developfrom
migrate/user-requests
Aug 4, 2026
Merged

Migrate user request bodies (partialUpdateUser, getGuestUser, updateUsers) to generated models#6613
gpunto merged 3 commits into
developfrom
migrate/user-requests

Conversation

@gpunto

@gpunto gpunto commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Goal

Migrate the partialUpdateUser, getGuestUser, and updateUsers request bodies to the generated UpdateUsersPartialRequest/UpdateUserPartialRequest, CreateGuestRequest, UpdateUsersRequest, and UserRequest network models.

Part of AND-1291

Implementation

  • partialUpdateUser -> UpdateUsersPartialRequest(UpdateUserPartialRequest(id/set/unset)).
  • getGuestUser -> CreateGuestRequest(UserRequest(id, name)); the generated UserRequest flattens custom to the wire root via a new UserRequestAdapter.
  • updateUsers -> UpdateUsersRequest(Map<String, UserRequest>) via a new User.toUserRequest() mapper.
  • Removed hand-written PartialUpdateUsersRequest, GuestUserRequest, PartialUpdateUserDto, and UpdateUsersRequest.

Note on updateUsers: the generated UserRequest is leaner than the old UpstreamUserDto — it omits role/teams/teams_role/banned/devices. That's intentional and safe: the backend marks role/teams/teams_role as ignore_if_client_side (stripped for client-token requests) and doesn't bind banned/devices on this endpoint, so the old DTO was shipping fields the server already discarded. Verified on the wire — an updateUsers upsert returns 200 and role/teams are preserved server-side even though the client no longer sends them.

Testing

  • New UserRequestsAdapterTest + testdata lock the wire shape (incl. UserRequest custom flatten and privacy_settings).
  • MoshiChatApiTest mapper assertions updated.
  • spotlessApply, apiDump (no public-API change), detekt, and the full client testDebugUnitTest suite pass.
  • Device-probed against the live backend: partialUpdateUser (set + unset paths) and updateUsers (custom sentinel round-trips; role/teams preserved) confirmed.

Summary by CodeRabbit

  • Improvements

    • Improved guest-user creation and user update requests for more consistent handling of profiles, custom data, and privacy settings.
    • Added support for partial and bulk user updates, including setting and removing user fields.
    • Improved request processing for typing indicators, read receipts, and delivery receipts.
    • Custom user data is now correctly included in outgoing requests.
  • Reliability

    • Added coverage for guest creation, partial updates, bulk updates, custom data, and privacy settings.

@gpunto
gpunto requested a review from a team as a code owner August 3, 2026 12:49
@gpunto gpunto added the pr:internal Internal changes / housekeeping label Aug 3, 2026
@github-actions

github-actions Bot commented Aug 3, 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.

@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

User update and guest creation flows now use network request models. User mapping includes privacy settings and custom data. A Moshi adapter flattens custom fields during serialization. Tests cover the updated request payloads.

Changes

User request migration

Layer / File(s) Summary
Request contracts and domain mapping
stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/*, stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/mapping/DtoMapping.kt, stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/model/dto/UserDtos.kt
Added network request and privacy response models. Added User.toUserRequest() and privacy settings mapping. Removed PartialUpdateUserDto.
User request serialization
stream-chat-android-client/src/main/java/io/getstream/chat/android/client/parser2/*, stream-chat-android-client/src/test/java/io/getstream/chat/android/client/parser2/*
Registered UserRequestAdapter. The adapter flattens custom data into JSON. Added serialization tests and fixtures.
API endpoint integration
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/*, stream-chat-android-client/src/test/java/io/getstream/chat/android/client/api2/MoshiChatApiTest.kt
Updated user and guest API calls to use the new request models. Updated endpoint signatures and request assertions.

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

Possibly related PRs

Suggested labels: released

Suggested reviewers: andremion

Poem

A rabbit maps each user field,
While custom carrots spread wide.
Moshi packs the guest request,
New DTOs hop inside.
Tests shine bright on every payload.

🚥 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%. 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 migration of the three user request bodies to generated models.
Description check ✅ Passed The description covers the goal, implementation, testing, issue link, intentional field changes, and backend verification; omitted UI sections are not applicable.
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.
✨ 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-requests

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/UserRequest.kt (1)

17-22: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Document or remove the file-level suppressions.

The suppression block disables four independent diagnostics without stating which generated construct requires each one. Keep only required suppressions and document each reason.

  • stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/UserRequest.kt#L17-L22: remove unused rules or document each required rule.
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/UpdateUserPartialRequest.kt#L17-L22: remove unused rules or document each required rule.
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/PrivacySettingsResponse.kt#L17-L22: remove unused rules or document each required rule.
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/ReadReceiptsResponse.kt#L17-L22: remove unused rules or document each required rule.
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/TypingIndicatorsResponse.kt#L17-L22: remove unused rules or document each required rule.
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/DeliveryReceiptsResponse.kt#L17-L22: remove unused rules or document each required rule.

As per coding guidelines, avoid suppressions unless documented.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/UserRequest.kt`
around lines 17 - 22, Review the file-level suppression blocks in
UserRequest.kt, UpdateUserPartialRequest.kt, PrivacySettingsResponse.kt,
ReadReceiptsResponse.kt, TypingIndicatorsResponse.kt, and
DeliveryReceiptsResponse.kt at lines 17-22: remove any unused rules and add
concise documentation explaining each suppression that remains, including why
the generated model requires it.

Source: Coding guidelines

stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/UpdateUsersPartialRequest.kt (1)

17-22: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Document or remove the file-level suppressions.

The shared suppression block hides lint findings for each generated request model. Document each required suppression in the generator template. Remove suppression IDs that are not required.

  • stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/UpdateUsersPartialRequest.kt#L17-L22: document or remove each suppression.
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/UpdateUsersRequest.kt#L17-L22: document or remove each suppression.
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/CreateGuestRequest.kt#L17-L22: document or remove each suppression.

As per coding guidelines, “avoid suppressions unless documented.”

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/UpdateUsersPartialRequest.kt`
around lines 17 - 22, Update the generator template producing the file-level
suppression block for
stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/UpdateUsersPartialRequest.kt
lines 17-22, UpdateUsersRequest.kt lines 17-22, and CreateGuestRequest.kt lines
17-22: document every suppression that remains necessary and remove any unused
suppression IDs, including ArrayInDataClass, EnumEntryName,
RemoveRedundantQualifierName, and UnusedImport. Ensure the generated models
consistently emit only justified, documented suppressions.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In
`@stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/UpdateUsersPartialRequest.kt`:
- Around line 17-22: Update the generator template producing the file-level
suppression block for
stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/UpdateUsersPartialRequest.kt
lines 17-22, UpdateUsersRequest.kt lines 17-22, and CreateGuestRequest.kt lines
17-22: document every suppression that remains necessary and remove any unused
suppression IDs, including ArrayInDataClass, EnumEntryName,
RemoveRedundantQualifierName, and UnusedImport. Ensure the generated models
consistently emit only justified, documented suppressions.

In
`@stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/UserRequest.kt`:
- Around line 17-22: Review the file-level suppression blocks in UserRequest.kt,
UpdateUserPartialRequest.kt, PrivacySettingsResponse.kt,
ReadReceiptsResponse.kt, TypingIndicatorsResponse.kt, and
DeliveryReceiptsResponse.kt at lines 17-22: remove any unused rules and add
concise documentation explaining each suppression that remains, including why
the generated model requires it.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 19b03979-5648-45b1-ae4b-e4d48ef09a71

📥 Commits

Reviewing files that changed from the base of the PR and between a7de8c8 and 838e6ce.

📒 Files selected for processing (19)
  • 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/GuestApi.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/endpoint/UserApi.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/mapping/DtoMapping.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/model/dto/UserDtos.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/client/parser2/MoshiChatParser.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/client/parser2/adapters/UserRequestAdapter.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/CreateGuestRequest.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/DeliveryReceiptsResponse.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/PrivacySettingsResponse.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/ReadReceiptsResponse.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/TypingIndicatorsResponse.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/UpdateUserPartialRequest.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/UpdateUsersPartialRequest.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/UpdateUsersRequest.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/UserRequest.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/parser2/UserRequestsAdapterTest.kt
  • stream-chat-android-client/src/test/java/io/getstream/chat/android/client/parser2/testdata/UserRequestsTestData.kt
💤 Files with no reviewable changes (1)
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/model/dto/UserDtos.kt

@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

SDK Size Comparison 📏

SDK Before After Difference Status
stream-chat-android-client 5.95 MB 5.95 MB 0.00 MB 🟢
stream-chat-android-ui-components 11.24 MB 11.24 MB 0.00 MB 🟢
stream-chat-android-compose 12.72 MB 12.73 MB 0.01 MB 🟢

@gpunto
gpunto force-pushed the migrate/user-requests branch from 838e6ce to d720cf3 Compare August 4, 2026 09:01
@sonarqubecloud

sonarqubecloud Bot commented Aug 4, 2026

Copy link
Copy Markdown

@gpunto
gpunto enabled auto-merge August 4, 2026 09:27
@gpunto
gpunto added this pull request to the merge queue Aug 4, 2026
Merged via the queue into develop with commit b496d76 Aug 4, 2026
19 checks passed
@gpunto
gpunto deleted the migrate/user-requests branch August 4, 2026 12:14
@stream-public-bot stream-public-bot added the released Included in a release label Aug 13, 2026
@stream-public-bot

Copy link
Copy Markdown
Contributor

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