Repository navigation
Conversation
…n request while… [bug-smasher poc] Automated fix from the bug smasher. Proof: ./gradlew :app:testStandardDebugUnitTest --tests "*AuthRequestManagerTest*" must fail on base and pass with the fix.
Signed-off-by: Andre Rosado <arosado@bitwarden.com>
🤖 Bitwarden Claude Code ReviewOverall Assessment: APPROVE This PR changes |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7602 +/- ##
==========================================
+ Coverage 86.82% 86.85% +0.03%
==========================================
Files 896 898 +2
Lines 65805 65204 -601
Branches 9411 9377 -34
==========================================
- Hits 57135 56636 -499
+ Misses 5188 5097 -91
+ Partials 3482 3471 -11
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
| val authRequest: AuthRequest, | ||
| ) | ||
|
|
||
| private fun pollPendingJson() = AuthRequestsResponseJson.AuthRequest( |
There was a problem hiding this comment.
The pattern we usually follow it to make these private helper classes and functions be top-level at the bottom of the file.
Looks like the setUpPollFailureScenario function needs to be in the test class, but can you move it to the bottom.
| // they are retried and only surfaced once after repeated consecutive | ||
| // failures. Polling continues so a later success can still recover. | ||
| consecutiveFailures++ | ||
| if (consecutiveFailures == MAX_CONSECUTIVE_POLL_FAILURES) { |
There was a problem hiding this comment.
Should this be consecutiveFailures >= MAX_CONSECUTIVE_POLL_FAILURES
🎟️ Tracking
https://bitwarden.atlassian.net/browse/PM-42224
📔 Objective
While a login-with-device request waits for approval,
AuthRequestManagerImpl.createAuthRequestWithUpdatespolls the server every 4 seconds. Any single failed poll emittedCreateAuthRequestResult.Error, so a brief network interruption (for example while the app is backgrounded) showed an error even though the request could still be approved a moment later.This change treats poll failures as transient: they are retried, and an error is emitted once after 3 consecutive failures (
MAX_CONSECUTIVE_POLL_FAILURES). A successful poll resets the counter, and polling continues after the error so a later poll can still recover, as before.Tests: three new cases in
AuthRequestManagerTest— a single transient failure is retried without an Error, repeated failures emit exactly one Error and then recover, and the failure count resets after a successful poll.🤖 AI-assisted review
code-review-local) of the branch: APPROVE, no findings. It covered the branch except a final one-line trailing-comma formatting amend.AuthRequestManagerTest(36 tests) and detekt pass.