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: read receipts are not sent when the app is in background (WPB-8756) #3054

Open
wants to merge 1 commit into
base: release/candidate
Choose a base branch
from

Conversation

ohassine
Copy link
Member

@ohassine ohassine commented Oct 8, 2024

BugWPB-8756 [Android] Read receipts not generated when responding from notification popup


PR Submission Checklist for internal contributors

  • The PR Title

    • conforms to the style of semantic commits messages¹ supported in Wire's Github Workflow²
    • contains a reference JIRA issue number like SQPIT-764
    • answers the question: If merged, this PR will: ... ³
  • The PR Description

    • is free of optional paragraphs and you have filled the relevant parts to the best of your ability

What's new in this PR?

Issues

Read receipts are not being sent when the app is in the background.

Causes (Optional)

In SendConfirmationUseCase we wait until app is live to send confirmations.

Solutions

Add a flag to the use case to ignore this wait if the user replies from notification.

Needs releases with:

  • GitHub link to other pull request

Testing

Test Coverage (Optional)

  • I have added automated test to this contribution

How to Test

Briefly describe how this change was tested and if applicable the exact steps taken to verify that it works as expected.

Notes (Optional)

Specify here any other facts that you think are important for this issue.

Attachments (Optional)

Attachments like images, videos, etc. (drag and drop in the text box)


PR Post Submission Checklist for internal contributors (Optional)

  • Wire's Github Workflow has automatically linked the PR to a JIRA issue

PR Post Merge Checklist for internal contributors

  • If any soft of configuration variable was introduced by this PR, it has been added to the relevant documents and the CI jobs have been updated.

References
  1. https://sparkbox.com/foundry/semantic_commit_messages
  2. https://github.com/wireapp/.github#usage
  3. E.g. feat(conversation-list): Sort conversations by most emojis in the title #SQPIT-764.

@echoes-hq echoes-hq bot added the echoes: features End-user visible changes intended to create customer value label Oct 8, 2024
@ohassine ohassine requested review from a team, typfel, alexandreferris, MohamadJaara, vitorhugods and saleniuk and removed request for a team October 8, 2024 12:30
Copy link

sonarcloud bot commented Oct 8, 2024

operator fun invoke(
conversationId: QualifiedID,
time: Instant,
shouldWaitUntilLive: Boolean = true
Copy link
Member

Choose a reason for hiding this comment

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

not sure if this is the right way to solve it, since this use case will send an encrypted message, and messages should only be sent if the app is live, to avoid breaking the session

Copy link
Member

Choose a reason for hiding this comment

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

maybe the better approach is to handle it the same way we do when FCM message is received, start incremental sync and send the message when we are live then drop after ?

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't see any reason to redo the sync for nothing because the app is already up to date, all messages are synced after getting the event through FCM.
The user in this case just need to reply from notification without waiting for app to complete sync.

Copy link
Contributor

github-actions bot commented Oct 8, 2024

Test Results

2 314 tests   - 903   2 303 ✅  - 808   24s ⏱️ - 4m 3s
    1 suites  - 551       6 💤  - 100 
    1 files    - 551       5 ❌ +  5 

For more details on these failures, see this check.

Results for commit 257d19b. ± Comparison against base commit 8be3015.

This pull request removes 3217 and adds 2314 tests. Note that renamed tests count towards both.
PocIntegrationTest ‑ givenApiWhenGettingACMEDirectoriesThenReturnAsExpectedBasedOnNetworkState
PocIntegrationTest ‑ givenEmailAndPasswordWhenLoggingInThenRegisterClientAndLogout
PocIntegrationTest ‑ givenUserWhenHandlingTextMessagesThenProcessShouldSucceed
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 ‑ givenCRLWithHttpsProtocol_whenGettingClientDomainCRL_thenItShouldNotBeChanged[jvm]
com.wire.kalium.api.common.ACMEApiTest ‑ givenNoLocationInHeader_whenCallingSendAcmeRequestApi_theResponseShouldBeConfigureCorrectly[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 106 skipped tests and adds 6 skipped tests. Note that renamed tests count towards both.
PocIntegrationTest ‑ givenApiWhenGettingACMEDirectoriesThenReturnAsExpectedBasedOnNetworkState
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.cryptography.CryptoUtilsTest ‑ givenDummyText_whenEncryptedAndDecryptedWithAES256_returnsOriginalText[js, browser]
…
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.

operator fun invoke(
conversationId: QualifiedID,
time: Instant,
shouldWaitUntilLive: Boolean = true
Copy link
Member

Choose a reason for hiding this comment

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

maybe the better approach is to handle it the same way we do when FCM message is received, start incremental sync and send the message when we are live then drop after ?

Copy link
Contributor

github-actions bot commented Oct 8, 2024

🐰 Bencher Report

Branchsend-read-receipt-after-replying-from-notification
Testbedubuntu-latest

⚠️ WARNING: The following Measure does not have a Threshold. Without a Threshold, no Alerts will ever be generated!

Click here to create a new Threshold
For more information, see the Threshold documentation.
To only post results if a Threshold exists, set the --ci-only-thresholds CLI flag.

Click to view all benchmark results
BenchmarkLatencynanoseconds (ns)
com.wire.kalium.benchmarks.logic.CoreLogicBenchmark.createObjectInFiles📈 view plot
⚠️ NO THRESHOLD
678,704.32
com.wire.kalium.benchmarks.logic.CoreLogicBenchmark.createObjectInMemory📈 view plot
⚠️ NO THRESHOLD
599,703,300.16
com.wire.kalium.benchmarks.persistence.MessagesNoPragmaTuneBenchmark.messageInsertionBenchmark📈 view plot
⚠️ NO THRESHOLD
926,142,192.65
com.wire.kalium.benchmarks.persistence.MessagesNoPragmaTuneBenchmark.queryMessagesBenchmark📈 view plot
⚠️ NO THRESHOLD
21,116,130.49
🐰 View full continuous benchmarking report in Bencher

@datadog-wireapp
Copy link

Datadog Report

Branch report: send-read-receipt-after-replying-from-notification
Commit report: aabc328
Test service: kalium-jvm

❌ 5 Failed (0 Known Flaky), 3072 Passed, 52 Skipped, 20s Total Time

❌ Failed Tests (5)

  • givenAnyCall_whenInvoking_thenShouldEnqueueWork[jvm] - com.wire.kalium.logic.feature.conversation.UpdateConversationReadDateUseCaseTest - Details

    Expand for error
     io.mockative.MixedArgumentMatcherException: Mixing values and matchers like \`eq()\` or \`any()\` in the same function call is not supported.
     
     io.mockative.MixedArgumentMatcherException: Mixing values and matchers like \`eq()\` or \`any()\` in the same function call is not supported.
     	at app//io.mockative.Invocation$Function.toExpectation(Invocation.kt:27)
     	at app//io.mockative.Invocation$Function.toExpectation(Invocation.kt:14)
     	at app//io.mockative.EveryKt.coEvery(Every.kt:29)
     	at app//com.wire.kalium.logic.feature.conversation.UpdateConversationReadDateUseCaseTest$Arrangement.arrange(UpdateConversationReadDateUseCaseTest.kt:181)
     	at app//com.wire.kalium.logic.feature.conversation.UpdateConversationReadDateUseCaseTest$Companion.arrange(UpdateConversationReadDateUseCaseTest.kt:205)
     	at app//com.wire.kalium.logic.feature.conversation.UpdateConversationReadDateUseCaseTest$givenAnyCall_whenInvoking_thenShouldEnqueueWork$1.invokeSuspend(UpdateConversationReadDateUseCaseTest.kt:151)
     	at app//com.wire.kalium.logic.feature.conversation.UpdateConversationReadDateUseCaseTest$givenAnyCall_whenInvoking_thenShouldEnqueueWork$1.invoke(UpdateConversationReadDateUseCaseTest.kt)
     ...
    
  • givenCurrentStoredLastReadDateIsNewerThanEnqueued_whenWorking_thenShouldNotTryToDoAnyWork[jvm] - com.wire.kalium.logic.feature.conversation.UpdateConversationReadDateUseCaseTest - Details

    Expand for error
     io.mockative.MixedArgumentMatcherException: Mixing values and matchers like \`eq()\` or \`any()\` in the same function call is not supported.
     
     io.mockative.MixedArgumentMatcherException: Mixing values and matchers like \`eq()\` or \`any()\` in the same function call is not supported.
     	at app//io.mockative.Invocation$Function.toExpectation(Invocation.kt:27)
     	at app//io.mockative.Invocation$Function.toExpectation(Invocation.kt:14)
     	at app//io.mockative.EveryKt.coEvery(Every.kt:29)
     	at app//com.wire.kalium.logic.feature.conversation.UpdateConversationReadDateUseCaseTest$Arrangement.arrange(UpdateConversationReadDateUseCaseTest.kt:181)
     	at app//com.wire.kalium.logic.feature.conversation.UpdateConversationReadDateUseCaseTest$Companion.arrange(UpdateConversationReadDateUseCaseTest.kt:205)
     	at app//com.wire.kalium.logic.feature.conversation.UpdateConversationReadDateUseCaseTest$givenCurrentStoredLastReadDateIsNewerThanEnqueued_whenWorking_thenShouldNotTryToDoAnyWork$1.invokeSuspend(UpdateConversationReadDateUseCaseTest.kt:58)
     	at app//com.wire.kalium.logic.feature.conversation.UpdateConversationReadDateUseCaseTest$givenCurrentStoredLastReadDateIsNewerThanEnqueued_whenWorking_thenShouldNotTryToDoAnyWork$1.invoke(UpdateConversationReadDateUseCaseTest.kt)
     ...
    
  • givenProvidedTimeIsNewerThanPersistedLastReadForConversation_whenWorking_thenShouldTryToSendReceipts[jvm] - com.wire.kalium.logic.feature.conversation.UpdateConversationReadDateUseCaseTest - Details

    Expand for error
     io.mockative.MixedArgumentMatcherException: Mixing values and matchers like \`eq()\` or \`any()\` in the same function call is not supported.
     
     io.mockative.MixedArgumentMatcherException: Mixing values and matchers like \`eq()\` or \`any()\` in the same function call is not supported.
     	at app//io.mockative.Invocation$Function.toExpectation(Invocation.kt:27)
     	at app//io.mockative.Invocation$Function.toExpectation(Invocation.kt:14)
     	at app//io.mockative.EveryKt.coEvery(Every.kt:29)
     	at app//com.wire.kalium.logic.feature.conversation.UpdateConversationReadDateUseCaseTest$Arrangement.arrange(UpdateConversationReadDateUseCaseTest.kt:181)
     	at app//com.wire.kalium.logic.feature.conversation.UpdateConversationReadDateUseCaseTest$Companion.arrange(UpdateConversationReadDateUseCaseTest.kt:205)
     	at app//com.wire.kalium.logic.feature.conversation.UpdateConversationReadDateUseCaseTest$givenProvidedTimeIsNewerThanPersistedLastReadForConversation_whenWorking_thenShouldTryToSendReceipts$1.invokeSuspend(UpdateConversationReadDateUseCaseTest.kt:82)
     	at app//com.wire.kalium.logic.feature.conversation.UpdateConversationReadDateUseCaseTest$givenProvidedTimeIsNewerThanPersistedLastReadForConversation_whenWorking_thenShouldTryToSendReceipts$1.invoke(UpdateConversationReadDateUseCaseTest.kt)
     ...
    
  • givenProvidedTimeIsNewerThanPersistedLastReadForConversation_whenWorking_thenShouldUpdateLastReadForOtherSelfClients[jvm] - com.wire.kalium.logic.feature.conversation.UpdateConversationReadDateUseCaseTest - Details

    Expand for error
     io.mockative.MixedArgumentMatcherException: Mixing values and matchers like \`eq()\` or \`any()\` in the same function call is not supported.
     
     io.mockative.MixedArgumentMatcherException: Mixing values and matchers like \`eq()\` or \`any()\` in the same function call is not supported.
     	at app//io.mockative.Invocation$Function.toExpectation(Invocation.kt:27)
     	at app//io.mockative.Invocation$Function.toExpectation(Invocation.kt:14)
     	at app//io.mockative.EveryKt.coEvery(Every.kt:29)
     	at app//com.wire.kalium.logic.feature.conversation.UpdateConversationReadDateUseCaseTest$Arrangement.arrange(UpdateConversationReadDateUseCaseTest.kt:181)
     	at app//com.wire.kalium.logic.feature.conversation.UpdateConversationReadDateUseCaseTest$Companion.arrange(UpdateConversationReadDateUseCaseTest.kt:205)
     	at app//com.wire.kalium.logic.feature.conversation.UpdateConversationReadDateUseCaseTest$givenProvidedTimeIsNewerThanPersistedLastReadForConversation_whenWorking_thenShouldUpdateLastReadForOtherSelfClients$1.invokeSuspend(UpdateConversationReadDateUseCaseTest.kt:118)
     	at app//com.wire.kalium.logic.feature.conversation.UpdateConversationReadDateUseCaseTest$givenProvidedTimeIsNewerThanPersistedLastReadForConversation_whenWorking_thenShouldUpdateLastReadForOtherSelfClients$1.invoke(UpdateConversationReadDateUseCaseTest.kt)
     ...
    
  • givenProvidedTimeIsNewerThanPersistedLastReadForConversation_whenWorking_thenShouldUpdateLastReadLocally[jvm] - com.wire.kalium.logic.feature.conversation.UpdateConversationReadDateUseCaseTest - Details

    Expand for error
     io.mockative.MixedArgumentMatcherException: Mixing values and matchers like \`eq()\` or \`any()\` in the same function call is not supported.
     
     io.mockative.MixedArgumentMatcherException: Mixing values and matchers like \`eq()\` or \`any()\` in the same function call is not supported.
     	at app//io.mockative.Invocation$Function.toExpectation(Invocation.kt:27)
     	at app//io.mockative.Invocation$Function.toExpectation(Invocation.kt:14)
     	at app//io.mockative.EveryKt.coEvery(Every.kt:29)
     	at app//com.wire.kalium.logic.feature.conversation.UpdateConversationReadDateUseCaseTest$Arrangement.arrange(UpdateConversationReadDateUseCaseTest.kt:181)
     	at app//com.wire.kalium.logic.feature.conversation.UpdateConversationReadDateUseCaseTest$Companion.arrange(UpdateConversationReadDateUseCaseTest.kt:205)
     	at app//com.wire.kalium.logic.feature.conversation.UpdateConversationReadDateUseCaseTest$givenProvidedTimeIsNewerThanPersistedLastReadForConversation_whenWorking_thenShouldUpdateLastReadLocally$1.invokeSuspend(UpdateConversationReadDateUseCaseTest.kt:100)
     	at app//com.wire.kalium.logic.feature.conversation.UpdateConversationReadDateUseCaseTest$givenProvidedTimeIsNewerThanPersistedLastReadForConversation_whenWorking_thenShouldUpdateLastReadLocally$1.invoke(UpdateConversationReadDateUseCaseTest.kt)
     ...
    

@yamilmedina yamilmedina changed the base branch from develop to release/candidate October 15, 2024 16:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants