Skip to content

test: close each floating-box example's page, and write each example's declared draft - #6450

Merged
max-sixty merged 2 commits into
mainfrom
fix/floating-box-closes-each-example-page
Nov 19, 2026
Merged

max-sixty merged 2 commits into
mainfrom
fix/floating-box-closes-each-example-page

Conversation

@max-sixty

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

Copy link
Copy Markdown
Owner

test_every_part_of_a_floating_box_moves_one_way_per_input[firefox_browser] hung for 30 minutes inside a Playwright call in the Nov 18 macOS nightly, until the suite's timeout ended its worker. Two harness faults in the test, both fixed here:

  • Every example's page stayed open. Each Hypothesis example opens a page and none closed one, so every example's page stood, live and polling, until the test ended, and on a starved runner Firefox stopped answering. Each page now closes once its frames are read.
  • Examples inherited each other's words. The examples share one page server, which keeps the words each one typed as the page's draft. An example with draft='' skipped write, so its field opened holding every earlier example's words, with the caret wherever the click landed. Each example now writes its declared draft, an empty one included.

The second fault surfaced when the first fix made this PR's Linux test job fail in both engines. Closing the page didn't cause that failure. derandomize seeds Hypothesis from the example function's source, so adding the page.close() call drew a different set of examples. Closing pages from the outer test instead, which leaves that source unchanged, drew main's examples and passed. main's file with only a print added, closing nothing, drew yet another set and failed the same way. The new draws reached a field holding inherited text below the caret, and deleting a line there jerks.

The jerk is the product's, and this PR leaves it. In the floating panel's field or a card's reply field, deleting a line with lines below the caret draws those lines a line higher for a frame, then glides them back. It happens at full speed in both engines; the comment box beside a passage doesn't do it. box-motion.js carries the editor's words by the field's start edge, which suits the lines above a removed line and not those below it. With every example's field holding what it declares, the test never puts lines below the caret, so it passes without covering this case.

Evidence:

Refs #6392.

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

test_every_part_of_a_floating_box_moves_one_way_per_input[firefox_browser]
hung for 30 minutes inside a Playwright call in the Nov 18 macOS nightly,
until the suite's timeout ended its worker. Its Hypothesis examples each
open a page and none closes one, so every page stood, live and polling,
until the test ended. On CI's macOS runner, 16 copies run four at once
all failed: 10 hung to the 30-minute limit with the main thread waiting
on Playwright, as in the nightly, and 6 timed out on a click, a goto or
the probes' module load. With each example's page closed once read, 8
copies run four at once hung none and finished in 15 minutes.
leaf-agent
leaf-agent previously approved these changes Nov 19, 2026
With each example's page closed, the PR's Linux `test` job failed this
test in both engines: a panel example's lines below the caret drawn a
line higher for a frame at a Backspace, then gliding back. Closing the
page didn't cause it. `derandomize` seeds Hypothesis from the example
function's source, so adding the `page.close()` call drew a different
set of examples. Closing pages from the outer test instead, which leaves
that source as it is, drew main's examples and passed; main's file with
only a print added, closing nothing, drew yet another set and failed the
same way.

The new draw reached a field holding text below the caret because the
examples share one page server, which keeps the words each example typed
as the page's draft: an example with `draft=''` skipped `write` and
opened on every earlier example's words, the caret wherever the click
landed. Each example now writes its declared draft, clearing what an
earlier one left, so its field holds what the example says.

The jerk itself is the product's, and is left for a change of its own:
deleting a line in the floating panel's or a card's field with lines
below the caret draws those lines a line higher for a frame and glides
them back, at full speed and in both engines. box-motion.js carries the
editor's words by its start edge, which suits the lines above a removed
line and not those below it.
@max-sixty max-sixty changed the title test: close each floating-box example's page once it has read its frames test: close each floating-box example's page, and write each example's declared draft Nov 19, 2026
@max-sixty
max-sixty merged commit 014c5e8 into main Nov 19, 2026
5 checks passed
@max-sixty
max-sixty deleted the fix/floating-box-closes-each-example-page branch November 19, 2026 07:16
max-sixty added a commit that referenced this pull request Nov 19, 2026
#6476)

Deleting a line in the floating panel's field or a margin card's reply
field, with lines after the caret, drew those lines a line higher for a
frame and then glided them back down, at full speed in Chromium and
Firefox. `box-motion.js` carried all of an editor's words by the field's
start edge. That suits the words before the removed line, which ride the
box's top edge down, but not the words after it, which layout leaves
where the box's foot holds them.

Now the editor marks the first line whose words all come after the
change (`data-lf-after`, a CodeMirror line decoration in
`field-editor.js`). While a key's removal travels, box-motion draws that
line and those below it by the field's end edge rather than its start
(`--lf-field-after`). The words before the line ride the top edge as
#4326 made them, and the words after it stand.

| Before (main) | After |
|---|---|
| <img
src="https://gist.githubusercontent.com/max-sixty/010731132b38024be413752a36544215/raw/75a4ad802c02ef8698b5ce3934c82ecd04c44858/before-main-firefox.gif"
width="420"> | <img
src="https://gist.githubusercontent.com/max-sixty/010731132b38024be413752a36544215/raw/75a4ad802c02ef8698b5ce3934c82ecd04c44858/after-fix-firefox.gif"
width="420"> |
| <img
src="https://gist.githubusercontent.com/max-sixty/010731132b38024be413752a36544215/raw/75a4ad802c02ef8698b5ce3934c82ecd04c44858/before-main-frames.png"
width="420"> | <img
src="https://gist.githubusercontent.com/max-sixty/010731132b38024be413752a36544215/raw/75a4ad802c02ef8698b5ce3934c82ecd04c44858/after-fix-frames.png"
width="420"> |

Firefox at half speed: two rounds of Shift+Enter then Backspace, with
the caret at the end of the second line. Each frame grid is eight
consecutive frames around one Backspace, read down the left column and
then the right. Chromium moves the same way; the test below reads the
same positions in both engines. Playwright's Firefox video now and then
drops the whole panel for a frame, in both arms, so the grids show a
Backspace without such a frame.

**What to weigh**

- **One edge never fit both sides.** `git log -L` on the carry shows the
edge flipping: #4174 carried a shrinking field's words by the edge that
stayed, which made the words before a removed line jump, and #4326 went
back to the start edge, which turns the words after it back. Splitting
the carry at the change replaces the single edge rather than adding a
case beside it.
- **Two readers see lines drawn off their place.** The Send corner
(`#cornerTaken`) takes each line's own carry back off, so it reads the
words where layout puts them. The editor's reveal (`editor-view.js`) now
gives the editor's own box a share of the caret's travel only where that
box is a scroll container. A text field's isn't, and a line drawn below
it made the reveal write a scroll there that moved nothing.
- **The comment box beside a passage keeps its instant move.** It stands
on its top, so its foot rises when a line goes. Drawing the words after
the line below its box would need its overflow held open, which laid a
one-line field's caret out below its box. There the words after the line
move up once, in the frame the key lands, as on main.
- **Only a removal travels.** A key that adds words takes no tween
(`box-motion.js`; the user asked for typing to grow the box as a
textarea's grows), so a line Shift+Enter adds among the words leaves the
words after it standing while the rest take their places in one frame.
The split carry is a removal's alone, and measured growth needs none.
- **One gap left, one-way:** in a field at its cap scrolled away from
its end, the words after the line move up at once by what was hidden
below (under a line), rather than glide.

Not in this change: Shift+Enter that takes a field to its cap turns the
words after the new line back by the overflow (2 px in the panel, 17 to
18 px in the card and the comment box at 1440×900). The field draws them
a frame before its scroll takes them back up, so it isn't the carry.
Main does the same, in all three boxes.

**Evidence**

- `test_a_line_removed_among_the_words_moves_only_what_layout_moved`
(new, beside the property test) adds and takes away a line with two
lines after it, three ways in each floating box, in both engines:
Backspace at the end of a line, at the start of the next one, and, in
the panel, in a field at its cap scrolled to its end. It records the
Shift+Enter that adds the line as well as the Backspace (all but the one
that takes the panel's field to its cap, above). It checks that every
part moves one way, and, holding each removal's first frame, that no
word in the panel or the card jumps. On main the panel and the card fail
in both engines. Reverting only the line-start mark fails them again,
restoring the old measure of the extra carry fails the panel's capped
case, and letting a typing change that grows the box tween fails the
panel and the card on the Shift+Enter, their words after the new line
drawn a line low and gliding back.
- On CI's macOS runner, the new test, recording the Shift+Enter too,
passed [48 of 48 as 8 copies across 4
workers](https://github.com/max-sixty/leaf/actions/runs/44469911946) and
[36 of 36 as 6 copies on one worker under load
4](https://github.com/max-sixty/leaf/actions/runs/44468180188). One
[earlier parallel
run](https://github.com/max-sixty/leaf/actions/runs/44468177400) passed
47 of 48: one Firefox copy timed out clicking the card's margin marker
to open it, before any key was pressed. The property test [timed
out](https://github.com/max-sixty/leaf/actions/runs/44459119589) there
on this branch alone, which is the macOS hang #6450 fixes, still on
main; with #6450 merged in, it passed [8 of 8 in
Firefox](https://github.com/max-sixty/leaf/actions/runs/44463254061) and
[8 of 8 in
Chromium](https://github.com/max-sixty/leaf/actions/runs/44463258546).
- Locally, these pass: the property test, the Send-corner journeys,
`test_lines_removed_below_the_field_s_cap_leave_the_rest_in_place`,
`test_a_line_the_field_gives_up_rides_the_box_s_top_edge`, the
card-reply growth tests, the editor reveal tests (file-editor page
navigation, a long rewrite's caret, a new line past the field's height),
`pnpm run test:runtime` and `pnpm run check`.

Found while settling why #6450's floating-box test failed on Linux. An
independent review pass found the line-start and capped-field cases,
both fixed here.

> _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