-
Notifications
You must be signed in to change notification settings - Fork 334
WPB-21964: move conversation creation to wire-subsystems #4977
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
WPB-21964: move conversation creation to wire-subsystems #4977
Conversation
1e8e214 to
e7b9141
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR refactors conversation creation logic by moving it from Galley to the wire-subsystems library, aligning with the architectural goal of separating concerns into reusable subsystems.
Changes:
- Moved conversation creation logic from
Galley.API.CreatetoWire.ConversationSubsystem.Interpreter - Relocated utility modules:
Galley.API.Error→Galley.Types.Error,Galley.API.One2One→Wire.ConversationSubsystem.One2One,Galley.API.Util→Wire.ConversationSubsystem.Util,Galley.Effects.ClientStore→Wire.Effects.ClientStore - Removed
Galley.Validationmodule (functionality moved to interpreter) - Updated background-worker to include new dependencies and error handlers
- Updated imports across numerous files to reflect module movements
Reviewed changes
Copilot reviewed 63 out of 64 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| services/galley/src/Galley/API/Create.hs | Simplified to delegate conversation creation to subsystem |
| libs/wire-subsystems/src/Wire/ConversationSubsystem/Interpreter.hs | New implementation containing conversation creation logic |
| libs/wire-subsystems/src/Wire/ConversationSubsystem/Util.hs | Utility functions moved from Galley |
| libs/wire-subsystems/src/Wire/ConversationSubsystem/Federation.hs | New module for federation-related conversation logic |
| libs/wire-subsystems/src/Wire/ConversationSubsystem/Types.hs | Configuration types for conversation subsystem |
| services/background-worker/src/Wire/BackgroundWorker/Jobs/Registry.hs | Updated to support new conversation subsystem dependencies |
| libs/galley-types/src/Galley/Types/Error.hs | Error types moved to galley-types library |
| services/galley/src/Galley/Effects.hs | Reordered effect stack and added new error types |
| Multiple import updates | Updated imports across ~30 files to reflect module movements |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
services/background-worker/src/Wire/BackgroundWorker/Jobs/Registry.hs
Outdated
Show resolved
Hide resolved
services/background-worker/src/Wire/BackgroundWorker/Jobs/Registry.hs
Outdated
Show resolved
Hide resolved
services/background-worker/src/Wire/BackgroundWorker/Jobs/Registry.hs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great effort! Thanks!. I feel there is more to do and to be said to get this really clean, so here are a few comments already.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if we just want to move this code, or maybe make it its own subsystem?
libs/wire-subsystems/src/Wire/ConversationSubsystem/Interpreter.hs
Outdated
Show resolved
Hide resolved
libs/wire-subsystems/src/Wire/ConversationSubsystem/Interpreter.hs
Outdated
Show resolved
Hide resolved
libs/wire-subsystems/src/Wire/ConversationSubsystem/Interpreter.hs
Outdated
Show resolved
Hide resolved
| . mapError (const ("Invalid input" :: Text) :: InvalidInput -> Text) | ||
| . mapError @MigrationError (T.pack . show) | ||
| . mapError @InternalError (TL.toStrict . internalErrorDescription) | ||
| . mapError @UnreachableBackends (T.pack . show) | ||
| . mapError @NonFederatingBackends (T.pack . show) | ||
| . mapError @TeamCollaboratorsError (const ("Team collaborators error" :: Text)) | ||
| . mapError @TeamFeatureStoreError (const ("Team feature store error" :: Text)) | ||
| . mapError @(Tagged OperationDenied ()) (const ("Operation denied" :: Text)) | ||
| . mapError @(Tagged 'NotATeamMember ()) (const ("Not a team member" :: Text)) | ||
| . mapError @(Tagged 'ConvAccessDenied ()) (const ("Conversation access denied" :: Text)) | ||
| . mapError @(Tagged 'NotConnected ()) (const ("Not connected" :: Text)) | ||
| . mapError @(Tagged 'MLSNotEnabled ()) (const ("MLS not enabled" :: Text)) | ||
| . mapError @(Tagged 'MLSNonEmptyMemberList ()) (const ("MLS non-empty member list" :: Text)) | ||
| . mapError @(Tagged 'MissingLegalholdConsent ()) (const ("Missing legalhold consent" :: Text)) | ||
| . mapError @(Tagged 'NonBindingTeam ()) (const ("Non-binding team" :: Text)) | ||
| . mapError @(Tagged 'NoBindingTeamMembers ()) (const ("No binding team members" :: Text)) | ||
| . mapError @(Tagged 'TeamNotFound ()) (const ("Team not found" :: Text)) | ||
| . mapError @(Tagged 'InvalidOperation ()) (const ("Invalid operation" :: Text)) | ||
| . mapError @(Tagged 'ConvNotFound ()) (const ("Conversation not found" :: Text)) | ||
| . mapError @(Tagged 'ChannelsNotEnabled ()) (const ("Channels not enabled" :: Text)) | ||
| . mapError @(Tagged 'NotAnMlsConversation ()) (const ("Not an MLS conversation" :: Text)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems verbose and like some duplication. Don't we have instances for these somewhere. Can we reuse them? Or can this be extracted into a singel mapping function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in galley they are converted to http errors, should we somehow group them?
| let remoteDomains = void <$> snd (partitionQualified lusr $ newConv.newConvQualifiedUsers) | ||
| enforceFederationProtocol (baseProtocolToProtocol newConv.newConvProtocol) remoteDomains | ||
| checkFederationStatus (RemoteDomains $ Set.fromList remoteDomains) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if checking the federation status should be implemented in a Federation subsystem, and if the conversation subsystem interpreter should be using it instead of having this here? Should that be part of this PR, too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the new design answers your questions?
…alley.API.Action`, `Galley.API.One2One`, `Galley.API.Util`, partially `Galley.API.Mappings`, partially `Galley.API.Create` to `wire-subsystems`
Co-authored-by: Copilot <[email protected]>
9402379 to
4614d96
Compare
https://wearezeta.atlassian.net/browse/WPB-21964
Checklist
changelog.d