Skip to content

refactor(llc): extract the message merge algebra into MessageMerging - #2913

Draft
VelikovPetar wants to merge 2 commits into
masterfrom
refactor/extract-message-merging
Draft

refactor(llc): extract the message merge algebra into MessageMerging#2913
VelikovPetar wants to merge 2 commits into
masterfrom
refactor/extract-message-merging

Conversation

@VelikovPetar

@VelikovPetar VelikovPetar commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Submit a pull request

Linear: FLU-724

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

Moves the pure message/pin/live-location merge and removal operations (formerly private on ChannelClientState) verbatim out of channel.dart into a new unexported static holder MessageMerging under lib/src/core/util/, following the MessageRules precedent. The two message predicates (isShownInChannel and hasValidPin, formerly the top-level _pinIsValid and inline filters) live in a separate unexported MessagePredicates extension on Message.

  • Call sites in channel.dart are requalified; the stateful orchestrators and persistence writes stay put.
  • The thread orchestrators preserve their exact write/no-write emission behavior via an identical() guard.
  • Adds pure unit-test suites (41 tests across message_merging_test.dart and message_predicates_test.dart) covering the merge semantics directly, including previously untested pin-expiry filtering and the thread phantom-guard / empty-thread-pruning rules.
  • Zero public API change (lib/stream_chat.dart untouched); no CHANGELOG entry since there is no observable behavior change.

Review tip: git diff --color-moved=dimmed-zebra shows the moved bodies as relocated text.

Test instructions: cd packages/stream_chat && dart test — full package suite passes (1,665 tests, including the existing through-state merge characterization); downstream stream_chat_flutter_core, stream_chat_persistence, and stream_chat_flutter suites verified.

Groundwork for the v11 shared merge-semantics rail.

Screenshots / Videos

No UI changes.

🤖 Generated with Claude Code

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Draft detected.

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 Plus

Run ID: c9cbf1b5-b4ac-4ead-ad70-5cb6577a171c

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

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.

…xtension

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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