Skip to content

Migrate the poll nested option and vote types to the generated models - #6684

Open
gpunto wants to merge 1 commit into
developfrom
migrate/poll-nested-types
Open

Migrate the poll nested option and vote types to the generated models#6684
gpunto wants to merge 1 commit into
developfrom
migrate/poll-nested-types

Conversation

@gpunto

@gpunto gpunto commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Goal

Adopt the generated PollOptionResponseData and PollVoteResponseData for the nested types of
DownstreamPollDto.

Part of AND-1291

Implementation

  • Swap options, latest_answers, latest_votes_by_option and own_votes on DownstreamPollDto to the
    generated models. Both mappers already existed from the PollResponseData slice, and field parity is
    exact including nullability, so no new mapping code was needed.
  • Delete DownstreamPollOptionDto with its CustomObjectDtoAdapter, its registration, and both its
    hand-written mappers. The generated PollOptionResponseDataAdapter collects root-level custom keys into
    custom the same way, so option custom data keeps reaching Option.extraData.
  • DownstreamVoteDto stays: four poll events still declare it.

Notes

The only strictness change is the nested user. UserResponse requires created_at, updated_at and
language where DownstreamUserDto did not, so the vote users in the poll fixtures gained them.

Testing

  • OptionParsingTest retargeted to the generated model, and DomainMappingTest covers the poll mapping
    with custom data on an option, a user on a vote, and an answer.
  • Mapper mutation sweep clean on all four mappers now in the path: dropping any mapped assignment fails a
    test or cannot compile.
  • Device-probed on the wire across every shape that carries DownstreamPollDto: the poll on a send
    response, the poll on a message fetch with own_votes, latest_votes_by_option and latest_answers all
    populated, and the poll.vote_casted, poll.answer_casted, poll.vote_removed, poll.closed and
    poll.deleted events. Every field of the resulting Poll, Vote and Answer asserted individually,
    including custom data round-tripping on both the poll and an option. poll.deleted ships a lean poll
    with the nested vote user omitted, which exercised the generated model against an absent user.

Summary by CodeRabbit

  • Bug Fixes

    • Updated poll processing to use the latest poll option and vote response data.
    • Poll answers are now identified correctly, and poll option custom data is mapped consistently.
    • Improved handling of user details included in poll responses.
  • Tests

    • Updated poll parsing and mapping coverage for the revised response format.
    • Removed obsolete poll option adapter tests and fixtures.

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

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

Copy link
Copy Markdown
Contributor

SDK Size Comparison 📏

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

@sonarqubecloud

sonarqubecloud Bot commented Sep 8, 2026

Copy link
Copy Markdown

@gpunto
gpunto marked this pull request as ready for review September 8, 2026 10:48
@gpunto
gpunto requested a review from a team as a code owner September 8, 2026 10:48
@coderabbitai

coderabbitai Bot commented Sep 8, 2026

Copy link
Copy Markdown

Review Change StackReview 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: 3e6569a3-81a7-4680-a6c7-f65a5fa08bd7

📥 Commits

Reviewing files that changed from the base of the PR and between c05a1a1 and 7f903ba.

📒 Files selected for processing (10)
  • 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/PollsDtos.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/client/parser2/MoshiChatParser.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/client/parser2/adapters/PollDtoAdapters.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/DownstreamPollOptionDtoAdapterTest.kt
  • stream-chat-android-client/src/test/java/io/getstream/chat/android/client/parser2/OptionParsingTest.kt
  • stream-chat-android-client/src/test/java/io/getstream/chat/android/client/parser2/testdata/PollDtoTestData.kt
  • stream-chat-android-client/src/test/java/io/getstream/chat/android/client/parser2/testdata/PollTestData.kt
💤 Files with no reviewable changes (3)
  • stream-chat-android-client/src/test/java/io/getstream/chat/android/client/parser2/DownstreamPollOptionDtoAdapterTest.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/client/parser2/MoshiChatParser.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/client/parser2/adapters/PollDtoAdapters.kt

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


Walkthrough

The poll pipeline now uses network response models for options and votes. The obsolete option DTO and Moshi adapter were removed. Domain mappings, test factories, parser tests, and poll fixtures were updated.

Changes

Poll response model migration

Layer / File(s) Summary
Response model and domain mapping
stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/model/dto/PollsDtos.kt, stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/mapping/DomainMapping.kt
Poll options and votes use PollOptionResponseData and PollVoteResponseData. Vote filtering uses isAnswer, and options use toOption().
Parser adapter removal
stream-chat-android-client/src/main/java/io/getstream/chat/android/client/parser2/MoshiChatParser.kt, stream-chat-android-client/src/main/java/io/getstream/chat/android/client/parser2/adapters/PollDtoAdapters.kt
The obsolete poll option adapter and its Moshi registration were removed.
Poll test data and coverage
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/OptionParsingTest.kt, stream-chat-android-client/src/test/java/io/getstream/chat/android/client/parser2/testdata/*
Test factories and assertions use response models. Option parsing tests cover toOption(). Poll fixtures include expanded user fields.

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

Merge Risk: ⚪ Minimal · up to 7f903

Poll options and votes now use the generated response models while retaining domain mapping and parsing coverage for option data, vote users, and answers. No merge-blocking behavior risk is identified.

Suggested reviewers: velikovpetar, andremion

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 35.71% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 14 functions across 7 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 nested poll option and vote types to generated models.
Description check ✅ Passed The description includes clear Goal, Implementation, and Testing sections. It explains the migration, removed components, retained types, compatibility impact, and test coverage. UI, checklist, and GI…
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/poll-nested-types

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 maps each poll with care
New options hop through clean data air
Old adapters rest in a burrow deep
Tests guard the fields the models keep
Fluffy green checks now gently leap

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