Skip to content

refactor(llc)!: route the partial channel and member updates through the generated client - #3044

Open
VelikovPetar wants to merge 13 commits into
refactor/flu-882_polls_openapi_migrationfrom
refactor/channel_response_mapper
Open

VelikovPetar wants to merge 13 commits into
refactor/flu-882_polls_openapi_migrationfrom
refactor/channel_response_mapper

Conversation

@VelikovPetar

@VelikovPetar VelikovPetar commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Linear: FLU-910

What

Moves the partial channel and member updates onto the OpenAPI-generated client, and adds the mappers from the generated channel and member types to our ChannelModel / Member.

  • Channel: StreamChatClient.updateChannelPartial, enableSlowMode and disableSlowMode, and Channel.updatePartial, updateName, updateImage, enableSlowMode and disableSlowMode, return Result<UpdateChannelPartialResponse> instead of throwing.
  • Member: StreamChatClient.updateMemberPartial, pinChannel, unpinChannel, archiveChannel and unarchiveChannel, and Channel.pin, unpin, archive and unarchive, return Result<UpdateMemberPartialResponse>. The Channel methods return the envelope instead of the bare Member.
  • New ChannelsRepository over DefaultApi; channel_mapper.dart maps ChannelResponse, ChannelMemberResponse, ChannelConfigWithInfo, Command and ChatPreferences; freezed envelopes in models/response/.
  • Custom data (README rule 9, from refactor(llc)!: route polls through the generated client #3037): ChannelModel, Member and Channel name their custom data custom (extraData → custom, extraDataStream → customStream, client.channel(custom:)), and it is the wire's custom, verbatim — the mapper no longer filters it.
  • The fields v10 parked in extraData are real fields: ChannelModel.disabled, hidden, muted, blocked, truncatedAt, truncatedBy, autoTranslationEnabled, autoTranslationLanguage, and Member.notificationsMuted, status, banFromFutureChannels, futureChannelBanExpires, deletedAt. merge keeps the same per-field rules.
  • ChannelModel.toJson / Member.toJson leave out a custom entry named like one of their fields, so it cannot overwrite the field. Member no longer carries the server-deprecated role in custom.
  • Persistence: columns for every promoted field (truncatedBy through the users table), custom columns for channels and members, and Member.banExpires is now stored (schema 1106).
Generated Public
DefaultApi.updateChannelPartial (PATCH /api/v2/chat/channels/{type}/{id}) StreamChatClient.updateChannelPartial
DefaultApi.updateMemberPartial (PATCH /api/v2/chat/channels/{type}/{id}/member) StreamChatClient.updateMemberPartial
UpdateChannelPartialResponse UpdateChannelPartialResponse (ours, freezed)
UpdateMemberPartialResponse UpdateMemberPartialResponse (ours, freezed)
ChannelResponse / ChannelMemberResponse ChannelModel / Member
ChannelConfigWithInfo / Command / ChatPreferences ChannelConfig / Command / ChatPreferences

⚠️ For reviewers: renames

This PR renames instead of keeping the v10 names:

  • PartialUpdateChannelResponse → UpdateChannelPartialResponse
  • PartialUpdateMemberResponse → UpdateMemberPartialResponse
  • StreamChatClient.partialMemberUpdate → updateMemberPartial
  • StreamChatClient.enableSlowdown / disableSlowdown → enableSlowMode / disableSlowMode

Why: every call site already changes for Result, the envelopes and the member method now share the API's naming scheme, and the slow-mode pair matches the Channel helpers and ChannelCapability.slowMode (the spec has no slow-mode operation). The alternative is keeping the v10 names, as earlier batches did; push back here if you prefer that. Names settled by earlier groups (getAppSettings, AppSettings, UploadConfig) are untouched. The plan's README rule 2 and the migration skill are updated to match.

Also renamed: ChannelModel.extraData, Member.extraData, Channel.extraData / extraDataStream and the extraData argument of Channel(…) and client.channel(…) → custom / customStream, following #3037's rule 9 (each group renames the models it maps first). Note client.channel('messaging', custom: {'members': [...]}) still creates members on v1; group 11 records how to keep that working on v2's typed ChannelInput.members.

Also removed: MemberUpdatePayload and MemberUpdateType. They only named pinned and archived; updateMemberPartial takes the map directly.

Notes

  • The v2 channel route is the same backend handler as v1. The v2 member route (/member) is a different handler from v1's (/member/{user_id}) but behaves the same for client-side calls. Neither is feature-flagged or in beta.
  • UpdateChannelPartialResponse.channel and UpdateMemberPartialResponse.channelMember are nullable, as the spec declares them. members is non-null; the server sends [] for an empty channel.
  • updateChannel and Channel.update still return a plain Future that throws a StreamChatException on failure. They move to Result with group 10's message mappers, because their request and response carry a Message. Until then the partial and full updates report failures differently, and the migration guide says so.
  • Plan: group 15 "Partial Updates" is split out of group 11. Based on refactor(llc)!: route polls through the generated client #3037; its custom-data group is renumbered 21 "Custom Data Check" (verification only), since the stack already uses 15–20.
  • merge rules verified live on v1 and v2: queries always send hidden/blocked, events omit them (except the channel.hidden a block sends), muted is never sent on a channel, truncated_* rides every event once set. auto_translation_* can't be set with a client token, so its rule rests on the backend code.

Testing

  • Analyze clean in every package, the sample app and docs screenshots; stream_chat 1,956, persistence 314, core 384 green; generate_plan.py --check reports 0 problems.
  • New client tests on fully populated generated responses: client_update_channel_partial_test.dart and client_update_member_partial_test.dart, with shared fixtures in fakes.dart.
  • Side-by-side parity with v11 against the live demo app, on throwaway channels deleted afterwards: channel set/unset, slow mode, pin/unpin/archive/unarchive, custom fields, invited/banned/shadow-banned members and the error cases. Only the documented differences showed up.

🤖 Generated with Claude Code

VelikovPetar and others added 3 commits October 5, 2026 14:00
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…the generated client

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…owMode and disableSlowMode

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 5, 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: Advanced
  • Run ID: 4cc479c5-7718-44c7-a93f-7a9576c16cf4

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

@github-actions

github-actions Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

⚠️ Database Entity Files Modified

The following database entity files have been modified in this PR:

packages/stream_chat_persistence/lib/src/entity/channels.dart
packages/stream_chat_persistence/lib/src/entity/members.dart

📝 Remember to:

  1. ✅ Database schema version bumped to 1106.
  2. Update entity schema tests if necessary.

Note: This comment is automatically generated by the CI workflow.

VelikovPetar and others added 3 commits October 5, 2026 16:30
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@VelikovPetar
VelikovPetar requested a review from a team October 5, 2026 14:42
@VelikovPetar
VelikovPetar marked this pull request as ready for review October 5, 2026 14:42
@codecov

codecov Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.64706% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.66%. Comparing base (d445345) to head (6e4f7ed).

Files with missing lines Patch % Lines
...es/stream_chat/lib/src/client/channel/channel.dart 87.50% 4 Missing ⚠️
...ckages/stream_chat/lib/src/core/models/member.dart 94.44% 1 Missing ⚠️
...h_scroll_view/stream_message_search_list_tile.dart 0.00% 1 Missing ⚠️
Additional details and impacted files
@@                             Coverage Diff                              @@
##           refactor/flu-882_polls_openapi_migration    #3044      +/-   ##
============================================================================
+ Coverage                                     78.48%   78.66%   +0.18%     
============================================================================
  Files                                           477      481       +4     
  Lines                                         29280    29380     +100     
============================================================================
+ Hits                                          22980    23112     +132     
+ Misses                                         6300     6268      -32     

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

VelikovPetar and others added 6 commits October 6, 2026 15:40
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nnelModel.copyWith and address the style review

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…date and slow mode docs

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…/channel_response_mapper

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@VelikovPetar
VelikovPetar changed the base branch from v11 to refactor/flu-882_polls_openapi_migration October 14, 2026 09:00
…om and promote their parked fields

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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