Repository navigation
Conversation
A 401 whose x-server-time is more than one minute away from the request time now shows the clock error instead of signing out. The mobile clients use the same one-minute limit.
|
AI review done for Quality: The retry and 401 classification paths have broad automated coverage. A separate response-ordering test confirmed one remaining startup race.
|
Without x-server-time a revoked session cannot be told apart from a clock error. Show the clock error instead, as the iOS client does; Android does not sign out either.
There was a problem hiding this comment.
AI review · Codex · 017ce38
Flutter analysis passed on all five changed files, and 22 of 23 focused tests passed. The existing logout test made one unexpected /logout request because its mock /me response omits x-server-time. Give that fixture a current server timestamp so it exercises automatic sign-out.
There was a problem hiding this comment.
AI review · Codex · 31eebf3
Changes requested. Flutter analysis passed on all six changed files, and all 39 related tests passed on a sequential rerun after the initial native-library staging error. A separate startup regression test reproduced the remaining issue.
Summary
Two parts: when a 401 means "clock error", and what startup does when the first Signal key upload fails.
1. 401 classification (
isClockSkewedinlib/utils/auth_token_utils.dart, used byAccountServer._handleApiError)The response time is taken when the headers arrive, so a slow or failed body read does not shift it. A 401 whose body is not JSON or fails to read keeps its status and headers, so it goes through the same check.
2. Startup (
AccountServer.initServer, the firstPOST /signal/keys)Before, an error here either signed the user out or was dropped, which left the app signed in with no message worker and no error on screen. Now one
AccountStartupStateowns the outcome:Continue on the clock screen makes one upload attempt. If it fails, it shows the error and the button is available again, the same as the Android and iOS clock screens. Sign-out and upgrade close the clock screen. No new strings: the Retry button uses the existing
retrylabel.Evidence
test/account/account_server_startup_exhaustive_test.dartdrives the realAccountServeragainst a fake HTTP adapter and a fake clock. It covers every sequence of up to 4 responses from 15 kinds, then "accept forever", with Continue, Retry, stop, and a concurrent/me401 at each step. It checks 10 properties: sign-out only on an in-sync 401 or a missing identity, no silent hang, recovery after the server accepts, one end state, nothing afterstop(), and the same key batch on retries.initServer -> badData forevernever ends and shows nothing, and Continue followed by an in-sync 401 leaves the clock screen open next to the sign-out.CLOCK_VERIFY_FULL=1runs the full bound.test/account/account_server_logout_test.dartadds a test for each case in the table above. Each test failed before its fix.flutter test test/account/ test/utils/ test/workers/: 291 passed, 4 skipped.dart analyze --fatal-infos lib test: no issues.Merge Danger
Door: two-way
Blast Radius: sign-in and startup.
badResponsewith its status, instead of aFormatException.