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

feat: create obfuscated copy of user DB [WPB-14826] #3241

Merged
merged 5 commits into from
Jan 27, 2025

Conversation

MohamadJaara
Copy link
Member

@MohamadJaara MohamadJaara commented Jan 22, 2025

BugWPB-14826 [Android] Conversation list loading very slow after closing a conversation


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

sometimes internally it is needed to debug the local user database

Solutions

  1. create empty file
  2. use sqlCipher export function to create unencrypted copy
  3. use the same code as backup to encrypt and share the file

Dependencies (Optional)

If there are some other pull requests related to this one (e.g. new releases of frameworks), specify them here.

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.

)

try {
plainDBDriver.execute(
Copy link
Member Author

Choose a reason for hiding this comment

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

those needed to be this way since opening this db file with sqlDelight resulted to errors where sqlDelight will try to create tables that have been already created via the export function

Copy link
Contributor

github-actions bot commented Jan 22, 2025

Test Results

3 411 tests  ±0   3 303 ✅ ±0   5m 30s ⏱️ -10s
  584 suites ±0     108 💤 ±0 
  584 files   ±0       0 ❌ ±0 

Results for commit 8bd2080. ± Comparison against base commit 04d81a9.

♻️ This comment has been updated with latest results.

Copy link
Contributor

@datadog-wireapp
Copy link

Datadog Report

Branch report: chore/conversation-loading-playground
Commit report: cc97c51
Test service: kalium-jvm

❌ 1 Failed (0 Known Flaky), 3261 Passed, 54 Skipped, 1m 3.25s Total Time

❌ Failed Tests (1)

  • useCasesShouldNotAccessDaoLayerDirectly[jvm] - com.wire.kalium.logic.architecture.LayerAccessRulesTest - Details

    Expand for error
     com.lemonappdev.konsist.core.exception.KoAssertionFailedException: Assert 'useCasesShouldNotAccessDaoLayerDirectly' was violated (1 time). Invalid files:
     /__w/kalium/kalium/logic/src/commonMain/kotlin/com/wire/kalium/logic/feature/backup/CreateObfuscatedCopyUseCase.kt (CreateObfuscatedCopyUseCase FileDeclaration)
     
     com.lemonappdev.konsist.core.exception.KoAssertionFailedException: Assert 'useCasesShouldNotAccessDaoLayerDirectly' was violated (1 time). Invalid files:
     /__w/kalium/kalium/logic/src/commonMain/kotlin/com/wire/kalium/logic/feature/backup/CreateObfuscatedCopyUseCase.kt (CreateObfuscatedCopyUseCase FileDeclaration)
     	at app//com.lemonappdev.konsist.core.verify.KoDeclarationAndProviderAssertCoreKt.getResult(KoDeclarationAndProviderAssertCore.kt:259)
     	at app//com.lemonappdev.konsist.core.verify.KoDeclarationAndProviderAssertCoreKt.assert(KoDeclarationAndProviderAssertCore.kt:54)
     	at app//com.lemonappdev.konsist.api.verify.KoDeclarationAndProviderAssertKt.assertFalse(KoDeclarationAndProviderAssert.kt:103)
     	at app//com.lemonappdev.konsist.api.verify.KoDeclarationAndProviderAssertKt.assertFalse$default(KoDeclarationAndProviderAssert.kt:97)
     	at app//com.wire.kalium.logic.architecture.LayerAccessRulesTest.useCasesShouldNotAccessDaoLayerDirectly(LayerAccessRulesTest.kt:50)
     ...
    

@MohamadJaara MohamadJaara requested a review from Garzas January 24, 2025 11:39
@MohamadJaara MohamadJaara changed the title feat: create obfuscated copy of user DB feat: create obfuscated copy of user DB [WPB-14826] Jan 27, 2025
@echoes-hq echoes-hq bot added the echoes: product-roadmap/bug Work contributing to resolve a bug not critical enough to have raised an incident. label Jan 27, 2025
@MohamadJaara MohamadJaara added this pull request to the merge queue Jan 27, 2025
@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 0% with 155 lines in your changes missing coverage. Please review.

Project coverage is 54.20%. Comparing base (04d81a9) to head (8bd2080).

Files with missing lines Patch % Lines
...ogic/feature/backup/CreateObfuscatedCopyUseCase.kt 0.00% 84 Missing ⚠️
...alium/persistence/backup/ObfuscatedCopyExporter.kt 0.00% 62 Missing ⚠️
...om/wire/kalium/logic/feature/backup/BackupScope.kt 0.00% 7 Missing ⚠️
.../wire/kalium/persistence/db/UserDatabaseBuilder.kt 0.00% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #3241      +/-   ##
===========================================
- Coverage    54.43%   54.20%   -0.23%     
===========================================
  Files         1271     1273       +2     
  Lines        37100    37254     +154     
  Branches      3769     3775       +6     
===========================================
  Hits         20195    20195              
- Misses       15483    15638     +155     
+ Partials      1422     1421       -1     
Files with missing lines Coverage Δ
.../wire/kalium/persistence/db/UserDatabaseBuilder.kt 79.06% <0.00%> (-0.47%) ⬇️
...om/wire/kalium/logic/feature/backup/BackupScope.kt 0.00% <0.00%> (ø)
...alium/persistence/backup/ObfuscatedCopyExporter.kt 0.00% <0.00%> (ø)
...ogic/feature/backup/CreateObfuscatedCopyUseCase.kt 0.00% <0.00%> (ø)

... 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 04d81a9...8bd2080. Read the comment docs.

@datadog-wireapp
Copy link

Datadog Report

Branch report: chore/conversation-loading-playground
Commit report: 10c1160
Test service: kalium-jvm

✅ 0 Failed, 3303 Passed, 108 Skipped, 1m 2.4s Total Time

Merged via the queue into develop with commit eb886e2 Jan 27, 2025
22 of 23 checks passed
@MohamadJaara MohamadJaara deleted the chore/conversation-loading-playground branch January 27, 2025 12:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
echoes: product-roadmap/bug Work contributing to resolve a bug not critical enough to have raised an incident. 🚨 Potential breaking changes 👕 size: L type: feature ✨
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants