Skip to content

Comments

FS-1467: Make conversation metadata APIs fault tolerant to federation errors#3229

Merged
mdimjasevic merged 16 commits intowireapp:developfrom
lepsa:FS-1467
May 9, 2023
Merged

FS-1467: Make conversation metadata APIs fault tolerant to federation errors#3229
mdimjasevic merged 16 commits intowireapp:developfrom
lepsa:FS-1467

Conversation

@lepsa
Copy link
Contributor

@lepsa lepsa commented Apr 13, 2023

Checklist

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

Changes

Making conversation metadata APIs fault tolerant of unavailable federation servers.
Adding new tests to check that we get the expected results when federation servers are unavailable.

@lepsa
Copy link
Contributor Author

lepsa commented Apr 13, 2023

@mdimjasevic Can you have a look at this for me.

notifyConversationAction
-- Removing members should be fault tolerant.
( case tag of
-- Removing members should be fault tolerant.
Copy link
Contributor

Choose a reason for hiding this comment

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

Should've brought this up before, but I'm feeling a case of boolean blindness here. Could we use a more descriptive type? 🤞

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fair enough, I've swapped it for a new type with better names.

let action = ConversationJoin neUsers role
pure (bmFromMembers lmems rmems, action)

data FederationFailEarly
Copy link
Contributor

Choose a reason for hiding this comment

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

👌🏼

Copy link
Contributor

@mdimjasevic mdimjasevic left a comment

Choose a reason for hiding this comment

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

Looks good! I believe you forgot to invoke those tests in Federation.hs so please double-check that before merging.

<!! const 200 === statusCode
liftIO $ map omQualifiedId (cmOthers (cnvMembers conv2)) @?= [bob]

-- @END
Copy link
Contributor

Choose a reason for hiding this comment

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

Please remove this comment tag as it will otherwise mess up a test report the QA team generates. Conversely, you can add its counterpart before the test to make it a whole, but I'm not sure what should go in there.

mkMember quid = OtherMember quid Nothing roleNameWireMember
fedGalleyClient <- view tsFedGalleyClient

mapM_ (`connectWithRemoteUser` qbob) [alice]
Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't this a strange way of saying connectWithRemoteUser alice qbob?

Comment on lines +555 to +585
notifyConvRenameUnavailable :: TestM ()
notifyConvRenameUnavailable = do
let d = ConversationRename "gossip++"
notifyUpdateUnavailable [] (SomeConversationAction (sing @'ConversationRenameTag) d) ConvRename (EdConvRename d)

notifyMessageTimerUnavailable :: TestM ()
notifyMessageTimerUnavailable = do
let d = ConversationMessageTimerUpdate (Just 5000)
notifyUpdateUnavailable
[]
(SomeConversationAction (sing @'ConversationMessageTimerUpdateTag) d)
ConvMessageTimerUpdate
(EdConvMessageTimerUpdate d)

notifyReceiptModeUnavailable :: TestM ()
notifyReceiptModeUnavailable = do
let d = ConversationReceiptModeUpdate (ReceiptMode 42)
notifyUpdateUnavailable
[]
(SomeConversationAction (sing @'ConversationReceiptModeUpdateTag) d)
ConvReceiptModeUpdate
(EdConvReceiptModeUpdate d)

notifyAccessUnavailable :: TestM ()
notifyAccessUnavailable = do
let d = ConversationAccessData (Set.fromList [InviteAccess, LinkAccess]) (Set.fromList [TeamMemberAccessRole])
notifyUpdateUnavailable
[]
(SomeConversationAction (sing @'ConversationAccessDataTag) d)
ConvAccessUpdate
(EdConvAccessUpdate d)
Copy link
Contributor

Choose a reason for hiding this comment

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

You forgot to list and therefore actually call these tests in the tests function on line 67, didn't you?

lepsa and others added 2 commits April 24, 2023 19:00
- Maybe it works now. Integration test SSL certificates expired and a
merged PR from less than an hour ago fixed that
@mdimjasevic
Copy link
Contributor

@lepsa , this still hasn't run in the CI so please don't merge just yet.

@elland elland added the ok-to-test Approved for running tests in CI, overrides not-ok-to-test if both labels exist label May 8, 2023
((), _fedRequests) <-
withTempMockFederator' (throw $ MockErrorResponse Http.status500 "Down for maintenance") $
runFedClient @"on-conversation-updated" fedGalleyClient bdom cu
putStrLn $ "on-conversation-updated: " <> show _fedRequests
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you remove this debugging line?

@mdimjasevic
Copy link
Contributor

mdimjasevic commented May 9, 2023

@lepsa , before merging there are conflicts to be resolved in these files:

services/galley/src/Galley/API/Action.hs
services/galley/src/Galley/API/Federation.hs
services/galley/src/Galley/API/Update.hs 

@mdimjasevic
Copy link
Contributor

@lepsa , before merging there are conflicts to be resolved in these files:

services/galley/src/Galley/API/Action.hs
services/galley/src/Galley/API/Federation.hs
services/galley/src/Galley/API/Update.hs 

I started resolving these.

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.

3 participants