Skip to content

Start a reload from its page's copy of each draft, taken or still waiting - #6428

Merged
max-sixty merged 2 commits into
mainfrom
queued-key-panel
Nov 19, 2026
Merged

max-sixty merged 2 commits into
mainfrom
queued-key-panel

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

A reload asks for its document before the page it replaces goes away. Where that page then hears the server take its last draft write, it holds the draft as durable, and #6399's handoff leaves the reload only drafts still waiting, so the reload shows the older generation it was served until its first look. Words typed on arrival go over that older generation and are replaced by the departing page's words. This is the flake in test_held_keys_stand_beside_a_saved_draft ("H" for "Half a thought", 2 of 13 runs under -n 3 on a loaded Mac, with #6399 in).

The page now leaves its durable copies in the tab too, still marked durable so the reload doesn't write them again; a served generation older than a copy gives way to it by version in hearReading, as for any reading. test_words_typed_on_a_reload_stand_over_a_write_taken_as_it_was_served serves the reload a document fetched before the write lands and fails on main. The saved-draft test drops the wait-for-save step #6416 added; its selection passed 8 of 8 runs.

To weigh: a store that went back as the page reloaded (a server restarting from an older copy) isn't heard by the reload, so a durable copy shows words the server lost and isn't written back; main drops them. A Codex review found that taking the copies' versions as the reload's heard store version, which would catch that, suppresses reads of other drafts, so it's left out. Codex also confirmed a pre-existing flaw this doesn't touch: recovery after a rollback writes the tab's words over a generation another device wrote after the rollback.

pnpm run check and pnpm run test:runtime fail on main at the moment in anchor-placement.js, from #6417; this change doesn't touch it.

Found while following up the saved-draft flake from #6383.

This was written by Claude Code on behalf of max-sixty

…ting

A reload asks for its document before the page it replaces goes away. Where that
page then heard the server take its last draft write, it held the draft as durable
and left the reload nothing, since #6399 leaves only words still waiting. The reload
showed the generation it was served, older than the one the server now held, until
its first look. Words typed on arrival went over that older generation, and the
server's answer replaced them with the departing page's words, which the reload took
for another tab's. test_held_keys_stand_beside_a_saved_draft read "H" for "Half a
thought" in 2 of 13 runs of its selection at -n 3 on a loaded Mac (2026-11-18), with
#6399 in.

The page now leaves its durable copies too, still marked durable so the reload
doesn't write them again, and a served generation older than a copy gives way to it
by version, as any reading does.

A store that went back as the page reloaded, as one restarting from an older copy
of its page does, isn't heard by the reload: a durable copy shows words the server
lost and isn't written back. Main drops those words at the reload. Taking
the copies' versions as the store version the reload has heard would catch it, but
a review found that suppresses reads of other drafts a copy's version says nothing
about, so this change leaves it.

Tests: test_words_typed_on_a_reload_stand_over_a_write_taken_as_it_was_served
serves the reload a document fetched before the write lands, and fails on main
("K" for "Kept"). test_held_keys_stand_beside_a_saved_draft no longer waits for the
save before it reloads (#6416's step); its selection passed 8 of 8 runs at -n 3.

> _This was written by Claude Code on behalf of max-sixty_

@leaf-agent leaf-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The red test job (run) fails in pnpm run check at savedAt in browser/runtime/anchor-placement.js (placement() / reads(placement), undefined names). That code is on current main from #6417, which this PR doesn't touch, so it doesn't withhold approval. Locally, the new reload test fails against the base drafts.js and passes on head; the other reload tests in test_shared_drafts.py and test_held_keys_stand_beside_a_saved_draft pass on head too.

@max-sixty
max-sixty merged commit 556794e into main Nov 19, 2026
4 checks passed
@max-sixty
max-sixty deleted the queued-key-panel branch November 19, 2026 00:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants