Skip to content

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

Open
gpunto wants to merge 2 commits into
developfrom
migrate/message-poll
Open

Migrate the message poll to the generated PollResponseData model#6680
gpunto wants to merge 2 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.

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.

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 🟢

@sonarqubecloud

sonarqubecloud Bot commented Sep 4, 2026

Copy link
Copy Markdown

@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
Title check ✅ Passed The title clearly and concisely describes the main change: migrating message poll parsing to the generated PollResponseData model.
Description check ✅ Passed The description includes the goal, implementation details, scope notes, and testing evidence. It omits template sections for UI changes, checklists, and a GIF, but these are non-critical for this non-…
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 💡
  • 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.

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.

1 participant