Migrate the thread reply and pinned message responses to the generated MessageResponse - #6733
Conversation
PR checklist ✅All required conditions are satisfied:
🎉 Great job! This PR is ready for review. |
SDK Size Comparison 📏
|
andremion
left a comment
There was a problem hiding this comment.
Looks good. One question inline, not blocking.
|
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 (13)
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review. WalkthroughAPI2 message responses now use network response models. The parser reads these models, and domain mapping converts message, reminder, and shared-location response data into domain objects. Tests cover parsing, mapping, and parity with the existing DTO path. ChangesMessage response integration
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~25 minutes Change: Refactor Suggested reviewers: Merge Risk: ⚪ Minimal · up to The migrated replies and pinned-message paths have no established blocking issue and are ready for normal merge checks. Security Architecture ReviewSecurity architecture risk: 🟡 Moderate · up to Replies and pinned messages now carry visibility metadata into message state where the previous parsing path did not. The change warrants checking whether clients can supply that metadata and how the server validates it; an exploit has not been established. Retained concerns
Security review detailsSecurity Blast Radius
Security Findings and Attack Paths
Trust Boundaries and Controls
Hardening Proposals
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 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. A rabbit checks each message field, Comment |
… on every other message path
|
|
🚀 Available in v7.13.0 |



Goal
Parse the messages returned by the thread replies and pinned messages endpoints with the generated
MessageResponse.Part of AND-1291
Implementation
MessagesResponse.messagesat the generatedMessageResponseand map it with a newMessageResponse.toDomain(), alongside the existingDownstreamMessageDtomapper, which every otherendpoint still uses.
MessageResponseand the models only it needs:DraftResponse,ReminderResponseDataandSharedLocationResponseData, each with its own mapper.MessageResponseAdaptercollects the flattened custom data. Keys the generated model now declares(
mml,poll_id,restricted_visibility,mentioned_group_ids,image_labels,draft) stay inextraDataas well, as they were before.moderation_detailsis not declared on the payload and arrives as custom data, so it is read fromthere into
moderationDetailsand removed fromextraData.mentioned_channel_membersis skipped instead of throwing.Testing
Mutation sweep over the new mappers: zero survivors.
MessageResponseParityTestparses every message fixture through both the hand-written DTO and thegenerated model and requires the same
Message, field by field. Where a fixture was leaner than the wire,it only fills fields the backend always sends.
Device-probed a thread reply with a mention, a custom attachment, a quote, a reaction, a reminder and custom
data, and a pinned parent and a pinned static location. Every field matched
getMessage, which still parsesthe hand-written DTO. The differences were what the endpoints send: neither endpoint sends the message's
channel, and pinned messages come back without
shared_location,thread_participantsorpoll. That lastone is the same on
develop.A second probe put unusual messages in a thread and in the pinned list: a soft-deleted reply, a link
preview, silent and shown-in-channel replies, an image attachment, a quote of a deleted message, a
translation, a giphy, a poll and an expiring pin. Both endpoints parsed them all, and each matched
getMessageapart from the endpoint differences above.The generated model requires some fields the hand-written DTO did not, so a missing one would fail the whole
response. Every required field across the models these responses reach is a plain, always-sent tag on the
backend, including the placeholder user sent for a deleted author, which a new parity fixture covers.
Summary by CodeRabbit