Show saves immediately and publish behind them #3
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/optimistic-ui"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Items 3 and 4 of the speed lane, together because the optimistic insert is what replaces the refetch. Stacked on #2.
Saving used to make the user watch: Amber, then the relay ack, then a list re-read, then one publish per list, then a full three-collection refetch. Only the first of those is the user's own decision time.
The claim this rests on, tested directly
The signature is the point of no return, not the relay ack. Once the signer returns, the event's id is fixed and it verifies — so the row goes on screen then, and the publish happens behind it. A relay refusing it afterwards is a retry of the same bytes, never a second trip through the signer.
If that claim were wrong the whole design would be, so
SignThenPublishE2ETesttests it on a real device: sign, assert the relay does not yet have it, publish separately, assert the id the UI showed is the id that landed. Plus the retry path — a silent relay fails the publish, and the same event object then publishes successfully to a working relay with no second signature.What the user sees
Rows carry their own state:
Sending…while in flight,Not sent: <reason>with a Retry button if no relay took it, and nothing at all once settled — which is almost every row. Optimism is only honest if those states are distinguishable; a pending row that looked identical to a saved one would be the lie.Covers
saveDraft,saveHighlight,deleteBookmarkanddeleteHighlight.Item 4, which falls out of it
Seven call sites ended a mutation by re-reading all three collections from the network to be told what we had just written.
refresh()references go 8 → 5, and the remaining five are the definition plus four legitimate startup/login calls.The local updates are pure and unit-tested (
optimisticUpsert,optimisticRemove,upsertList), and all three refuse to let an older version displace a newer one — so a lagging relay answering after an edit cannot undo it.What deliberately did NOT become optimistic
Everything in
saveHighlightthat keys on the relay outcome.CompanionGatedecides whether publishing a blank39701would destroy an existing bookmark, and it must act on what the relays actually did, never on a signature. Those orderings are unchanged.A behaviour change worth a look
The per-list Amber prompts now appear after the user lands back on the bookmarks screen, rather than while they wait on the save sheet. Same number of prompts, different screen. I think it is better, but it is a judgement call.
Testing
The last commit also fixes the harness that kept truncating those runs.
am instrument -wstreams over adb, so a run only survives as long as that connection — three runs today died at 9/35, 39/43 and 41/43, each at a different point, every one with zero test failures. The instrumentation was never the problem; the pipe was. It now runs detached on the device and is polled forINSTRUMENTATION_CODE, the one marker meaning the whole run ended. First attempt after the change: 43/43.