Migrate the message moderation and reaction groups to the generated models - #6685
Draft
gpunto wants to merge 1 commit into
Draft
Migrate the message moderation and reaction groups to the generated models#6685gpunto wants to merge 1 commit into
gpunto wants to merge 1 commit into
Conversation
Contributor
PR checklist ✅All required conditions are satisfied:
🎉 Great job! This PR is ready for review. |
Contributor
SDK Size Comparison 📏
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Goal
Adopt the generated
ModerationV2ResponseandReactionGroupResponsefor the last two nested leaves ofDownstreamMessageDto.Part of AND-1291
Implementation
DownstreamMessageDto.moderationandreaction_groupsat the generated models and follow thefield renames in both mappers.
DownstreamModerationDtoandDownstreamReactionGroupDtogo away;ReactionDtos.ktbecomesDownstreamReactionDto.kt, since that is all it still holds.ModerationV2Response,ReactionGroupResponseandReactionGroupUserResponse, which the formerreferences as a field type.
Notes
Neither swap changes strictness.
ReactionGroupResponserequires the same four fields the hand-written DTOdeclared non-null, and
ModerationV2Responserequiresactionandoriginal_textand leaves the restnullable, exactly as before.
Neither mapping can diverge, because of how the backend tags the struct.
actionandoriginal_textareplain tags and always serialized, and every other field is
omitemptyon a non-pointer type, so it iseither a real value or absent and can never arrive as JSON
null. That is the only input that would tellthe old "nullable, no default" fields apart from the generated "nullable with default" ones, so an absent
key produces the same
Moderationthrough both:.orEmpty()for the harm lists, null for the two strings,?: falseforplatform_circumvented.ReactionGroupResponse.latest_reactions_byhas no home on the domain and is read then dropped, like theconfig fields in
AND-1498.
blocklists_matchedis also parsed and dropped, but it is a different problem: the backend deprecates thesingular
blocklist_matchedthatModeration.blocklistMatchedmaps, in favour of exactly that plural.Tracked as
AND-1502.
Testing
ModerationParsingTestandReactionGroupParsingTestretargeted to the generated models, andDomainMappingTestcovers both mappings.ReactionGroupResponse.toDomainhas all five assignments caught, andevery field of
ModerationV2Response.toDomainis compile-guaranteed, sinceModerationdefaults none ofthem.
reaction_groupson the wire across the four shapes that carry it:getMessage,queryChannels,reaction.newandreaction.deleted. EveryReactionGroupfield asserted, with tworeaction types at different scores so
countandsumScorecannot be confused.moderationis covered by unit tests only. The server sets it only when moderation blocks a message, soreaching it needs a channel type whose automod behaviour blocks or bounces rather than flags, and that is
server-side app config the demo app does not have.