Skip to content

Test in one generated matrix that the page holds still under the user - #5398

Merged
max-sixty merged 6 commits into
mainfrom
agent-a22bb380351c3854e
Nov 5, 2026
Merged

max-sixty merged 6 commits into
mainfrom
agent-a22bb380351c3854e

Conversation

@max-sixty

@max-sixty max-sixty commented Nov 5, 2026 •

Copy link
Copy Markdown
Owner

One generated browser test now checks Leaf's guarantee that the page holds still under the user's aim (browser/AGENTS.md): wherever the user is, a change they didn't make leaves what they read, point at or type into where it stood. It is the test the places step of the cutover finishes against: #5396, the one hold that replaces placeKeeper and the seat's hold, has to pass every cell main passes, so its remaining regressions show up all at once instead of one review round at a time.

How it works

tests/journeys/test_page_holds_still.py crosses two lists. PLACES says where the user is and which box marks it: typing in a reply box, a focused message, Send, a paragraph being read, a margin pin, a pointer that left the window, a wheel or smooth scroll under way, a Page Map row under focus or the pointer, a diff gutter Comment, a control under the pointer inside a widget's shadow tree, the depth dial, a pane, an On me row. CHANGES says what arrives: an agent reply above or below, an edit that grows or shrinks a message above, a revision that adds above or on screen or removes above, a new seat thread, Page Map joins, diff deletions, a dial turn, growth after the dial's glide, a revision in a pane, an ask. A case exists wherever the change can reach the place (Place.around, Change.on): 44 cells, each in Chromium and Firefox.

Each case puts the user there, reads the box's top and left, makes the change, waits for it to show and settle, and reads the box again; it must stand within 1px. It also reads the box after every rendered frame in between, so a move the page paints and then takes back fails, and so does a frame where the box is gone or has zero width or height. Two results move the place by design, and their descriptors state how: the user's own scroll, where every frame must stand on the path from start to goal, and a new thread drawn at once above the place. The dial's glide is exempt from the turn's press to the first frame the browser draws with no animation running; from then on every frame must stand still. Each case records what it measured as JUnit properties, so --junitxml holds the whole table.

What main gets wrong today

68 cases pass. 20 are strict xfails, xfail(strict=True, raises=Moved), so only the position check can produce the expected failure: a failed setup or delivery fails the case, and a fix shows as an XPASS. Each gives its measured pixels:

Cell Chromium Firefox
Message focused × reply below it −195px −195px
Message focused × revision above −95.5px −96px
Reading × edit of the paragraph read 84px 84px
Reading × edit shrinking a message above −42px −42px
Reading × revision on screen above the line 67.4px 67.4px
Reading × revision removing a paragraph on screen above −67.4px −67.4px
Smooth scroll of 300px × reply above passes stops after 34 to 66px
Smooth scroll of 300px × revision above passes stops after 59 to 102px
Diff gutter Comment × deletions above 100px 100px
Pointer on a control in a shadow tree × deletions 100px 100px
Dial × growth on screen above after the glide 199.8px 199.7px

The dial row is growth on screen above the reading line, which the browser's anchoring holds by the first block in view: before #5397 Chromium held there only by chance and until the next scroll, and Firefox moved 560.7px.

Where the test stands in for the user

  • Firefox on macOS reaches no link or button with Tab, so a message is focused by a click on its words.
  • In a smooth-scroll case the server's answer is released once the scroll has come 30px. In Firefox the answer arrives mid-scroll; a scroll that reached its goal first fails the case's setup instead of measuring. Playwright's calls return about 250ms late during a Chromium smooth scroll, so there the answer waits for the scroll's end and the cell measures a finished scroll.
  • Playwright's wheel scrolls at once, and Firefox fires no scrollend for it, so a wheel cell releases the answer once the page has stood still for 160ms, longer than the runtime's 80ms rule for a scroll whose end it never hears (SETTLE_MS in arrivals.js).
  • The shift watch is off for the file (shifts_unsurveyed), since the cases measure what it watches and an xfail would otherwise fail its teardown too.

Planted faults confirm the checks fire. A permanent translateX(50px), scale(0) or scaleX(0) for three frames, a 200px move taken back, a 50px overshoot of a scroll, and a 50px shift for three frames right after the dial's glide each fail the case. Holding the answer until a Firefox smooth scroll has finished fails its setup.

Cost and tier

