Skip to content

test: wait for the admitted thread id and the framed page's body in two macOS-only tests - #5949

Merged
max-sixty merged 1 commit into
mainfrom
fix/issue-4225-macos-reads
Nov 14, 2026
Merged

max-sixty merged 1 commit into
mainfrom
fix/issue-4225-macos-reads

Conversation

@leaf-agent

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

Copy link
Copy Markdown
Collaborator

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.

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

…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
max-sixty merged commit 3ffaed7 into main Nov 14, 2026
6 checks passed
@max-sixty
max-sixty deleted the fix/issue-4225-macos-reads branch November 14, 2026 18:45
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_
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