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: do not commit User and Client upserts if nothing has changed [WPB-15055] 🍒 #3195

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Dec 23, 2024

BugWPB-15055 [Android] Crash when opening connection request from paginated list

This PR was automatically cherry-picked based on the following PR:

Original PR description:



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

When the user data is outdated, the app fetches it again and makes an upsert to the database, but even if there are no changes in the data at all, the insert query is still executed and it notifies all other queries unnecessarily.

Solutions

Make it so that when the app upserts User or Client data and there are absolutely no changes, then rollback that query to not make all other queries that depend on that one dirty.

Testing

Test Coverage (Optional)

  • I have added automated test to this contribution

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.

…B-15055] (#3188)

* fix: do not commit User and Client upserts if nothing has changed [WPB-15055]

* fix unused parameter

* fix detekt
@github-actions github-actions bot added cherry-pick PR is cherry-picking changes from another banch echoes: unplanned Any work item that isn’t part of the product or technical roadmap. type: bug / fix 🐞 👕 size: M labels Dec 23, 2024
Copy link
Contributor Author

github-actions bot commented Dec 30, 2024

Test Results

2 935 tests   - 443   2 926 ✅  - 345   4m 36s ⏱️ -44s
    2 suites  - 578       9 💤  -  98 
    2 files    - 578       0 ❌ ±  0 

Results for commit f2e310d. ± Comparison against base commit 6ddef73.

This pull request removes 3378 and adds 2935 tests. Note that renamed tests count towards both.
PocIntegrationTest ‑ givenApiWhenGettingACMEDirectoriesThenReturnAsExpectedBasedOnNetworkState
PocIntegrationTest ‑ givenEmailAndPasswordWhenLoggingInThenRegisterClientAndLogout
PocIntegrationTest ‑ givenUserWhenHandlingTextMessagesThenProcessShouldSucceed
QualifiedIdTest ‑ givenIdsWithDifferentDomains_whenEqualsIgnoringBlankDomain_thenReturnsFalse[jvm]
QualifiedIdTest ‑ givenIdsWithDifferentValues_whenEqualsIgnoringBlankDomain_thenReturnsFalse[jvm]
QualifiedIdTest ‑ givenIdsWithSameDomains_whenEqualsIgnoringBlankDomain_thenReturnsTrue[jvm]
QualifiedIdTest ‑ givenIdsWithoutDomains_whenEqualsIgnoringBlankDomain_thenReturnsTrue[jvm]
QualifiedIdTest ‑ givenOneIdWithoutDomain_whenEqualsIgnoringBlankDomain_thenReturnsTrue[jvm]
com.wire.kalium.HttpClientConnectionSpecsTest ‑ givenOkHttpSingleton_whenBuildingClearTextTrafficOkhttpClient_thenEnsureConnectionSpecClearText[jvm]
com.wire.kalium.HttpClientConnectionSpecsTest ‑ givenTheHttpClientIsCreated_ThenEnsureOnlySupportedSpecsArePresent[jvm]
…
.QualifiedIdTest ‑ givenIdsWithDifferentDomains_whenEqualsIgnoringBlankDomain_thenReturnsFalse
.QualifiedIdTest ‑ givenIdsWithDifferentValues_whenEqualsIgnoringBlankDomain_thenReturnsFalse
.QualifiedIdTest ‑ givenIdsWithSameDomains_whenEqualsIgnoringBlankDomain_thenReturnsTrue
.QualifiedIdTest ‑ givenIdsWithoutDomains_whenEqualsIgnoringBlankDomain_thenReturnsTrue
.QualifiedIdTest ‑ givenOneIdWithoutDomain_whenEqualsIgnoringBlankDomain_thenReturnsTrue
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
…
This pull request removes 107 skipped tests and adds 9 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.data.conversation.ConversationRepositoryTest ‑ givenAGroupConversationHasNotNewMessages_whenGettingConversationDetails_ThenReturnZeroUnreadMessageCount
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
com.wire.kalium.persistence.dao.message.MessageDAOBenchmarkTest ‑ null
com.wire.kalium.persistence.kmmSettings.EncryptedSettingsBuilderTest ‑ givenShouldEncryptDataIsTrue_whenEncryptingData_thenShouldEncryptWithoutFailing

♻️ This comment has been updated with latest results.

Copy link
Contributor Author

@saleniuk saleniuk closed this Dec 30, 2024
@saleniuk saleniuk deleted the fix/do-not-commit-user-and-client-upserts-if-nothing-has-changed-cherry-pick branch December 30, 2024 11:18
@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 86.66667% with 6 lines in your changes missing coverage. Please review.

Project coverage is 54.12%. Comparing base (6ddef73) to head (f2e310d).

Files with missing lines Patch % Lines
...ire/kalium/persistence/dao/client/ClientDAOImpl.kt 73.33% 3 Missing and 1 partial ⚠️
...lin/com/wire/kalium/persistence/dao/UserDAOImpl.kt 93.33% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #3195   +/-   ##
========================================
  Coverage    54.11%   54.12%           
========================================
  Files         1264     1264           
  Lines        36800    36818   +18     
  Branches      3735     3743    +8     
========================================
+ Hits         19915    19927   +12     
- Misses       15446    15449    +3     
- Partials      1439     1442    +3     
Files with missing lines Coverage Δ
...lin/com/wire/kalium/persistence/dao/UserDAOImpl.kt 52.58% <93.33%> (+0.10%) ⬆️
...ire/kalium/persistence/dao/client/ClientDAOImpl.kt 77.16% <73.33%> (+2.16%) ⬆️

... and 4 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6ddef73...f2e310d. Read the comment docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cherry-pick PR is cherry-picking changes from another banch echoes: unplanned Any work item that isn’t part of the product or technical roadmap. 👕 size: M type: bug / fix 🐞
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants