Skip to content

Conversation

mdimjasevic
Copy link
Contributor

This PR is a carved out part of #3324 that relates to conversation creation only.

When a Proteus conversation is created and remote members are added to it as part of the request to POST /conversations, remote clients now get two events: a conversation.create event as before with a subset of other members, and also a conversation.member-join event once the list of all remote members is confirmed. Local users get only the conversation.create event as before with the full list of members.

For details see https://wearezeta.atlassian.net/wiki/spaces/CORE/pages/751435862/Offline+backend+handling+-+analysis+of+creating+a+conversation#Events-for-joining-clients.

Tracked by https://wearezeta.atlassian.net/browse/WPB-1085.

Checklist

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

- Conversation creation at this point was able to fail only because
remotes were unreachable. As of recently this is handled gracefully: no
more throwing in IO, but rather reporting to the creator that some
remote users could not be added
@mdimjasevic mdimjasevic requested a review from fisx June 16, 2023 12:36
@zebot zebot added the ok-to-test Approved for running tests in CI, overrides not-ok-to-test if both labels exist label Jun 16, 2023
@mdimjasevic mdimjasevic changed the title [WPB-1085] Two-event member adding process during conversation creation flow [WPB-1085] Two-event member adding process during conversation creation Jun 16, 2023
allRemoteMembersQualified = remoteMemberQualify <$> allRemoteMembers
allRemoteBuckets :: [Remote [RemoteMember]] = bucketRemote allRemoteMembersQualified
rc = toConversationCreated now c
failedToNotify <- fmap (foldMap (either (sequenceA . fst) mempty)) $
Copy link
Contributor

Choose a reason for hiding this comment

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

this looks weird.

the type of the second argument of this fmap is [Either (Remote [RemoteMember], FederationError) (Remote ())].

  • shouldn't we keep the buckets with the different remotes, rather than filtering out again below in line 786?
  • why does the FederationError have to be the same value for all remote members? shouldn't it be allowed to differ between members?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The comment is referring to old code so I'm not sure my reply will address your concerns, but here's an attempt:

  1. Regarding keeping them in buckets, there are a few variations of the same data, but in different types, each suitable for a slightly different need. We do have buckets around too.
  2. The same FederationError question is, I believe, addressed by the observation I made yesterday during the call: there's no incremental update from a remote backend on the progress of processing member updates, so either all of members are added successfully or there is a failure, e.g., a FederationError is returned, in which case none of the remote backend's users are considered to be conversation members.

@mdimjasevic mdimjasevic requested review from fisx and battermann July 4, 2023 13:59
@mdimjasevic
Copy link
Contributor Author

@fisx and @battermann , I've merged the latest develop into the PR and cleaned up the PR a bit (fixed a few typos, made tiny changes to haddock, and removed the unused EventWithUnreachables type). I believe it's good to be merged now.

Let me know if you have any further feedback, remarks, or questions.

Copy link
Contributor

@battermann battermann left a comment

Choose a reason for hiding this comment

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

LGTM

Co-authored-by: Leif Battermann <[email protected]>
@mdimjasevic mdimjasevic merged commit d1f4295 into develop Jul 5, 2023
@mdimjasevic mdimjasevic deleted the wpb-1085/two-event-conversation-create branch July 5, 2023 08:10
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.

4 participants