-
Notifications
You must be signed in to change notification settings - Fork 333
KeyPackage -> Conversation Internal API #2375
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
Conversation
aca601d
to
3954b8e
Compare
3954b8e
to
f4a025b
Compare
59fabf4
to
f2f3545
Compare
f2f3545
to
0236542
Compare
0236542
to
28bb8c0
Compare
28bb8c0
to
c24a455
Compare
c24a455
to
2961368
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, but it's not entirely clear to me if this is the API that we'll need. For example, when dereferencing a recipient of a welcome message, it might be useful to fetch both the user and the corresponding conversation at the same time, instead of making two calls to brig.
But this is ok for now, we can always add more endpoints later.
@@ -201,6 +217,87 @@ testFeatureConferenceCallingByAccount (Opt.optSettings -> settings) mgr db brig | |||
check $ ApiFt.TeamFeatureStatusNoConfig ApiFt.TeamFeatureDisabled | |||
check' | |||
|
|||
keyPackageCreate :: HasCallStack => Brig -> Http KeyPackageRef |
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.
Isn't this test basically contained in testKeyPackageClaim
in API.MLS
?
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 isn't a test itself, it's a helper function to get a valid, claimed ref.
kpcPut :: HasCallStack => Brig -> KeyPackageRef -> Qualified ConvId -> Http () | ||
kpcPut brig ref qConv = do | ||
resp <- | ||
put | ||
( brig | ||
. paths ["i", "mls", "key-packages", toByteString' $ toUrlPiece ref, "conversation"] | ||
. contentJson | ||
. json qConv | ||
) | ||
liftIO $ assertEqual "PUT i/mls/key-packages/:ref/conversation failed" 204 (statusCode resp) |
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.
kpcPut :: HasCallStack => Brig -> KeyPackageRef -> Qualified ConvId -> Http () | |
kpcPut brig ref qConv = do | |
resp <- | |
put | |
( brig | |
. paths ["i", "mls", "key-packages", toByteString' $ toUrlPiece ref, "conversation"] | |
. contentJson | |
. json qConv | |
) | |
liftIO $ assertEqual "PUT i/mls/key-packages/:ref/conversation failed" 204 (statusCode resp) | |
kpcPut brig ref qConv = | |
put | |
( brig | |
. paths ["i", "mls", "key-packages", toByteString' $ toUrlPiece ref, "conversation"] | |
. contentJson | |
. json qConv | |
) | |
!!! const 204 === statusCode |
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 think I prefer the custom message, since this failure might occur inside 3-4 different tests.
q = "SELECT conv_domain, conv FROM mls_key_package_refs WHERE ref = ?" | ||
|
||
-- We want to proper update, not an upsert, to avoid "ghost" refs without user+client | ||
keyPackageRefSetConvId :: MonadClient m => KeyPackageRef -> Qualified ConvId -> m Bool |
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 is probably ok, but we might also want to consider the more simple-minded approach of checking existence first, then updating, as we do in various other places.
I had this in PR #2368 (commit 320c309), but later I realised I don't need it for that PR and reverted the commit. @stephen-smith , feel free to adopt it as part of your PR. |
I didn't want to change the public API (and disrupt other teams) for this intra-service communication feature, since it's still on the horizon to merge galley and brig, but I'll look into it. One query to grab the whole row is going to be more efficient for the computers, certainly. |
Hmm, that's actually in the Internal API. Going to merge as-is for now, but since both those queries are internal I might merge them as part of the next round of changes. |
https://wearezeta.atlassian.net/browse/FS-532 (partial, brig changes)
New endpoints are not in use, but brig will need to be deployed before galley, which I think is the status quo.
Checklist
changelog.d
.