Skip to content

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

Merged
VelikovPetar merged 3 commits into
masterfrom
fix/flu-974_poll_vote_list_other_polls
Oct 15, 2026
Merged

VelikovPetar merged 3 commits into
masterfrom
fix/flu-974_poll_vote_list_other_polls

Conversation

@VelikovPetar

@VelikovPetar VelikovPetar commented Oct 13, 2026 •

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 has the same code; a port is to be decided separately.

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.

🤖 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

Review in Change Stack →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 331f8e98-7286-44fa-923e-bbff0f251cc6
📥 Commits

Reviewing files that changed from the base of the PR and between 457fa83 and e4d826d.

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

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 55d01412-4094-43ea-971c-2a95bf285bf3
📥 Commits

Reviewing files that changed from the base of the PR and between 4d39b4a and 457fa83.

📒 Files selected for processing (3)
  • packages/stream_chat_flutter_core/CHANGELOG.md
  • packages/stream_chat_flutter_core/lib/src/stream_poll_vote_list_controller.dart
  • packages/stream_chat_flutter_core/test/stream_poll_vote_list_controller_test.dart

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

StreamPollVoteListController now processes poll vote events only when their poll ID matches the controller's poll ID. Tests cover matching, non-matching, and missing poll IDs.

Changes: Poll vote event filtering

Layer / File(s) Summary
Filter and test poll vote events
packages/stream_chat_flutter_core/lib/src/stream_poll_vote_list_controller.dart, packages/stream_chat_flutter_core/test/stream_poll_vote_list_controller_test.dart, packages/stream_chat_flutter_core/CHANGELOG.md
The event listener checks the poll ID before processing an event. Tests cover votes and answers for matching and other polls, plus missing poll IDs. The changelog records the fix.

Priority: ⬇️ Low

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

Change: Bug fix

Suggested reviewers: xsahil03x

Merge Risk: ⚪ Minimal · up to 457fa

The poll vote filtering change is mergeable after normal checks.

Pre-merge checks: Passed 5
Passed Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
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.
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: preventing StreamPollVoteListController from processing votes from other polls.
✨ Finishing Touches
🧪 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

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

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@VelikovPetar
VelikovPetar requested a review from a team October 13, 2026 15:57
@VelikovPetar
VelikovPetar marked this pull request as ready for review October 13, 2026 15:57
@VelikovPetar VelikovPetar changed the title fix(core): ignore other polls' votes in StreamPollVoteListController fix(core): ignore other polls' votes in StreamPollVoteListController Oct 13, 2026
@codecov

codecov Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.45%. Comparing base (dd324b8) to head (e4d826d).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3057      +/-   ##
==========================================
+ Coverage   78.29%   78.45%   +0.15%     
==========================================
  Files         452      452              
  Lines       29409    29413       +4     
==========================================
+ Hits        23025    23075      +50     
+ Misses       6384     6338      -46     

☔ 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.

Verified against the backend: every poll vote event carries poll and a non-omitempty poll_vote.poll_id, and the answer resolvers keep the payload, so the check holds for every event type. Tests pass, and both failure claims in the description reproduce.

Nit on the description: iOS's PollVoteListController also scopes by optionId / isAnswer, not only pollId. That part is covered by #3059, so "matches iOS" here is true for the poll id only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@VelikovPetar
VelikovPetar merged commit 1dfc1b2 into master Oct 15, 2026
29 checks passed
@VelikovPetar
VelikovPetar deleted the fix/flu-974_poll_vote_list_other_polls branch October 15, 2026 11:34
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