Skip to content

refactor: lazy evaluate for kalium config [WPB-23190]#3828

Open
MohamadJaara wants to merge 4 commits intodevelopfrom
mo/lazy-evaluate-kalium-config
Open

refactor: lazy evaluate for kalium config [WPB-23190]#3828
MohamadJaara wants to merge 4 commits intodevelopfrom
mo/lazy-evaluate-kalium-config

Conversation

@MohamadJaara
Copy link
Member

@MohamadJaara MohamadJaara commented Jan 30, 2026

TaskWPB-23190 [Android] lazy caculate values from KaliumConfig class


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

all values in kalium config are calculated at app startup but will be needed way later of never
for example

  1. isWebSocketEnabledByDefaultis used only when adding a new user aka login
  2. fileRestrictionState can be lazy calculated later when needed
  3. shouldEncryptData is only needed during init and no need to have it around all the time

Solutions

  1. remove isWebSocketEnabledByDefaultis since it is only used one time when logging in and it can be passed when needed
  2. fileRestrictionState and shouldEncryptData as lambdaz that will be evaluated lazely

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.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 30, 2026

Test Results

0 tests   - 4 295   0 ✅  - 4 182   0s ⏱️ - 5m 10s
0 suites  -   723   0 💤  -   113 
0 files    -   723   0 ❌ ±    0 

Results for commit 0ac7c38. ± Comparison against base commit ae71a9a.

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 30, 2026

🐰 Bencher Report

Branchmo/lazy-evaluate-kalium-config
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
713.87 µs
com.wire.kalium.benchmarks.logic.CoreLogicBenchmark.createObjectInMemory📈 view plot
⚠️ NO THRESHOLD
348,532.34 µs
com.wire.kalium.benchmarks.persistence.MessagesNoPragmaTuneBenchmark.messageInsertionBenchmark📈 view plot
⚠️ NO THRESHOLD
1,375,401.82 µs
com.wire.kalium.benchmarks.persistence.MessagesNoPragmaTuneBenchmark.queryMessagesBenchmark📈 view plot
⚠️ NO THRESHOLD
21,165.59 µs
🐰 View full continuous benchmarking report in Bencher

@MohamadJaara MohamadJaara requested review from sbakhtiarov and yamilmedina and removed request for Garzas, sbakhtiarov and yamilmedina January 30, 2026 16:20
@sonarqubecloud
Copy link

@codecov-commenter
Copy link

Codecov Report

❌ Patch coverage is 74.28571% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 59.56%. Comparing base (ae71a9a) to head (0ac7c38).

Files with missing lines Patch % Lines
.../logic/feature/auth/AddAuthenticatedUserUseCase.kt 76.66% 2 Missing and 5 partials ⚠️
.../kotlin/com/wire/kalium/logic/GlobalKaliumScope.kt 0.00% 1 Missing ⚠️
...ire/kalium/logic/data/session/SessionRepository.kt 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #3828   +/-   ##
========================================
  Coverage    59.55%   59.56%           
========================================
  Files         1898     1898           
  Lines        59197    59213   +16     
  Branches      6417     6423    +6     
========================================
+ Hits         35255    35269   +14     
+ Misses       21027    21025    -2     
- Partials      2915     2919    +4     
Files with missing lines Coverage Δ
...kalium/logic/configuration/UserConfigRepository.kt 39.08% <100.00%> (-0.31%) ⬇️
...om/wire/kalium/logic/featureFlags/KaliumConfigs.kt 100.00% <100.00%> (ø)
.../kotlin/com/wire/kalium/logic/GlobalKaliumScope.kt 0.00% <0.00%> (ø)
...ire/kalium/logic/data/session/SessionRepository.kt 0.00% <0.00%> (ø)
.../logic/feature/auth/AddAuthenticatedUserUseCase.kt 80.95% <76.66%> (-0.45%) ⬇️

... 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 ae71a9a...0ac7c38. Read the comment docs.

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

@sbakhtiarov
Copy link
Contributor

I have a general question about this refactoring: what is the actual performance impact on initializing these config values on app startup? It seems like we do not do any expensive calculations or IO calls.

@MohamadJaara MohamadJaara requested a review from Garzas February 4, 2026 13: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.

3 participants