Skip to content

Migrate the message updated and deleted events to the generated event models - #6789

Merged
gpunto merged 2 commits into
developfrom
migrate/message-events
Oct 8, 2026
Merged

gpunto merged 2 commits into
developfrom
migrate/message-events

Conversation

@gpunto

@gpunto gpunto commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Goal

Parse the message.updated and message.deleted events with the generated event models.

Part of AND-1291

Implementation

  • Vendor the generated MessageUpdatedEvent and MessageDeletedEvent, with the MessageUpdate and MessageChangeSet they carry, and delete the hand-written DTOs.
  • The adapters require the cid, plus the user on message.updated, which the domain events need. The channel type and id come from the cid.
  • hard_delete and message_id are nullable in MessageDeletedEvent, and message_id in MessageUpdatedEvent: backends before v239.47.0 replay these events on /sync without them, and the spec marks them required. A missing hard_delete maps to false, as before; the mapper never reads message_id. The model comments say when to drop the patches.
  • CustomAdapterCoverageTest only checks custom fields that hold custom data: MessageChangeSet.custom is a flag saying the custom data changed.

Testing

GeneratedMessageEventParsingTest covers both events from the socket and from /sync, a replayed update without message_id, a replayed deletion without message_id and hard_delete, and rejects an event missing a required field. The mapping tests cover every field, including the replayed shape.

On a device: updated a message with custom data, partially updated and pinned it, and soft deleted, hard deleted and deleted a message for me. Every domain field was set, custom data round-tripped, and /sync parsed the replayed deletions.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Improved handling of message-deleted and message-updated events across live connections and replay, including events where some optional fields are absent.
    • Preserved accurate event timing when processing message changes.
    • Events missing information required for processing are now rejected rather than mapped with incomplete data.

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

github-actions Bot commented Oct 7, 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 Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

SDK Size Comparison 📏

SDK Before After Difference Status
stream-chat-android-client 6.21 MB 6.22 MB 0.01 MB 🟢
stream-chat-android-ui-components 11.52 MB 11.53 MB 0.00 MB 🟢
stream-chat-android-compose 13.19 MB 13.20 MB 0.00 MB 🟢

@gpunto
gpunto marked this pull request as ready for review October 7, 2026 15:03
@gpunto
gpunto requested a review from a team as a code owner October 7, 2026 15:03
@gpunto
gpunto enabled auto-merge October 7, 2026 15:47

@andremion andremion left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One inline comment about /sync on older backends.

@coderabbitai

coderabbitai Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 3534c6a3-8634-4547-b01c-e4cd50b83656
📥 Commits

Reviewing files that changed from the base of the PR and between 8c18209 and 0676937.

📒 Files selected for processing (12)
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/mapping/EventMapping.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/model/dto/EventDtos.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/client/parser2/adapters/EventAdapter.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/MessageChangeSet.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/MessageDeletedEvent.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/MessageUpdate.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/MessageUpdatedEvent.kt
  • stream-chat-android-client/src/test/java/io/getstream/chat/android/client/EventChatJsonProvider.kt
  • stream-chat-android-client/src/test/java/io/getstream/chat/android/client/api2/mapping/EventMappingTestArguments.kt
  • stream-chat-android-client/src/test/java/io/getstream/chat/android/client/parser/EventArguments.kt
  • stream-chat-android-client/src/test/java/io/getstream/chat/android/client/parser2/CustomAdapterCoverageTest.kt
  • stream-chat-android-client/src/test/java/io/getstream/chat/android/client/parser2/GeneratedMessageEventParsingTest.kt
💤 Files with no reviewable changes (1)
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/model/dto/EventDtos.kt

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.


Walkthrough

Message-deleted and message-updated events now parse through generated network models and map to domain events. The changes add model definitions, update parser adapters and event dispatch, and revise fixtures and tests for socket and sync parsing.

Changes

Message Event Parsing

Layer / File(s) Summary
Message event models
stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/MessageChangeSet.kt, .../MessageDeletedEvent.kt, .../MessageUpdate.kt, .../MessageUpdatedEvent.kt, .../client/api2/model/dto/EventDtos.kt
Added generated event and update models with Moshi field mappings. Removed the legacy deleted and updated event DTOs.
Parser adapters and domain mapping
stream-chat-android-client/src/main/java/io/getstream/chat/android/client/parser2/adapters/EventAdapter.kt, .../client/api2/mapping/EventMapping.kt
Adapters parse generated models and require cid for both event types, plus user for message-updated events. Domain mapping derives channel identifiers from cid; nullable deleted-event flags default to false.
Message event fixtures and validation
stream-chat-android-client/src/test/java/io/getstream/chat/android/client/EventChatJsonProvider.kt, .../client/api2/mapping/EventMappingTestArguments.kt, .../client/parser/EventArguments.kt, .../client/parser2/*
Updated fixtures and mapping expectations for generated events. Added parsing tests for timestamps, sync replay, defaults, and missing required fields. Refined custom-property coverage matching to require a Map type.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Refactor

Suggested reviewers: velikovpetar

Merge Risk: ⚪ Minimal · up to 06769

No actionable merge blocker is identified; complete the normal test checks before merging.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 24 functions across 11 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly and concisely describes the main change: migrating message updated and deleted events to generated event models.
Description check ✅ Passed The description includes the goal, implementation details, issue reference, and comprehensive testing information. UI sections and checklist details are omitted, but they are not critical for this non…
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

A rabbit checks each event’s trail,
New fields arrive in JSON mail.
The timestamps keep their tiny ticks,
Replay tests check the default tricks.
The parser hops through models neat,
Then maps the event on nimble feet.

Comment @coderabbitai help to get the list of available commands.

@sonarqubecloud

sonarqubecloud Bot commented Oct 8, 2026

Copy link
Copy Markdown

@andremion andremion left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@gpunto
gpunto added this pull request to the merge queue Oct 8, 2026
Merged via the queue into develop with commit a1da03f Oct 8, 2026
21 checks passed
@gpunto
gpunto deleted the migrate/message-events branch October 8, 2026 11:34
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.

2 participants