Repository navigation
fix(pending): a held copy is claimed before its Send now types it - #3608
Conversation
Follow-ups to #3173, from the reviews of its last head. - The resend handler claims the ID among the receipts (`sending`) before the dispatch. A pane move carries the claim, every resend of that ID under any pane ID answers pending_busy while it stands, and the send's end is recorded under the ID the pane has then: sent, the "not confirmed" note, or the held receipt back in place when nothing was typed. Before, a pane herdr moved while the text was on its way left the outcome under the old ID, and the other tab's copy under the new one could be typed again. - A `dismissed` removal (the owner's uncertain record aging out) ends only a held receipt, so the note that a Send now may have typed the copy stays its ten minutes. - A pane that ends takes its held receipts away, and a follow-up the bridge still holds for it gets none when its connection closes later: herdr may give the ID to another pane. - The page reckons what is left of a held proof on a clock that steps by the larger of the wall clock's and performance.now's movement, so a device clock set back does not stretch it. Co-Authored-By: Claude Fable 5.2 <[email protected]>
|
No actionable comments were generated in the recent review. Summary
Merge Risk:
|
Merge passMerged head
Merge pass note (head 5f41475). Both reviewers CLEAR. No sequence was found that types a message twice or after Discard in one browser with working storage. Left for one PR after the release (LOW; each needs a press on a held card for a pane ID herdr reused):
CodeRabbit did not post findings on this head. |
Change
Follow-ups to #3173 (queued follow-ups recovered as held after a disconnect), from the two reviews of its last head. Each is a way the bridge alone could let a held message be typed twice or offered for the wrong pane; in one browser whose storage works, the page's own re-read before a press already stops the double sends.
The claim comes before the dispatch. A Send now of a saved copy removed the held receipt, typed the text, and only then recorded
sentunder the pane ID it started with. A turn is its pane ID's, so when herdr moved the pane while the text was on its way, the outcome landed under the old ID and a second tab's copy under the new one was typed again (a resend there with another generation typed at the same time). The handler now puts asendingclaim among the receipts before anything is typed. The move carries it, every resend of that ID under any pane ID answerspending_busywhile it stands, and the send's end is recorded under the ID the pane has then:sent, the "not confirmed" note, or the held receipt back in place when nothing was typed.The "not confirmed" note outlives its owner's record. When a Send now ended without an answer inside the first minute after the reload, the closed owner's record aged out as
dismissed60 s after the close, and that removal erased the note. Only the record's own disposition was left, and past 1,024 later dispositions the other tab's copy was typed again. Adismissedremoval now ends only a held receipt.A pane that ended leaves no held receipt. herdr may give its ID to another pane, and the same browser attaching there was told the old pane's copy was held, with Send now, for a terminal it was never written for. The pane's held receipts now go when it ends, and a follow-up the bridge still holds for it gets none when its connection closes later (the same failure with the pane ending first). What was sent, or may have been, stays and only refuses.
The page's proof no longer stretches when the device's clock is set back. The bridge ends its receipt on a forward-only clock; the page ended its proof on the wall clock. What is left of a proof now runs on a clock that steps forward by the larger of what the wall clock and
performance.now()moved since it was last read, so a wall clock set back takes nothing from the time that passed and a sleepperformance.now()did not count is still counted.Validation
All on commit
5f414757d.bun run check fast: passed (unit: 15255 pass, 0 fail, 51 skip; typecheck, build, generated types and themes, workflow syntax).herdr-ci-runner:local, a clone of this commit, each throughbun run check run), all passed: the contract testsserver/pending-input.contract.test.tsandserver/submit.contract.test.ts(228 pass, 0 fail), and the browser regressionspending-pane-switch-regression.ts,composer-fit-demo-regression.ts,held-rows-demo-regression.ts,restored-draft-demo-regression.ts,composer-draft-demo-regression.ts,chat-local-send-follow-demo-regression.ts.server/core/pending.test.ts: a pane moved while a Send now is on its way, for each end of the send (sent, not confirmed, nothing typed): the other tab's resend under the new ID with another generation is answeredpending_busyduring the flight (on main it typed at the same time), and afterwards the outcome is known under the new ID. The harness's turns are now per pane ID, as in the bridge.server/core/pending.test.ts: a Send now that ends without an answer inside the owner's first minute, then the record's expiry and 1,100 other dispositions: the other tab's resend is stillpending_uncertain(on main it typed).server/core/pending.test.ts: a pane that ended with one held receipt and one message still held on a live connection that closes afterwards: a browser attaching under the reused ID is told neither as held; a follow-up taken for the new pane is held and told as before.src/lib/pendingMessages.test.ts: a proof ends after the time that passed with the device clock set back an hour, and after a sleep the forward-only clock did not count. The file's clock tests now move both clocks together.bun run check full; the full browser sequence of a pane move during a send (the tests drive the bridge and the store directly). The branch is based on main as of fix(cli): ovis add takes a line as an answer only when it was typed after its request was shown #3581 and merges with today's main without conflicts.🤖 Generated with Claude Code