Migrate the message write request bodies to the generated models - #6716
Conversation
PR checklist ✅All required conditions are satisfied:
🎉 Great job! This PR is ready for review. |
SDK Size Comparison 📏
|
|
|
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 configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (9)
💤 Files with no reviewable changes (2)
Included review availability: Your plan provides up to 4 included reviews per hour; 2 remain after this review. WalkthroughThe 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. ChangesRequest model migration
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~15 minutes Change: Refactor Suggested reviewers: Merge Risk: ⚪ Minimal · up to 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)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 2📝 Generate docstrings 💡
🛠️ Fix failing CI checks 💡
🧪 Generate unit tests (beta)
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. I’m a rabbit with models in line Comment |
|
🚀 Available in v7.12.0 |



Goal
Send the message write request bodies with the generated models, retiring the hand-written
SendMessageRequest,UpdateMessageRequestandTruncateChannelRequest.Part of AND-1291
Implementation
sendMessage,createDraftMessage,updateMessageandtruncateChannelat the generatedwrappers and delete the hand-written ones. The message body itself was already
MessageRequest, so thisis only the envelopes.
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.
createDraftMessagebuilds the request without the skip flags. They were non-null with afalsedefaultbefore, so the body always carried them; the generated model declares them nullable, so they are now
omitted.
payload.SendMessageRequestdeclares both as*booland the handler reads them throughutil.ValueOf, which returns the zero value for nil, so absent andfalseare the same request.Truncate now sends
"member_ids": [], because the generated model defaults that field to an empty listrather than null. The handler branches on
IsMemberSpecific(), which islen(MemberIDs) > 0, so an emptyarray 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_membersandkeep_channel_hiddenon send, andhard_delete,skip_pushandtruncated_aton truncate. The domain has no source for any of them, so they stay absent rather than beingfilled with invented defaults.
Testing
Device-probed all four endpoints. The request bodies confirm both shape changes: send and update still
carry
skip_pushandskip_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-upquery 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
Bug Fixes