Skip to content

Wait for the saved draft before reloading in the held-keys draft test - #6416

Merged
max-sixty merged 1 commit into
mainfrom
saved-draft-test-waits
Nov 18, 2026
Merged

max-sixty merged 1 commit into
mainfrom
saved-draft-test-waits

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

test_held_keys_stand_beside_a_saved_draft typed a draft and reloaded at once. On a busy host the first keystroke's write was still out, so the reload's document was served holding "H" and the page going away resent the full words only after it. The test then read "H", about one run in three in a parallel local selection (CI passes it). The test now waits until the server holds the draft before reloading.

The runtime is unchanged. Held deterministically (first write's answer held, then a reload), the reloaded page shows the short words until its first look reads the newer draft, and words typed in that window are replaced. That needs a reload within one write's round trip and typing before the first look, so the commit records it and leaves it.

Found while testing #6383. The selection around it passed 4 of 4 runs at -n 3 on a loaded host.

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

test_held_keys_stand_beside_a_saved_draft typed a draft and reloaded at once. On a
busy host the first keystroke's write was still out, so the rest of the words waited
behind it; the reload's document was served holding "H", and the page going away
resent the full words only after that. The test then read "H" where it expected
"Half a thought", about one run in three in a parallel selection on a loaded Mac
(2026-11-18), with or without #6383. It now waits until the server holds the draft,
which is what "a saved draft" means.

Held deterministically (the first write's answer held, then a reload), the reloaded
page showed "H" until its first look read the newer draft; words typed in that window
were replaced by it. That path needs a reload within one write's round trip and typing
before the first look, so the runtime is left as it is.

> _This was written by Claude Code on behalf of max-sixty_
@max-sixty
max-sixty merged commit 73fcb37 into main Nov 18, 2026
5 checks passed
@max-sixty
max-sixty deleted the saved-draft-test-waits branch November 18, 2026 20:53
max-sixty added a commit that referenced this pull request Nov 19, 2026
…ting (#6428)

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_
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