-
Notifications
You must be signed in to change notification settings - Fork 333
[FS-1148] Backport general changes from mls
to develop
#3322
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
[FS-1148] Backport general changes from mls
to develop
#3322
Conversation
f69d3ec
to
3f869aa
Compare
3f869aa
to
962a955
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.
looks good to me! found some nit-picks.
MLSMessageResponseUnreachableBackends (Set Domain) | ||
| -- | If the list of unreachable users is non-empty, it corresponds to users | ||
-- that an application message could not be sent to. | ||
MLSMessageResponseUpdates [ConversationUpdate] (Maybe UnreachableUsers) |
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.
Maybe (NonEmpty ..)
instead of just [..]
is a bit silly, but ok. :) that discussion doesn't belong into this PR.
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.
Also, can you explain in the haddocks how users can be unreachable, if not by their backend being unreachable? (If this is obvious to most readers let me know; I have very little context on MLS yet.)
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.
Maybe (NonEmpty ..)
instead of just[..]
is a bit silly, but ok. :) that discussion doesn't belong into this PR.
They are isomorphic. I did get some mileage out of my choice over the alternative, but nothing big.
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.
Also, can you explain in the haddocks how users can be unreachable, if not by their backend being unreachable? (If this is obvious to most readers let me know; I have very little context on MLS yet.)
This comes by extension: if a remote backend is unreachable, all of the users on that backend are unreachable too.
Are you confused by the fact I introduced two data constructors for seemingly the same thing ? In the first one, a commit is considered (therefore, an MLS protocol message) and it either fails (e.g., because some backends are unreachable) or succeeds (all backends are reachable); no partiality allowed. In the second one, an application message is considered and it is fine if it cannot be delivered to some users.
If you can clarify this, that would be great as that would help me understand what should be added to haddocks.
federationUnreachableError (Set.map domainText -> ds) = | ||
Wai.mkError | ||
status | ||
"federation-unreachable-domains-error" | ||
("The following domains are unreachable: " <> (LT.pack . show . Set.toList) ds) |
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.
federationUnreachableError (Set.map domainText -> ds) = | |
Wai.mkError | |
status | |
"federation-unreachable-domains-error" | |
("The following domains are unreachable: " <> (LT.pack . show . Set.toList) ds) | |
federationUnreachableError ds = | |
Wai.mkError | |
status | |
"federation-unreachable-domains-error" | |
("The following domains are unreachable: " <> (LT.pack . show . fmap domainText . Set.toList) ds) |
withTempMockFederator' commitMocks $ do | ||
sendAndConsumeCommitFederated commit | ||
liftIO $ ftpCommit @?= mempty | ||
sendAndConsumeCommit commit |
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.
have you tried translating this test case into /integration
? i'd give it a (time-boxed) try after this PR has been merged, /integration
is really neat! :)
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 entertained the idea, but many times I need at least three backends that federate, and support for testing that is still in the works.
This change in particular looks like simplifying an existing test, though.
@@ -745,15 +745,15 @@ notifyConversationAction tag quid notifyOrigDomain con lconv targets action = do | |||
-- For now these users will not be able to join the conversation until | |||
-- queueing and retrying is implemented. | |||
let failedNotifies = lefts notifyEithers | |||
for_ failedNotifies $ | |||
logError |
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 about the log level here. is this something we're doing elsewhere? i think for some clients this may be the right log level, others (more hypothetical ones?) will be hit by a lot of noise. (Yes, this discussion also doesn't belong here, sorry :)
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 don't think we're consistent when it comes to logging, including something like this.
@@ -532,6 +543,12 @@ postMLSMessageToRemoteConv loc qusr _senderClient con smsg rcnv = do | |||
MLSMessageResponseProtocolError e -> | |||
throw (mlsProtocolError e) | |||
MLSMessageResponseProposalFailure e -> throw (MLSProposalFailure e) | |||
MLSMessageResponseUnreachableBackends ds -> | |||
throw . InternalErrorWithDescription $ |
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.
de-duplicate this particular internal error and give it a name?
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.
... as in to have a new data constructor for InternalError
that is suited for this specific purpose?
@fisx , I just merged the PR. However, I am still interested in hearing from you regarding my follow-ups to your questions. Once we sort that out, I'll be happy to make another PR to incorporate that too. |
There are a few things I introduced while working on #3304 after Paolo provided good feedback. These are not specific to MLS, hence this PR that backports them to
develop
.Tracked by https://wearezeta.atlassian.net/browse/FS-1148.
Checklist
changelog.d