diff --git a/src/Simplex/Chat.hs b/src/Simplex/Chat.hs index 2cf37abb5..7b6f763a8 100644 --- a/src/Simplex/Chat.hs +++ b/src/Simplex/Chat.hs @@ -2882,17 +2882,21 @@ processAgentMessageConn user@User {userId} corrId agentConnId agentMessage = do -- TODO add debugging output _ -> pure () + -- TODO revert to commented function to enable creation of decryption errors chat items agentMsgDecryptError :: AgentErrorType -> Maybe (MsgDecryptError, Word32) - agentMsgDecryptError = \case - AGENT (A_CRYPTO RATCHET_HEADER) -> Just (MDERatchetHeader, 1) - AGENT (A_CRYPTO (RATCHET_SKIPPED n)) -> Just (MDETooManySkipped, n) - -- we are not treating this as decryption error, as in many cases it happens as the result of duplicate or redundant delivery, - -- and we don't have a way to differentiate. - -- we could store the hashes of past messages in the agent, or delaying message deletion after ACK - -- A_DUPLICATE -> Nothing - -- earlier messages may be received in case of redundant delivery, and do not necessarily indicate an error - -- AGENT (A_CRYPTO (RATCHET_EARLIER n)) -> Nothing - _ -> Nothing + agentMsgDecryptError _ = Nothing + + -- agentMsgDecryptError :: AgentErrorType -> Maybe (MsgDecryptError, Word32) + -- agentMsgDecryptError = \case + -- AGENT (A_CRYPTO RATCHET_HEADER) -> Just (MDERatchetHeader, 1) + -- AGENT (A_CRYPTO (RATCHET_SKIPPED n)) -> Just (MDETooManySkipped, n) + -- -- we are not treating this as decryption error, as in many cases it happens as the result of duplicate or redundant delivery, + -- -- and we don't have a way to differentiate. + -- -- we could store the hashes of past messages in the agent, or delaying message deletion after ACK + -- -- A_DUPLICATE -> Nothing + -- -- earlier messages may be received in case of redundant delivery, and do not necessarily indicate an error + -- -- AGENT (A_CRYPTO (RATCHET_EARLIER n)) -> Nothing + -- _ -> Nothing mdeUpdatedCI :: (MsgDecryptError, Word32) -> CChatItem c -> Maybe (ChatItem c 'MDRcv, CIContent 'MDRcv) mdeUpdatedCI (mde', n') (CChatItem _ ci@ChatItem {content = CIRcvDecryptionError mde n}) diff --git a/tests/ChatTests/Direct.hs b/tests/ChatTests/Direct.hs index e54bddb38..0f5fe5f71 100644 --- a/tests/ChatTests/Direct.hs +++ b/tests/ChatTests/Direct.hs @@ -82,7 +82,7 @@ chatDirectTests = do it "mark contact verified" testMarkContactVerified it "mark group member verified" testMarkGroupMemberVerified describe "message errors" $ do - it "show message decryption error and update count" testMsgDecryptError + xit "show message decryption error and update count" testMsgDecryptError testAddContact :: HasCallStack => SpecWith FilePath testAddContact = versionTestMatrix2 runTestAddContact diff --git a/tests/ChatTests/Groups.hs b/tests/ChatTests/Groups.hs index a70117d8c..e74071c3b 100644 --- a/tests/ChatTests/Groups.hs +++ b/tests/ChatTests/Groups.hs @@ -52,7 +52,7 @@ chatGroupTests = do it "group link member role" testGroupLinkMemberRole it "leaving and deleting the group joined via link should NOT delete previously existing direct contacts" testGroupLinkLeaveDelete describe "group message errors" $ do - it "show message decryption error and update count" testGroupMsgDecryptError + xit "show message decryption error and update count" testGroupMsgDecryptError testGroup :: HasCallStack => SpecWith FilePath testGroup = versionTestMatrix3 runTestGroup