Skip to content

test: wait for lf-motion's failure reports before consuming them - #5351

Merged
leaf-agent merged 1 commit into
mainfrom
fix/issue-5138-motion-reports
Nov 4, 2026
Merged

leaf-agent merged 1 commit into
mainfrom
fix/issue-5138-motion-reports

Conversation

@leaf-agent

Copy link
Copy Markdown
Collaborator

The motion failure test read its browser problems a task too early. A widget failure's console report is deferred by lfDocumentLifetime.whenActive (browser/runtime/prepaint.js), which reports in a setTimeout after the widget has already drawn "Failed" on its clock, so consume_browser_errors could run between the paint and the report and find an empty list, as the macOS job did in run 41432142330. The test now waits for the complete inventory with reported_browser_errors: one playback failure, then one frame failure for each of the three draws that threw (End, ArrowLeft, Play). Widening the report's deferral by 300 ms in the page reproduces the CI assertion (assert ([])) on the old test and passes on the new one; without the injected delay the test passes repeatedly, including at --cpu-throttle 12.

The same deferral also let the frame-failure check consume early, which left a late third report for the fixture's teardown under the widened delay; the exact inventory closes that too. No product code changes, and the behavior the test protects (the clock says Failed, the box stays single, the agent hears each failure) is unchanged.

Closes #5138 — automated triage

A widget failure's console report lands a task after the widget draws it
(`lfDocumentLifetime.whenActive` defers it with setTimeout), so the motion
failure test could see "Failed" on the clock and then read an empty problem
list. It now waits for the complete inventory with `reported_browser_errors`:
one playback failure, and one frame failure for each of the three draws that
threw (End, ArrowLeft, Play). The behavior protected is unchanged.

Closes #5138
@leaf-agent
leaf-agent merged commit 7f8047f into main Nov 4, 2026
5 checks passed
@leaf-agent
leaf-agent deleted the fix/issue-5138-motion-reports branch November 4, 2026 10:21
max-sixty pushed a commit that referenced this pull request Nov 9, 2026
…ors reads it (#5781)

`consume_browser_errors` read `page.lf_errors` the moment it was called.
A widget's failure box and its console report reach Python by separate
paths, so a test that waited for the box and then consumed the problem
could find an empty list. That is what failed
`test_visual_review_guides_one_typed_still_run` on macOS in scheduled
run
[42604289041](https://github.com/max-sixty/leaf/actions/runs/42604289041):
the page showed `before is 1800px wide and after is 780px` in
`.lf-error`, then `consume_browser_errors` asserted on `[]`. #5351 and
#5352 fixed this same race one test at a time. Now the helper itself
keeps the Playwright driver pumping until the first problem arrives,
using the same wait `reported_browser_errors` already had (moved into
`_await_browser_errors`). A closed page stops the wait. What counts as a
match is unchanged.

The race only shows on macOS, so the failing run above is the before
evidence. On Linux, the visual-review journey,
`tests/model/test_chrome_contracts.py`, the closed-page consumer in
`test_status_and_news.py` and `tests/smoke/test_plain_page.py` pass with
the change. The next scheduled `test-macos` run shows whether it holds
there.

#5780's other nine macOS failures have different causes and stay open
there.

Refs #5780 — automated triage

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.

Motion failure produces no expected study report

1 participant