Skip to content

fix(core): ignore other polls' votes in StreamPollVoteListController (v9) - #3058

Merged
VelikovPetar merged 1 commit into
v9from
fix/flu-974_poll_vote_list_other_polls_v9
Oct 15, 2026
Merged

VelikovPetar merged 1 commit into
v9from
fix/flu-974_poll_vote_list_other_polls_v9

Conversation

@VelikovPetar

Copy link
Copy Markdown
Contributor

Submit a pull request

Linear: FLU-974
Github Issue: #

CLA

  • I have signed the Stream CLA (required).
  • The code changes follow best practices
  • Code changes are tested (add some information if not applicable)

Description of the pull request

StreamPollVoteListController listens to channel.on() and passed every poll vote and answer event to its event handler without checking the poll. A channel can hold several polls, so a vote or comment on one poll showed up in another poll's votes or comments list. For example, a comment on "Team offsite" appeared in the open comments of "Lunch: pizza or sushi?".

The controller now ignores vote and answer events whose vote belongs to a different poll. It reads the poll from pollVote.pollId, falling back to poll.id. Notes:

  • eventListener still receives every event before the check, as before.
  • No public API changes. StreamPollVoteEventHandler is untouched.
  • Events that carry neither id are ignored. The channel's own poll state already ignores those.

This matches the iOS SDK: its PollVoteListController only applies a vote when query.pollId == vote.pollId.

v9 port of #3057.

Testing

  • New stream_poll_vote_list_controller_test.dart: vote-casted, answer-casted and vote-changed events for another poll, and a vote with no poll id at all, leave the list unchanged; a vote for the same poll is still added, including one whose only poll id is on the event's poll. The four "leaves the list unchanged" tests fail without the fix; the fallback test fails without the poll.id fallback.
  • stream_chat_flutter_core analyzes clean and its full suite passes. The fallback test is renamed to a vote-casted event matching only by its event poll is added to fit v9's 80-column limit.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Poll vote lists now ignore votes and comments associated with other polls in the same channel. Votes without their own poll ID are added only when the event identifies the list’s poll.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 9f7f158c-3468-481f-8c2b-9460acbb3a17

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • 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

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

@VelikovPetar
VelikovPetar marked this pull request as ready for review October 13, 2026 16:05
@VelikovPetar
VelikovPetar requested a review from a team October 13, 2026 16:05
@codecov

codecov Bot commented Oct 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (v9@b32c752). Learn more about missing BASE report.

Additional details and impacted files
@@          Coverage Diff          @@
##             v9    #3058   +/-   ##
=====================================
  Coverage      ?   68.87%           
=====================================
  Files         ?      435           
  Lines         ?    27711           
  Branches      ?        0           
=====================================
  Hits          ?    19085           
  Misses        ?     8626           
  Partials      ?        0           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@xsahil03x xsahil03x left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Faithful v9 port of #3057: the same check in the same place, with only v9's 80-column formatting and one renamed test differing. v9's answer resolver keeps the payload, so the check holds for every event type, and CI is green.

Nit on the description, same as #3057: iOS also scopes by optionId / isAnswer; that part is #3060, so "matches iOS" here is true for the poll id only.

@VelikovPetar
VelikovPetar merged commit 34363de into v9 Oct 15, 2026
25 checks passed
@VelikovPetar
VelikovPetar deleted the fix/flu-974_poll_vote_list_other_polls_v9 branch October 15, 2026 11:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants