Skip to content

test: credit the shift watch's first presentation while the document parses - #5765

Merged
leaf-agent merged 1 commit into
mainfrom
fix/issue-5745
Nov 9, 2026
Merged

leaf-agent merged 1 commit into
mainfrom
fix/issue-5745

Conversation

@leaf-agent

Copy link
Copy Markdown
Collaborator

On a slow runner, Chrome can paint a document its HTML parser has only partly added. In run 42587155541, the parser yielded inside tests/smoke/test_plain_page.py's host section. The paint showed the select with no option yet (22 px wide) and without the 20 px svg that comes after it on the same line. When the rest of the markup arrived, the select widened to 50 px and moved down 5 px. The shift watch reported that as a move without input. The watch already treated everything before first presentation as exempt, but only on a Leaf page, where first presentation ends when the runtime stamps data-lf-presented. A plain page had no exemption at all, even while its own markup was still being parsed.

tests/shift_watch.js now treats any page as still in its first presentation until the second frame after the parser finishes (readyState leaves loading). Moves after that are judged as before.

Verification:

  • Reproduction: serving the smoke test's page in two pieces, split at the select's <option>, reproduces the CI finding exactly: 22→50 px wide, y 142→147. With the change, the smoke test passes under the same split.
  • New test: test_the_document_moves_what_it_painted_half_parsed_without_a_finding holds the second half of a document on an explicit event rather than a sleep. It fails without the change, with select#pick moved without input by (0, 25)px. With the change it passes, both normally and with --cpu-throttle 10. Its control, a scripted move after parsing, still fails as before.
  • Focused selection: the plain-page smoke file plus the watch's core cases pass (12 tests).

Closes #5745 — automated triage

…parses

Chrome may paint a document its HTML parser has only partly added. On a
slow runner the parser yielded inside the plain-page smoke test's host
section, so a paint showed its select with no option (22 px wide) and
without the 20 px svg beside it; the rest of the markup widened the select
and pushed it down 5 px, which the watch reported as a move without input.
The watch credited first presentation only on a Leaf page, until the
runtime stamps data-lf-presented. Any page now presents first until the
second frame after its parser finishes. A move after that still fails.

Closes #5745
@leaf-agent
leaf-agent merged commit 97cfc4e into main Nov 9, 2026
6 checks passed
@leaf-agent
leaf-agent deleted the fix/issue-5745 branch November 9, 2026 10:02
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.

Plain-page smoke test intermittently sees the host's select shift 5px at teardown

1 participant