Migrate the message responses to the generated responses by gpunto · Pull Request #6775 · GetStream/stream-chat-android · GitHub
Skip to content

Migrate the message responses to the generated responses - #6775

Merged
gpunto merged 3 commits into
developfrom
migrate/message-envelope-responses
Oct 7, 2026
Merged

gpunto merged 3 commits into
developfrom
migrate/message-envelope-responses

Conversation

@gpunto

@gpunto gpunto commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Goal

Parse the message responses (send, get, update, partial update, delete, action, delete reaction and translate) with the generated response models.

Part of AND-1291

Implementation

  • The eight message endpoints return their generated responses, and the hand-written MessageResponse envelope is deleted.
  • getMessage maps the generated MessageWithChannelResponse, taking the message's channel info from the channel it carries. It gets its own custom data adapter, so extraData is kept.
  • The partial update and action responses declare message optional. A response without it is a Result.Failure.
  • getPendingMessage returns empty metadata. The backend only sends pending message metadata to server-side callers, so it is always empty for the SDK.
  • MessageWithChannelResponse comes off the patched models list: it is MessageResponse plus channel, and its null collections are covered by a test.

Testing

GetMessageResponseParityTest runs every shared message fixture, with a nested channel, through the generated model: it matches the generated MessageResponse field by field and maps to the same Message as the hand-written DTO, including the channel info and custom data. MoshiChatApiTest covers each endpoint, including a partial update or action without a message.

On a device: sent, read, updated, partially updated and deleted messages (soft, hard and for me), deleted a reaction, translated, and shuffled and sent a giphy. Every response kept its custom data, and getMessage carried the channel.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Improved handling of message responses across sending, retrieving, updating, deleting, translating, and reacting to messages.
    • Message actions and partial updates now report an error when a response omits the message, rather than returning incomplete data.
    • Message retrieval now preserves channel details and custom data, and pending messages are mapped directly from their response.

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

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

@github-actions

github-actions Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

SDK Size Comparison 📏

SDK Before After Difference Status
stream-chat-android-client 6.19 MB 6.20 MB 0.01 MB 🟢
stream-chat-android-ui-components 11.50 MB 11.51 MB 0.01 MB 🟢
stream-chat-android-compose 13.16 MB 13.18 MB 0.02 MB 🟢

@gpunto
gpunto force-pushed the migrate/message-envelope-responses branch 2 times, most recently from 079c934 to 5b96903 Compare October 6, 2026 18:57
@gpunto
gpunto marked this pull request as ready for review October 7, 2026 07:31
@gpunto
gpunto requested a review from a team as a code owner October 7, 2026 07:31
@coderabbitai

coderabbitai Bot commented Oct 7, 2026

Copy link
Copy Markdown

Review in 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: a1df1d29-342b-426e-82eb-333338c46c3f
📥 Commits

Reviewing files that changed from the base of the PR and between f196da7 and 5b96903.

📒 Files selected for processing (21)
  • 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/mapping/DomainMapping.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/MessageWithChannelResponseAdapter.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/ChannelContextResponse.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/DeleteMessageResponse.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/DeleteReactionResponse.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/GetMessageResponse.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/MessageActionResponse.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/MessageWithChannelResponse.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/SendMessageResponse.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/TranslateMessageResponse.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/UpdateMessagePartialResponse.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/UpdateMessageResponse.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/api2/mapping/DomainMappingTest.kt
  • stream-chat-android-client/src/test/java/io/getstream/chat/android/client/parser2/GetMessageResponseParityTest.kt
  • stream-chat-android-client/src/test/java/io/getstream/chat/android/client/parser2/ParityAssertions.kt
  • stream-chat-android-client/src/test/java/io/getstream/chat/android/client/parser2/SearchResponseParityTest.kt
💤 Files with no reviewable changes (1)
  • stream-chat-android-client/src/test/java/io/getstream/chat/android/client/api2/mapping/DomainMappingTest.kt

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 1 remain after this review.


Walkthrough

Message endpoints now use endpoint-specific response models. The parser and domain mapping support message-with-channel responses, while API mapping handles nullable messages and pending-message responses. Tests cover endpoint result types and parser mapping parity.

Changes

Message response parsing and mapping

Layer / File(s) Summary
Endpoint response contracts
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/network/models/*.kt
Message operations now return endpoint-specific response types. New Moshi models represent those responses and their message and channel data.
Message-with-channel parsing and mapping
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/MessageWithChannelResponseAdapter.kt, stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/mapping/DomainMapping.kt
The parser registers an adapter that reads custom fields from message-with-channel responses. Domain mapping uses channel context and converts get-message responses to pending messages with empty metadata.
API response result handling
stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/MoshiChatApi.kt
Partial updates and message actions map response messages through a shared mapper. Missing messages return the MISSING_MESSAGE error. Pending-message retrieval uses the pending-message mapping.
Response mapping validation
stream-chat-android-client/src/test/java/io/getstream/chat/android/client/api2/*, 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/*
API tests use endpoint-specific response models. Parser parity tests check message fields, channel and custom-data mapping, collection defaults, and required response fields. Search parity tests compare fields with a shared assertion helper.

Priority: ⬇️ Low

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

Change: Refactor

Suggested reviewers: velikovpetar

Merge Risk: ⚪ Minimal · up to 5b969

No blocking regression is established. The response shape for pending messages remains unconfirmed, so confidence in merge readiness is limited.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 14.46% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 83 functions across 20 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 describes the main change: migrating message endpoints to generated response models.
Description check ✅ Passed The description covers the goal, implementation, and testing, including endpoint behavior and reported device testing. UI-specific sections and checklist items are not necessary for this 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
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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 checks each message type,
Then hops through fields parsed just right.
The channel joins the mapped response,
Empty metadata finds its place.
Missing messages raise their sign,
The tests keep every field in line.

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. One small nit inline.

@gpunto
gpunto enabled auto-merge October 7, 2026 09:55
@gpunto
gpunto added this pull request to the merge queue Oct 7, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Oct 7, 2026
@gpunto
gpunto force-pushed the migrate/message-envelope-responses branch from 207b951 to eaa8071 Compare October 7, 2026 11:22
@sonarqubecloud

sonarqubecloud Bot commented Oct 7, 2026

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
11.3% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

@gpunto
gpunto merged commit 0ac6649 into develop Oct 7, 2026
18 of 19 checks passed
@gpunto
gpunto deleted the migrate/message-envelope-responses branch October 7, 2026 12:13
@stream-public-bot stream-public-bot added the released Included in a release label Oct 8, 2026
@stream-public-bot

Copy link
Copy Markdown
Contributor

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