Build the outgoing message body with the generated MessageRequest model - #6678
Conversation
PR checklist ✅All required conditions are satisfied:
🎉 Great job! This PR is ready for review. |
SDK Size Comparison 📏
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (11)
💤 Files with no reviewable changes (3)
Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review. WalkthroughThe client replaces ChangesMessage request model migration
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to The change moves four existing message operations to the generated request model while preserving custom-data serialization and removing unused fields. Tests and device probes cover the updated payloads, so no actionable merge-blocking risk remains beyond normal checks and review. Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Description checkExplanation The description includes the goal, implementation details, testing results, issue references, and relevant behavioral changes. The UI Changes section is not applicable to this SDK model and request-body change, although the contributor and reviewer checklist items remain unchecked.
✨ 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. Comment |
andremion
left a comment
There was a problem hiding this comment.
Looks good. Two coverage notes and a couple of small things inline.
…tore the docs lost with UpstreamMessageDto
|
|
🚀 Available in v7.11.0 |



Goal
Build the outgoing message body with the generated
MessageRequestand delete the hand-writtenUpstreamMessageDto.Part of AND-1291
Implementation
messagefield ofSendMessageRequest,UpdateMessageRequestandTruncateChannelRequestatMessageRequest, and move the four call sites inMoshiChatApi(send, update, draft create, truncate) ontotoMessageRequest(). That mapper, theMessageRequestcustom-flattening adapter and theTypeadapter were already in place, serving the system-message paths.DraftMessage.toMessageRequest(), replacingDraftMessage.toDto(). The draft endpoint takes the same body:CreateDraftRequest.Messageis the samepayload.MessageRequeststruct as sending a message.UpstreamMessageDto,Message.toDto(),UpstreamMessageDtoAdapterand its registration.MessageDtoAdapters.ktbecomesDownstreamMessageDtoAdapter.kt, since one declaration remains.toJsonassertions that pin the serialised body.The request no longer sends
args,cid,command,html,pinned_by,shadowedorthread_participants. None are read on this path:htmlisignore_if_client_side,shadowedisreadonly,cidandpinned_byareutils.JSONPlaceholderin the block the struct comments as legacy fields kept only so the API does not break, and the other three are absent from the struct.Notes
Two fixture defaults let assertions pass that should not have.
randomMessagedefaultsextraDatato empty, so the existingrequest.custom shouldBeEqualTo message.extraDataassertion held even with the mapper droppingcustomentirely;randomDraftMessagedefaultssilenttorandomBoolean(), so a mapper hardcoding it would have failed intermittently. Both are now pinned in the tests that depend on them.Testing
poll_idreached the server exactly once at the root, which is worth checking because it is now a declared field while the SDK still passes it throughextraData.customfrom either mapper, and hardcoding the draft'ssilent, each fail a test.Summary by CodeRabbit
Bug Fixes
Tests