Skip to content

Migrate CompletableResponse to generated Response#6543

Merged
gpunto merged 2 commits into
developfrom
migrate/completable-response
Jul 6, 2026
Merged

Migrate CompletableResponse to generated Response#6543
gpunto merged 2 commits into
developfrom
migrate/completable-response

Conversation

@gpunto

@gpunto gpunto commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Goal

Replace the hand-written CompletableResponse DTO with the generated Response model. First slice of the incremental OpenAPI model migration: generated models keep their generated package io.getstream.chat.android.network.models as internal classes inside the client module (no separate module, mirroring the generator output so a future regen is drag-and-drop), one endpoint/model at a time.

Part of AND-1291

Implementation

  • Add the generated Response under io.getstream.chat.android.network.models (internal).
  • Swap every CompletableResponse usage to Response across the api2 endpoint interfaces and RetrofitCdnApi, and delete the two hand-written CompletableResponse classes.
  • Update the affected tests and drop the stale CompletableResponse baseline-profile entries.

Testing

  • Project-wide spotlessApply, apiDump (no API drift), lint, detekt, and testDebugUnitTest all pass.
  • Verified on device: markAllRead (backed by RetrofitCall<Response>) parses the real wire response and completes successfully.

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

github-actions Bot commented Jul 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.

@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

SDK Size Comparison 📏

SDK Before After Difference Status
stream-chat-android-client 5.93 MB 5.93 MB 0.00 MB 🟢
stream-chat-android-ui-components 11.20 MB 11.20 MB 0.00 MB 🟢
stream-chat-android-compose 12.66 MB 12.66 MB 0.00 MB 🟢

@gpunto gpunto force-pushed the migrate/completable-response branch from 140861e to 81a52cf Compare July 3, 2026 15:28
@sonarqubecloud

sonarqubecloud Bot commented Jul 6, 2026

Copy link
Copy Markdown

@gpunto gpunto marked this pull request as ready for review July 6, 2026 07:42
@gpunto gpunto requested a review from a team as a code owner July 6, 2026 07:42
@coderabbitai

coderabbitai Bot commented Jul 6, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

The internal CompletableResponse Moshi data class is removed (including its baseline profile entries) and replaced by a new Response data class under io.getstream.chat.android.network.models. All Retrofit endpoint interfaces (CDN, Channel, Device, Message, Moderation, Polls, Reminders, UserGroup) that returned RetrofitCall<CompletableResponse> now return RetrofitCall<Response>, with corresponding test and fixture updates.

Changes

CompletableResponse to Response migration

Layer / File(s) Summary
New Response model
stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/Response.kt, stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api/models/CompletableResponse.kt, stream-chat-android-client/src/main/baseline-prof.txt
CompletableResponse is deleted and a new Response data class with @Json(name="duration") annotation is introduced in a new package; baseline profile entries for the old class are removed.
CDN API delete endpoints
RetrofitCdnApi.kt
deleteImage (channel and upload scoped) and deleteFile now return RetrofitCall<Response>.
Channel API endpoints
ChannelApi.kt
markAllRead, hideChannel, markRead, markUnread, showChannel, stopWatching, markDelivered now return RetrofitCall<Response>.
Device, Message, Moderation, Polls, Reminders, UserGroup APIs
DeviceApi.kt, MessageApi.kt, ModerationApi.kt, PollsApi.kt, RemindersApi.kt, UserGroupApi.kt
Endpoints such as addDevices, deleteDevice, deleteDraftMessage, unmuteUser, muteChannel, unmuteChannel, banUser, unbanUser, deletePoll, deletePollOption, deleteReminder, deleteUserGroup now return RetrofitCall<Response>.
Test and fixture updates
MoshiChatApiTest.kt, MoshiChatApiTestArguments.kt, StreamFileUploaderTest.kt
Test method signatures, argument builders, and mocked responses updated to construct and use Response instead of CompletableResponse.

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

Possibly related PRs

  • GetStream/stream-chat-android#6493: Adds the UserGroupApi.deleteUserGroup endpoint whose return type is directly affected by this PR's CompletableResponse-to-Response refactor.

Suggested labels: pr:improvement

Suggested reviewers: andremion

Poem

A hop, a skip, a model's gone away,
CompletableResponse bids farewell today.
In its place, Response shines anew,
Duration tagged with Moshi's @Json too. 🐰
Endpoints all aligned, tests refreshed and bright—
This bunny thumps its paw in pure delight!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
Title check ✅ Passed The title accurately summarizes the main change: replacing CompletableResponse with the generated Response model.
Description check ✅ Passed The description covers the required Goal, Implementation, and Testing sections and gives concrete migration details.
✨ 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 migrate/completable-response

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 (1)
stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/Response.kt (1)

17-22: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Undocumented @file:Suppress block.

As per coding guidelines, **/*.kt should "avoid suppressions unless documented." This blanket suppression has no comment explaining why each rule is disabled. Since this is generated model code (first of many in the migration stack), consider adding a brief comment noting it's codegen output to preempt future guideline flags on subsequent generated files.

🤖 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/Response.kt`
around lines 17 - 22, The `@file`:Suppress block in Response.kt is undocumented
and should be explained to satisfy the “avoid suppressions unless documented”
guideline. Add a brief comment near the file-level suppression in Response to
note that this is generated model code from the migration stack, so the
suppressions are intentional and expected for codegen output.

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/Response.kt`:
- Around line 17-22: The `@file`:Suppress block in Response.kt is undocumented and
should be explained to satisfy the “avoid suppressions unless documented”
guideline. Add a brief comment near the file-level suppression in Response to
note that this is generated model code from the migration stack, so the
suppressions are intentional and expected for codegen output.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 8da47426-1b35-4ab2-b432-37eb0eb651bb

📥 Commits

Reviewing files that changed from the base of the PR and between 2fdde71 and 332f09a.

📒 Files selected for processing (14)
  • stream-chat-android-client/src/main/baseline-prof.txt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api/RetrofitCdnApi.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api/models/CompletableResponse.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/endpoint/ChannelApi.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/endpoint/DeviceApi.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/endpoint/ModerationApi.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/endpoint/PollsApi.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/endpoint/RemindersApi.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/endpoint/UserGroupApi.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/Response.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/MoshiChatApiTestArguments.kt
  • stream-chat-android-client/src/test/java/io/getstream/chat/android/client/uploader/StreamFileUploaderTest.kt
💤 Files with no reviewable changes (2)
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api/models/CompletableResponse.kt
  • stream-chat-android-client/src/main/baseline-prof.txt

@gpunto gpunto merged commit a6d598f into develop Jul 6, 2026
21 checks passed
@gpunto gpunto deleted the migrate/completable-response branch July 6, 2026 12:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr:internal Internal changes / housekeeping

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants