Queue accepted Settings choices before replacement reads

This commit is contained in:
2026-11-08 01:13:27 +00:00
parent 0ddc1dd2f8
commit eee3b70684
4 changed files with 98 additions and 94 deletions
+14 -11
View File
@@ -20,16 +20,19 @@ clean (`flutter-analyze.q5b4VU`). Manager owns the full-app integration wiring,
rendered tab-switch/relaunch capture and delivery. No deployment, server
restart or device testing was performed in this lane.
Replacement ownership is also guarded: a disposed widget or changed scope skips
queued saves before they start, and the production store rechecks its owner
inside the shared per-key storage queue. A replacement Settings page reads after
any already-started write from the previous owner, then saves its newer choice
last. The queue is shared with tab-location persistence through
Accepted category choices register their writes synchronously in the shared
per-key queue. They are not canceled on disposal: old A, accepted old B,
replacement load, and newer C execute in that order. Thus a normal recreation
restores B, while a newer replacement choice C still wins. Production stores
coordinate all instances by actual preference key; injected stores are
coordinated by store identity. Restoration still checks mounted/revision before
changing the UI. No widget-local deferred write chain can enqueue old B late.
The queue is shared with tab-location persistence through
`core/storage/ordered_local_storage.dart` (companion prerequisite `f6e1ede6`).
The follow-up passed 27 tests including the shared queue tests
(`/tmp/memwatch/out.a86IS6`) and clean analysis (`2CMlDH`). The new recreation
regression blocks old choice A, queues old choice B, disposes the widget,
chooses C in its replacement, then releases A: B never writes and C remains
selected/persisted. A production-store test also verifies reads wait for pending
writes and an invalidated queued save is skipped inside the operation.
Recreation regressions cover both no-new-choice (B restored) and a new choice
(C wins), plus a production two-instance store read after accepted queued
writes. All existing topic retention, scope and delayed-load checks remain.
Final durability follow-up: 28 focused tests passed (`/tmp/memwatch/out.13xC9z`),
including the shared queue tests; analyzer clean (`flutter-analyze.NUqNw2`).