The file runs in tests/journeys/: the daily run, a manual dispatch, and any pull request that edits the test. On CI's runner it is over the 8s per case that tests/browser/ allows (BUDGETS in suite_profile.py). In this PR's test job at ddbb6da its 88 cases took 15.1 of the job's 37.6 worker-minutes, a median of 9.7s per case, and 56 cases were over 8s; for comparison, the heaviest file in a push run on main, test_render_floating_panel.py, takes 12.9 worker-minutes for 139 cases. Locally a case takes 1–5s, and the whole file runs in 97s at -n 2. Opening each case's page takes about 2.4s of it (Page.goto). Sharing one page per place would save most of that, but each change appends to the page's log or publishes a revision, so the next case would inherit it; each case keeps its own page, as tests/AGENTS.md asks.

This was written by Claude Code on behalf of max-sixty

`test_page_holds_still.py` crosses where the user is with what arrives, wherever
the change can reach the place: 38 cases, each in Chromium and Firefox. The places
are typing in a seat's reply box, a clicked message, Send, reading a message or the
page with focus scrolled away, a margin pin under the pointer, the reply box after
the pointer left the window, a wheel or smooth scroll under way, a focused Page Map
row or one under the pointer, a diff Comment focused or under the pointer in the
diff's shadow root, the dial's folded inline text with motion on and reduced, a
pane, and an On me row. The changes are an agent reply above or below, an agent
edit above, a revision above the window, on screen or inside a pane, a new thread in
a seat or Page Map, a widget's Page Map entry, an ask, diff deletions, and the
user's own dial turn.

Each case reads the place's box before the change, after every rendered frame, and
once the page settles, and fails on a move over 1px. Where the change's own result
moves the place, the case allows exactly that: the user's own scroll, a new thread
drawn at once above it, or the dial's glide before it lands. A scroll case holds the
server's answer until the scroll is moving, so the page takes the change in mid-
scroll; Chromium's headless shell finishes those scrolls at once.

The 15 cases the runtime fails today are strict xfails carrying the pixels they
measured, so a place-keeping fix flips one and has to take its mark off. Planting
faults in the hold (no yield to a scroll, a keep one painted frame late, no keep at
all) fails the cases that rely on it, so the passing cases are not vacuous.

A case takes 1 to 5s; the file is 173s of test time, 87s of wall time at two
workers, so it sits in tests/browser/, which runs on each push to main.
…5397 left

On main with #5397, the dial's Firefox turn holds the line read (-0.4px, was
708.6px), so its cell is a plain pass. The other strict xfails measure as before.
The dial's depths are now Web Awesome radios (#5393), so a turn presses the radio.

A new cell, dial × grown-after-glide, turns Read to Skim and, once the glide ends,
lets a 200px image load in the gist of the section above. On main the gist read
moves 199.8px in Chromium, which held it at 2e17258 before #5397 (-0.2px), and
199.7px in Firefox, which moved before too (560.7px). Both are strict xfails.
leaf-agent
leaf-agent previously approved these changes Nov 5, 2026
The review of #5398 found moves the matrix let through, each reproduced by a fault:

- A frame is now held to the place except where the user's own act or the change's
  own result accounts for it. A scrolled place stays on its path from the start to
  the scroll's goal and never turns back, where before any frame of a scroll case
  passed. The dial's glide is passed over only until its animations end, so growth
  after the glide is held, which grown-after-glide inherited no allowance for.
- Each frame reads the box's left as well as its top, and a frame without the box,
  or with one of no size, fails.
- A scroll case releases the page's held read once the scroll has come a tenth of its
  way. In Firefox it goes while the scroll is short of its goal, and the case confirms
  the change drew before the scroll ended. In Chromium, where Playwright's calls answer
  some 250ms late during a smooth scroll, and for Playwright's wheel, which scrolls at
  once, the read waits for the scroll's end (`scrollend`, or ten still frames where
  Firefox fires none). Holding the read past the scroll no longer passes the Firefox
  smooth cells.
- A case marked as failing expects only `Moved`, the verdict on where the place
  stood, so a failed setup or delivery fails it.
- Two changes take content out above the place: a revision removing the last of the
  page's paragraphs above it (typing, reading, reading-page), and the agent's edit
  shrinking a message above it (typing, reading). On main, reading-page moves 67.4px
  up as the paragraph on screen above it goes, and reading moves 42px up as the edit
  takes out the paragraph above it.

On main the file is 68 passes and 20 strict xfails in each engine pair.

