Skip to content
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

extend on-new-remote-conversation by the subconv ID #2997

Merged
merged 22 commits into from
Feb 1, 2023

Conversation

stefanwire
Copy link
Contributor

@stefanwire stefanwire commented Jan 17, 2023

When a subconversation is created, all backends involved in the main conversation need to be notified, so that they create a group ID → subconversation mapping. Otherwise, commits coming from clients on those backends cannot be routed.

Similarly, when a user from a new backend B joins a conversation containing non-empty subconversations, it needs to be informed of those subconversations, so that (external) commits for those subconversations coming from clients in B can be routed.

https://wearezeta.atlassian.net/browse/FS-1451

TODO

  • Split federation endpoint into on-new-remote-conversation and on-new-remote-subconversation
  • Call on-new-remote-subconversation when a new subconversation is created
  • Call on-new-remote-subconversation for all existing subconversations when a new backend gets involved
  • Call on-new-remote-subconversation when a subconversation is reset
  • Integration tests
  • Subconversation End-to-end tests
  • (optional) Split executeProposalAction into one function for conversations and one for subconversations

Checklist

  • Add a new entry in an appropriate subdirectory of changelog.d
  • Read and follow the PR guidelines

@stefanwire stefanwire temporarily deployed to cachix January 17, 2023 16:35 — with GitHub Actions Inactive
@stefanwire stefanwire temporarily deployed to cachix January 17, 2023 16:35 — with GitHub Actions Inactive
@stefanwire stefanwire changed the base branch from develop to mls January 17, 2023 16:35
@zebot zebot added the ok-to-test Approved for running tests in CI, overrides not-ok-to-test if both labels exist label Jan 17, 2023
@stefanwire stefanwire marked this pull request as ready for review January 17, 2023 16:37
services/galley/src/Galley/API/Federation.hs Outdated Show resolved Hide resolved
@@ -220,6 +220,8 @@ ccRemoteOrigUserId cc = qualifyAs (ccCnvId cc) (ccOrigUserId cc)
data NewRemoteConversation = NewRemoteConversation
{ -- | The conversation ID, local to the backend invoking the RPC.
nrcConvId :: ConvId,
-- | The subconversation, if set.
nrcSubConvId :: Maybe SubConvId,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a fan of encoding things with such ambiguity. It's a bit unintuitive that this maps to a sub-conversation if this value is present. Could we change this into a sum type instead?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is a sum type (Maybe). I'm not sure where the ambiguity is. We are using the same representation for events.

Copy link
Contributor

@mdimjasevic mdimjasevic Jan 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The way we handled a need for a change like this before is to use the ConvOrSubConvId type instead of ConvId, and that type can carry either of the conv ID or the full subconv ID (maybe modulo the domain). This would be a change that affects the federation API beyond MLS, so I'd recommend a separate PR to develop just to change these types/API and then rebase the PR to mls on top of it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm still not sure what we are looking to achieve. What is the problem with the current representation?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's nothing wrong. It will get the job done. It's just not consistent with how it was done before, but maybe we shouldn't worry about it.

Another note: the way I did such a change before is to split the request type into two: one for Proteus (which doesn't feature subconversations) and one for MLS. It could be done here too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be the first commit in develop and the second in mls. This would require SubConversationStore in develop which doesn't exist there yet.

Copy link
Contributor

@mdimjasevic mdimjasevic Jan 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be the first commit in develop and the second in mls. This would require SubConversationStore in develop which doesn't exist there yet.

Unfortunately, the links lead to nowhere now (I suppose due to a rebase). The split of the message sending types that I was referring to was in PR #2925. There I didn't need the SubConversationStore effect, but your mileage might vary.

@stefanwire stefanwire temporarily deployed to cachix January 18, 2023 10:01 — with GitHub Actions Inactive
@stefanwire stefanwire temporarily deployed to cachix January 18, 2023 10:01 — with GitHub Actions Inactive
@pcapriotti pcapriotti marked this pull request as draft January 18, 2023 10:02
@stefanwire stefanwire temporarily deployed to cachix January 18, 2023 10:12 — with GitHub Actions Inactive
@stefanwire stefanwire temporarily deployed to cachix January 18, 2023 10:12 — with GitHub Actions Inactive
@stefanwire stefanwire temporarily deployed to cachix January 18, 2023 14:00 — with GitHub Actions Inactive
@stefanwire stefanwire temporarily deployed to cachix January 18, 2023 14:00 — with GitHub Actions Inactive
@stefanwire stefanwire temporarily deployed to cachix January 18, 2023 14:10 — with GitHub Actions Inactive
@stefanwire stefanwire temporarily deployed to cachix January 18, 2023 14:10 — with GitHub Actions Inactive
@stefanwire stefanwire temporarily deployed to cachix January 19, 2023 16:42 — with GitHub Actions Inactive
@stefanwire stefanwire temporarily deployed to cachix January 19, 2023 16:42 — with GitHub Actions Inactive
@stefanwire stefanwire temporarily deployed to cachix January 20, 2023 10:31 — with GitHub Actions Inactive
@stefanwire stefanwire temporarily deployed to cachix January 20, 2023 10:31 — with GitHub Actions Inactive
@pcapriotti pcapriotti temporarily deployed to cachix January 20, 2023 10:59 — with GitHub Actions Inactive
@pcapriotti pcapriotti temporarily deployed to cachix January 20, 2023 10:59 — with GitHub Actions Inactive
@pcapriotti pcapriotti temporarily deployed to cachix January 20, 2023 14:32 — with GitHub Actions Inactive
@pcapriotti pcapriotti temporarily deployed to cachix January 20, 2023 14:32 — with GitHub Actions Inactive
@stefanwire stefanwire temporarily deployed to cachix January 20, 2023 14:41 — with GitHub Actions Inactive
@stefanwire stefanwire marked this pull request as ready for review January 31, 2023 15:54
@smatting smatting assigned smatting and unassigned smatting Jan 31, 2023
@smatting smatting self-requested a review January 31, 2023 16:38
pure (scMLSData sconv)

-- notify all backends that the subconversation has a new ID
let remotes = Set.fromList (map (void . rmId) (convRemoteMembers cnv))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit-pick: in other places we've used bucketRemote instead of Set.fromList

Comment on lines 1372 to 1374
-- TODO: only do this for new subconversations (i.e. Epoch 1)
-- call `on-new-remote-conversation` on all the remote backends involved in
-- the main conversation
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

still left to do?

services/galley/test/integration/API/MLS.hs Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ok-to-test Approved for running tests in CI, overrides not-ok-to-test if both labels exist
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants