Repository navigation
test: wait for the admitted thread id and the framed page's body in two macOS-only tests - #5949
Merged
Merged
Conversation
…wo macOS-only tests Scheduled run 43587194195's macOS job failed two tests on reads that happen before what they wait for exists. Neither change touches product code. - `test_packages_and_panel_share_threads_through_gestures_and_authored_content[choose-earlier]` read the admitted thread's id once, right after `round_trip`, and got the tab's pending id. Since #5899, the page adopts the server's reading a task after the send's answer, so the test now waits for the id to change. This is the same wait #5943 gave the sibling package test. - `test_a_framed_page_moves_nobody_until_the_user_enters_it` polled `document.body.hasAttribute(...)` in a frame that was still navigating, and failed with `Cannot read properties of null (reading 'hasAttribute')`. The predicate now treats a missing body as not yet presented. Both pass on Linux before and after the change. The next scheduled macOS run will show whether they pass there. Refs #4225
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.
Two tests failed only in the macOS job of scheduled run 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]failedassert admitted["id"] != pending["id"]with both idspending:98b291bc…. Since Draw a sent comment and a Resolve before the server's reading on a long page, and make a publication cost what it changed #5899, the page adopts the server's reading a task after the send's answer, so reading the collection once right afterround_tripcan still see the tab's pending copy. test: wait for the server's reading of a send before reading what only it decides #5943 diagnosed this in Seven macOS browser tests: an acked thread stays pending in the tab, so readThreads lacks it and z sends no undo #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_itfailed in its ownwait_for_functionpredicate withTypeError: Cannot read properties of null (reading 'hasAttribute'). The inner frame was still navigating and had nodocument.bodyyet. Itsdata-lf-presentedwait, and the identical one intest_a_same_origin_frame_reads_hidden_and_settled_off_screen, now usedocument.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
cion main is live, the next scheduledtest-macosrun after merge is the before/after evidence.Refs #4225 — automated triage