Sitelet https://github.com/GetStream/stream-chat-android/pull/6680
Skip to content

Migrate the message poll to the generated PollResponseData model - #6680

Merged
gpunto merged 3 commits into
developfrom
migrate/message-poll
Sep 8, 2026
Merged

gpunto merged 3 commits into
developfrom
migrate/message-poll

Conversation

@gpunto

@gpunto gpunto commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

Goal

Parse the poll embedded in a message with the generated PollResponseData.

Part of AND-1291

Implementation

  • Point DownstreamMessageDto.poll at PollResponseData, the model the poll endpoints already use, and follow the field rename in lastUpdateTime(). PollResponseData.toDomain() was already in place, so no mapping code is added.
  • Enrich the nested vote, answer and creator users in the message fixture. The generated UserResponse requires created_at, updated_at and language, and the fixture carried only id, role, banned and online.

DownstreamPollDto stays for the poll events, which still parse it.

Notes

The message carries Poll *commonpayloads.PollResponseData, the same struct the poll endpoints return, and created_at, updated_at and language are non-omitempty on UserResponseCommonFields. So the wire always sends them for a nested poll user and the old fixture was the unrealistic part.

The two paths swap strictness on three keys. voting_visibility was String? and defaulted to PUBLIC; it is required on PollResponseData, so a poll that omits it now throws on the DTO path while PollAdapter still defaults it. options and own_votes go the other way, defaulting to empty on the DTO path while PollAdapter still throws. None can fire in practice: all three are plain non-omitempty tags on the Go response struct.

A custom key with a null value no longer reaches Poll.extraData. The DTO path used to keep it and the direct path already dropped it, so this aligns them.

Testing

  • Device probe: created a poll with custom data on the poll and on one option, sent it, cast a vote and an answer, then read the message back through getMessage and queryChannels. Both custom values round-tripped, config was preserved, and every nested user (creator, votes, own votes, answers) carried the three required fields.
  • Mutation checks: nulling message.poll, and dropping poll.updatedAt from lastUpdateTime, each fail 6 tests.
  • MessageParsingTest gains a case for poll and option custom data inlined on the message, which also pins the null-valued key being dropped on both paths.

Summary by CodeRabbit

  • Bug Fixes
    • Poll messages now correctly reflect the poll’s latest update time.
    • Poll data is mapped consistently, preserving custom poll information in message details.
    • Poll-related user information, including creator, voters, and respondents, is handled more completely.
  • Tests
    • Expanded coverage for poll custom data, optional message properties, timestamps, and user metadata.

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

github-actions Bot commented Sep 2, 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 Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

SDK Size Comparison 📏

SDK Before After Difference Status
stream-chat-android-client 6.11 MB 6.11 MB 0.00 MB 🟢
stream-chat-android-ui-components 11.41 MB 11.41 MB 0.00 MB 🟢
stream-chat-android-compose 12.90 MB 12.90 MB 0.00 MB 🟢

@gpunto
gpunto marked this pull request as ready for review September 4, 2026 14:22
@gpunto
gpunto requested a review from a team as a code owner September 4, 2026 14:22
@gpunto
gpunto enabled auto-merge September 4, 2026 14:23
@coderabbitai

coderabbitai Bot commented Sep 4, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Team

Run ID: 089a3412-3f1b-474c-86fa-9215121ab769

📥 Commits

Reviewing files that changed from the base of the PR and between 8e661ce and bc5cf6a.

📒 Files selected for processing (5)
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/mapping/DomainMapping.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/model/dto/MessageDtos.kt
  • stream-chat-android-client/src/test/java/io/getstream/chat/android/client/Mother.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/parser2/testdata/MessageTestData.kt

Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review.


Walkthrough

The message DTO now uses PollResponseData. Poll timestamp mapping reads updatedAt. Tests cover custom poll data, optional message properties, and enriched poll user fields.

Changes

Poll mapping

Layer / File(s) Summary
Poll response contract and timestamp mapping
stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/model/dto/MessageDtos.kt, stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/mapping/DomainMapping.kt
DownstreamMessageDto.poll now uses PollResponseData. Message update timestamps now use poll.updatedAt.
Poll mapping validation
stream-chat-android-client/src/test/java/io/getstream/chat/android/client/Mother.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/parser2/testdata/MessageTestData.kt
Test helpers and fixtures use PollResponseData. Tests verify custom data filtering and enriched poll user fields.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to bc5cf

Message poll parsing now uses the generated response model and its updated timestamp while preserving domain poll mapping and custom data behavior. The supplied coverage and current implementation alignment indicate no remaining merge-blocking risk.

Suggested reviewers: aleksandar-apostolov

Poem

A rabbit checked the poll at dawn
Its newest timestamp now lives on
Custom data hopped in line
Null fields vanished, neat and fine
The tests now greet the change with song

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 5 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
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.
Title check ✅ Passed The title clearly identifies the primary change: migrating message poll parsing to the generated PollResponseData model.
Description check ✅ Passed The description clearly explains the goal, implementation, retained DownstreamPollDto usage, behavioral differences, and testing. The UI, GIF, and checklist sections are not included, but they are non…
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch migrate/message-poll

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

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 note inline on the nullability change and two optional ones.

@sonarqubecloud

sonarqubecloud Bot commented Sep 7, 2026

Copy link
Copy Markdown

@gpunto
gpunto added this pull request to the merge queue Sep 8, 2026
Merged via the queue into develop with commit c8cb901 Sep 8, 2026
19 checks passed
@gpunto
gpunto deleted the migrate/message-poll branch September 8, 2026 08:44
@stream-public-bot stream-public-bot added the released Included in a release label Sep 10, 2026
@stream-public-bot

Copy link
Copy Markdown
Contributor

🚀 Available in v7.11.0

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