Skip to content

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

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

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>
@VelikovPetar

Copy link
Copy Markdown
Contributor Author

Superseded by #2944.

Closing rather than rebasing: #2930 moves ChannelClientState out of channel.dart, and 99% of this PR's channel.dart diff (281 of 282 changed lines) sits inside that moved block.

#2944 re-hosts the same extraction onto channel_client_state.dart, done as a real three-way merge against #2943 rather than a replay. The two refactors proved disjoint — all nine helpers extracted here still live in channel_client_state.dart after #2943, none having moved into channel_state_mutations.dart. Four conflicts arose, all determinate; the notable one is that #2943 and this PR independently extracted the same shown-in-channel predicate, resolved in favour of this PR's shared MessagePredicates.isShownInChannel.

Public member sets of Channel and ChannelClientState verified identical to #2930 across the whole stack.

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