Skip to content

Stand the floating panel's row and its field from the first paint - #6383

Merged
max-sixty merged 12 commits into
mainfrom
queued-key-panel
Nov 18, 2026
Merged

max-sixty merged 12 commits into
mainfrom
queued-key-panel

Conversation

@max-sixty

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

Copy link
Copy Markdown
Owner

The floating panel's row now stands on every served page from the first paint, instead of appearing when the runtime mounts the panel 240–640 ms later. Keys pressed before then show in its field, and a reader who clicks the field and types before then writes words that carry into the panel's field. This removes the stand-in #5800 added for held keys (runtime/panel-stand-in.js, its dependency-cruiser closure rule and its kernel entry). The runtime's panel takes the row over as it mounts, and the leaf, field and On Me mark don't move.

First paint, main
First paint, this PR
Once mounted, this PR

How the row reaches the first paint. There's still one drawing of the row. build/panel-row.mjs renders the panel's own detached first drawing (panelTemplate(true)) in happy-dom and writes runtime/panel-row.html. pnpm run build:browser regenerates it, and check:browser fails while it is stale. The served document carries it in an inert <template>, and the bootstrap stands it after body at the size the reader left the panel. The prepaint now builds the constructed sheets once (window.lfSheets), so the row and the runtime adopt the same chrome sheet. Delivery writes the chrome sheet's URLs inline as data URLs (today only the layer's icon.svg, the leaf's mask), so the leaf is in the row's first frame without a fetch. A preload missed whenever another script world, such as a test driver or an extension, styled the row first. Lit hydration was rejected, since @lit-labs/ssr emits nothing for element-part directives.

Calls to weigh:

  • The served row's field is a textarea, so the browser keeps what a reader types there before the runtime mounts: caret, selection, paste, input methods, a phone's keyboard. As the panel mounts, its field takes the words and caret, after any composition ends, since words taken mid-composition the input method writes again. Before mount, Return makes a line, since nothing can send yet, and Escape does nothing (a key listener beside the register would break its test for a rare path); while the reader is in the field, On Me steps aside as in the panel's writing posture. Undo after the handover takes back all pre-load typing in one step. A click on the leaf or On Me does nothing until mount. Dropping those keys, and drawing them as a run of words in the field, were both built and reverted: the first loses every word typed before load, the second lost words on Enter, Escape or a second click. Only the row's buttons are inert, and its words are a status, so screen readers hear held keys. Typed before load, then just after, in Firefox:
  • Every text field's box before CodeMirror is now a textarea (composing/text-field.js, #rest). Firefox deletes nothing from a contenteditable standing after body, where the chrome stands (notes/browser-support.md has the reproduction), so in Firefox Backspace did nothing in any panel field or reply box until its editor loaded, and the handover above moved typed words into that window. The textarea reads its words and selection directly, which drops the old box's Range walk.
  • A reader who folded the panel sees the folded leaf from the first paint, with held keys beside it. The stand-in drew a full row there, which jumped to the corner at mount.
  • A page with an unsent draft in the panel's field shows the one-line row ("Connecting…") until mount, and then the card grows to hold the draft. This is a rare path that redraws once (SOUL.md).

Cost. First paint is later, and the time until the page shows the server's state doesn't change beyond the spread. Each figure is the paired difference over 8 alternating Chromium runs at 1440×900, median and range:

  • alert-review: +8 ms (+4 to +16), and +16 ms (+8 to +28) at 4× CPU.
  • review-a-plan: +6 ms (+4 to +16), and +8 ms (−8 to +24) at 4× CPU.

These figures were measured before the icon was inlined and the field became a textarea. Inlining removes the mask's icon request, so one fewer request comes before presentation. The chrome sheet carries the icon as about 4 KB of base64, once for mask and once for -webkit-mask. The textarea adds about 3 KB to the inline bootstrap, mostly its header comment, and does no work until a click.

Tests. pnpm run check passes. The changed startup tests are tests/browser/startup/test_keys.py and test_presentation.py: they cover the row in the first frame and still across the handover at four widths, held keys in the field and the folded peek, held keys as a status, words typed in the served field carrying into the panel's field (in Chromium and Firefox, including Backspace in the panel's field while CodeMirror loads, which fails in Firefox with the old box, and an input method composing across the mount), words kept when no panel comes, and the row going away when it holds none. Independent Codex reviews and cold UI reviews in Chromium and Firefox found the screen-reader gap, the leaf's late first frame, overstated startup figures, the typing problem above, and then, on the textarea, Firefox's dead Backspace after the handover, a duplicated composition, words lost on a failed start (they now stay until recovery reloads the page), and a swallowed Return. All are fixed here.

Max asked for this on a Leaf page, after #5800 merged.

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

…drawing

The floating panel used to appear only once the runtime's module graph had
loaded and mounted it, 240-640 ms after first paint depending on CPU load.
Keys held before then showed in a stand-in for the panel's row
(runtime/panel-stand-in.js), a second drawing of the row that the bootstrap
imported on the first held key. The row now stands on every served page from
its first paint, and the runtime's panel takes it over as it mounts with
nothing moving.

How the row reaches the first paint:
- The panel's detached first drawing (`panelTemplate(true)`) is now the row
  as it stands before any reading or editor: the leaf, the field saying the
  status the panel has before one ("Connecting…") in a box of its own
  (`.lf-fp-words`), and the On Me mark with no count. build/panel-row.mjs
  draws it with the panel's module in the runtime tests' happy-dom document,
  drops Lit's markers and the template's indentation, and writes
  runtime/panel-row.html; `pnpm run build:browser` regenerates it and
  `pnpm run check:browser` fails while it is stale.
- page_delivery carries it in an inert `<template data-lf-panel-row>`. The
  bootstrap stands it after `body` as soon as `body` is parsed, at the size
  the reader left the panel (`lfChrome.rest`), and adopts the chrome's sheet
  with it.
- The prepaint now builds the layer's constructed sheets from the text the
  document carries, once, for whoever asks first (`window.lfSheets`), so the
  bootstrap and stylesheets.js share one instance. Adopted early, the chrome
  sheet keeps its cascade position after every sheet the page holds; leaf.js
  keeps it after the annotations' sheets when it adopts the rest.
- When the panel mounts it offers its field (`lf-held-keys-seat`), which
  takes the served row away in the task that draws the panel's first frame.
  Where no panel is coming, because the document reports a startup fault or
  the runtime gives the document up, the row goes as the hold on keys ends,
  and its sheet with it.