@leaf-agent leaf-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR description no longer matches the file after ddbb6da. It becomes main's commit message when the PR is squash-merged, so its numbers and explanations need to match the code:

  • Counts. The file now generates 44 cells (88 cases). That is 68 passes and 20 strict xfails, not 39 cells with 62 passes and 16 xfails. The cost paragraph's 174s was measured on the smaller matrix.
  • CHANGES and the table. The two new changes are missing: a shrinking edit above the place and a revision that removes a paragraph above it. So are their xfail rows, Reading × edit shrinks the message above (42px) and Reading page × revision removes the paragraph above (67.4px). The Firefox smooth-scroll rows still give 1–16px and 12–43px. The MOVES_ON_MAIN reasons now say 39–66px and 59–95px.
  • Mid-scroll explanation. The description says Chromium's headless shell finishes wheel and smooth scrolls at once. arriving's docstring now gives a different reason: Playwright's wheel scrolls at once in both engines, and in Chromium Playwright's calls answer about 250ms late during a smooth scroll, so the read waits for the scroll to end.
  • The dial. The description says that for the dial's glide "landing alone is held". Now turn holds every frame from the glide's end onward, and every case marked xfail expects only Moved.

…oth sizes

The re-review of #5398 found three narrower gaps, each reproduced by a fault:

- The glide's allowance now starts at the turn's press and ends in the frame reader,
  at the first frame in which no animation runs. It used to last until the next
  Python poll, which hid a 50px shift right after the glide.
- A box counts as standing only with both a width and a height, so `scaleX(0)` for
  three frames is three frames without the box.
- A case that means the change to draw mid-scroll fails setup when the scroll has
  reached its goal before the page's read goes, where it used to measure as a
  finished scroll and strictly XPASS. Only the smooth scroll means that, in Firefox.
- A scroll whose end the engine never announces, Playwright's wheel in Firefox,
  stands still 160ms before the read goes, past the runtime's 80ms rule for such an
  end (`SETTLE_MS`), where ten frames were 40ms at 240fps.

On main the file is 68 passes and 20 strict xfails.
…rowser tier allows

On CI's runner the file's 88 cases took 15.1 of the PR job's 37.6 worker-minutes,
a median of 9.7s per case, and 56 were over the 8s a test in tests/browser/ may take
(BUDGETS in suite_profile.py). Each case needs a page of its own, since every change
appends to the log or publishes a revision, so the file moves to tests/journeys/:
the daily run, a manual dispatch, and a pull request that edits the test.

@leaf-agent leaf-agent left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Withdrawn: the description at this head already matches the code on the wheel release and the Firefox smooth-scroll ranges. Moving the file to tests/journeys/ follows its measured cost against the browser tier's 8s budget. No findings remain.

@max-sixty
max-sixty merged commit 0acede6 into main Nov 5, 2026
4 checks passed
@max-sixty
max-sixty deleted the agent-a22bb380351c3854e branch November 5, 2026 02:18
max-sixty added a commit that referenced this pull request Nov 5, 2026
… the reading's frame, read the line's block

