Skip to content

chore(persistence): Remove unused DAO methods#2754

Open
VelikovPetar wants to merge 1 commit into
masterfrom
feature/FLU-501_cleanup_unusued_daos_v10
Open

chore(persistence): Remove unused DAO methods#2754
VelikovPetar wants to merge 1 commit into
masterfrom
feature/FLU-501_cleanup_unusued_daos_v10

Conversation

@VelikovPetar

@VelikovPetar VelikovPetar commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Submit a pull request

Linear: FLU-501

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

  • Removes all unused DAO methods

Summary by CodeRabbit

  • Refactor

    • Consolidated persistence layer APIs by removing redundant single-channel convenience methods for updating members, messages, reads, and reactions, standardizing on bulk update operations for improved consistency and simplified maintenance.
  • Tests

    • Updated test suite throughout to use standardized bulk and batch operations for data setup and verification.

@coderabbitai

coderabbitai Bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 99a17638-3a26-42e5-a949-7dd6ae99ea9a

📥 Commits

Reviewing files that changed from the base of the PR and between 5f5b23b and 8e6e79a.

📒 Files selected for processing (20)
  • packages/stream_chat_persistence/CHANGELOG.md
  • packages/stream_chat_persistence/lib/src/dao/member_dao.dart
  • packages/stream_chat_persistence/lib/src/dao/message_dao.dart
  • packages/stream_chat_persistence/lib/src/dao/pinned_message_dao.dart
  • packages/stream_chat_persistence/lib/src/dao/pinned_message_reaction_dao.dart
  • packages/stream_chat_persistence/lib/src/dao/poll_dao.dart
  • packages/stream_chat_persistence/lib/src/dao/reaction_dao.dart
  • packages/stream_chat_persistence/lib/src/dao/read_dao.dart
  • packages/stream_chat_persistence/lib/src/dao/user_dao.dart
  • packages/stream_chat_persistence/test/src/dao/channel_dao_test.dart
  • packages/stream_chat_persistence/test/src/dao/draft_message_dao_test.dart
  • packages/stream_chat_persistence/test/src/dao/location_dao_test.dart
  • packages/stream_chat_persistence/test/src/dao/member_dao_test.dart
  • packages/stream_chat_persistence/test/src/dao/message_dao_test.dart
  • packages/stream_chat_persistence/test/src/dao/pinned_message_dao_test.dart
  • packages/stream_chat_persistence/test/src/dao/pinned_message_reaction_dao_test.dart
  • packages/stream_chat_persistence/test/src/dao/poll_dao_test.dart
  • packages/stream_chat_persistence/test/src/dao/reaction_dao_test.dart
  • packages/stream_chat_persistence/test/src/dao/read_dao_test.dart
  • packages/stream_chat_persistence/test/src/dao/user_dao_test.dart
💤 Files with no reviewable changes (8)
  • packages/stream_chat_persistence/lib/src/dao/member_dao.dart
  • packages/stream_chat_persistence/lib/src/dao/pinned_message_dao.dart
  • packages/stream_chat_persistence/lib/src/dao/reaction_dao.dart
  • packages/stream_chat_persistence/lib/src/dao/read_dao.dart
  • packages/stream_chat_persistence/lib/src/dao/poll_dao.dart
  • packages/stream_chat_persistence/lib/src/dao/user_dao.dart
  • packages/stream_chat_persistence/lib/src/dao/pinned_message_reaction_dao.dart
  • packages/stream_chat_persistence/lib/src/dao/message_dao.dart

📝 Walkthrough

Walkthrough

Unused single-channel convenience wrapper methods (updateMembers, updateMessages, updateReads, getReactions, getReactionsByUserId, getPolls, getUsers, getThreadMessages, getThreadMessagesByParentId) are removed from internal DAO classes. PinnedMessageDao gains bulkUpdateMessages. All DAO test files are updated to call the remaining bulk/batched APIs directly.

Changes

DAO Convenience Method Removal and Test Updates

Layer / File(s) Summary
DAO convenience method removals
lib/src/dao/member_dao.dart, lib/src/dao/message_dao.dart, lib/src/dao/pinned_message_dao.dart, lib/src/dao/pinned_message_reaction_dao.dart, lib/src/dao/poll_dao.dart, lib/src/dao/reaction_dao.dart, lib/src/dao/read_dao.dart, lib/src/dao/user_dao.dart, CHANGELOG.md
Removes single-channel wrappers (updateMembers, updateMessages, updateReads) and single-result queries (getReactions, getReactionsByUserId, getPolls, getUsers, getThreadMessages, getThreadMessagesByParentId). Adds bulkUpdateMessages to PinnedMessageDao in place of the removed updateMessages. Changelog entry added.
Test suite updates
test/src/dao/channel_dao_test.dart, test/src/dao/draft_message_dao_test.dart, test/src/dao/location_dao_test.dart, test/src/dao/member_dao_test.dart, test/src/dao/message_dao_test.dart, test/src/dao/pinned_message_dao_test.dart, test/src/dao/pinned_message_reaction_dao_test.dart, test/src/dao/poll_dao_test.dart, test/src/dao/reaction_dao_test.dart, test/src/dao/read_dao_test.dart, test/src/dao/user_dao_test.dart
All test data setup calls replaced: updateMembers/updateMessages/updateReadsbulkUpdate* with map argument; reaction assertions switched from getReactions(id) to getReactionsForMessages([id])[id]!; poll assertions switched to getPollsByIds; user assertions replaced getUsers() with direct DB query. Removes the getThreadMessages test group.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • GetStream/stream-chat-flutter#2681: Introduces the batched getReactionsForMessages and getReactionsForMessagesByUserId APIs in ReactionDao and PinnedMessageReactionDao that this PR's tests now call exclusively.
  • GetStream/stream-chat-flutter#2679: Refactors the internal _selectReactions helper in both reaction DAOs whose single-message convenience wrappers (getReactions, getReactionsByUserId) are removed in this PR.
  • GetStream/stream-chat-flutter#2731: Overlaps on ReactionDao/PinnedMessageReactionDao batch querying patterns that this PR's tests adopt after removing the single-message convenience methods.

Suggested reviewers

  • renefloor

🐇 Convenience wrappers, begone from sight!
The bulk APIs now shine so bright.
One map to update, one batch to fetch—
No single-channel shortcuts left to catch.
Clean DAOs hop forward, lean and right! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the main change: removing unused DAO methods from the persistence layer, which is the primary focus across all modified files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/FLU-501_cleanup_unusued_daos_v10

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.

@VelikovPetar VelikovPetar marked this pull request as ready for review June 15, 2026 08:03
@codecov

codecov Bot commented Jun 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 68.37%. Comparing base (5f5b23b) to head (8e6e79a).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2754      +/-   ##
==========================================
- Coverage   68.42%   68.37%   -0.06%     
==========================================
  Files         413      413              
  Lines       24944    24885      -59     
==========================================
- Hits        17069    17014      -55     
+ Misses       7875     7871       -4     

☔ 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