Repository navigation
Wait for the saved draft before reloading in the held-keys draft test - #6416
Merged
Merged
Conversation
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_
leaf-agent
approved these changes
Nov 18, 2026
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_
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
test_held_keys_stand_beside_a_saved_drafttyped 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 3on a loaded host.