You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(storage): one hung secure-storage call now blocks every later token operation, including each request's token read and logout's clear #1002
Found by the pre-merge review of #1001 (for #986). Confirmed from the code on that branch.
Summary
SecureTokenStore now runs every token read, write and delete in issue order, so that a logout's clear lands after a pending refresh write (#986). The flip side: a platform call that never completes (a flutter_secure_storage read, write or delete that hangs, as opposed to one that fails) now holds every later token operation behind it. That includes AuthInterceptor.onRequest's token read on every request, and a logout's clearAllTokens(). The app then can neither make an authenticated request nor sign out until it is restarted. Before the queue, a hung call stalled only its own caller. Neither SecureStorageService nor the queue has a timeout. A plain timeout inside the queue would let the abandoned call land late and break the ordering again, so this needs a design, not a one-line fix.
Acceptance criteria
A test with a storage whose write never completes shows the chosen behaviour. For example: later operations fail with a CacheException after a bounded wait, and a logout still ends with the session torn down in memory and a retry of the clear scheduled, or another documented outcome that leaves the app usable.
The ordering guarantee tested in secure_token_store_order_test.dart still holds.
The SecureTokenStore class doc describes the bound.
Fixed by #1021 (squash f01e91d). SecureTokenStore waits for the operation ahead of it at most operationTimeout (10 s by default), then runs anyway.
Criterion
Result
Artifact
1. With a write that never completes, later operations get a documented, usable outcome
PASS
named-tests.log: a write that never completes stops holding the read and the clear behind it after the bound: the read and the logout clear both run after the bound. mutant-unbounded.log: times out on the unbounded queue
2. The ordering in secure_token_store_order_test.dart still holds
PASS
Same log: the three order tests and operations that complete in time keep their order pass
G2 on main99d457a (which contains every fix merged this cycle): audit_template.log exits 0 (3861 tests), and g2-checks.log shows check_epic_coverage and check_deliverable exit 0. PR checks: pr1021-checks.txt. G3 found that a call which outlives the bound and then succeeds lands out of order, re-storing a token after a clear. That is filed as #1024 (P1) and fixed by the repair in #1031, which is not merged yet; this issue's criteria (a hang no longer wedges the store) hold on main regardless. Pre-merge review ran (storage surface). No screenshots were produced or cited (run_acceptance.sh was not used, so there are no standing goldens to account for). Self-QA: each artifact was opened and matches its row.
Activity
fix(storage): read tokens strictly, bound the wait behind a hung call…
evidence: #912 #918 #921 #922 #913 #929 #985 #930 #1002 #1003 #931 #943
evidence: doc excerpts for #929 #931 #1002 #1003
koniz-dev commentedon Oct 31, 2026
Fixed by #1021 (squash f01e91d).
SecureTokenStorewaits for the operation ahead of it at mostoperationTimeout(10 s by default), then runs anyway.named-tests.log:a write that never completes stops holding the read and the clear behind it after the bound: the read and the logout clear both run after the bound.mutant-unbounded.log: times out on the unbounded queuesecure_token_store_order_test.dartstill holdsoperations that complete in time keep their orderpassdoc-bound.txtG2 on
main99d457a (which contains every fix merged this cycle):audit_template.logexits 0 (3861 tests), andg2-checks.logshowscheck_epic_coverageandcheck_deliverableexit 0. PR checks:pr1021-checks.txt. G3 found that a call which outlives the bound and then succeeds lands out of order, re-storing a token after a clear. That is filed as #1024 (P1) and fixed by the repair in #1031, which is not merged yet; this issue's criteria (a hang no longer wedges the store) hold onmainregardless. Pre-merge review ran (storage surface). No screenshots were produced or cited (run_acceptance.shwas not used, so there are no standing goldens to account for). Self-QA: each artifact was opened and matches its row.