Stop waiting on a verification request the other session never accepts - #7457
Stop waiting on a verification request the other session never accepts#7457hayaksi1 wants to merge 3 commits into
Conversation
The outgoing verification flow had no client side timeout: if the other session never answered, the screen waited on "Waiting to accept request" for as long as the user left it open, with no indication that the request could no longer succeed. Bound the wait to the ten minutes the Matrix specification gives a verification request. Past that the other session can no longer accept it, so cancel the request and move to the canceled state, which already offers to start again.
|
Thank you for your contribution! Here are a few things to check in the PR to ensure it's reviewed as quickly as possible:
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #7457 +/- ##
===========================================
- Coverage 80.64% 80.62% -0.02%
===========================================
Files 2758 2758
Lines 80588 80593 +5
Branches 11029 11029
===========================================
- Hits 64989 64979 -10
- Misses 11342 11360 +18
+ Partials 4257 4254 -3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
It seems that there is an unused import: /home/runner/work/element-x-android/element-x-android/features/verifysession/impl/src/test/kotlin/io/element/android/features/verifysession/impl/outgoing/OutgoingVerificationPresenterTest.kt:30:1: The import 'kotlinx.coroutines.test.TestScope' is unused. [UnusedImports] |
ktlint reports the TestScope import as unused because the type only appears in a context parameter, which the rule does not look at. The file carried a file-level suppression for exactly that before this branch dropped it.
|
@bmarty Done — restored the file-level
|
Content
The outgoing verification flow has no client-side timeout. Once a request is sent the screen sits on "Waiting to accept request" indefinitely: if the other session never answers, or is not running at all, nothing in the app ever tells the user the request can no longer succeed, and the only way out is to press back.
Bound that wait to ten minutes, the lifetime the Matrix specification gives a
m.key.verification.request. Past that point the other session can no longer accept it, so waiting longer cannot succeed. On expiry the request is cancelled and the machine moves to its existing canceled state, which already offers to start again.The duration is anchored to the specification rather than chosen for UX reasons: cancelling earlier would abort verifications that would still have completed once the user picked up their other device.
Motivation and context
Part of #1270.
Tests
features/verifysession/impl/.../OutgoingVerificationPresenterTest.kt: a new case asserts that a request nobody accepts stays in the waiting state at nine minutes, then cancels the verification and moves to the canceled state once the timeout passes.The shared helper that drives a verification to the verifying state now advances time by a bounded amount instead of
advanceUntilIdle(), which would otherwise skip straight past the new timeout.Run with
./gradlew :features:verifysession:impl:testDebugUnitTest.Tested devices
Checklist