Skip to content

Migrate the channel hidden and visible events to the generated event models - #6791

Queued
gpunto wants to merge 2 commits into
developfrom
migrate/channel-hidden-visible-events
Queued

gpunto wants to merge 2 commits into
developfrom
migrate/channel-hidden-visible-events

Conversation

@gpunto

@gpunto gpunto commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Goal

Parse the channel.hidden and channel.visible events with the generated event models.

Part of AND-1291

Implementation

  • Vendor the generated ChannelHiddenEvent and ChannelVisibleEvent, and delete the hand-written DTOs.
  • The adapters require the cid and the user, which the domain events need. The channel type and id come from the cid.
  • clear_history (hidden) and channel (visible) are nullable in the vendored models: backends before v239.47.0 replay these events on /sync without them, and the spec marks them required. As before, a missing clear_history maps to false and a missing channel to a channel with only its type and id. The model comments say when to drop the patch.

Testing

GeneratedChannelEventParsingTest covers both events from the socket and in the replayed shape, and rejects an event without a cid or user. The mapping tests cover every field, including both replayed shapes.

On a device: hid a channel with and without clearing history and showed it again. Every domain field was set on the live events, and /sync parsed the replayed events.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Improved handling of channel hidden and visible events, including sync-replay events, so they are interpreted consistently.
    • Hidden events without a clear-history value now default to retaining history.
    • Visible events can still provide channel details when the event omits the channel payload.

@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

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 8, 2026 •

Copy link
Copy Markdown
Contributor

SDK Size Comparison 📏

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

@gpunto
gpunto marked this pull request as ready for review October 8, 2026 10:36
@gpunto
gpunto requested a review from a team as a code owner October 8, 2026 10:36
@gpunto
gpunto enabled auto-merge October 8, 2026 10:36
@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: 492a0cca-da6e-4d58-b1af-63ea2b34ea1e
📥 Commits

Reviewing files that changed from the base of the PR and between 76477fd and d1f73ba.

📒 Files selected for processing (9)
  • 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/ChannelHiddenEvent.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/ChannelVisibleEvent.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/GeneratedChannelEventParsingTest.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

Channel-hidden and channel-visible events now use generated network event models for parsing and domain mapping. The conversion requires cid and user; missing clearHistory maps to false, and a missing visible-event channel is derived from cid.

Changes

Channel Visibility Event Mapping

Layer / File(s) Summary
Event models and parsing
stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/ChannelHiddenEvent.kt, stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/ChannelVisibleEvent.kt, stream-chat-android-client/src/main/java/io/getstream/chat/android/client/parser2/adapters/EventAdapter.kt
Adds generated network event models and updates the hidden and visible event adapters to require cid and user.
Domain event conversion
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
Maps generated hidden and visible events to domain events and removes the corresponding legacy DTOs.
Fixtures and mapping tests
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/GeneratedChannelEventParsingTest.kt
Updates event fixtures and tests for generated event models, required fields, nullable clearHistory, and hidden and visible event mapping.

Priority: ⬇️ Low

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

Change: Refactor

Suggested reviewers: velikovpetar

Merge Risk: ⚪ Minimal · up to d1f73

The visibility-event migration has no identified issue that should delay merging after normal checks.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 15 functions across 8 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 primary change: migrating channel hidden and visible events to generated event models.
Description check ✅ Passed The description covers the goal, implementation, compatibility behavior, testing, and issue context. UI-specific sections are not relevant to this change, and the omitted checklist items do not preven…
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,
Hidden fields hop into place.
Visible channels follow cid,
clearHistory rests at false,
New wire shapes pass the test,
And springtime bounces through the logs.

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 optional nit inline.

@gpunto
gpunto added this pull request to the merge queue Oct 8, 2026
Any commits made after this event will not be merged.
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Oct 8, 2026
@gpunto
gpunto enabled auto-merge October 8, 2026 14:51
@gpunto
gpunto force-pushed the migrate/channel-hidden-visible-events branch from 74f00d7 to 9def7f3 Compare October 8, 2026 14:56
@sonarqubecloud

sonarqubecloud Bot commented Oct 8, 2026

Copy link
Copy Markdown

@gpunto
gpunto added this pull request to the merge queue Oct 8, 2026
Any commits made after this event will not be merged.

This branch has not been deployed

No deployments
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