Skip to content

fix(persistence): port poll DAO null-user fix and chunked size guard from #2731#2752

Open
VelikovPetar wants to merge 1 commit into
v9from
fix/port-pr-2731-remarks-to-v9
Open

fix(persistence): port poll DAO null-user fix and chunked size guard from #2731#2752
VelikovPetar wants to merge 1 commit into
v9from
fix/port-pr-2731-remarks-to-v9

Conversation

@VelikovPetar

Copy link
Copy Markdown
Contributor

Linear: FLU-
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

Ports the review fixes from #2731 (commit 15af740) onto v9. These were applied during the merge-master-to-v10 PR but never landed on the v9 branch directly.

  • PollDao: switch the user side of the polls LEFT JOIN users read from readTable(users) to readTableOrNull(users) in both _pollFromJoinRow and getPollsByIds, and make userEntity nullable in _buildPoll. Without this, reading a poll whose creator user isn't in the local cache crashes (the LEFT JOIN legitimately returns no user row).
  • chunked(): throw ArgumentError when size <= 0 instead of looping forever / producing nonsense chunks.
  • Adds a unit test file for chunked() covering the empty/single/even/partial/default-size cases plus the new zero/negative guards. All 7 tests pass locally (flutter test test/src/db/query_utils_test.dart).

Screenshots / Videos

NA — persistence-layer change.

Before After
getPollById / getPollsByIds throws when the creator user row is absent. Returns the poll with createdBy: null.

…from #2731

Cherry-picks the review fixes from PR #2731 (commit 15af740) onto v9:
- PollDao: read users via readTableOrNull on the LEFT JOIN so polls whose
  creator user is missing from the local cache no longer crash.
- chunked(): throw ArgumentError when size <= 0; add unit tests for chunked.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jun 12, 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: Pro

Run ID: 6fff3fa1-6a13-43af-9d30-5c742666c000

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
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/port-pr-2731-remarks-to-v9

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 and usage tips.

@codecov

codecov Bot commented Jun 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 65.96%. Comparing base (e19b1ce) to head (e697a30).

Additional details and impacted files
@@           Coverage Diff           @@
##               v9    #2752   +/-   ##
=======================================
  Coverage   65.96%   65.96%           
=======================================
  Files         425      425           
  Lines       26926    26928    +2     
=======================================
+ Hits        17761    17763    +2     
  Misses       9165     9165           

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

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.

1 participant