Skip to content

Migrate the message write request bodies to the generated models - #6716

Merged
gpunto merged 1 commit into
developfrom
migrate/message-write-requests
Sep 22, 2026
Merged

gpunto merged 1 commit into
developfrom
migrate/message-write-requests

Conversation

@gpunto

@gpunto gpunto commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

Goal

Send the message write request bodies with the generated models, retiring the hand-written
SendMessageRequest, UpdateMessageRequest and TruncateChannelRequest.

Part of AND-1291

Implementation

  • Point sendMessage, createDraftMessage, updateMessage and truncateChannel at the generated
    wrappers and delete the hand-written ones. The message body itself was already MessageRequest, so this
    is only the envelopes.
  • Add serialization tests for all three. They had none, and object equality in the api tests does not
    check what reaches the wire, which is the whole of what this changes.

Notes

Two fields the wire sees differently, both verified against the backend rather than the spec.

createDraftMessage builds the request without the skip flags. They were non-null with a false default
before, so the body always carried them; the generated model declares them nullable, so they are now
omitted. payload.SendMessageRequest declares both as *bool and the handler reads them through
util.ValueOf, which returns the zero value for nil, so absent and false are the same request.

Truncate now sends "member_ids": [], because the generated model defaults that field to an empty list
rather than null. The handler branches on IsMemberSpecific(), which is len(MemberIDs) > 0, so an empty
array and an absent key both take the whole-channel path.

The generated models declare fields the hand-written ones did not: include_channel_context,
include_mentioned_members and keep_channel_hidden on send, and hard_delete, skip_push and
truncated_at on truncate. The domain has no source for any of them, so they stay absent rather than being
filled with invented defaults.

Testing

Device-probed all four endpoints. The request bodies confirm both shape changes: send and update still
carry skip_push and skip_enrich_url, the draft body carries neither, and truncate carries
"member_ids": []. All four returned success, the draft came back with its text and id, and a follow-up
query confirmed the truncate actually emptied the channel rather than no-opping. Custom data round-tripped
through the send and update bodies via a sentinel in extraData.

Summary by CodeRabbit

  • Improvements

    • Updated message sending and editing request handling to support optional delivery, URL enrichment, channel context, mentioned-member, and channel-visibility settings.
    • Improved channel truncation request support, including message details, member IDs, timestamps, and push-notification preferences.
    • Standardized request serialization to ensure settings are transmitted using the expected API field names.
  • Bug Fixes

    • Corrected request payload handling for message and channel operations, improving compatibility with server-side behavior.

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

github-actions Bot commented Sep 21, 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

Copy link
Copy Markdown
Contributor

SDK Size Comparison 📏

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

@sonarqubecloud

Copy link
Copy Markdown

@gpunto
gpunto marked this pull request as ready for review September 22, 2026 10:16
@gpunto
gpunto requested a review from a team as a code owner September 22, 2026 10:16
@gpunto gpunto added pr:internal Internal changes / housekeeping and removed pr:internal Internal changes / housekeeping labels Sep 22, 2026
@gpunto
gpunto enabled auto-merge September 22, 2026 10:16
@coderabbitai

coderabbitai Bot commented Sep 22, 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: 3cc4c060-3346-49c3-a681-24621fd377c3

📥 Commits

Reviewing files that changed from the base of the PR and between 297ba0b and 457b190.

📒 Files selected for processing (9)
  • 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/ChannelApi.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/SendMessageRequest.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/model/requests/UpdateMessageRequest.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/SendMessageRequest.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/TruncateChannelRequest.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/UpdateMessageRequest.kt
  • stream-chat-android-client/src/test/java/io/getstream/chat/android/client/parser2/MessageWriteRequestAdapterTest.kt
💤 Files with no reviewable changes (2)
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/model/requests/SendMessageRequest.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/model/requests/UpdateMessageRequest.kt

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


Walkthrough

The request models for sending, updating, and truncating messages moved to the network models package. Their JSON fields now use explicit camelCase properties and nullable options. API wiring and Moshi serialization tests were updated.

Changes

Request model migration

Layer / File(s) Summary
Request model contracts
stream-chat-android-client/src/main/java/io/getstream/chat/android/{client/api2/model/requests,network/models}/*
Added network request models for send, update, and truncate operations. The models define explicit JSON names, nullable flags, and truncate defaults. The previous send and update request files were removed.
API request wiring
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/{ChannelApi,MessageApi}.kt
Updated imports to use network request models. Updated send and update request construction to use camelCase property names.
Serialization validation
stream-chat-android-client/src/test/java/io/getstream/chat/android/client/parser2/MessageWriteRequestAdapterTest.kt
Added Moshi serialization tests for send, update, and truncate requests, including optional flags and default empty member_ids.

Priority: ⬇️ Low

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

Change: Refactor

Suggested reviewers: velikovpetar

Merge Risk: ⚪ Minimal · up to 457b1

This changes message write payloads to generated network models while preserving existing wire fields and adding serialization coverage; no actionable merge-blocking risk is currently identified.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 42.86% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 7 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 write request bodies to generated models.
Description check ✅ Passed The description includes a clear goal, implementation details, behavioral differences, and thorough testing results. It omits the template's UI, checklist, and GIF sections, but these are non-critical…
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 💡 2
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🛠️ Fix failing CI checks 💡
  • 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 models in line
JSON fields now neatly shine
Send and update hop with care
Truncate brings its IDs there
Tests guard each payload bright

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

@gpunto
gpunto added this pull request to the merge queue Sep 22, 2026
Merged via the queue into develop with commit cf36c97 Sep 22, 2026
20 of 23 checks passed
@gpunto
gpunto deleted the migrate/message-write-requests branch September 22, 2026 13:47
@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