Skip to content

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

Open
VelikovPetar wants to merge 9 commits into
v11from
refactor/channel_response_mapper
Open

VelikovPetar wants to merge 9 commits into
v11from
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/.
  • ChannelModel gains truncatedBy, autoTranslationEnabled and autoTranslationLanguage, and Member gains notificationsMuted, status, banFromFutureChannels, futureChannelBanExpires and deletedAt. They are getters over extraData, like the existing muted and blocked, so copyWith, merge and the offline cache behave as before.
  • Persistence: Member.banExpires is now stored (schema 1104).
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 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.
  • Known issue, unchanged here: disableSlowMode sends unset: ['cooldown'], which the server rejects on both v1 and v2; it is fixed separately.

Testing

  • stream_chat analyze clean, full suite green (1,904 tests); the other packages and the sample app analyze clean; 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: 3069f9c7-29eb-43d2-a283-32396623fe9e

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/members.dart

📝 Remember to:

  1. ✅ Database schema version bumped to 1104.
  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 99.42857% with 1 line in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (v11@e4533d9). Learn more about missing BASE report.

Files with missing lines Patch % Lines
...ckages/stream_chat/lib/src/core/models/member.dart 95.23% 1 Missing ⚠️
Additional details and impacted files
@@          Coverage Diff           @@
##             v11    #3044   +/-   ##
======================================
  Coverage       ?   78.12%           
======================================
  Files          ?      473           
  Lines          ?    29325           
  Branches       ?        0           
======================================
  Hits           ?    22911           
  Misses         ?     6414           
  Partials       ?        0           

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

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