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

fix: repositoriesShouldNotAccessFeature in MLSConversationRepository [WPB-6326] #2736

Conversation

borichellow
Copy link
Contributor

What's new in this PR?

Issues

MLSConversationRepository was accessing the useCase from Feature module

Causes (Optional)

It was done like that

Solutions

Move CheckRevocationListUseCase into Logic module and update it to not use UseCases from the Feature.
This UseCase is used only in kalium, so it doesn't affect Android part.

Copy link
Contributor

github-actions bot commented May 2, 2024

Test Results

2 170 tests   - 868   2 164 ✔️  - 770   8s ⏱️ - 3m 34s
       1 suites  - 527          6 💤  -   98 
       1 files    - 527          0 ±    0 

Results for commit df441cc. ± Comparison against base commit fac18ff.

This pull request removes 3038 and adds 2170 tests. Note that renamed tests count towards both.
PocIntegrationTest ‑ givenApiWhenGettingACMEDirectoriesThenReturnAsExpectedBasedOnNetworkState
PocIntegrationTest ‑ givenEmailAndPasswordWhenLoggingInThenRegisterClientAndLogout
com.wire.kalium.HttpClientConnectionSpecsTest ‑ givenOkHttpSingleton_whenBuildingClearTextTrafficOkhttpClient_thenEnsureConnectionSpecClearText[jvm]
com.wire.kalium.HttpClientConnectionSpecsTest ‑ givenTheHttpClientIsCreated_ThenEnsureOnlySupportedSpecsArePresent[jvm]
com.wire.kalium.api.base.authenticated.notification.AccessUpdateTest ‑ givenPayloadWithAccessRoleAndDeprecatedAccessRoleField_whenDecoding_thenDeprecatedFieldIsPreferred[jvm]
com.wire.kalium.api.base.authenticated.notification.AccessUpdateTest ‑ givenPayloadWithDeprecatedAccessRoleField_whenDecoding_thenSuccess[jvm]
com.wire.kalium.api.base.authenticated.notification.AccessUpdateTest ‑ givenPayload_whenDecoding_thenSuccess[jvm]
com.wire.kalium.api.common.ACMEApiTest ‑ givenNoLocationInHeader_whenCallingSendAcmeRequestApi_theResponseShouldBeConfigureCorrectly[jvm]
com.wire.kalium.api.common.ACMEApiTest ‑ givenNoNonce_whenCallingSendAcmeRequestApi_theResponseShouldBeMissingNonce[jvm]
com.wire.kalium.api.common.ACMEApiTest ‑ givingASuccessfulResponse_whenGettingACMEFederationCertificateChain_thenAllCertificatesShouldBeParsed[jvm]
…
com.wire.kalium.logic.cache.SelfConversationIdProviderTest ‑ givenFailure_thenErrorIsPropagated
com.wire.kalium.logic.cache.SelfConversationIdProviderTest ‑ givenMLSClientHasBeenRegistered_thenMLSAndProteusSelfConversationAreReturned
com.wire.kalium.logic.cache.SelfConversationIdProviderTest ‑ givenMLSClientHasNotBeenRegistered_thenProteusSelfConversationIsReturned
com.wire.kalium.logic.client.E2EIClientProviderTest ‑ givenIsNewClientTrue_whenGettingE2EIClient_newAcmeEnrollmentCalled
com.wire.kalium.logic.client.E2EIClientProviderTest ‑ givenMLSClientWithE2EI_whenGettingE2EIClient_callsNewActivationEnrollment
com.wire.kalium.logic.client.E2EIClientProviderTest ‑ givenMLSClientWithoutE2EI_whenGettingE2EIClient_callsNewRotateEnrollment
com.wire.kalium.logic.client.E2EIClientProviderTest ‑ givenSelfUserNotFound_whenGettingE2EIClient_ReturnsError
com.wire.kalium.logic.configuration.CustomServerConfigRepositoryTest ‑ givenStoredConfigLinksAndVersionInfoData_whenAddingNewOne_thenCommonApiShouldBeCalculatedAndConfigShouldBeStored
com.wire.kalium.logic.configuration.CustomServerConfigRepositoryTest ‑ givenStoredConfig_whenAddingNewOne_thenNewOneShouldBeInsertedAndReturned
com.wire.kalium.logic.configuration.CustomServerConfigRepositoryTest ‑ givenStoredConfig_whenAddingTheSameOneWithNewApiVersionParams_thenStoredOneShouldBeUpdatedAndReturned
…
This pull request removes 104 skipped tests and adds 6 skipped tests. Note that renamed tests count towards both.
PocIntegrationTest ‑ givenApiWhenGettingACMEDirectoriesThenReturnAsExpectedBasedOnNetworkState
PocIntegrationTest ‑ givenEmailAndPasswordWhenLoggingInThenRegisterClientAndLogout
com.wire.kalium.api.common.ACMEApiTest ‑ whenCallingGeTrustAnchorsApi_theResponseShouldBeConfigureCorrectly[jvm]
com.wire.kalium.api.common.ACMEApiTest ‑ whenCallingSendChallengeRequestApi_theResponseShouldBeConfigureCorrectly[jvm]
com.wire.kalium.api.v0.user.register.RegisterApiV0Test ‑ givenAValidEmail_whenActivationEmailWIthCode_theRequestShouldBeConfiguredCorrectly[jvm]
com.wire.kalium.api.v0.user.register.RegisterApiV0Test ‑ givenAValidEmail_whenRegisteringAccountWithEMail_theRequestShouldBeConfiguredCorrectly[jvm]
com.wire.kalium.api.v0.user.register.RegisterApiV0Test ‑ givenAValidEmail_whenSendingActivationEmail_theRequestShouldBeConfiguredCorrectly[jvm]
com.wire.kalium.api.v0.user.register.RegisterApiV0Test ‑ givenActivationCodeFail_thenErrorIsPropagated[jvm]
com.wire.kalium.api.v0.user.register.RegisterApiV0Test ‑ givenRegistrationFail_whenRegisteringAccountWithEMMail_thenErrorIsPropagated[jvm]
com.wire.kalium.api.v0.user.register.RegisterApiV0Test ‑ givenSendActivationCodeFail_thenErrorIsPropagated[jvm]
…
com.wire.kalium.logic.feature.backup.RestoreBackupUseCaseTest ‑ givenACorrectlyEncryptedBackup_whenRestoringWithWrongPassword_thenTheRightErrorIsThrown
com.wire.kalium.logic.feature.backup.RestoreBackupUseCaseTest ‑ givenAnEncryptedBackupFileFromDifferentUserID_whenRestoring_thenTheRightErrorIsThrown
com.wire.kalium.logic.feature.call.CallManagerTest ‑ givenCallManager_whenCallingMessageIsReceived_then_wcall_recv_msg_IsCalled
com.wire.kalium.logic.feature.conversation.ObserveConversationListDetailsUseCaseTest ‑ null
com.wire.kalium.logic.feature.session.DeleteSessionUseCaseTest ‑ givenSuccess_WhenDeletingSessionLocally_thenSuccessAndResourcesAreFreed
com.wire.kalium.logic.sync.incremental.EventProcessingHistoryTest ‑ measureContainsTimeOverLargeAmountOfEvents