The stability matrix (tests/browser/test_page_holds_still.py, #5398) found three
cells main passes and this branch failed, in both engines unless named:

- left-window x reply-above, 0 -> 195px: the user typed in the reply box, hovered an
  earlier message and left the window. The pointer's position stayed where it last
  moved, so the hold aimed at that message, which the answer joining below it left
  still, and the still place kept its scroller from the box. pointer.js now forgets a
  mouse once `pointerout` relates it to nothing, as the browser sends when it leaves
  the window; a finger's out after a lift keeps its tap's position. Now 0.
- Firefox wheel x reply-above, -300 -> -105px: the answer arrived while a wheel was
  gliding, and the keep yielded to the scroll under way (`browserScrolls`), though
  the wheel had started before the reading and no frame had let it move the place.
  The keep now yields to a scroll the browser runs only once a frame has rendered
  since the reading; in the reading's own frame it pays for the change and the glide
  goes on. Now -300, the wheel's own travel.
- The dial's turn, -0.4 -> 2.6px, with motion and reduced: `readingAt` named the em
  holding the words at the reading line, whose box starts below its line's top by
  the leading, so Skim's gist landed 2.6px under the line read. It now names the
  block holding them. Now -0.4.

Matrix, main -> this commit: 62 passed and 16 xfailed on main; here every cell main
passes passes, and four of main's expected failures pass
(reading x edit-paragraph 84 -> 0, gutter x deletions 100 -> 0, both engines). Their
strict marks are #5398's to drop. Firefox's smooth cells stay failing as on main: the
keep's scroll stops a smooth scroll under way (smooth x reply-above -2px of 300).

Tests: a runtime case that a mouse leaving the window stands nowhere and a lifted
finger stays, and the yield test now separates a scroll a frame has moved (yields)
from one in the reading's frame (pays the change). Each fails with its rule undone.
max-sixty added a commit that referenced this pull request Nov 5, 2026
…no longer needs

a6fe0f0 let the keep pay for a change while a scroll was under way if no frame had
rendered since the reading, because the matrix's Firefox wheel x reply-above cell
moved the reply box -105px of the wheel's -300. That cell released the answer
straight after Playwright's instant wheel, which fires no `scrollend` in Firefox, so
the keep saw a scroll still under way. The matrix now releases a wheel's answer after
ten still frames (ddbb6da on #5398), and without the gate the cell moves -300 in
both engines, as on main.

The keep again yields to any scroll the browser is still running. Under the updated
matrix Firefox's smooth x reply-above moves -105px without the gate and -33px with it
(main -42px), failing on both sides: the gate's keep cut the smooth scroll short as
main's does, and without it the scroll runs on and the box moves by the 195px answer.

Updated matrix (88 cases), main 1906206 -> this commit: every cell main passes passes,
and six of main's expected failures pass (reading x edit-paragraph 84 -> 0, reading x
edit-shrinks -42 -> 0, gutter x deletions 100 -> 0, both engines). The pointer and
reading-line rules still earn their place: with either undone, left-window x
reply-above or the four dial-turn cells fail.

Tests: the yield test goes back to yielding to a scroll under way and to input, without
the frame case.
leaf-agent pushed a commit that referenced this pull request Nov 5, 2026
…place of placeKeeper and the seat's hold (#5396)

One Leaf hold now keeps the user's place where the browser's scroll
anchoring can't, replacing `placeKeeper` and the seat's `holdBox`. This
is the places step of the cutover to one way of knowing what's on
screen, after #5361, #5392 and the anchoring fixes in #5397. It passes
every case of the hold-still matrix (#5398) that `main` passes, in
Chromium and Firefox, and six that fail on `main`.

## The one hold

Scroll anchoring keeps the reader's place through re-renders and
revisions since #5397, but it holds the first box on screen, so it can't
keep three places still: a control under the user's hands below growth
on screen, the reading line when growth starts between anchoring's box
and the line, and a place the change hides. `user-place.js` holds those
once, after the change has drawn:

- `holdPlace(node, standIn)` reads where `node` (an element, or a range
over words) stands and returns the step that scrolls it, or what
`standIn(node)` names once the change hid or removed it, back there.
- `holdUserPlace()` takes it around a reading from outside the tab,
where `state-application.js` applies the reading, and keeps it once the
page shows it, whichever surfaces the reading redraws. Page Map takes it
around a widget's own contribution joining with no reading behind it. A
gesture's own result is never held; its handler places it.
- The place is, in order: a field the user types in; then the control
under a resting pointer (only a control a press acts on, `PRESSES`, and
nothing once a mouse has left the window) or the focused control,
whichever input came last; then, if focus is scrolled away, the words at
the reading line (`readingAt`, a range over the letter a quarter of the
way down the window). A thread the user sent from stands at its reply
box (`standsAt`).
- The keep puts back the first of these the change moved. A place the
change left still keeps its scroller, so a later place in it moves
nothing. It yields to what the user did since the reading: a scroll they
or a landing chose, one still under way, a press, or a key anywhere but
in the field it holds, so typing into that field leaves the place kept.
- The dial holds the block it folds, with the gist standing in for it.
Page Map's sheet is a reading region while it stands, so its list is the
scroller that keeps its row. The press-in-place correction in
`floating-panel.js` uses `holdPlace` for its arithmetic.

The revision landmark restore (`version.js`) stays as on `main`, and a
revision takes no hold, since the two undid each other by up to 82px.

## Measured

The matrix, `tests/journeys/test_page_holds_still.py`, 50 cells × 2
engines: `main` passes 80 and fails 20; this branch passes 86 and 14
stay expected failures. The six it fixes, both engines:

| Cell | `main` | this branch |
|---|---|---|
| Reading × edit growing the paragraph read | 84px | 0 |
| Reading × edit shrinking a message above | −42px | 0 |
| Diff gutter Comment × deletions above | 100px | 0 |

A new seat thread drawn above the place moves it by the thread on `main`
(153px, which the matrix allows); here it stays at 0. The cases
independent reviews found that a fixture can reach are new matrix cells,
each holding still on `main` and here: typing then a pointer parked on a
margin pin, on page background, or on a message's words; reading line 40
of an 80-line message whose start the agent grows or shrinks by five
lines; and a disclosure the user opens while `lf-diff` still waits on a
syntax grammar. Words between line breaks inside a widget's open shadow
tree hold still too, checked with a probe, since no bundled widget draws
them.

## Behavior changed

- A re-render that replaces the very element the reader reads can move
them by what grew above their line in it (the user's choice, 4
November). No keyed re-render hands the place to a node drawn under the
same identity.
- A presenter that paints a reading's change frames after it arrives, as
`lf-diff` does while it waits on a syntax grammar, shows the move until
the keep runs, and typing in that window ends the hold, since the caret
keeping itself in view is a chosen scroll (+75px after a letter, +86px
after an arrow key, measured with a presenter held back). The hold's
header records the limit.
- Two rarer paths move the reader where `main` holds them, left without
a rule of their own: growth above the reading line inside a closed
shadow tree, where the hold can only name the host (±150px measured; the
only bundled closed root is the text field's), and a press inside a
child frame while a presentation is pending, which the page's input
watch can't see (140px).
- In Firefox, an answer arriving during a smooth scroll or a wheel's
glide is yielded to, so the scroll finishes and the place moves by the
answer, where on `main` the hold's write stops the scroll short. In the
matrix's smooth scroll × reply above, the reply box ends −105px along
the scroll's −300 (the 195px answer pushed it back), against −40px on
`main`; the revision cell fails on both, by an amount that varies run to
run. Both stay expected failures. Playwright's Firefox wheel fires no
`scrollend`, so an answer straight after it counts as mid-scroll too;
the matrix waits that out.
- `widget-api.js` exports `holdPlace` and `readingAt` in place of
`placeKeeper`; `lf-dial` is the bundled consumer, and
`module-scroll-and-motion.md` describes them. `headerInset` is no longer
exported, and `offFlowSurfaceOf` is deleted.

## Tests

- **Deleted:** `placeKeeper`'s runtime tests in `user-place.test.mjs`,
which guarded its candidate order, clamp correction, nested keepers on
one scroller, the identity hand-off, the band-top rule and its anchoring
claim.
- **Rewritten:**
`test_an_edit_above_the_paragraph_read_keeps_it_where_anchoring_holds_it`
is now `..._holds_it_with_the_reply_box_scrolled_away`, which needs the
reading line.
- **New:**
`test_a_thread_joining_page_map_above_the_row_the_user_is_on_leaves_it_still`
(focus and resting-pointer aims); runtime tests for each rule of the
hold (growth anchoring left, a hidden node's stand-in, the first moved
place, a still place keeping its scroller, yielding to a scroll under
way, to a press and to a key at a control while typing into the held
field keeps it, a typed field before a resting pointer that names only a
control, a mouse leaving the window, until-found folds); the matrix
cells above, with the six fixed cells' expected-failure marks removed.
Each rule's test fails with the rule undone.

## Size

Runtime −141 lines net (+360 −501), `lf-dial.js` −20, tests +164, docs
+28.

> _This was written by Claude Code on behalf of max-sixty_
leaf-agent added a commit that referenced this pull request Nov 9, 2026
… watches it (#5733)

The `smooth` place in `tests/journeys/test_page_holds_still.py` started
its glide with one `page.evaluate` and began watching it with the next.
Its two Firefox cases need the page's read of the change to go while the
scroll is still under way. In the nightly macOS job of
[42365682113](https://github.com/max-sixty/leaf/actions/runs/42365682113)
and
[42473165114](https://github.com/max-sixty/leaf/actions/runs/42473165114),
both ended at `assert 'missed' == 'under way'`: the scroll had already
gone its full 300px when the watch first read it, so the cases never
reached the behavior they mark xfail. The smooth place was added in
#5398, and these are its first macOS runs.

A place's `during` can now be a page statement. The page runs it in the
same task that starts watching the scroll, so no driver round trip falls
between the start of the glide and its first reading. When the
precondition fails, the message now lists where the scroll stood at each
scroll event. Several steps mean the watch started late. A single step
at 300px means the engine finished the glide at once, and that would
need a different case design. The cases keep their xfail reasons and
assertions.

Verification: on Linux, `pytest tests/journeys/test_page_holds_still.py
-k "smooth or wheel-reply" --run-nightly` gives 4 passed and 2 xfailed.
Both Firefox smooth cases reach their expected xfail, as they did
before. Linux can't reproduce the macOS miss, so the next scheduled
`test-macos` run after merge settles it.

The same file's `on-me-turned-back-ask` place still picked On Claude's
tab by excluding `me`, so after #5633 renamed the list On Me its filter
matched both tabs and the click failed in strict mode, on main and on
this PR (whose edit to the file runs its journeys). The filter now
excludes `Me`; `-k on-me-turned-back --run-nightly` gives 2 passed on
Linux.

Refs #5711 — automated triage. That issue's drawing-preview failure
(`test_drawing_preview_contains_page_content_and_freezes_it[light-False]`)
is a separate cause and stays open there.

---------

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.

2 participants