Skip to content

fix: keep waiting for page readiness when the page replaces its document mid-wait - #7029

Merged
leaf-agent merged 1 commit into
mainfrom
fix/issue-7022-readiness
Nov 24, 2026
Merged

leaf-agent merged 1 commit into
mainfrom
fix/issue-7022-readiness

Conversation

@leaf-agent

@leaf-agent leaf-agent commented Nov 24, 2026 •

Copy link
Copy Markdown
Collaborator

wait_until_ready waits on a page through wait_for_function(...).json_value(). A page can replace its document on the way to ready, as a revision whose executable identity differs does, and if that happens between the old document's answer and the read of its handle, the read raises Execution context was destroyed and the whole wait fails. The scheduled macOS run 45378690705 failed test_a_user_working_an_obligation_keeps_it_across_a_replacing_document this way, inside told → wait_until_ready. The wait now treats that error as the document moving on and keeps waiting in the new document, within the same no-progress bound. Any other Playwright error still raises.

The fix sits in wait_until_ready rather than in the one test, because every caller that writes a version behind a live page (told, the render gate) waits across the same possible replacement.

test_a_handover_that_replaces_the_document_waits_on_in_the_new_one uses a fake page whose first read fails with Playwright's error. It fails without the change and passes with it. A dispatch of the failing test alone on the macOS runner (--workers 1 --load 4, 18 copies, from main) passed every copy, because the window is the gap between two driver calls. So the failing nightly is the before evidence, and the next scheduled run is the after.

Refs #7022 — automated triage. #7022's other failure, the Firefox undo grouping, is fixed separately in #7030.

…ent mid-wait

wait_until_ready read each standing through a JSHandle the old document
returned. A page that replaces its document on the way to ready, as a
revision that cannot be patched in does, could destroy that context between
the answer and the read, and the wait raised "Execution context was destroyed"
instead of waiting on in the new document. The scheduled macOS run 45378690705
failed test_a_user_working_an_obligation_keeps_it_across_a_replacing_document
this way. A model test with a page whose first read fails like that fails
before the change and passes after it.

Refs #7022
@leaf-agent
leaf-agent merged commit c5ac16d into main Nov 24, 2026
7 checks passed
@leaf-agent
leaf-agent deleted the fix/issue-7022-readiness branch November 24, 2026 17:52
leaf-agent added a commit that referenced this pull request Nov 24, 2026
…plit it (#7030)

CodeMirror's history starts a new undo step when a run of keystrokes
pauses longer than its group delay.
`test_words_typed_while_the_editor_loads_are_its_first_words` typed
`kept ` after the editor loaded and expected a single undo to remove it.
On the scheduled macOS run
[45378690705](https://github.com/max-sixty/leaf/actions/runs/45378690705),
Firefox typed slowly enough to split the word, and the first undo left
`Typed ear and\nkely`. The test now types one key there. One key is one
transaction however slowly the runner types, so the test still checks
what it protects: words typed before the editor loads are one undo step,
separate from words typed after it arrives.

Before the change, a 700 ms pause between `ke` and `pt ` reproduces the
nightly's `kely` locally on both Chromium and Firefox. After it, both
engines pass. A dispatch of the unchanged test alone on the macOS runner
passed 18 of 18 copies, so the failing nightly is the before evidence on
that runner.

Refs #7022 — automated triage. #7022's other failure, the readiness
probe across a replacing document, is fixed separately in #7029.

Co-authored-by: leaf-agent <[email protected]>
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.

1 participant