Migrate the AI indicator and added to channel events to the generated event models by gpunto · Pull Request #6794 · GetStream/stream-chat-android · GitHub
Skip to content

Migrate the AI indicator and added to channel events to the generated event models - #6794

Merged
gpunto merged 1 commit into
developfrom
migrate/ai-indicator-added-to-channel-events
Oct 9, 2026
Merged

gpunto merged 1 commit into
developfrom
migrate/ai-indicator-added-to-channel-events

Conversation

@gpunto

@gpunto gpunto commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Goal

Parse the ai_indicator.update, ai_indicator.clear, ai_indicator.stop and notification.added_to_channel events with the generated event models.

Part of AND-1291

Implementation

  • Vendor the generated AIIndicatorUpdateEvent, AIIndicatorClearEvent, AIIndicatorStopEvent and NotificationAddedToChannelEvent as they are, and delete the hand-written DTOs.
  • The adapters require the cid, plus the user on the AI indicator events, which the domain events need. The channel type and id come from the cid.
  • A missing unread count on notification.added_to_channel maps to 0, as before.

Testing

GeneratedAIIndicatorEventParsingTest parses each AI indicator event and rejects one missing a required field. GeneratedNotificationEventParsingTest covers notification.added_to_channel, including zero unread counts. The mapping tests cover every field.

On a device: received the three AI indicator events and notification.added_to_channel over the socket, and parsed notification.added_to_channel replayed by /sync.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Added support for receiving AI indicator updates, clears, and stops, as well as notifications when added to a channel.
  • Bug Fixes
    • Channel notifications now report unread message and channel counts as zero when those counts are missing.
    • Events missing required channel or user details are rejected during parsing.

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

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

@github-actions

github-actions Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

SDK Size Comparison 📏

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

@gpunto
gpunto force-pushed the migrate/ai-indicator-added-to-channel-events branch from dacddad to 1a5dd8b Compare October 8, 2026 15:00
@gpunto
gpunto marked this pull request as ready for review October 8, 2026 15:26
@gpunto
gpunto requested a review from a team as a code owner October 8, 2026 15:26
@gpunto
gpunto enabled auto-merge October 8, 2026 15:26
@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: df3c7c51-ea38-46ba-b13b-bc217b9f0471
📥 Commits

Reviewing files that changed from the base of the PR and between 4e63aa2 and 1a5dd8b.

📒 Files selected for processing (10)
  • 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/AIIndicatorClearEvent.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/AIIndicatorStopEvent.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/AIIndicatorUpdateEvent.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/NotificationAddedToChannelEvent.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/parser2/GeneratedAIIndicatorEventParsingTest.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; 1 remain after this review.


Walkthrough

The event parser now represents notification-added-to-channel and AI indicator update, clear, and stop events with generated WebSocket models. Adapters enforce required fields, and event mapping derives channel identifiers from cid. Mapping and parser tests use generated-event fixtures and verify required fields and notification unread-count defaults.

Changes

Generated event parsing

Layer / File(s) Summary
Event models and parser adapters
stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/AIIndicator*Event.kt, stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/NotificationAddedToChannelEvent.kt, stream-chat-android-client/src/main/java/io/getstream/chat/android/client/parser2/adapters/EventAdapter.kt
Adds WebSocket event models for the four event types. Their parser adapters require cid; the AI indicator adapters also require user.
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/main/java/io/getstream/chat/android/client/api2/model/dto/EventDtos.kt
Dispatches generated event models to domain events. It derives channel identifiers from cid, defaults missing notification unread counts to zero, and removes the corresponding legacy DTO declarations.
Generated-event fixtures and parser tests
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/parser2/Generated*EventParsingTest.kt
Updates mapping fixtures to use generated event models. Parser tests cover event types, required fields, and notification unread-count defaults.

Priority: ⬇️ Low

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

Change: Refactor

Sequence Diagram(s)

sequenceDiagram
  participant EventAdapter
  participant GeneratedEventDto
  participant EventMapping
  participant ChatEvent
  EventAdapter->>GeneratedEventDto: Parse generated WebSocket event
  GeneratedEventDto->>EventMapping: Dispatch event model
  EventMapping->>ChatEvent: Map to domain event
Loading

Suggested reviewers: velikovpetar

Merge Risk: ⚪ Minimal · up to 1a5dd

No actionable issue is established for the event-parsing migration; it is mergeable after normal checks.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 32.14% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 28 functions across 9 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 migration of the AI indicator and added-to-channel events to generated event models.
Description check ✅ Passed The description includes the goal, implementation details, related issue, and testing evidence. It omits the UI Changes, contributor checklist, reviewer checklist, and GIF sections, but these are not …
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

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’s glow,
New fields take paths the parsers know.
Four event shapes hop into view,
Required fields are checked there too.
Zero counts complete the queue.

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

@gpunto
gpunto force-pushed the migrate/ai-indicator-added-to-channel-events branch from 1a5dd8b to 088386f Compare October 9, 2026 07:32
@sonarqubecloud

sonarqubecloud Bot commented Oct 9, 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.

Looks good, thanks!

@gpunto
gpunto added this pull request to the merge queue Oct 9, 2026
Merged via the queue into develop with commit 0463980 Oct 9, 2026
19 checks passed
@gpunto
gpunto deleted the migrate/ai-indicator-added-to-channel-events branch October 9, 2026 10:56
@stream-public-bot stream-public-bot added the released Included in a release label Oct 16, 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