Migrate the message poll to the generated PollResponseData model - #6680
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 (5)
Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review. WalkthroughThe message DTO now uses ChangesPoll mapping
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to Message poll parsing now uses the generated response model and its updated timestamp while preserving domain poll mapping and custom data behavior. The supplied coverage and current implementation alignment indicate no remaining merge-blocking risk. Suggested reviewers: Poem
🚥 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. Comment |
andremion
left a comment
There was a problem hiding this comment.
Looks good. One note inline on the nullability change and two optional ones.
|
|
🚀 Available in v7.11.0 |



Goal
Parse the poll embedded in a message with the generated
PollResponseData.Part of AND-1291
Implementation
DownstreamMessageDto.pollatPollResponseData, the model the poll endpoints already use, and follow the field rename inlastUpdateTime().PollResponseData.toDomain()was already in place, so no mapping code is added.UserResponserequirescreated_at,updated_atandlanguage, and the fixture carried onlyid,role,bannedandonline.DownstreamPollDtostays for the poll events, which still parse it.Notes
The message carries
Poll *commonpayloads.PollResponseData, the same struct the poll endpoints return, andcreated_at,updated_atandlanguageare non-omitemptyonUserResponseCommonFields. So the wire always sends them for a nested poll user and the old fixture was the unrealistic part.The two paths swap strictness on three keys.
voting_visibilitywasString?and defaulted toPUBLIC; it is required onPollResponseData, so a poll that omits it now throws on the DTO path whilePollAdapterstill defaults it.optionsandown_votesgo the other way, defaulting to empty on the DTO path whilePollAdapterstill throws. None can fire in practice: all three are plain non-omitemptytags on the Go response struct.A custom key with a null value no longer reaches
Poll.extraData. The DTO path used to keep it and the direct path already dropped it, so this aligns them.Testing
getMessageandqueryChannels. Both custom values round-tripped, config was preserved, and every nested user (creator, votes, own votes, answers) carried the three required fields.message.poll, and droppingpoll.updatedAtfromlastUpdateTime, each fail 6 tests.MessageParsingTestgains a case for poll and option custom data inlined on the message, which also pins the null-valued key being dropped on both paths.Summary by CodeRabbit