Skip to content

Commit

Permalink
chore: bump cc to 3.1.0 [WPB-16041] 🍒 (#3293)
Browse files Browse the repository at this point in the history
* Commit with unresolved merge conflicts

* Update CoreFailure.kt

* Update MLSMessageFailureHandler.kt

* merge conflicts

* detekt

---------

Co-authored-by: Mohamad Jaara <[email protected]>
  • Loading branch information
github-actions[bot] and MohamadJaara authored Feb 18, 2025
1 parent 4abd575 commit 7c462ea
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,21 @@ actual fun mapMLSException(exception: Exception): MLSFailure =
is MlsException.StaleCommit -> MLSFailure.StaleCommit
is MlsException.ConversationAlreadyExists -> MLSFailure.ConversationAlreadyExists
is MlsException.MessageEpochTooOld -> MLSFailure.MessageEpochTooOld
else -> MLSFailure.Generic(exception)

is MlsException.Other -> {
if ((exception.v1 as MlsException.Other).v1
.startsWith(COMMIT_FOR_MISSING_PROPOSAL)
) {
MLSFailure.CommitForMissingProposal
} else {
MLSFailure.Other
}
}

is MlsException.OrphanWelcome -> MLSFailure.Generic(exception)
}
} else {
MLSFailure.Generic(exception)
}

private const val COMMIT_FOR_MISSING_PROPOSAL = "Incoming message is a commit for which we have not yet received all the proposals"
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ sealed class NetworkFailure : CoreFailure {
data object FeatureNotSupported : NetworkFailure()
}

interface MLSFailure : CoreFailure {
sealed interface MLSFailure : CoreFailure {

data object WrongEpoch : MLSFailure

Expand All @@ -200,10 +200,9 @@ interface MLSFailure : CoreFailure {
data object StaleCommit : MLSFailure
data object InternalErrors : MLSFailure
data object Disabled : MLSFailure

data class Generic(val exception: Exception) : MLSFailure {
val rootCause: Throwable get() = exception
}
data object Other : MLSFailure
data object CommitForMissingProposal : MLSFailure
data class Generic(val rootCause: Throwable) : MLSFailure
}

interface E2EIFailure : CoreFailure {
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ pbandk = "0.15.0"
turbine = "1.1.0"
avs = "10.0.5"
jna = "5.14.0"
core-crypto = "3.0.2"
core-crypto = "3.1.0"
core-crypto-multiplatform = "0.6.0-rc.3-multiplatform-pre1"
completeKotlin = "1.1.0"
desugar-jdk = "2.1.3"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@
package com.wire.kalium.logic.sync.receiver.conversation.message

import com.wire.kalium.common.error.CoreFailure
import com.wire.kalium.common.error.E2EIFailure
import com.wire.kalium.common.error.MLSFailure
import com.wire.kalium.common.error.NetworkFailure
import com.wire.kalium.common.error.ProteusFailure
import com.wire.kalium.common.error.StorageFailure

sealed class MLSMessageFailureResolution {
data object Ignore : MLSMessageFailureResolution()
Expand All @@ -31,20 +35,45 @@ internal object MLSMessageFailureHandler {
return when (failure) {
// Received messages targeting a future epoch (outside epoch bounds), we might have lost messages.
is MLSFailure.WrongEpoch -> MLSMessageFailureResolution.OutOfSync

// Received already sent or received message, can safely be ignored.
is MLSFailure.DuplicateMessage -> MLSMessageFailureResolution.Ignore
// Received message was targeting a future epoch and been buffered, can safely be ignored.
is MLSFailure.BufferedFutureMessage -> MLSMessageFailureResolution.Ignore
// Received self commit, any unmerged group has know been when merged by CoreCrypto.
is MLSFailure.SelfCommitIgnored -> MLSMessageFailureResolution.Ignore
// Message arrive in an unmerged group, it has been buffered and will be consumed later.
is MLSFailure.UnmergedPendingGroup -> MLSMessageFailureResolution.Ignore
is MLSFailure.StaleProposal -> MLSMessageFailureResolution.Ignore
is MLSFailure.StaleCommit -> MLSMessageFailureResolution.Ignore
is MLSFailure.MessageEpochTooOld -> MLSMessageFailureResolution.Ignore
is MLSFailure.InternalErrors -> MLSMessageFailureResolution.Ignore
is MLSFailure.Disabled -> MLSMessageFailureResolution.Ignore
else -> MLSMessageFailureResolution.InformUser
is MLSFailure.DuplicateMessage,
// Received message was targeting a future epoch and been buffered, can safely be ignored.
is MLSFailure.BufferedFutureMessage,
// Received self commit, any unmerged group has know been when merged by CoreCrypto.
is MLSFailure.SelfCommitIgnored,
// Message arrive in an unmerged group, it has been buffered and will be consumed later.
is MLSFailure.UnmergedPendingGroup,
is MLSFailure.StaleProposal,
is MLSFailure.StaleCommit,
is MLSFailure.MessageEpochTooOld,
is MLSFailure.InternalErrors,
is MLSFailure.Disabled,
MLSFailure.CommitForMissingProposal,
is CoreFailure.DevelopmentAPINotAllowedOnProduction -> MLSMessageFailureResolution.Ignore

MLSFailure.ConversationAlreadyExists,
MLSFailure.ConversationDoesNotSupportMLS,
is MLSFailure.Generic,
is MLSFailure.Other,
is E2EIFailure,
is CoreFailure.FeatureFailure,
CoreFailure.MissingClientRegistration,
is CoreFailure.MissingKeyPackages,
NetworkFailure.FeatureNotSupported,
is NetworkFailure.FederatedBackendFailure.ConflictingBackends,
is NetworkFailure.FederatedBackendFailure.FailedDomains,
is NetworkFailure.FederatedBackendFailure.FederationDenied,
is NetworkFailure.FederatedBackendFailure.FederationNotEnabled,
is NetworkFailure.FederatedBackendFailure.General,
is NetworkFailure.NoNetworkConnection,
is NetworkFailure.ProxyError,
is NetworkFailure.ServerMiscommunication,
is ProteusFailure,
StorageFailure.DataNotFound,
is StorageFailure.Generic,
is CoreFailure.Unknown -> MLSMessageFailureResolution.InformUser

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ class ConversationGroupRepositoryTest {
conversationGroupRepository.addService(serviceID, TestConversation.ID)
.shouldFail {
assertIs<MLSFailure.Generic>(it)
assertIs<UnsupportedOperationException>(it.exception)
assertIs<UnsupportedOperationException>(it.rootCause)
}

coVerify {
Expand Down

0 comments on commit 7c462ea

Please sign in to comment.