fix(server-storage): a re-read keeps writes another tab had unconfirmed when it went out

A re-read checked other tabs' unconfirmed entries only after its answer
arrived. A tab whose write was unconfirmed when the read went out (its
edit already in the snapshot) and confirmed before the old answer came
back matched neither check, so the stale answer replaced its saved value
in the shared cache; that tab's next edit, holding the newer tag, then
wrote the stale list and deleted the item on the server. The entries
unconfirmed when the read is sent are kept too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
4grayandClaude Opus 5.5 committed 2026-10-14 20:50:11 +02:00
1 parent c4425c4c8d
commit dd143c8aca
3 files changed
+81 -5

No files matched your search

+3 -2
View File
@@ -272,8 +272,9 @@ settings and guards read them in every build.
playlist's lists (`UserDataStorage.flushed`); a refused one stays parked. Replayed edits keep recently viewed lists newest first,
as the app cuts them at their limit from the end. Also,
re-reads run one at a time and keep entries edited while they were in
flight or not yet saved, and entries another tab saved meanwhile (the
answer predates them; their next write here conflicts and replays). A response body cut off after its headers counts
flight or not yet saved, and entries another tab saved meanwhile or had
unconfirmed when the read went out (the answer predates them; their next
write here conflicts and replays). A response body cut off after its headers counts
as offline. Each write is sent on the tag of the entry it was made
against (`UserDataWriteQueue`); after a `412` the edit (before → after) is
replayed on the server's current value, so another device's change to the