[PM-35117] fix: Getting updated values from KDF before displaying update KDF prompt#6802
[PM-35117] fix: Getting updated values from KDF before displaying update KDF prompt#6802
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #6802 +/- ##
==========================================
+ Coverage 85.41% 85.65% +0.23%
==========================================
Files 871 871
Lines 60064 60072 +8
Branches 8613 8621 +8
==========================================
+ Hits 51304 51453 +149
+ Misses 5775 5629 -146
- Partials 2985 2990 +5
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Great job! No new security vulnerabilities introduced in this pull request |
| * Tracks whether a forced sync was initiated to resolve a KDF update check. While true, | ||
| * the KDF update dialog is suppressed until the sync completes. | ||
| */ | ||
| private var isAwaitingKdfSync = false |
There was a problem hiding this comment.
Can we put this in the state
| if (authRepository.needsKdfUpdateToMinimums()) { | ||
| isAwaitingKdfSync = true | ||
| viewModelScope.launch { | ||
| try { |
There was a problem hiding this comment.
Why is there a ``tryhere,syncForResult` does not throw anything
There was a problem hiding this comment.
Claude review tricked me here, it flagged this as necessary in case the syncForResult throws.
Although it should never throw.
| } | ||
| } | ||
|
|
||
| @Suppress("MaxLineLength") |
There was a problem hiding this comment.
Can we move this suppression closer to the offending location.
| verify(exactly = 0) { vaultRepository.syncIfNecessary() } | ||
| } | ||
|
|
||
| @Suppress("MaxLineLength") |
There was a problem hiding this comment.
This suppression is not needed
| ), | ||
| ) | ||
| val viewModel = createViewModel() | ||
| assertNull(viewModel.stateFlow.value.dialog) |
There was a problem hiding this comment.
Can you verify the entire state instead of just the dialog.
| assertNull(viewModel.stateFlow.value.dialog) | ||
| } | ||
|
|
||
| @Suppress("MaxLineLength") |
There was a problem hiding this comment.
This suppression is not needed
| runTest { | ||
| every { authRepository.needsKdfUpdateToMinimums() } returns true andThen false | ||
| val viewModel = createViewModel() | ||
| assertNull(viewModel.stateFlow.value.dialog) |
There was a problem hiding this comment.
Same thing, you should be validating the entire state.
| .the_new_recommended_encryption_settings_will_improve_your_account_desc_long | ||
| .asText(), | ||
| ), | ||
| viewModel.stateFlow.value.dialog, |
… tests and removed unnecessary MaxLineLength suppresions
| ) | ||
| } | ||
|
|
||
| @Suppress("MaxLineLength") |
There was a problem hiding this comment.
Can we move this closer to the offending line of code
Code Review: PM-35117 fix: Getting updated values from KDF before displaying update KDF promptPR: #6802 | Author: aj-rosado | Reviewed by: Claude SummaryThis PR fixes a loop state where users who updated their KDF settings on another client would get stuck in a KDF update prompt after unlock. The fix has two parts:
FindingsNo issues found. The implementation is clean and well-tested:
Verdict: Approved ✅ |

🎟️ Tracking
https://bitwarden.atlassian.net/browse/PM-35117
📔 Objective
Avoid a loop state where users that updated the KDF information on a different client are stuck with after unlock.
Adding kdf info on state and calling sync to get the most recent data before displaying the prompt