Align the direct parser's nulls and users with the generated models by gpunto · Pull Request #6812 · GetStream/stream-chat-android · GitHub
Skip to content

Align the direct parser's nulls and users with the generated models - #6812

Merged
gpunto merged 2 commits into
developfrom
fix/direct-message-explicit-null
Oct 13, 2026
Merged

gpunto merged 2 commits into
developfrom
fix/direct-message-explicit-null

Conversation

@gpunto

@gpunto gpunto commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Goal

The direct (fast) event parser rejected payloads the generated models accept, such as explicit null lists on a message or a poll, so those events fell back to the slower path. It also read event users with own-user fields the generated UserResponse doesn't have.

Part of AND-1291

Implementation

  • Message, poll, message.new and channel info accept explicit null and missing keys wherever the generated models do, falling back to the same defaults; message.new takes the channel type and id from cid.
  • Event users read like the generated user models: a device that isn't an object or has no string id is dropped, and own-user fields (invisible, privacy_settings, unread counts) are no longer read, so they land in extraData as on the generated path. PrivacySettingsAdapter is deleted.

Testing

Parsing tests compare the direct and generated paths on the same payloads, including explicit null and missing keys.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Improved parsing of messages, polls, channel information, and events when optional fields are missing or null, using empty collections or default values where applicable.
    • Made device parsing more tolerant of unexpected input, while still returning no device when its ID is missing.
    • Channel type and ID are now derived from the channel identifier when parsing new-message events.
    • Unrecognized user fields are preserved in extra data.

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

Copy link
Copy Markdown
Contributor

@github-actions

Copy link
Copy Markdown
Contributor

SDK Size Comparison 📏

SDK Before After Difference Status
stream-chat-android-client 6.21 MB 6.21 MB 0.00 MB 🟢
stream-chat-android-ui-components 11.51 MB 11.51 MB 0.00 MB 🟢
stream-chat-android-compose 13.18 MB 13.18 MB 0.00 MB 🟢

@sonarqubecloud

Copy link
Copy Markdown

@gpunto
gpunto marked this pull request as ready for review October 13, 2026 10:26
@gpunto
gpunto requested a review from a team as a code owner October 13, 2026 10:26
@gpunto
gpunto enabled auto-merge October 13, 2026 10:26
@coderabbitai

coderabbitai Bot commented Oct 13, 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: 475a0a25-b191-4b9f-83da-18bd5c185f06
📥 Commits

Reviewing files that changed from the base of the PR and between 1e0ba38 and f1e3d1e.

📒 Files selected for processing (22)
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/client/parser2/DirectEventParser.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/client/parser2/direct/ChannelInfoAdapter.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/client/parser2/direct/DeviceAdapter.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/client/parser2/direct/JsonParsingUtils.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/client/parser2/direct/MessageAdapter.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/client/parser2/direct/NewMessageEventAdapter.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/client/parser2/direct/PollAdapter.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/client/parser2/direct/PrivacySettingsAdapter.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/client/parser2/direct/UserAdapter.kt
  • stream-chat-android-client/src/test/java/io/getstream/chat/android/client/parser2/DeviceParsingTest.kt
  • stream-chat-android-client/src/test/java/io/getstream/chat/android/client/parser2/GetMessageResponseParityTest.kt
  • stream-chat-android-client/src/test/java/io/getstream/chat/android/client/parser2/MessageParsingTest.kt
  • stream-chat-android-client/src/test/java/io/getstream/chat/android/client/parser2/NewMessageEventParsingTest.kt
  • stream-chat-android-client/src/test/java/io/getstream/chat/android/client/parser2/PollParsingTest.kt
  • stream-chat-android-client/src/test/java/io/getstream/chat/android/client/parser2/PrivacySettingsParsingTest.kt
  • stream-chat-android-client/src/test/java/io/getstream/chat/android/client/parser2/ReactionParsingTest.kt
  • stream-chat-android-client/src/test/java/io/getstream/chat/android/client/parser2/UserParsingTest.kt
  • stream-chat-android-client/src/test/java/io/getstream/chat/android/client/parser2/testdata/ChannelInfoTestData.kt
  • stream-chat-android-client/src/test/java/io/getstream/chat/android/client/parser2/testdata/MessageTestData.kt
  • stream-chat-android-client/src/test/java/io/getstream/chat/android/client/parser2/testdata/NewMessageEventTestData.kt
  • stream-chat-android-client/src/test/java/io/getstream/chat/android/client/parser2/testdata/UserTestData.kt
  • stream-chat-android-client/src/test/java/io/getstream/chat/android/client/parser2/testdata/WireShape.kt
💤 Files with no reviewable changes (5)
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/client/parser2/direct/PrivacySettingsAdapter.kt
  • stream-chat-android-client/src/test/java/io/getstream/chat/android/client/parser2/ReactionParsingTest.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/client/parser2/direct/JsonParsingUtils.kt
  • stream-chat-android-client/src/test/java/io/getstream/chat/android/client/parser2/MessageParsingTest.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/client/parser2/direct/UserAdapter.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

Direct JSON adapters now tolerate null or missing values for selected message, poll, channel-count, and new-message event fields. The new-message parser derives channel type and ID from cid. Device parsing skips non-object and wrongly typed values and returns null when id is absent. UserAdapter no longer maps privacy, invisibility, and unread-count fields to dedicated User properties. The direct privacy-settings adapter was removed. Tests and fixtures were updated to cover these changes and preserve explicit nulls.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to f1e3d

The change aligns direct parsing with the generated models for nulls, missing keys and user fields. No merge-blocking issues were found.

Pre-merge checks · Passed 4 · Failed 1

Failed 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 40 functions across 17 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks (4 passed)
Check name Status Explanation
Title check Passed The title clearly summarizes the main change: aligning direct-parser null handling and user parsing with generated models.
Description check Passed The description includes the goal, implementation details, linked issue, and testing approach. UI, checklist, reviewer, and GIF sections are omitted, but these are non-critical for this parser-only ch…
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
  • Autofix · 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 fields at dawn,
Nulls hop in, and defaults are drawn.
Devices skip what strings are not,
Extra data keeps each unhandled spot.
The parser nibbles clover, then moves on.

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

@gpunto
gpunto added this pull request to the merge queue Oct 13, 2026
Merged via the queue into develop with commit 1b11a59 Oct 13, 2026
20 of 21 checks passed
@gpunto
gpunto deleted the fix/direct-message-explicit-null branch October 13, 2026 15:55
@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