WPB-5989 polysemy create client subsystem (part 2)#5156
Conversation
44f5d77 to
486566c
Compare
There was a problem hiding this comment.
Pull request overview
This PR continues the WPB-5989 migration by moving more client-management behavior behind the Polysemy ClientSubsystem, updating Brig API handlers to call the subsystem, and centralizing a Client -> PubClient conversion helper in wire-api.
Changes:
- Route more Brig public/internal client endpoints through
Wire.ClientSubsystem(update/remove/legal hold request + DPoP access token naming). - Add new
ClientSubsystemactions and implement them in the interpreter; expand unit tests accordingly. - Introduce
Wire.API.User.Client.toPubClientand remove duplicate local helpers; drop an unusedBrig.Data.Clientmodule.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| services/brig/test/integration/Federation/End2end.hs | Switch expected client list conversion to shared toPubClient. |
| services/brig/src/Brig/Data/Client.hs | Remove unused/empty module. |
| services/brig/src/Brig/API/Public.hs | Route update/delete client + public lookups via ClientSubsystem; rename access-token handler. |
| services/brig/src/Brig/API/Internal.hs | Route legal-hold internal handlers via ClientSubsystem. |
| services/brig/src/Brig/API/Client.hs | Remove migrated client management exports; keep DPoP access-token logic + prekey endpoints. |
| services/brig/brig.cabal | Drop Brig.Data.Client from build. |
| libs/wire-subsystems/test/unit/Wire/Util.hs | Add generators/fixtures for prekeys used by new ClientSubsystem tests. |
| libs/wire-subsystems/test/unit/Wire/MockInterpreters/ClientStore.hs | Remove local toPubClient helper (but see review comments). |
| libs/wire-subsystems/test/unit/Wire/ClientSubsystem/InterpreterSpec.hs | Add/expand property tests for add/remove/update + legal-hold flows. |
| libs/wire-subsystems/src/Wire/ClientSubsystem/Interpreter.hs | Implement RemoveClient, RemoveLegalHoldClient, PublishLegalHoldClientRequested, UpdateClient. |
| libs/wire-subsystems/src/Wire/ClientSubsystem.hs | Add new effect constructors for client removal/legal-hold/update. |
| libs/wire-subsystems/src/Wire/ClientStore/Cassandra.hs | Inline PubClient construction and remove redundant helper. |
| libs/wire-api/src/Wire/API/UserEvent.hs | Derive Show for EventType. |
| libs/wire-api/src/Wire/API/User/Client.hs | Add shared toPubClient helper. |
| changelog.d/5-internal/WPB-5989 | Update changelog entry with additional PR reference. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
blackheaven
left a comment
There was a problem hiding this comment.
I'm not sure how it interacts with Galley's Client code, have you had a look for duplication?
This is just a refactoring and the intention is not to merge brig's and galley's Client types and code. We can't have galley use the ClientSubsystem easily. Not yet. But I hope soon. |
https://wearezeta.atlassian.net/browse/WPB-5989
In this PR, 4 more operations have been moved to the ClientSubsystem, and unit tests have been added.
The other operations will be move in subsequent PRs.
Checklist
changelog.d