Migrate the member and typing events to the generated event models by gpunto · Pull Request #6761 · GetStream/stream-chat-android · GitHub
Skip to content

Migrate the member and typing events to the generated event models - #6761

Merged
gpunto merged 2 commits into
developfrom
migrate/member-typing-events
Oct 1, 2026
Merged

gpunto merged 2 commits into
developfrom
migrate/member-typing-events

Conversation

@gpunto

@gpunto gpunto commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Goal

Parse the member and typing events with the generated event models.

Part of AND-1291

Implementation

  • Vendor the generated MemberAddedEvent, MemberRemovedEvent, MemberUpdatedEvent, TypingStartEvent and TypingStopEvent, and delete the hand-written DTOs.
  • The adapters require cid and user, which the spec marks optional but every domain event needs, and reject an event missing either.

Testing

GeneratedMemberTypingEventParsingTest covers each event, a nanosecond created_at, and a missing required field.

On a device: added, updated and removed a member, and started and stopped typing in a channel and in a thread. Every event arrived with the right cid, user and member (including its custom data), and the typing events sent over REST matched the ones received on the socket.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Improvements
    • Updated handling of member-added, member-removed, member-updated, typing-start, and typing-stop events to support the current event format.
    • Event data now includes channel and user details needed to map these events into chat events.
    • Invalid events missing required information are rejected during parsing.

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

Copy link
Copy Markdown
Contributor

@github-actions

github-actions Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

SDK Size Comparison 📏

SDK Before After Difference Status
stream-chat-android-client 6.15 MB 6.16 MB 0.01 MB 🟢
stream-chat-android-ui-components 11.46 MB 11.46 MB 0.00 MB 🟢
stream-chat-android-compose 13.13 MB 13.14 MB 0.01 MB 🟢

@gpunto
gpunto force-pushed the migrate/member-typing-events branch from 30bfedf to b0ef20f Compare September 30, 2026 15:51
@gpunto
gpunto marked this pull request as ready for review October 1, 2026 07:19
@gpunto
gpunto requested a review from a team as a code owner October 1, 2026 07:19
@coderabbitai

coderabbitai Bot commented Oct 1, 2026

Copy link
Copy Markdown

Review in Change Stack →

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 configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: c0cfd8de-2a85-478c-8831-d5b917bebc8f

📥 Commits

Reviewing files that changed from the base of the PR and between de6a7d8 and b0ef20f.

📒 Files selected for processing (13)
  • 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/MemberAddedEvent.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/MemberRemovedEvent.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/MemberUpdatedEvent.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/TypingStartEvent.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/TypingStopEvent.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/extensions/internal/MemberExtensionsTests.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/GeneratedMemberTypingEventParsingTest.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

Five member and typing events now use generated network models for parsing and domain conversion. The mappings require CID and user, derive channel type and ID from CID, and preserve event timestamps and applicable member or parent-ID data.

Changes

Member and Typing Event Handling

Layer / File(s) Summary
Generated event models and parsing
stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/*Event.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/client/api2/model/dto/EventDtos.kt
Added generated network models for the five events. Their adapters now use generated event parsing, and the corresponding DTO declarations were removed.
Generated event domain mapping
stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/mapping/EventMapping.kt
Added generated-event dispatch and domain mappings. The mappings require CID and user, derive channel type and ID from CID, and map timestamps, members, and typing parent IDs.
Event fixtures and validation
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/extensions/internal/MemberExtensionsTests.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/GeneratedMemberTypingEventParsingTest.kt
Updated event fixtures and mapping expectations for generated models. Added parsing tests for event types, timestamps, and missing required fields.

Priority: ⬇️ Low

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

Change: Refactor

Suggested reviewers: velikovpetar

Merge Risk: ⚪ Minimal · up to b0ef2

The migration appears mergeable after normal checks. Member events now require channel data; compatibility with backend payloads that omit it remains unverified, rather than a demonstrated production regression.

Security Architecture Review

Security architecture risk: 🔵 Low · up to b0ef2

Member events can now be rejected for missing channel data that was previously unnecessary, potentially delaying membership removal and local cleanup. Required identity checks remain in place, and no authorization bypass has been established. Production payload compatibility and recovery still need confirmation.

Retained concerns

  • Medium · architecture · inferred: Requiring an unused channel object narrows the member-event reader contract. If a producer sends the previously accepted shape without channel, the event is rejected before membership removal, read-state cleanup, or repository eviction can run. This can strand local membership and cleanup state; production occurrence and security consequences remain unverified.
Security review details

Security Blast Radius

  • inferred — The supported exposure is client-local: affected member events can fail to update membership, reader state, and cleanup for their channel. Evidence does not establish attacker control over authenticated event delivery, cross-tenant reachability, or continued server access after membership removal.

Trust Boundaries and Controls

  • observed — Incoming event type selects the generated adapter. The adapter explicitly rejects missing cid or user, and domain conversion independently requires both. Those fields were already required by the previous DTOs; the migration does not introduce their validation as a new security guarantee.

Resilience and Maintainability Implications

  • observed — NotificationRemovedFromChannelEvent provides another reconciliation path: active state replaces its member list, and offline processing removes current-user membership and invokes eviction. This is counterevidence to permanent drift, but does not establish that this notification or a refresh always follows a rejected member event.

Hardening Proposals

  • proposed — Preserve the previously accepted member-event shape at the shared reader boundary unless a verified producer contract guarantees the complete channel object. Retain cid and user validation, and define authoritative reconciliation for rejected membership events rather than relying on an unspecified later notification.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 29.41% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 34 functions across 12 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: migrating member and typing events to generated event models.
Description check ✅ Passed The description includes the goal, implementation details, issue reference, and testing results. It omits the UI Changes, contributor checklist, reviewer checklist, and GIF sections, but these section…
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.
  • 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

Autopilot is currently an internal CodeRabbit preview.


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 the event stream,
Five new models hop into view.
CID and user must be present,
Timestamps pass the parser through.
Members and parent IDs arrive,
The mapping burrow’s lined anew.

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

@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.

Looks good. One question inline about channel on the member events.

@gpunto
gpunto enabled auto-merge October 1, 2026 08:02

@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, thanks for the fix.

@sonarqubecloud

sonarqubecloud Bot commented Oct 1, 2026

Copy link
Copy Markdown

@gpunto
gpunto added this pull request to the merge queue Oct 1, 2026
Merged via the queue into develop with commit fd9f289 Oct 1, 2026
19 checks passed
@gpunto
gpunto deleted the migrate/member-typing-events branch October 1, 2026 10:20
@stream-public-bot stream-public-bot added the released Included in a release label Oct 8, 2026
@stream-public-bot

Copy link
Copy Markdown
Contributor

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

Labels

pr:internal Internal changes / housekeeping released Included in a release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants