-
Notifications
You must be signed in to change notification settings - Fork 332
Add GET endpoint for subconversations #2869
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
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
ff7716b
Add subconverstion endpoint
94a21a4
Nix-Cabal package changes
f4a383f
Use a qualified action identifier
eeea123
Add golden tests for subconversations
ed1d82f
A couple of TODO and FUTUREWORK notes
1d1ff2c
Simplify the get subconversation test
a46e3fe
Move the initialGroupId function
7f16372
Test injectivity of initialGroupId
6bb4148
Remove a left-over TODO
93d1071
Add changelogs
9d47fff
fixup! Move the initialGroupId function
1c4df29
Remove old notes
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Introduce a subconversation GET endpoint |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Introduce a Galley DB table for subconversations |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Support mapping MLS group IDs to subconversations |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Introduce an effect for subconversations |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 77 additions & 0 deletions
77
libs/wire-api/test/golden/Test/Wire/API/Golden/Manual/SubConversation.hs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| -- This file is part of the Wire Server implementation. | ||
| -- | ||
| -- Copyright (C) 2022 Wire Swiss GmbH <opensource@wire.com> | ||
| -- | ||
| -- This program is free software: you can redistribute it and/or modify it under | ||
| -- the terms of the GNU Affero General Public License as published by the Free | ||
| -- Software Foundation, either version 3 of the License, or (at your option) any | ||
| -- later version. | ||
| -- | ||
| -- This program is distributed in the hope that it will be useful, but WITHOUT | ||
| -- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
| -- FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more | ||
| -- details. | ||
| -- | ||
| -- You should have received a copy of the GNU Affero General Public License along | ||
| -- with this program. If not, see <https://www.gnu.org/licenses/>. | ||
|
|
||
| module Test.Wire.API.Golden.Manual.SubConversation | ||
| ( testObject_PublicSubConversation_1, | ||
| testObject_PublicSubConversation_2, | ||
| ) | ||
| where | ||
|
|
||
| import Data.Domain | ||
| import Data.Id | ||
| import Data.Qualified | ||
| import qualified Data.UUID as UUID | ||
| import Imports | ||
| import Wire.API.MLS.CipherSuite | ||
| import Wire.API.MLS.Credential | ||
| import Wire.API.MLS.Epoch | ||
| import Wire.API.MLS.Group | ||
| import Wire.API.MLS.SubConversation | ||
|
|
||
| subConvId1 :: SubConvId | ||
| subConvId1 = SubConvId "test_group" | ||
|
|
||
| subConvId2 :: SubConvId | ||
| subConvId2 = SubConvId "call" | ||
|
|
||
| domain :: Domain | ||
| domain = Domain "golden.example.com" | ||
|
|
||
| convId :: Qualified ConvId | ||
| convId = | ||
| Qualified | ||
| ( Id (fromJust (UUID.fromString "00000000-0000-0001-0000-000100000001")) | ||
| ) | ||
| domain | ||
|
|
||
| testObject_PublicSubConversation_1 :: PublicSubConversation | ||
| testObject_PublicSubConversation_1 = | ||
| PublicSubConversation | ||
| convId | ||
| subConvId1 | ||
| (GroupId "test_group") | ||
| (Epoch 5) | ||
| MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519 | ||
| [] | ||
|
|
||
| testObject_PublicSubConversation_2 :: PublicSubConversation | ||
| testObject_PublicSubConversation_2 = | ||
| PublicSubConversation | ||
| convId | ||
| subConvId2 | ||
| (GroupId "test_group_2") | ||
| (Epoch 0) | ||
| MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519 | ||
| [mkClientIdentity user cid] | ||
| where | ||
| user :: Qualified UserId | ||
| user = | ||
| Qualified | ||
| ( Id (fromJust (UUID.fromString "00000000-0000-0007-0000-000a00000002")) | ||
| ) | ||
| domain | ||
| cid = ClientId "deadbeef" |
11 changes: 11 additions & 0 deletions
11
libs/wire-api/test/golden/testObject_PublicSubConversation_1.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| { | ||
| "cipher_suite": 1, | ||
| "epoch": 5, | ||
| "group_id": "dGVzdF9ncm91cA==", | ||
| "members": [], | ||
| "parent_qualified_id": { | ||
| "domain": "golden.example.com", | ||
| "id": "00000000-0000-0001-0000-000100000001" | ||
| }, | ||
| "subconv_id": "test_group" | ||
| } |
17 changes: 17 additions & 0 deletions
17
libs/wire-api/test/golden/testObject_PublicSubConversation_2.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| { | ||
| "cipher_suite": 1, | ||
| "epoch": 0, | ||
| "group_id": "dGVzdF9ncm91cF8y", | ||
| "members": [ | ||
| { | ||
| "client_id": "deadbeef", | ||
| "domain": "golden.example.com", | ||
| "user_id": "00000000-0000-0007-0000-000a00000002" | ||
| } | ||
| ], | ||
| "parent_qualified_id": { | ||
| "domain": "golden.example.com", | ||
| "id": "00000000-0000-0001-0000-000100000001" | ||
| }, | ||
| "subconv_id": "call" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
libs/wire-api/test/unit/Test/Wire/API/MLS/SubConversation.hs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| -- This file is part of the Wire Server implementation. | ||
| -- | ||
| -- Copyright (C) 2022 Wire Swiss GmbH <opensource@wire.com> | ||
| -- | ||
| -- This program is free software: you can redistribute it and/or modify it under | ||
| -- the terms of the GNU Affero General Public License as published by the Free | ||
| -- Software Foundation, either version 3 of the License, or (at your option) any | ||
| -- later version. | ||
| -- | ||
| -- This program is distributed in the hope that it will be useful, but WITHOUT | ||
| -- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
| -- FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more | ||
| -- details. | ||
| -- | ||
| -- You should have received a copy of the GNU Affero General Public License along | ||
| -- with this program. If not, see <https://www.gnu.org/licenses/>. | ||
|
|
||
| module Test.Wire.API.MLS.SubConversation where | ||
|
|
||
| import Data.Domain | ||
| import Data.Id | ||
| import Data.Qualified | ||
| import Imports | ||
| import Test.QuickCheck | ||
| import Test.Tasty | ||
| import Test.Tasty.QuickCheck | ||
| import Wire.API.MLS.SubConversation | ||
|
|
||
| tests :: TestTree | ||
| tests = | ||
| testGroup | ||
| "Subconversation" | ||
| [ testProperty "injectivity of the initial group ID mapping" $ | ||
| forAll genIds injectiveInitialGroupId | ||
| ] | ||
| where | ||
| genIds :: Gen (ConvId, SubConvId, SubConvId) | ||
| genIds = do | ||
| s1 <- arbitrary | ||
| (,,) <$> arbitrary <*> pure s1 <*> arbitrary `suchThat` (/= s1) | ||
|
|
||
| injectiveInitialGroupId :: (ConvId, SubConvId, SubConvId) -> Property | ||
| injectiveInitialGroupId (cnv, scnv1, scnv2) = do | ||
| let domain = Domain "group.example.com" | ||
| lcnv = toLocalUnsafe domain cnv | ||
| initialGroupId lcnv scnv1 =/= initialGroupId lcnv scnv2 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
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 tests that they'll (probably) never overlap, but we could also test that the deterministic nature of the function also holds true.
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 the way we have it now, i.e., without running in any monad that could leave room for non-determinism, we don't have to test that as all "pure" functions are deterministic. If we were to run it in some monad
mwe'd have to change the test anyway.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.
Fair enough 👍