Skip to content
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

chore: bump cc to 3.1.0 [WPB-16041] #3292

Merged
merged 4 commits into from
Feb 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ pbandk = "0.14.2"
turbine = "1.1.0"
avs = "9.10.16"
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.0.4"
Expand Down
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 @@ -193,7 +193,7 @@ sealed class NetworkFailure : CoreFailure {
data object FeatureNotSupported : NetworkFailure()
}

interface MLSFailure : CoreFailure {
sealed interface MLSFailure : CoreFailure {

data object WrongEpoch : MLSFailure

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

data class Generic(internal 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
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.logic.CoreFailure
import com.wire.kalium.logic.E2EIFailure
import com.wire.kalium.logic.MLSFailure
import com.wire.kalium.logic.NetworkFailure
import com.wire.kalium.logic.ProteusFailure
import com.wire.kalium.logic.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
Loading