Skip to content

Migrate the invite and channel notification events to the generated event models - #6763

Merged
gpunto merged 1 commit into
developfrom
migrate/invite-notification-events
Oct 1, 2026
Merged

gpunto merged 1 commit into
developfrom
migrate/invite-notification-events

Conversation

@gpunto

@gpunto gpunto commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Goal

Parse the invite and channel notification events with the generated event models.

Part of AND-1291

Implementation

  • Vendor the generated NotificationInvitedEvent, NotificationInviteAcceptedEvent, NotificationInviteRejectedEvent, NotificationChannelDeletedEvent and NotificationChannelTruncatedEvent, and delete the hand-written DTOs.
  • The adapters require the fields the spec marks optional but each domain event needs (the cid, and the user on the invite events), and reject an event missing one.
  • DomainMappingTest now checks every field of the generated channel mapper these events share.

Testing

GeneratedNotificationEventParsingTest covers each event, a nanosecond created_at, and a missing required field. Before this, channels recorded from each of the five events were mapped through the hand-written and the generated channel model and produced the same Channel.

On a device: invited the current user to a channel, accepted and rejected invites, and deleted and truncated a channel. Every event arrived with the right channel, member and user.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Improvements
    • Improved handling of channel invitation, invitation accepted/rejected, channel deleted, and channel truncated notifications.
    • These events now provide channel and user details where available, preserve event timestamps, and report unread counts consistently. Required information is validated when notifications are received.

@gpunto gpunto added the pr:internal Internal changes / housekeeping label Oct 1, 2026
@gpunto
gpunto force-pushed the migrate/invite-notification-events branch from a55ad25 to dc2dbc2 Compare October 1, 2026 08:10
@github-actions

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

Copy link
Copy Markdown
Contributor

SDK Size Comparison 📏

SDK Before After Difference Status
stream-chat-android-client 6.16 MB 6.17 MB 0.01 MB 🟢
stream-chat-android-ui-components 11.47 MB 11.48 MB 0.01 MB 🟢
stream-chat-android-compose 13.14 MB 13.14 MB 0.00 MB 🟢

@gpunto
gpunto marked this pull request as ready for review October 1, 2026 08:18
@gpunto
gpunto requested a review from a team as a code owner October 1, 2026 08: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: 8dc879b9-1269-4427-93fc-63df1c3df1ff

📥 Commits

Reviewing files that changed from the base of the PR and between d675c90 and dc2dbc2.

📒 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/NotificationChannelDeletedEvent.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/NotificationChannelTruncatedEvent.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/NotificationInviteAcceptedEvent.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/NotificationInviteRejectedEvent.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/NotificationInvitedEvent.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/DomainMappingTest.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/GeneratedNotificationEventParsingTest.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; 2 remain after this review.


Walkthrough

Five notification event types now use generated websocket models for parsing and domain mapping instead of handwritten event DTOs. The changes also add parsing validation and a separate test for mapping ChannelResponse to Channel.

Changes

Generated notification events

Layer / File(s) Summary
Notification event models and parsing
stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/Notification*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, 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/parser/EventArguments.kt, stream-chat-android-client/src/test/java/io/getstream/chat/android/client/parser2/GeneratedNotificationEventParsingTest.kt
Adds generated models and parser adapters for five notification event types. Parsing tests check event timestamps and required fields.
Generated event domain mapping
stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/mapping/EventMapping.kt, stream-chat-android-client/src/test/java/io/getstream/chat/android/client/api2/mapping/EventMappingTestArguments.kt
Dispatches the generated notification models to domain mappings. The mappings require cid, invite mappings require user, and channel deletion and truncation default nullable unread counts to 0.

Channel response mapping test

Layer / File(s) Summary
ChannelResponse mapping test
stream-chat-android-client/src/test/java/io/getstream/chat/android/client/api2/mapping/DomainMappingTest.kt
Adds a test for ChannelResponse field mapping, capability conversion, and promoted name and image values being excluded from extraData.

Priority: ⬇️ Low

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

Change: Refactor

Sequence Diagram(s)

sequenceDiagram
  participant EventAdapter
  participant GeneratedEventDto
  participant EventMapping
  participant DomainEvent
  EventAdapter->>GeneratedEventDto: Wrap parsed notification model
  GeneratedEventDto->>EventMapping: Dispatch generated event
  EventMapping->>DomainEvent: Map notification fields
Loading

Suggested reviewers: velikovpetar

Merge Risk: ⚪ Minimal · up to dc2db

This change moves invite and channel notification parsing to generated models. Tests cover each event, required fields and timestamp handling. No concrete merge-blocking risk was found in the supplied context.

Security Architecture Review

Security architecture risk: 🔵 Low · up to dc2db

The migration preserves existing identity checks and notification handling, with no demonstrated increase in privileges or exposure. Some previously accepted payload shapes are now rejected, leaving bounded compatibility and recovery uncertainty.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The demonstrated affected scope is client-side notification processing and channel state reachable through the existing socket session. The inspected path does not establish new service privileges or cross-tenant access; server-side authorization remains outside the available evidence.

Trust Boundaries and Controls

  • observed — Required-field checks remain ahead of domain dispatch, and channel type and ID now share cid as their source. This avoids independently trusting duplicate channel identifiers, but does not authenticate payload identities or verify consistency with the nested channel object.

Resilience and Maintainability Implications

  • inferred — Stricter decoding contains malformed events before state mutation, but rejection also prevents the corresponding local update or cleanup. Recovery after CANT_PARSE_EVENT was not established; the inspected code supports error conversion, not a guarantee of retry or state refresh.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 29.73% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 37 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 invite and channel notification events to generated event models.
Description check ✅ Passed The description includes the goal, implementation details, testing coverage, device validation, and issue reference. The UI, GIF, and checklist sections are omitted, but they are not critical for this…
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 the scene.
Required fields are snug and tight,
Unread counts settle right.
The mapping burrow welcomes each event,
Then bounds away, content.

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

@gpunto
gpunto force-pushed the migrate/invite-notification-events branch from dc2dbc2 to dabc7a7 Compare October 1, 2026 10:50
@gpunto
gpunto enabled auto-merge October 1, 2026 11:10
@gpunto
gpunto added this pull request to the merge queue Oct 1, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 1, 2026
@gpunto
gpunto added this pull request to the merge queue Oct 1, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Oct 1, 2026
@gpunto
gpunto enabled auto-merge October 1, 2026 13:00
@gpunto
gpunto force-pushed the migrate/invite-notification-events branch from dabc7a7 to 36e2be4 Compare October 1, 2026 13:08
@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 4b786bd Oct 1, 2026
19 checks passed
@gpunto
gpunto deleted the migrate/invite-notification-events branch October 1, 2026 14:30
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