Behaviour that changed:
- The row, its field and On Me mark show from the first paint. In Chromium
  the leaf, a CSS mask of icon.svg fetched once its rule first matches, comes
  a frame later locally and a round trip later over a network. At the
  handover the leaf, field, words' start and On Me mark stand still; what
  changes is the words ("Connecting…" becomes the panel's own status, and
  "Comment… c" arrives at the field's end with the keyboard) and the ring at
  the card's corners, which box-motion.js draws for the live panel and the
  served card mimics (58 px of a 1160x160 capture in Chromium, 12 in
  Firefox).
- On a page with an unsent draft in the panel's field, the row says
  "Connecting…" where the draft will stand, and the panel draws the draft as
  it takes the row over; a draft of several lines grows the card at the
  handover, by about 42 px for the draft measured. A rare path the reader
  takes in at a glance, which redraws.
- A reader who left the panel folded sees the folded leaf from the first
  paint, with held keys in its peek, as the panel shows them. The stand-in
  drew a full row there and the panel folded as it mounted.
- Before the runtime mounts, a press on the row lands on it and does
  nothing, never on the page beneath, and lets held keys go as any press
  does; its controls are inert, so Tab passes them. What a press on the leaf,
  field or On Me does depends on panel state only the runtime reads, so a
  held press would act on a panel the user never saw take it.

Removed: runtime/panel-stand-in.js, its closure rule and exclusion in
.dependency-cruiser.mjs, and its kernel entry, which had split stylesheets.js
into its own chunk.

Startup cost. Requests before presentation are unchanged for a
source-served page (294 on review-a-plan, 300 on alert-review), and the
compiled kernel's leaf.js loads one module fewer (16, was 17). The served
document grows 7.7 KB (2.8 KB the row, the rest the bootstrap's and
prepaint's new code and comments, which ship inline), 1.8 KB on the wire.
First paint comes later: parsing the layer's sheets (about 4 ms at 4x CPU)
and matching the chrome's rules move before it. Paired differences, the
branch's head minus main, over 8 runs alternating which ran first, at
1440x900 in Chromium, median and range:
- alert-review: first paint +8 ms (+4 to +16) unthrottled, +16 ms (+8 to
  +28) at 4x; presented +0.5 ms (-18 to +10) and -2 ms (-25 to +24).
- review-a-plan: first paint +6 ms (+4 to +16) unthrottled, +8 ms (-8 to
  +24) at 4x; presented -2 ms (-20 to +16) and -16 ms (-61 to +22).
Presentation shows no change beyond the spread. Adopting the chrome's sheet
at boot restyles for about 1.4 ms at 4x where it took 20, since the sheet is
already in place.

Tests: the startup readability test now holds the row in the first frame and
the panel's leaf, field and On Me mark where the row's stood at four widths;
the held-keys presentation test reads the served row; the test of a
document the runtime gives up on holds that the row and its sheet go; a new
test covers the folded row and its peek.

> _This was written by Claude Code on behalf of max-sixty_
The served row made every part of the panel inert, which hides it from
assistive technology too, so keys held before the runtime mounted were shown
but never announced; the stand-in it replaced said them in a status. Only the
row's controls are inert now, and the field's words and the folded leaf's peek
are each a status. Once the panel mounts it announces held keys as before.

The held-keys presentation test and the folded-row test now find the held
words in a status before the runtime loads; both fail without this change.

> _This was written by Claude Code on behalf of max-sixty_
The served row puts the panel's field on screen from the first paint, so a
reader clicks it and types before the runtime has loaded. Those keys used to
be held as page keys: "fix it" showed as `f i x Space i t run when the page
is ready`, and once the page loaded `t` walked to a thread and the rest ran
as shortcuts.

A press on the served field now starts a run of words. Every printed key
after it, Space included, is a letter, Backspace takes the last one back,
and the row shows them at once as typed words, in the ink words written in
the field wear. None of them is a page key, and shortcuts being off doesn't
drop them. As the panel mounts, its field takes the press and the words
(`write` on `lf-held-keys-seat`): the caret goes to the page's field with
the words in it, so typing goes on natively. Any other key still ends the
run, and presses on the leaf and On Me still land on the row and do
nothing.

Test: test_a_press_on_the_served_field_writes_there types "fix itt" and
Backspace before the runtime loads, and finds "fix it" in the focused panel
field after it, with typing going on there.

> _This was written by Claude Code on behalf of max-sixty_
The leaf in the panel's row is the layer's icon.svg as a CSS mask
(chrome.css), which Chromium fetches only once the mask's rule first matches.
So the row's first frame drew the leaf's press with no leaf in it, and the
leaf arrived a frame later locally and a round trip later over a network.

A served document now preloads the mark from its head, as an image fetched by
CORS, the mode the mask fetches it in, so the mask takes the preloaded copy
and the icon is fetched once (one icon.svg entry, the preload's, in Chromium
and Firefox).

Chromium screencast of fresh loads of alert-review at 1440x900, the first
frame that draws the row: without the preload the leaf was missing in 4 of 4
loads unthrottled and 4 of 4 at 100 ms added latency per request; with it
the leaf was drawn in 6 of 6 unthrottled, at 100 ms and at 300 ms.

> _This was written by Claude Code on behalf of max-sixty_
This reverts commit 51cf700, which made a press on the served row's field
start a run of words that the panel's field took as it mounted. Keys typed
after that press are page keys again until the next commit drops them; the
next commit says why the run of words went.

> _This was written by Claude Code on behalf of max-sixty_
The served row puts the panel's field on screen before the runtime loads, so
a reader may click it and type a sentence. Held as page keys, "fix it" showed
as `f i x Space i t run when the page is ready` and ran as shortcuts once the
page loaded: `t` walked to a thread.

Now a press anywhere on the served row (leaf, field or On Me) still lands on
it and does nothing, and from then until the row goes, as the panel mounts or
no panel is coming, printed keys are dropped: neither held nor shown, and
Space doesn't scroll. The row shows nothing new. A press elsewhere on the page
keeps the old rule: it ends the run, and keys after it are held as before.

The previous commit took back the run of words that wrote such keys into the
panel's field as it mounted. It is a rare path, and the words were lost on
every early end: Enter, Escape, a second press on the field, or a press
elsewhere before load. Keeping them would have needed a mechanism of its own:
a display that keeps the end being typed in view, a caret or other sign the
press took, a space before a saved draft, an editable that opens a phone's
keyboard, and a status that doesn't read each key aloud.

Test: test_keys_typed_after_a_press_on_the_served_row_run_nothing clicks the
served field, types "fix it", releases the runtime, and finds no held keys,
focus still on the page's body, and the page unscrolled; it fails when the
keys are held. It waits for the page's first frame before the click: a
Playwright press that comes earlier styles the row from Playwright's own
world, and the leaf's mask fetched then misses its preload, which Chromium
warns about.

> _This was written by Claude Code on behalf of max-sixty_
leaf-agent
leaf-agent previously approved these changes Nov 18, 2026
The served row's leaf is the layer's icon.svg as a CSS mask. A preload from
the document's head put it in the row's first frame, but only while the
page's own world was the first to style the row. When a script in another
world styled it first, as Playwright's checks do before a press and an
extension's content script could, the mask was fetched from that world,
missed the preload, and Chromium warned that the preload went unused ("a
cross-world-for-csp resource mismatch"). CI failed a startup test on that
warning.

Delivery now writes what the runtime's own chrome rules name inline, as data
URLs; today that is only the layer's mark, a package's replacement included.
The leaf needs no fetch, so whichever world styles the row first, it draws in
the row's first frame. The preload is gone.

Chromium screencast of fresh loads of alert-review at 1440x900, the first
frame that draws the row: the leaf was drawn in 6 of 6 loads unthrottled,
at 100 ms and at 300 ms added latency per request.

Cost: the mark is 1,556 bytes, base64 in the chrome sheet's text twice (its
-webkit-mask and mask), so a runtime document's text grows about 4.1 KB.
Compressed, the second copy costs almost nothing, and the icon request the
mask made before presentation is gone: on alert-review, requests before
presentation are 299 against main's 300, and bytes on the wire 140 fewer.
The tab's icon still fetches icon.svg once the runtime runs.

test_the_delivered_stylesheets_read_exactly_as_their_files_do now compares
the delivered rules with the file's but for where each URL points, and finds
the layer's icon.svg inline in the chrome.

> _This was written by Claude Code on behalf of max-sixty_
On CI, test_a_key_pressed_before_presentation_runs_once_the_page_presents
[False-module] found the panel's field 732 px from where the served row's
field had stood. The served field had read as a full-width box near the
page's top: the test took its position as soon as the runtime's module was
requested, before the render-blocking theme had arrived under xdist's load,
so it read a layout no reader sees. The page draws nothing until the theme
has loaded, and then the served row stands at the foot where the panel takes
it over. With the theme's request held, a probe reads the served field as a
1207x54 box at the top and no frame drawn; once the theme arrives, it is
440x32 at the foot.

`first_frame` (tests/browser/startup) waits for the page's first frame, and
the held-keys presentation test, the folded-row test and the dropped-keys
test take it before reading or pressing the served row. No behaviour of the
page changed.

> _This was written by Claude Code on behalf of max-sixty_
leaf-agent
leaf-agent previously approved these changes Nov 18, 2026
The served row stands the panel's field from the first paint, so a reader may click
it and type before the runtime loads. Until now those keys were dropped (453c9c2):
"fix it" typed into the field before load was lost. This reverses that call. Max
weighed it against his goals for the row, with "don't miss keys" first.

The field in the panel's first drawing now holds a textarea (`.lf-fp-served-field`),
over the words it says, which hide while it holds any. The browser keeps what the
reader types there, with the caret, selection, input methods, a phone's keyboard and
a screen reader's reading of a textbox, and the key hold already leaves keys typed
into a field to it (`takesLetters`), so the drop rule goes. As the panel mounts, its
field takes the words after any draft it holds, as typing there would, and, if the
reader is in the textarea, the caret and selection where they stood and the focus,
moved before the row goes (`write` on `lf-held-keys-seat`). The words left in the
textarea when the reader went back to the page wait in the panel's field without
taking the focus.

Where Return sends from the panel's field (a fine pointer), it makes no line in the
textarea and sends nothing either, so the words wait for the panel; Shift+Return makes
a line. Holding Return to send once the panel stands would have mixed typed words with
held page keys in one run and needed its own display, for a key the reader can press
again a moment later. The textarea shows the field's ring while the reader is in it.

The word run this branch built and reverted (51cf700) drew typed keys itself and
needed a caret, endings and wrapping of its own. A `contenteditable`, as the runtime
field's own box takes typing while CodeMirror loads, was tried first: Firefox types
into an editing host standing after `body`, where the chrome stands, but deletes
nothing from it, so Backspace did nothing. A textarea edits there in both engines.

Measured at 1440x900 on review-a-plan, in Chromium and Firefox: the row at rest is
pixel-identical with the textarea and without it, and the typed words' pixels are
identical before and after the handover (0 of the words' pixels differ). What changes
at the handover is the panel's writing posture: Send takes the On Me mark's place and
the ring reaches the row's end.

Tests: test_words_typed_in_the_served_field_go_on_in_the_panels_field, in Chromium and
Firefox, clicks the served field, types "fix itt", Backspace, Return and two Lefts
before the runtime loads, and finds "fix it" focused in the panel's field with the
caret after "fix ", typing going on there and nothing run.
test_words_left_in_the_served_field_wait_in_the_panels_field finds words left there
waiting in the panel's field with focus where the reader went. They replace
test_keys_typed_after_a_press_on_the_served_row_run_nothing, whose behavior this
changes.

> _This was written by Claude Code on behalf of max-sixty_
A Codex review and a fresh UI review in Firefox and Chromium of the served row's
textarea found words lost or garbled on paths around the handover. Each now keeps them:

- Firefox's Backspace did nothing from the panel's mount until CodeMirror loaded: the
  handover put the caret in the runtime field's own pre-editor box, a contenteditable
  that Firefox deletes nothing from after `body`. A served field the user is in or wrote
  in now stands over the mounted panel until the panel's field has its editor
  (`editor` on `lf-held-keys-seat`), so typing goes on in the textarea meanwhile.
- An input method composing at the mount had its unfinished letters taken and then
  wrote its own words after them ("にほ日本"). The handover now waits for it to finish.
- A page that cannot start took the row away with the words; they now stay where the
  user wrote them.
- Return before load did nothing, so a second message ran into the first. It now makes a
  line, since nothing can send yet; holding it to send at mount would hide the words
  typed after it or need a display of its own. This also drops the bootstrap's copy of
  the coarse-pointer rule from `submitBindings`.
- Escape left the caret in the textarea, so the next page key became text; it now takes
  the user out, as from the panel's field.
- While the user is in the field or it holds words, the On Me mark steps aside and the
  ring reaches the row's end, as in the panel's writing posture, so the ring no longer
  jumps at mount and a long comment wraps at the width it will have.
- A saved draft the row didn't show took the typed words with no space ("old draftnew");
  they now join with one.

Left as they are: undo after the handover takes back everything typed before load in
one step, Tab before load passes the row's inert controls, and held page keys pressed
after writing in the field are heard and run but not shown, since the words cover them.

Tests: test_the_served_field_takes_typing_until_the_panels_editor_has_loaded holds
CodeMirror and Backspaces in the served field after the mount, in Chromium and Firefox;
test_an_input_method_composing_as_the_panel_stands_finishes_first composes through
Chromium's IME input across the mount; test_words_in_the_served_field_stay_when_no_panel_comes
aborts the runtime after typing; test_words_left_in_the_served_field_wait_in_the_panels_field
leaves by Escape too. The first two fail with their fix turned off.

> _This was written by Claude Code on behalf of max-sixty_
leaf-agent
leaf-agent previously approved these changes Nov 18, 2026
…here

Firefox types into a `contenteditable` standing after `body`, as Leaf's chrome does,
but deletes nothing from it (notes/browser-support.md). A text field's box before
CodeMirror loads was such a host, so in Firefox Backspace and Delete did nothing in
any composer in the chrome, the panel's field and a thread's reply box among them,
from the moment it took focus until its editor built: on a cold load, as long as the
editor bundle takes to arrive. The served row's handover moved words typed before
load into exactly that window.

The box is now a textarea, which edits alike in every engine and reads its words and
selection from `value` and the selection triple, so the Range walk over text nodes
and breaks that read the old box goes. Return and Shift+Return are both a line break
to a textarea's `beforeinput`, so the field reads which it was from the input stream
(`inputs.observe`) rather than a key listener of its own.

With the box fixed, the served row no longer stands over the mounted panel until the
editor loads, which the previous commit added for Firefox's Backspace: a second
review found the live panel underneath took keys meanwhile ("dog catz"), focus fell
to the page when the panel changed under the row, and a failed editor load handed the
words to the broken box. The row now goes as the panel mounts, after any composition
ends. Escape in the served field no longer leaves it, since a key listener beside the
register breaks test_the_register_is_the_only_way_a_key_enters_the_runtime for a rare
path.

Tests: test_the_panels_field_takes_backspace_before_its_editor_loads holds CodeMirror,
hands words over at mount and Backspaces in the panel's field, in Chromium and
Firefox; with the old box it fails in Firefox ("catzs"). The editor-load tests in
tests/browser/startup/test_modules.py and the composition tests pass.

> _This was written by Claude Code on behalf of max-sixty_
@max-sixty max-sixty changed the title Stand the floating panel's row from the first paint Stand the floating panel's row and its field from the first paint Nov 18, 2026
leaf-agent
leaf-agent previously approved these changes Nov 18, 2026
…ret's direction

A Codex review of the textarea before a field's editor found:

- Any Enter on the page set whether the last Return held Shift, so a script's
  Shift+Enter on one field let a Return in another make a line without asking its
  owner. The field now reads Shift only from a Return typed in itself, noted as the
  key goes down, since a dispatched event from a shadow tree names no target.
- A change of only the selection's direction was not written to the textarea, so the
  editor built with the old direction. The textarea's direction is now compared too.
- A one-line field's Return never asked its owner before the editor loaded, though the
  editor's does; it now asks first, as before this branch it didn't either.
- `aria-multiline` set after the field connected left the box before its editor
  declaring the old value; the field now observes it.

The browser-support note now says CodeMirror also deletes nothing by
`execCommand("delete")` in Firefox, and that standing the chrome inside `body` would
cure both.

Test: test_the_panels_field_takes_backspace_before_its_editor_loads also makes a line
with Shift+Return in the field before its editor.

> _This was written by Claude Code on behalf of max-sixty_
@max-sixty
max-sixty merged commit fae06d6 into main Nov 18, 2026
5 checks passed
@max-sixty
max-sixty deleted the queued-key-panel branch November 18, 2026 20:53
max-sixty added a commit that referenced this pull request Nov 18, 2026
…#6416)

`test_held_keys_stand_beside_a_saved_draft` typed a draft and reloaded
at once. On a busy host the first keystroke's write was still out, so
the reload's document was served holding "H" and the page going away
resent the full words only after it. The test then read "H", about one
run in three in a parallel local selection (CI passes it). The test now
waits until the server holds the draft before reloading.

The runtime is unchanged. Held deterministically (first write's answer
held, then a reload), the reloaded page shows the short words until its
first look reads the newer draft, and words typed in that window are
replaced. That needs a reload within one write's round trip and typing
before the first look, so the commit records it and leaves it.

Found while testing #6383. The selection around it passed 4 of 4 runs at
`-n 3` on a loaded host.

> _This was written by Claude Code on behalf of max-sixty_
max-sixty added a commit that referenced this pull request Nov 19, 2026
…ting (#6428)

A reload asks for its document before the page it replaces goes away.
Where that page then hears the server take its last draft write, it
holds the draft as durable, and #6399's handoff leaves the reload only
drafts still waiting, so the reload shows the older generation it was
served until its first look. Words typed on arrival go over that older
generation and are replaced by the departing page's words. This is the
flake in `test_held_keys_stand_beside_a_saved_draft` ("H" for "Half a
thought", 2 of 13 runs under `-n 3` on a loaded Mac, with #6399 in).

The page now leaves its durable copies in the tab too, still marked
durable so the reload doesn't write them again; a served generation
older than a copy gives way to it by version in `hearReading`, as for
any reading.
`test_words_typed_on_a_reload_stand_over_a_write_taken_as_it_was_served`
serves the reload a document fetched before the write lands and fails on
main. The saved-draft test drops the wait-for-save step #6416 added; its
selection passed 8 of 8 runs.

To weigh: a store that went back as the page reloaded (a server
restarting from an older copy) isn't heard by the reload, so a durable
copy shows words the server lost and isn't written back; main drops
them. A Codex review found that taking the copies' versions as the
reload's heard store version, which would catch that, suppresses reads
of other drafts, so it's left out. Codex also confirmed a pre-existing
flaw this doesn't touch: recovery after a rollback writes the tab's
words over a generation another device wrote after the rollback.

`pnpm run check` and `pnpm run test:runtime` fail on main at the moment
in `anchor-placement.js`, from #6417; this change doesn't touch it.

Found while following up the saved-draft flake from #6383.

> _This was written by Claude Code on behalf of max-sixty_
leaf-agent added a commit that referenced this pull request Nov 19, 2026
…tarea from #6383 (#6453)

#6383 stands the floating panel's row from the first paint and makes an
unbuilt text field's box a textarea. Three main-tier tests still
asserted the earlier behavior, and each one failed on `main`. This PR
updates the tests to match #6383 and changes no product code. Each test
fails on `main` (`c865c3e99`) and passes on this branch, run with `uv
run pytest <node id> -n 0`.

- **`test_startup_continues_while_the_registry_fetch_is_held`** asserted
that no panel stands while the registry fetch is held. Now the panel
there is the row the document served (`data-lf-served`), which #6383
meant to show. The test asserts that instead, so it still checks that
the runtime's panel hasn't mounted.
-
**`test_an_empty_field_reads_the_same_before_and_after_its_editor_builds`**
compared the accessibility nodes exactly. An empty textarea gives the
tree no value, while CodeMirror's empty line reads `'\n'`, and a
textarea reports `invalid: false`. Those two differences are the whole
failure. The textarea still matches the editor on role, name,
description, `editable`, `focusable`, `multiline`, `readonly` and
`required`, which are what #3307 made the test check. The test now holds
the field's editable node to its exact empty value: Chromium's tree
gives the empty textarea no value at all, and the built editor's empty
document one line break (`'\n'`), so a field holding several blank lines
no longer passes. It ignores `invalid: false` and still compares every
other node and property before and after. No screen reader was run; the
docstring describes the observed tree.
- **`test_firefox_s_copy_of_a_group_builds_no_add_field`** no longer
reached the case it guards. In both commits, Firefox's selection at
mouseup sits in the add field's shadow root, at the placeholder text.
Before #6383, `cloneContents()` on it threw `HierarchyRequestError`.
With the textarea, it clones without error. I tried the same drag on
this commit after the field's editor had built (an editable node is back
in the shadow root), and it throws again. So the `inWindowDocument`
guard in `widget-upgrade.js` and `leaf-element.js` is still needed. The
test now focuses the field and releases focus before the drag, which
brings the guarded case back.

Closes #6451 — automated triage

---------

Co-authored-by: leaf-agent <[email protected]>
leaf-agent added a commit that referenced this pull request Nov 25, 2026
…rt, whichever wait reads it (#7111)

The render gate gave one page either of two findings, depending on
timing. It waits first for the runtime to start, then for the widget
layer to upgrade. Each wait ends on the page's own declaration that it
cannot start, but the first reported `no-runtime` and the second
`never-upgraded`. A widget module that fails to link makes that
declaration just after the runtime's chrome stands, so which finding the
gate reported depended on which poll saw it first. That is how
`test_a_render_check_names_the_import_a_package_module_fails_to_link`
failed on main in [run
45516663690](https://github.com/max-sixty/leaf/actions/runs/45516663690)
(`assert 'never-upgraded' == 'no-runtime'`), while it passes locally.

A declaration that the page cannot start is now `no-runtime`, whichever
wait reads it. Its text now reads "the runtime never started" in place
of "never injected its chrome", which is false once the chrome stands
before the failure. #6899's intent, naming the module and the missing
export within seconds, is unchanged.

**Verification.** The test gains a `once-read` case. Its widget module
is imported only once the gate's upgrade wait first reads the page's
`lfReadiness`, which forces the losing ordering from CI. On the old gate
that case fails with CI's exact assertion. With the change, both cases
pass, and so do the render gate's other `no-runtime` test and the
findings model tests.

<details><summary>Why the race exists</summary>

The gate's `runtimeStarted` probe looks for `.lf-floating-panel`. The
static panel row that bootstrap stands at first paint (#6383) carries
that class, so the start wait succeeds at its first poll. A trace of the
original module shows the order: row, then the runtime's own panel, then
the startup-error mark. The widget import runs in `upgradeWidgets`,
after the runtime has created its panel. So the declaration can land on
either side of the wait boundary. Making the probe ignore the static row
(`:not([data-lf-served])`) did not remove the race, so this change
leaves the probe as it is.

</details>

Refs #7110 — 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.

2 participants