♻️ This comment has been updated with latest results.

@datadog-wireapp
Copy link

datadog-wireapp bot commented May 2, 2024

Datadog Report

Branch report: fix/repository_should_not_access_feature_in_mls_conversation_repository
Commit report: a41189a
Test service: kalium-jvm

✅ 0 Failed, 2934 Passed, 104 Skipped, 14m 29.03s Wall Time

@mchenani mchenani added this pull request to the merge queue May 3, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to no response for status checks May 3, 2024
@yamilmedina yamilmedina added this pull request to the merge queue May 3, 2024
Copy link
Member

@vitorhugods vitorhugods left a comment

Choose a reason for hiding this comment

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

Nice to dedicate some time to fix this.

But I think just moving the file and adding "internal" to the name isn't enough.

This is just moving a "UseCase" to data, which is not a pattern we should follow.

Unlike real use cases, this one is not public, it shouldn't be used by the apps.

It's an internal, reusable piece of logic that other use cases (and even repositories) are using. So removing this suffix would be better.

@@ -35,15 +36,18 @@ interface CheckRevocationListUseCase {
suspend operator fun invoke(url: String): Either<CoreFailure, ULong?>
}

internal class CheckRevocationListUseCaseImpl(
internal class CheckRevocationListInternalUseCaseImpl(
Copy link
Member

Choose a reason for hiding this comment

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

I think we should reserve the name UseCase for exposing functionality to the apps.

It isn't gonna be public and usable by the apps. So no need to be named a "UseCase" when it isn't.

Suggested change
internal class CheckRevocationListInternalUseCaseImpl(
internal class RevocationListCheckerImpl(

Also, no need to be a invoke function either.

It could be a check or whatever.

@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to no response for status checks May 3, 2024
@borichellow borichellow enabled auto-merge May 6, 2024 09:11
@borichellow borichellow added this pull request to the merge queue May 6, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks May 6, 2024
@borichellow borichellow added this pull request to the merge queue May 6, 2024
Merged via the queue into develop with commit f852cb9 May 6, 2024
19 checks passed
@borichellow borichellow deleted the fix/repository_should_not_access_feature_in_mls_conversation_repository branch May 6, 2024 10:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants