Skip to content

Migrate the message moderation and reaction groups to the generated models - #6685

Draft
gpunto wants to merge 1 commit into
developfrom
migrate/message-nested-leaves
Draft

Migrate the message moderation and reaction groups to the generated models#6685
gpunto wants to merge 1 commit into
developfrom
migrate/message-nested-leaves

Conversation

@gpunto

@gpunto gpunto commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Goal

Adopt the generated ModerationV2Response and ReactionGroupResponse for the last two nested leaves of
DownstreamMessageDto.

Part of AND-1291

Implementation

  • Point DownstreamMessageDto.moderation and reaction_groups at the generated models and follow the
    field renames in both mappers. DownstreamModerationDto and DownstreamReactionGroupDto go away;
    ReactionDtos.kt becomes DownstreamReactionDto.kt, since that is all it still holds.
  • Vendor ModerationV2Response, ReactionGroupResponse and ReactionGroupUserResponse, which the former
    references as a field type.

Notes

Neither swap changes strictness. ReactionGroupResponse requires the same four fields the hand-written DTO
declared non-null, and ModerationV2Response requires action and original_text and leaves the rest
nullable, exactly as before.

Neither mapping can diverge, because of how the backend tags the struct. action and original_text are
plain tags and always serialized, and every other field is omitempty on a non-pointer type, so it is
either a real value or absent and can never arrive as JSON null. That is the only input that would tell
the old "nullable, no default" fields apart from the generated "nullable with default" ones, so an absent
key produces the same Moderation through both: .orEmpty() for the harm lists, null for the two strings,
?: false for platform_circumvented.

ReactionGroupResponse.latest_reactions_by has no home on the domain and is read then dropped, like the
config fields in
AND-1498.
blocklists_matched is also parsed and dropped, but it is a different problem: the backend deprecates the
singular blocklist_matched that Moderation.blocklistMatched maps, in favour of exactly that plural.
Tracked as
AND-1502.

Testing

  • ModerationParsingTest and ReactionGroupParsingTest retargeted to the generated models, and
    DomainMappingTest covers both mappings.
  • Mutation sweep over both mappers: ReactionGroupResponse.toDomain has all five assignments caught, and
    every field of ModerationV2Response.toDomain is compile-guaranteed, since Moderation defaults none of
    them.
  • Device-probed reaction_groups on the wire across the four shapes that carry it: getMessage,
    queryChannels, reaction.new and reaction.deleted. Every ReactionGroup field asserted, with two
    reaction types at different scores so count and sumScore cannot be confused.
  • moderation is covered by unit tests only. The server sets it only when moderation blocks a message, so
    reaching 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.

@gpunto gpunto added the pr:internal Internal changes / housekeeping label Sep 8, 2026
@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

PR checklist ✅

All required conditions are satisfied:

  • Title length is OK (or ignored by label).
  • At least one pr: label exists.
  • Sections ### Goal, ### Implementation, and ### Testing are filled, or the PR is bot-authored.
  • An issue is linked (Linear ticket or GitHub issue), or the PR is bot-authored.

🎉 Great job! This PR is ready for review.

@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

SDK Size Comparison 📏

SDK Before After Difference Status
stream-chat-android-client 6.10 MB 6.11 MB 0.00 MB 🟢
stream-chat-android-ui-components 11.41 MB 11.41 MB 0.00 MB 🟢
stream-chat-android-compose 13.09 MB 13.09 MB 0.00 MB 🟢

@sonarqubecloud

sonarqubecloud Bot commented Sep 8, 2026

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr:internal Internal changes / housekeeping

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant