Repository navigation
refactor(llc)!: route user blocking through the generated client - #3050
Draft
VelikovPetar wants to merge 7 commits into
Draft
VelikovPetar wants to merge 7 commits into
VelikovPetar wants to merge 7 commits into
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
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. Comment |
…onses Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
3 tasks done
…refactor/flu-937_user_blocking_openapi_migration
…refactor/flu-937_user_blocking_openapi_migration
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…penapi_migration' into HEAD
…refactor/flu-937_user_blocking_openapi_migration Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Submit a pull request
Linear: FLU-937
Github Issue: -
CLA
Description of the pull request
Moves blocking and unblocking a user, and listing the blocked users, onto the OpenAPI-generated client, as new plan group 19 (User Blocking), split out of group 09 (Users). Stacked on #3049 (group 18).
blockUserreturnsResult<BlockUsersResponse>,unblockUserResult<UnblockUsersResponse>, andqueryBlockedUsersis renamedgetBlockedUsersand returnsResult<GetBlockedUsersResponse>— none of them throw any more. On success they still update the current user'sblockedUserIds(viaresult.onSuccess); a failure leaves it unchanged and is still logged (viaresult.onFailure).models/response/as freezed classes with a non-nullduration.UserBlockbecomes a freezed plain model withoutfromJson/toJson, and itsblockedUser,userId,blockedUserIdandcreatedAtare now required and non-null.UsersRepositorygains the three calls; the mappers go in the existinguser_mapper.dart.StreamChatApi.user.blockUser,unblockUserandqueryBlockedUsers,UserBlockResponseandBlockedUsersResponseare removed.DefaultApi.blockUsers(POST /api/v2/users/block)StreamChatClient.blockUser(kept)DefaultApi.unblockUsers(POST /api/v2/users/unblock)StreamChatClient.unblockUser(kept)DefaultApi.getBlockedUsers(GET /api/v2/users/block)StreamChatClient.getBlockedUsers(wasqueryBlockedUsers)BlockUsersResponseBlockUsersResponse(wasUserBlockResponse)UnblockUsersResponseUnblockUsersResponse(new; wasEmptyResponse)GetBlockedUsersResponseGetBlockedUsersResponse(wasBlockedUsersResponse)BlockedUserResponseUserBlock(kept)UsersRepository(internal)Why
The migration moves every endpoint onto the generated client, which returns a
Resultfor every call. Blocking and unblocking are a pair and the list refreshes the same state, so they move together. They need none of group 09'sUserrestructuring: they embedUseronly through the existing mappers, and nothing persists them.Notes for reviewers
Important
Singular methods, plural envelopes — please weigh in.
blockUserandunblockUser(one user id each) returnBlockUsersResponseandUnblockUsersResponse, the spec's plural names. The backend controllers are alreadyBlockUsers/UnblockUsers, and if the API later blocks several users in one call on the same operation, these envelopes can gain a field (e.g.blocks) additively and a newblockUsers(List<String>)can return the same type — no rename, no break. Singular envelope names (BlockUserResponse, the first iteration of this PR) would have forced either a breaking rename or two near-identical public types. The trade-off: today a single-user call answers a plural-named type.Other decision points:
blockUser/unblockUserkeep their names rather than the spec's pluralblockUsers/unblockUsers, since each takes one user id; a batch method would be added beside them.queryBlockedUserstakes the spec'sgetBlockedUsers, since the call has no filter, sort or pagination. Hard renames, no deprecated aliases.unblockUsergets an envelope rather thanResult<void>: the generated response is a namedUnblockUsersResponse, notDurationResponse, so a field the server adds later stays additive.UserBlockis tightened to non-null. An extra break beyond the plan's rule that nullability follows v10; the server always sends every field (an unresolvable user arrives as adeleted-userplaceholder), so callers no longer handle nulls that never arrive.Backend:
lib/chat/routes.gomounts oneuserBlockRoutestable (v1.BlockUsers,v1.UnblockUsers,v1.GetBlockedUsers) both at the root and under/api/v2/; only the JSON encoding differs. None is feature-flagged, in beta or deprecated.created_atas epoch nanoseconds rather than RFC 3339; the generated converter handles both.stream_chat_flutterand sample-app callers compile unchanged; they never awaited the result, so a failure stays silently ignored, as before.Testing
melos run analyzeclean across all packages,sample_appincluded;stream_chatsuite green, flutter_core and persistence green;generate_plan.py --checkreports 0 problems.copywith_audit.py UserBlock(from refactor(llc)!: route polls through the generated client #3037) on the pre-migration tree: no call site in lib or tests changes behaviour or stops compiling.UserBlock.copyWithnow takes non-nullable values, recorded in the CHANGELOG and the guide.client_block_user_test.dart,client_unblock_user_test.dart,client_get_blocked_users_test.dart: the full envelope against a fully populated generated response and the exact request sent, theblockedUserIdsupdate (add without duplicates, remove, replace), the failure without throwing, and the ids left unchanged on failure.Screenshots / Videos
Not applicable: no visible UI change.
🤖 Generated with Claude Code