kalium icon indicating copy to clipboard operation
kalium copied to clipboard

fix: keep and fetch MLS public keys every 24h [WPB-17161]

Open saleniuk opened this issue 7 months ago β€’ 4 comments

BugWPB-17161 [Android] Excessive frequency of fetching MLS public keys


PR Submission Checklist for internal contributors

  • The PR Title

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

    • [x] 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

Currently we do not keep the MLS public keys, they are being fetched every time. MLS public keys should be treated the same way as feature-config and api-version, so should be fetched once every 24h and when the app is put into foreground (cannot be done in kalium itself, but the worker is provided to do it on the specific platform).

Solutions

Keep MLS public keys in-memory. Create a worker to fetch them once every 24h. Update repository to be thread safe and try to fetch keys when cannot be found for the given cipherSuite.

Testing

Test Coverage (Optional)

  • [x] I have added automated test to this contribution

PR Post Submission Checklist for internal contributors (Optional)

  • [x] 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.

saleniuk avatar Apr 15 '25 13:04 saleniuk

Test Results

0 tests   -β€Š3β€ˆ797   0 βœ…  -β€Š3β€ˆ688   0s ⏱️ - 6m 6s 0 suites  -β€Šβ€‡β€ˆ652   0 πŸ’€  -β€Šβ€‡β€ˆ109  0 files    -β€Šβ€‡β€ˆ652   0 ❌ Β±β€‡β€ˆβ€‡β€‡0 

Results for commit 145975e2. ± Comparison against base commit 180ae266.

:recycle: This comment has been updated with latest results.

github-actions[bot] avatar Apr 15 '25 13:04 github-actions[bot]

Codecov Report

Attention: Patch coverage is 80.72289% with 16 lines in your changes missing coverage. Please review.

Project coverage is 50.07%. Comparing base (180ae26) to head (145975e). Report is 18 commits behind head on develop.

Files with missing lines Patch % Lines
...ogic/data/mlspublickeys/MLSPublicKeysRepository.kt 72.50% 9 Missing and 2 partials :warning:
...alium/logic/feature/mls/MLSPublicKeysSyncWorker.kt 90.47% 2 Missing and 2 partials :warning:
...in/com/wire/kalium/logic/feature/user/UserScope.kt 0.00% 1 Missing :warning:
Additional details and impacted files
@@              Coverage Diff              @@
##             develop    #3414      +/-   ##
=============================================
+ Coverage      50.02%   50.07%   +0.05%     
  Complexity        41       41              
=============================================
  Files           1623     1624       +1     
  Lines          62477    62548      +71     
  Branches        5524     5528       +4     
=============================================
+ Hits           31255    31322      +67     
  Misses         29084    29084              
- Partials        2138     2142       +4     
Files with missing lines Coverage Ξ”
...um/logic/data/mlspublickeys/MLSPublicKeysMapper.kt 12.50% <ΓΈ> (ΓΈ)
...in/com/wire/kalium/logic/feature/user/UserScope.kt 0.00% <0.00%> (ΓΈ)
...alium/logic/feature/mls/MLSPublicKeysSyncWorker.kt 90.47% <90.47%> (ΓΈ)
...ogic/data/mlspublickeys/MLSPublicKeysRepository.kt 73.91% <72.50%> (+51.69%) :arrow_up:

... and 3 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 180ae26...145975e. Read the comment docs.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

codecov-commenter avatar Apr 15 '25 13:04 codecov-commenter

Datadog Report

Branch report: fix/keep-and-fetch-mls-public-keys-every-24h Commit report: facd766 Test service: kalium-jvm

:white_check_mark: 0 Failed, 3704 Passed, 109 Skipped, 52.89s Total Time

datadog-wireapp[bot] avatar Apr 15 '25 13:04 datadog-wireapp[bot]

This PR is stale because it has been open 30 days with no activity. Please update it or close it in case is not relevant anymore.

github-actions[bot] avatar Jun 09 '25 00:06 github-actions[bot]

🐰 Bencher Report

Branchfix/keep-and-fetch-mls-public-keys-every-24h
Testbedubuntu-latest

⚠️ WARNING: No Threshold found!

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 flag.

Click to view all benchmark results
BenchmarkLatencymicroseconds (Β΅s)
com.wire.kalium.benchmarks.logic.CoreLogicBenchmark.createObjectInFilesπŸ“ˆ view plot
⚠️ NO THRESHOLD
680.58 Β΅s
com.wire.kalium.benchmarks.logic.CoreLogicBenchmark.createObjectInMemoryπŸ“ˆ view plot
⚠️ NO THRESHOLD
403,680.83 Β΅s
com.wire.kalium.benchmarks.persistence.MessagesNoPragmaTuneBenchmark.messageInsertionBenchmarkπŸ“ˆ view plot
⚠️ NO THRESHOLD
1,475,762.41 Β΅s
com.wire.kalium.benchmarks.persistence.MessagesNoPragmaTuneBenchmark.queryMessagesBenchmarkπŸ“ˆ view plot
⚠️ NO THRESHOLD
28,266.21 Β΅s
🐰 View full continuous benchmarking report in Bencher

github-actions[bot] avatar Jun 17 '25 10:06 github-actions[bot]