Repository navigation
test: wait for the server's reading of a send before reading what only it decides - #5943
Merged
Merged
Conversation
…y it decides #5899 made `applyState` wait for the frame a gesture owes before it adopts the server's reading, so the send's answer (`round_trip`, `sending`) now arrives a task before the page holds the server's thread or offers Undo. Tests that read `readThreads()`, a package widget's thread id, or pressed `z` right after the trip read the tab's pending copy instead. - `open_panel_thread` waits until the page holds the thread rather than reading `readThreads()` once. - The two floating-panel tests take back a Resolve with `undo(page)`, which waits for the dispatcher to take `z`, instead of pressing it at once. - The package thread-widget test waits for the server's id before naming the panel view. No product behavior changes; the tests protect the same behavior, read once the page has the reading that decides it. Refs #5941
This was referenced Nov 14, 2026
Merged
max-sixty
pushed a commit
that referenced
this pull request
Nov 14, 2026
…wo macOS-only tests (#5949) Two tests failed only in the macOS job of scheduled run [43587194195](https://github.com/max-sixty/leaf/actions/runs/43587194195) because each reads something before it exists. This PR makes each test wait for it. No product code changes. - **`test_packages_and_panel_share_threads_through_gestures_and_authored_content[choose-earlier]`** failed `assert admitted["id"] != pending["id"]` with both ids `pending:98b291bc…`. Since #5899, the page adopts the server's reading a task after the send's answer, so reading the collection once right after `round_trip` can still see the tab's pending copy. #5943 diagnosed this in #5941 and gave the sibling package test the same wait. The test now waits until the thread with the pending key has a different id. - **`test_a_framed_page_moves_nobody_until_the_user_enters_it`** failed in its own `wait_for_function` predicate with `TypeError: Cannot read properties of null (reading 'hasAttribute')`. The inner frame was still navigating and had no `document.body` yet. Its `data-lf-presented` wait, and the identical one in `test_a_same_origin_frame_reads_hidden_and_settled_off_screen`, now use `document.body?.`, so a frame with no body counts as not yet presented and the wait keeps polling. **Verification.** Both tests pass locally on Linux before and after the change, and ruff is clean. Neither failure reproduces on Linux. Per **A red `ci` on main is live**, the next scheduled `test-macos` run after merge is the before/after evidence. Refs #4225 — automated triage Co-authored-by: leaf-agent <[email protected]>
This was referenced Nov 14, 2026
This was referenced Nov 15, 2026
leaf-agent
added a commit
that referenced
this pull request
Nov 15, 2026
…sure cards and acked undo (#6046) Four tests in [scheduled run 43706054091](https://github.com/max-sixty/leaf/actions/runs/43706054091) still expect what the page did before a merged change. Each change moved the interface on purpose, and this PR updates the tests to the new behavior. No product code changes. - **`test_an_agent_reply_can_move_a_thread_to_its_revised_visual`, `test_an_agent_reply_can_remove_a_subject_and_detach_its_open_thread`** (both platforms): #5961 added `holder` to each thread record in `page state` and updated the model tests, but not these journeys. They now expect `"holder": {"kind": "main"}`. - **`test_complete_views_restore_native_values_in_wrapped_layouts[1200|390]`** (both platforms): #6040 names a playground control with `aria-labelledby` (the textbox is still named "Title"). The test looked for `input[aria-label="Title"]`, which no longer matches, so it now uses `get_by_role("textbox", name="Title")` like the rest of the test. #6038 moved this test into the journeys tier, so #6040's own CI didn't run it. - **`test_strokes_join_one_drawing_until_it_is_sent_and_escape_leaves`** (both platforms): `git bisect` names #5846 as the first bad commit. That change opens the comment box and the sent thread's card at the full measure. In the test's window, the box (x 382–946) and then the card (x 368–960) cover `#fig`, where the test's strokes began. The press landed on the box's text field, so no second stroke was drawn. The two strokes over the figure now start at its left edge (x ≈ 262–348). They still begin over another element, which is what the test checks. - **`test_resolving_a_thread_from_threads_moves_on_to_the_next`** (macOS only): it pressed `z` as soon as the Resolve was acked, before the page held the server's reading. That's #5941's mechanism, which #5943 fixed in the sibling tests. It now uses `undo(page)`, which waits until the dispatcher would take `z`. **Verification.** On main (`9f3c6590b`), the five Linux-reproducible cases fail before this change and pass after it. The edited modules pass in full, along with `tests/model/test_suite_source.py`: 1,225 passed. The resolve test passes on Linux both before and after. Its macOS evidence is the next scheduled `test-macos` run. This leaves the run's other new failures to their own owners. Those are listed on #4225. Refs #4225 — automated triage Co-authored-by: leaf-agent <[email protected]>
max-sixty
added a commit
that referenced
this pull request
Nov 15, 2026
…in round_trip, and refuse assertions that rest on a sleep (#5988) Three changes to how the suite isolates tests and waits, from a review of recent flakes. **Process state.** Nothing writes the pytest process's environment directly now. `pytest_configure` sets the run-wide conditions once through a `MonkeyPatch` (failing harness programs on PATH, the headless shell as `LEAF_BROWSER_EXECUTABLE`, Linux fonts, SIGINT), and tests use `monkeypatch`. The website's `restore()` no longer sets `LEAF_PAGE_COMMIT`; the container's `main` does, so `isolated_session` drops the reset b45b8e1 added. A teardown hook fails any test that leaves the environment, working directory or SIGINT/SIGTERM/SIGHUP handlers changed, and a command a test runs through `CliRunner` keeps the signal handlers it takes (`leaf wait`, `leaf page events`) to that run. Layer caches are per test through `monkeypatch.setattr` instead of cleared after. **`round_trip`.** Since #5899 the page adopts the server's reading a task after the answer, so tests that read page state right after `round_trip` saw stale state (#5943 and #5949 fixed seven one by one). The traffic ledger now counts `received` and `applied` states, and `round_trip` also waits until every received state has finished applying. `postEvent` counts `acked` once the answer's body is read; its headers still decide at once. The two one-shot reads those PRs replaced are back. Two tests hold that application on purpose (behind a held Markdown import, and held zero-delay timers), and end their trip at the answer through a new `delivered`. **Sleeps.** `test_no_assertion_rests_on_a_sleep` refuses a sleep followed by an assertion. The 79 such sleeps in nine files now wait for `rendered`, an ordered later event, or the page clock run past the runtime's own preview timers (`PREVIEW_TIMERS`, read through `__lfCheckApi`); each pattern was checked against a product change that brings the bug back. `tests/AGENTS.md`, "Fixtures", states the isolation rule. Max asked for this. Codex reviewed it twice, and its findings are fixed. A [full-suite dispatch](https://github.com/max-sixty/leaf/actions/runs/43651852106) on an earlier commit found four failures this change caused, all fixed since: the two held applications, `leaf page events` taking SIGTERM, and a finger landing on a panel still opening (macOS). Its other failures also fail on main, in main's own runs or run locally, except three macOS ones that pass here under `--cpu-throttle 10`. Focused tests, `pnpm run test:runtime` and `pnpm run check` pass. > _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.
#5899 made
applyState(browser/runtime/state-application.js) wait for the frame a gesture owes before it adopts the server's reading, so the gesture's own result paints first. So the send's answer, whichround_tripandsendingwait for, now lands a task before the page holds the server's thread or offers Undo. Six of the seven macOS failures in #5941 read that state right after the trip:readThreads()throughopen_panel_thread, a package widget's thread id, or azpressed straight after a Resolve. They saw the tab's pending copy, and the droppedznever retried. This PR makes them wait for the reading itself. It changes no product code. The harness already says delivery does not mean the page applied the returned state (_Trafficintests/render_harness.py).open_panel_threadwaits untilreadThreads()holds the thread instead of reading it once.test_one_field_starts_a_thread_takes_its_reply_and_settles_itandtest_a_thread_s_keys_answer_in_its_viewundo the Resolve with the existingundo(page), which waits until the dispatcher would takez.test_package_thread_widgets_keep_local_filters_and_independent_subscriptionswaits for the server's id before it names the panel view.Verification. On Linux, the failing state appears when
zis pressed right after the Resolve is acked. A probe did that 15 times per arm. It failed 6 of 15 at #5899 (c0ff621c1), 5 of 15 on main, and 0 of 30 at #5899's parent. In each failing run, a secondza second later sent the undo, so the page catches up; only the early press is lost. The same probe usingundo(page)passed 15 of 15. The six edited tests pass locally. They passed on Linux before this change too, so the macOS evidence is the next scheduled run after merge. I couldn't make the old one-shotopen_panel_threadread fail on Linux, even with--cpu-throttle 15.What this leaves.
test_undo_waits_while_the_candidate_is_applying_then_reads_accepted_truthalready usesundo(page). On macOS its page ended at#sug-thistle, so thatzshowed the suggestion rather than taking it. That's a different mechanism, and it stays open on #5941. If the next macOS run still showsreadThreadswithout the server's thread after these waits, the reading never got adopted, not just adopted late. The likely cause would be an owed frame that never paints, leavingafterOwedFrameunresolved.Refs #5941 — automated triage