Skip to content

Build every control by its role, and remove what no task needs at rest - #4323

Merged
max-sixty merged 79 commits into
mainfrom
diagnose-ui-whack-a-mole
Oct 27, 2026
Merged

max-sixty merged 79 commits into
mainfrom
diagnose-ui-whack-a-mole

Conversation

@max-sixty

@max-sixty max-sixty commented Oct 27, 2026 •

Copy link
Copy Markdown
Owner

UI defects kept reaching the user one screenshot at a time because nothing judged a change the way its user would, and Leaf let each widget choose its own control faces. This branch narrows Leaf's control vocabulary to one face per role, removes 22 things shown at rest that no task needed, and makes a UI review use the change before reading its code. The user picked each removal from proposals with captures on a Leaf page.

Controls are built by role

A widget names a role and never a face's classes: offerAction(role, className, label, {title, icon}), or offeredAction(…) in a template, from widget-api.js. The four roles are symbol, word, commit and mark. Their face classes are spelled once, in ACTION_FACES in browser/runtime/prepaint.js, and test_controls_are_built_by_role_and_never_by_face fails when any other bundled module spells one. Every runtime and package control is cut over, including controls main added while this branch was open (the Other responses trigger, the playground's instruction bar, page diagnostics).

Symbols and worded buttons are quiet until hovered or reached by key; only the committing press keeps a frame, in the accent. The word role absorbs the old item role. module-authoring.md lists the roles for package authors, and says a control shows a symbol only where a standard one for its action exists.

A pressed quiet button no longer keeps its hover chip, and a tapped button no longer keeps its hover face on a touch screen: hover faces apply only where a pointer hovers.

Removed at rest

The twelve clear cuts from the surface audit, nine of its judgment calls, and the panel seat's agent-message count:

  • Panel and threads: an untitled thread view's repeated heading; "New" on unread rows in Threads; the seat's "2 agent messages in 2 threads" (now announced only); the widget kind on On me cards; a message's age where it repeats the one above; the "Chose X — sent" notice (announced only).
  • Decisions: the § reference where all rows point at one block; the "✓ selected" chip on a picked card; the option count on a settled decision.
  • Queues: "To answer" under rows the user owes.
  • Diffs: the filter bar on a one-file diff; the open reply field under each conversation, which now rests as a one-line Reply that click, Tab or c opens; "Changed" on worktree rows.
  • Evidence: the trace timeline's legend line; four of the five places a trace showed its playhead time; the count in "Moments (3)"; a visual-review case's empty discussion box, its "Unchecked" label and its long capture caption.
  • Playgrounds and samples: the "Controls" and "Starting points" labels (kept as accessible names); "LIVE SAMPLE ·" and "INTERACTIVE SAMPLE ·" captions (quoted samples keep "QUOTED ·").

Each module whose header recorded the old behavior as a product choice now records the new one and the alternative it replaced.

Alignment

Option titles line up across a row whatever chips a card has, a row of metric tiles sets every figure on one line, and a board card's prose starts on its title's next line in every shape. Where chips wrap, Chromium still sets that title lower; authoring-on-me.md now asks for labels of a word or two, and the options-label-what-sets-them-apart eval gained a labels-fit-one-line metric (both arms 3/3; facts-labelled 1/3 → 3/3).

Review and tests

  • developing-leaf states the review a UI change gets in place of the /ui-sweep line sessions skipped: use the live change for the user's task by every route before reading its code, judge each control against its neighbours, and keep appearance in any reviewer's brief. Fresh sessions writing a reviewer brief asked for that on 3 of 3 runs with the new text and 0 of 3 with the old.
  • The shift watch credits a sticky box's animated inset only by its move within its block. Box-motion's ride animates sticky heads' top against the carry, and the watch read that as an offset; test_send_grows_thread_around_the_words failed at random on main too.
  • The stills catalogue gains states for the timeline, Threads, a pick's notice, option references, the visual review, a picked card, a settled option and an interactive sample.

Two regressions from main, fixed here

Behavior changes in tests

Tests that asserted removed words or framed faces now assert their absence; the worktree column and playground region tests were adjusted for rows without a status word and a rail without labels; the trace journeys read each playhead fact from its one label; a side-list Back check that main's #3998 superseded is removed. Each commit message names the behavior it changed.

Focused tests for each change, pnpm run test:runtime (668) and pnpm run check pass locally; the broad suite runs here.

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

max-sixty and others added 30 commits October 25, 2026 08:51
A quiet action wore its hover chip whenever it held focus. A pointer press
leaves focus on the button it pressed, so a pressed quiet action kept the
chip after the pointer left and stood apart from the unpressed action
beside it: on the deck's bar, a pressed forward chevron looked framed and
Back did not, and the deck stopped its presses from taking focus to hide
it. An ordinary button shows nothing for pointer focus. The chip now
follows hover and visible focus, so a key that moves focus to a quiet
action still shows it, and a press leaves no mark.

The new test presses one of two quiet actions in Chrome and Firefox,
compares their faces after the pointer leaves, then moves focus by key.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
developing-leaf asked for /ui-sweep before handing over any change to
controls, navigation, focus, motion, forms or layout. Of the 33 sessions
since 18 October that loaded developing-leaf and edited widget, theme or
runtime code, one loaded /ui-sweep; 15 spawned their own reviewer and
wrote its brief. The Catch up session's brief asked for correctness and
"Skip style nits", after compaction had dropped /review, whose brief
asks the reviewer to judge what the evidence shows first. The user then
found the deck's defects one screenshot at a time.

The passage now states the review itself: whoever reviews a UI change
first uses the live candidate for the user's task, by every route to each
result, judges each control against its neighbours and Leaf's controls
for the same role, and keeps appearance in scope. /ui-sweep stays the
audit for theme and shared-control changes.

Evidence:
- Two reviewers of the deck as handed over (454ee04): the session's
  brief found none of the five defects the user later reported; the same
  brief with a use-first pass found three and a sibling of a fourth.
- Briefs written with developing-leaf loaded and /review withheld, as at
  the session's decision: 0 of 3 asked for a use-first pass or a
  comparison with neighbouring controls on the old text, 3 of 3 on the
  new; every brief kept its code review.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
A finger leaves the last control it tapped matching :hover until the
next tap elsewhere, so on a phone a tapped button kept its hover fill and
stood apart from the untapped button beside it: the deck's Later stayed
grey after a tap. The hover faces of ordinary, quiet and accent buttons
now sit under `@media (hover: hover)`; visible focus still fills a quiet
action under any pointer.

The new test taps one of each pair of buttons on a touch phone viewport
and compares it with its neighbour.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
A widget composed each control from class strings, so two controls of one
kind could wear different faces: a symbol came bordered in some widgets
and quiet in others, and a worded press bordered, quiet or as the
thread's own quiet word. Max caught these by eye, most recently a Back
drawn as a quiet word beside a bordered forward press.

Controls now come from a closed set of roles, each with one face and one
helper. `offerAction(role, className, label, {title, icon})` and the
template directive `offeredAction` (widget-api.js) build them, and
prepaint.js's `ACTION_FACES` is the one place a role's classes are
spelled, so initial producers get the same `offerAction`:

- symbol: an icon named by its tooltip and accessible name, quiet until
  hovered or focused. The bordered symbols (a live sample's Reset and
  full view, motion's Play, the thread card's steps) merge into it.
  `closeControl` is now a use of it.
- word: words on the card ground inside a hairline. The quiet words
  (visual review's actions, the screenshot's view and outline toggles,
  the trace's scale menu) and the thread's quiet Done, Resolve and
  Reopen words merge into it; a toggle is a word with aria-pressed.
- commit: the accent press (the playground's submit).
- item: a row of a list or menu (trace moments, visual review's thread
  list, the file editor's conflict menu), framed only under the pointer
  or focus.
- mark: the seated corner or toolbar mark, renamed from `lf-mark` to
  `lf-mark-action`, since `lf-mark` is also the comment highlight's name.

Every caller in browser/runtime and packages is cut over, and the
example pages' own widgets with them. The composer's Send and Dictate
keep their own disc face, which wireInput gives whatever its caller
made; they now state their box themselves instead of borrowing the
symbol's. The dead faces go: the thread action's quiet word, the vendor
part variants of the quiet face, and the sample and trace rules that
restated a symbol's box.

`test_controls_are_built_by_role_and_never_by_face` reads the role
table and fails when any other bundled module spells one of its classes.

The widget-api change is additive, so the protocol stays.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…face

The microphone was a plain button before the role change, and making it
an offer would have joined it to the page's pressables for no gain. The
file editor's conflict menu restyled its worded buttons into list rows
by hand, which the item role now draws, so its own copy of that face
goes. browser/AGENTS.md's visual grammar states the role rule and names
its check.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…g it

The card restyled its Previous and Next into a quiet face of its own;
the symbol role now draws that face, with its hover waiting for a
pointer that hovers.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Max chose the quiet face for words: no frame until a hovering pointer
or visible focus lays the chip under them, with the hover still waiting
for a pointer that hovers. The framed word face goes, and with it the
item role, which was the quiet word under another name, so four roles
remain: symbol, word, commit and mark. A list's or menu's rows are
words now, and so are options' Done, the playground's Reset and
presets, a tally's Next on me, the file editor's buttons and the
authored `.button` face, which matches Leaf's word.

The commit face keeps its accent frame and now states its card ground
itself, since the word under it no longer has one, and a toggle's
aria-pressed face keeps its accent frame and chip, so the chosen mode
still shows: `test_a_quiet_toggle_still_shows_its_chosen_mode` holds
that.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…gent-aa23f5ba85db87f11

# Conflicts:
#	dist/kernel/kernel.json
#	dist/kernel/leaf.js
#	dist/kernel/runtime/bundle-annotation-overlay.js
#	dist/kernel/runtime/bundle-answer.js
#	dist/kernel/runtime/bundle-media.js
#	dist/kernel/runtime/bundle-page-inspection.js
#	dist/kernel/runtime/bundle-surfaces.js
#	dist/kernel/runtime/widget-api.js
# Conflicts:
#	dist/kernel/kernel.json
#	dist/kernel/leaf.js
#	dist/kernel/runtime/bundle-annotation-overlay.js
#	dist/kernel/runtime/bundle-answer.js
#	dist/kernel/runtime/bundle-media.js
#	dist/kernel/runtime/bundle-page-inspection.js
#	dist/kernel/runtime/bundle-surfaces.js
#	dist/kernel/runtime/widget-api.js
An untitled thread's name is its opening message's words, so the bold heading
over its view in the floating panel repeated the first message drawn right
under it (and, after a page comment, the comment itself). The view's heading
now stays visible only once the thread has a title; untitled, it is clipped
like On's, so the view keeps its accessible name. A view's `quiet` is now a
predicate of its route.

Behaviour change: test_agent_titles_update_without_losing_the_users_draft now
asserts the untitled heading takes no room and the titled one does.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
An unread row in Threads carried both the blue news mark at its start and the
word "New" at its end, read from the same unread value. The visible word goes;
the mark keeps saying New to assistive tech, so a screen reader still hears
which rows hold news. The Unread filter and its count are unchanged.

Behaviour change: test_an_agent_reply_says_when_the_user_owes_an_answer now
asserts an unread row's accessible name opens with New while its status
names only the turn.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
After any named widget gesture, such as picking an option, the floating
panel's status seat said "Chose “…” — sent" for four seconds in place of the
agent's status. The pick is already drawn where the user made it, and the
margin's receipt says it was sent, so the notice was a third copy. The words
now reach the live region alone; the status seat is no longer interrupted
after every pick. Undo's notice is unchanged.

Behaviour change: the tests that read "— sent" from the panel's field
(test_the_presses_a_user_is_mid_way_through_survive_the_page_following, the
answered-group journey and the board move journey) now read it from the live
region, and the board journey asserts the field does not repeat it.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
A one-file lf-diff drew the "Filter files" field, a "1 file" count and the
open-all press over a diff whose only file header sat right below: nothing to
filter or open all of, and a count restating the header. The filter now draws
from two files up, `/` offers it only while it stands, and the first-paint
height reserves its row only for those diffs.

Behaviour change: test_filtering_a_diff_keeps_its_field_and_toolbar_controls_fixed
steps between twelve and two files and asserts a one-file patch draws no filter;
test_a_diff_counts_and_filters_inline_files asserts the single-file diff has no
filter. Tests that filter a diff (the call-diff reveal, the shadow input click,
the data-bound diff journey) gain a second file so the filter is there.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Cards laid across set each title below whatever chips opened its card, so a
card with a chip band put its title, and the sentence under it, a chip line
lower than its chipless neighbours.

In a row, a card's opening chips now float out of the line flow and each card
aligns its contents on its title's first baseline (`align-content: first
baseline`). Where any card in the row opens with chips, every title also
clears the state seat, so chips that fit beside the seat leave every title on
the line below it. A stacked group, and a row without chips, keep their
layout. Subgrid can't do this: it would need a box around each card's chips,
and a card's children stay as the author wrote them.

Chromium lacks baseline content-alignment, so there a card whose chips wrap
past the seat's line still lowers its title (notes/browser-support.md).

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…nt blocks

lf-options drew "§ <block>" on every row with a `for`, so a group whose rows
all named the same block (command-hub's zero-row question, ship-review's patch
decision) repeated on each row, and at phone width on its own line, a place the
reader had just above the question. A row now draws its reference only when
the group's rows name different blocks; rows that share one draw none.

Behaviour change: test_a_rows_block_reference_never_costs_its_words_a_line now
points its two rows at different blocks and asserts a group whose rows share a
block draws no reference.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
lf-trace printed "Input bars span each recorded call; the notch is its Action
checkpoint…" under every timeline on every visit, a how-to-read sentence a
reader needs once at most. It goes; the Input lane's label already carries the
same explanation as its tooltip.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
At rest with a moment selected, lf-trace said the playhead's time five times
around one image (the toolbar, the image badge "3.003 s · after Click", the
caption "Page 1 · After checkpoint · 3.003 s", the selected Moments row and the
step detail) and the moment's name twice (the toolbar and its row). Now the
toolbar says the time, the selected Moments row the moment, and the step
detail the call and its checkpoint. The toolbar adds the shown image's own time
only where it differs from the playhead's; the badge names the input and its
relation; the caption says only the page (where there are several), a frame
and a preview. The lf-trace header records the rule and the rejected layout.

Behaviour change: the screenshot journey reads the checkpoint's time from the
toolbar and the bare phase from the step detail, and finds "Captured frame" in
the caption rather than the toolbar.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
lf-trace headed its moments list "Moments (3)" above three visible rows
numbered 1 to 3, which already show the count. The heading now says Moments.

Behaviour change: the dense-trace journey counts the scope's moments by the
visible rows and asserts the heading carries no count.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
A case with no threads drew a 26px empty bordered strip under its caption.
The theme meant to hide it (`.lf-vr-discussion:has(> .lf-vr-threads:empty)`),
and the selector matched, but the discussion is a pane, and the pane
grammar's `display: grid` stands in the Layouts tier above every package, so
it won over the package's `display: none`. The hide is now important, the one
declaration of the package's tier the cascade ranks above the Layouts tier,
and layouts.css says so where it sets the grammar.

Behaviour change: test_a_comment_being_written_on_a_visual_case_stays_in_hand_as_the_case_goes
asserts the case's discussion is hidden until a comment box is seated in it.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
A side list of obligations (alert-review) wrote "To answer" under every
unanswered row, beside the open mark and the tally's "9 of 9 to answer". The
row now shows the mark alone while the user owes the answer; "On Claude", "Open"
and the answer's own words once answered still show, and the tab's accessible
description still says "To answer".

Behaviour change: test_side_tabs_distinguish_withdrawn_obligations_from_answers
and the side-queue journey assert the open row's words are empty and its
description says To answer.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…shape

A card's title kept a 4px bottom margin that the frame's edge trim removed
only when no element followed it: a plain sentence after the title is a text
node, so the trim took the title for the card's last block. A sentence holding
an inline element, or Markdown the runtime wraps in an island, kept the margin
and started 4px lower than its neighbours' plain sentences.

The title now has no margin, so what follows starts on its next line whatever
it is, and the paragraph rule that zeroed the margin before a <p> goes.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The case list wrote "Unchecked" under every case, beside the header's
"0 of 3 look right" and each case's own Looks right box. A row now says
Looks right once its case is checked and nothing before; the words keep their
line hidden, so checking a case moves no row.

Behaviour change: test_visual_review_approvals_survive_reload_and_undo asserts
each row's status is hidden until its case is checked, then reads Looks right
at the same row height.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
A metric tile stacked its figure under its label, so a label that wrapped to a
second line set that tile's figure a line lower than its neighbours'. The tile
now takes two of its grid's row tracks with subgrid, the label in one and the
figure in the next, so every figure in a row stands on one line. Outside a
grid the tile is its own two-row grid and looks as before.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
lf-playground headed its rail's box of sliders, checkboxes and radios with an
uppercase "CONTROLS" label, naming what the box evidently is while each
control carries its own label. The label goes; the group keeps "Controls" as
its accessible name.

Behaviour change: test_a_short_workspace_shows_more_below_its_playground_regions
reads code-comparison at 1100px wide, where the controls still run well past
their pane's foot without the label above them, accepts any visible cue, and
its pixel probe now puts the more-below mark back only where it found one.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
A card's title kept a 2px margin that the frame's edge trim removed only when
no element followed it, so a sentence holding an inline element sat 2px lower
than a plain one, and a paragraph after the title kept its own 13px top
margin. The title has no margin now and a paragraph after it starts at once,
as an option card's does.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent added a commit that referenced this pull request Oct 27, 2026
The read-position test treated an empty metadata wrapper's box as
content that must stay fixed. #4323 intentionally stopped repeating the
preceding message's age, so reading a reply can remove its only metadata
child, the New dot. The wrapper collapses from 6×6 to 0×0 while the
message header, body and remaining content stay in place.

Compare the retained metadata children and surrounding elements at their
full geometry, without constraining the wrapper. This preserves both the
intentional timestamp removal and the reading-position guarantee; no
runtime or visible behavior changes.

The exact browser test fails on current main with the reported
`522,2708,6,6 -> 522,2711,0,0` diagnostic and passes with this change.
Earlier run 40436400169 passed before #4323; run 40448023036 records the
failure after it. #3799 previously adjusted this same assertion for the
New label's horizontal disappearance; checking the retained content
avoids extending that box-specific tolerance again.

Closes #4348 — automated triage

Co-authored-by: leaf-agent <[email protected]>
leaf-agent added a commit that referenced this pull request Oct 27, 2026
#4323 intentionally removed the option count from settled decisions,
leaving this replay test waiting for an element that no longer exists.
The test now checks the option set directly, verifies that the settled
summary names the added choice, and reopens the disclosure after reload
to prove that choice remains reachable. Separate undos still verify that
the pick is withdrawn before the added option disappears.

The reported test failed locally on the missing count before this change
and passes afterward (6.28 seconds). The previous main CI run,
40444131163, passed this case before #4323; run 40448023036 failed on
the removed count afterward. This preserves #4323's intended interface
and changes no product code.

Closes #4347 — automated triage

Co-authored-by: leaf-agent <[email protected]>
leaf-agent added a commit that referenced this pull request Oct 27, 2026
The two option-presentation tests still required a visible “selected”
caption after #4323 deliberately removed that caption. They now require
the caption to stay hidden and the selected check to have a nonzero font
size and a visible mark. Existing keyboard, card geometry, and
accessible-name checks remain. Production rendering is unchanged.

Both reported tests fail before this change on current main and pass
after it; the related report-only selected-option test also passes (3
focused tests). The earlier CI run 40423336764 passed both reported
cases, while run 40448023036 records the zero-font-size failures after
#4323. Failure screenshots show the selected check and card treatment
already rendering correctly.

Closes #4344 — automated triage

---------

Co-authored-by: leaf-agent <[email protected]>
leaf-agent added a commit that referenced this pull request Oct 27, 2026
The diff draft appearance test now clicks Reply before filling it. #4323
deliberately made an empty diff reply rest as a compact press that
expands on focus; the test's `write()` helper focused it by script,
producing the reported 12px movement without user input. A click
exercises the intended opening route and keeps the compact reply and all
Markdown typography assertions intact. No product behavior changes.

Both outlet color variants reproduce the exact shift before this change.
All five draft appearance variants and the existing compact Reply
click/Escape/`c` test pass afterward; the outlet variants also pass with
6× CPU throttling.

Closes #4350 — automated triage

Co-authored-by: leaf-agent <[email protected]>
leaf-agent added a commit that referenced this pull request Oct 27, 2026
The panel tests still expected the narrator-style working and offline
wording replaced by #4325, and a draft-edit notice in the field even
though #4323 moved widget acknowledgements to the live region. Match the
working detail and connection message, and check the draft's named live
announcement at its current surface. No product behavior changes.

The three affected browser cases pass locally (3 passed in 9.85s). They
retain the checks for saving exactly one edit, discarding, focus
transitions, working sheen and reduced motion, and commenting from the
panel before the first log arrives. The reported CI run fails at the
replaced assertions; the preceding run 40444131163 passed them.

Closes #4342 — automated triage

Co-authored-by: leaf-agent <[email protected]>
max-sixty added a commit that referenced this pull request Oct 27, 2026
Every opening fetched and evaluated CodeMirror
(`vendor/codemirror.esm.js`, 345 KB)
before the page first showed the server's state. `bundle-answer`
imported it statically
through the text field (`composing/text-field.js`), and `widget-api.js`
re-exported
`LeafEditorView`, which extends CodeMirror's `EditorView`. Only writing
needs it, and
an empty field already built its editor only when the user arrived in
it.

CodeMirror now loads with a dynamic import once the page has presented
(`afterPresentation`, the route `floating-ui` takes), as an arrival the
page answers
for. The code that needs CodeMirror is built over the loaded module: the
field's
state, decorations, preview and row reveal in
`composing/field-editor.js`
(`loadFieldEditor`), and the view class in `editor-view.js`
(`leafEditorView(codemirror)`, one class per module). `caretAt`, which
main's #4116
exported for the field's row reveal, needs CodeMirror's `Direction`, so
it is now the
view's method (`view.caretAt(pos)`). These modules stay in the page's
static graph, so
the kernel's chunks keep their shape. Importing `field-editor.js` lazily
instead made
the compiler regroup the shared chunks around it: four more requests on
every opening
with the compiler's chunk optimization off, as on main, and two more
(`bundle-editor-view`, `bundle-widget-upgrade`) on top of #3904, which
turns it on.

Before its editor exists, a field holds a plain draft: its words, its
selection, the
words its history starts from, and the history steps its owner recorded.
A field that
must build before CodeMirror has arrived, because it holds words or the
user arrived in
it, keeps a rendering hold until the module lands. Meanwhile it shows
its words plain
in the empty line's place, with the draft's caret there while the user
is in it.
Typing lands natively in that place, as does a selection the page sets,
and the field reads the words and caret back
after each input, so the editor builds holding both. Words an input
method is still
composing join the draft when it commits, and the editor builds then.
The editor's
history starts from the draft's base words, with the early typing as one
step undo
takes back. Return still asks the owner first (`lf-edit-return`), and
Shift+Return
breaks the line.

`widget-api.js` exports `leafEditorView(codemirror)` in place of
`LeafEditorView`, and
the file editor passes the CodeMirror module it already imports, so it
gets the class
synchronously, with no top-level await. Removing a public export breaks
pages vendored
before this change, so the page protocol
(`browser/runtime/kernel-registry.json`)
moves from 28 to 29.

A one-line field (`aria-multiline="false"`, #4323) holds one line in
both forms: its
editor turns a pasted or platform line break into a space and takes no
Shift+Return,
as on main, and the plain draft before CodeMirror arrives does the same.

Measured with `uv run leaf-dev probe <page> --base` against merge base
f90ff10 (first
measured at 4789149; an independent run reproduced the release-notes
figures), on
the compiled kernel. JS requests and JS bytes (decoded) are those loaded
when the page
first showed the server's state (`presented`). Release-notes read the
same in both
runs. On triage-board, `markdown-it.esm.js` (102 KB) sometimes finishes
just before
`presented` on either arm, on a host at load 30-48; the table gives the
reading without
it, which base gave in 4 of 5 runs and this branch in 3 of 5. In every
run on this branch `codemirror.esm.js` finished after
`presented`.

| page | arm | JS requests | JS bytes |
| --- | --- | --: | --: |
| release-notes | base | 45 | 2,494 KB |
| release-notes | this | 44 | 2,156 KB |
| triage-board | base | 38 | 2,360 KB |
| triage-board | this | 37 | 2,022 KB |

Time to `presented` wasn't measured on the new base, since the host was
too loaded for
timings to mean anything. On earlier bases it didn't move beyond
run-to-run noise:
medians of three runs were 510 → 411 ms and 323 → 314 ms at 1x against
c7e3d23, and
1,135 → 1,112 ms and 851 → 773 ms at 4x CPU against 936b607.

From a press of `c` to a focused editor in the page comment box (Event
Timing on the
keydown, measured against 936b607), focus was in CodeMirror's content
node by the
first animation frame after the press in every run of both arms. The
keydown's
input-to-paint duration was 16 ms at 1x on both arms; at 4x it was 64-72
ms on both,
with handler time 27-30 ms on base and 33-35 ms here on release-notes.
With CodeMirror
held, focus lands in the field in the first frame, and in Chromium and
Firefox the
words typed meanwhile, a caret moved with the arrow keys and a
Shift+Return included,
are in the editor once it builds.

Tests:

- `test_words_typed_while_the_editor_loads_are_its_first_words`, in
Chromium and
Firefox, holding CodeMirror's module: the page presents and reads
`arrived`; `c`,
typing, a caret moved back, more typing and a Shift+Return reach the
editor with the
caret where it was; undo takes back the editor's typing, then the early
words.
- `test_a_kept_draft_and_an_input_method_reach_the_editor_as_it_loads`,
in Chromium
(the input method goes through CDP), holding CodeMirror's module: words
typed after
a kept draft on reload follow it; a selection the page sets
(`setSelectionRange`)
is where the next words land; an input method composing as CodeMirror
lands
  commits its words once.
- `test_an_unavailable_editor_module_leaves_fields_writing_plain_words`,
with
CodeMirror's module aborted: Leaf reports the failure each time a field
asks for
its editor, and the field keeps writing plain words, Shift+Return
breaking the line
  and Return sending.

On the merge base the first test times out, since the held module keeps
the page from
loading; on this PR's first version both fail (caret at 16 not 14; "
wordsKept").

## How it merges with other bundle work

- #3904 (`grind/g-boot-tla`) moves `leaf.js`'s boot out of a top-level
await. On top of
it, at c7e3d23, this PR's chunk layout was the same 27 files as
main's; the lazily
imported `field-editor.js` alternative gave 30, two of them on the
opening. With
#3904's `architecture/top-level-await` rule this PR adds no top-level
await. Not
  re-checked on the new base.
- #3462 (Solid 2, draft) changes `composing/input.js`, the top of
`widget-api.js`'s
export list and the build scripts, and bumps the protocol too. It
touches neither
`text-field.js` nor `editor-view.js`. Expected conflicts: the protocol
number (take
one bump above whichever lands first) and `dist/kernel/`, which a
rebuild resolves.

## Calls Max may reverse

- The public API shape `leafEditorView(codemirror)`, which takes the
CodeMirror module
  the caller imports.
- `caretAt` as a method of the view class rather than a module export.
- CodeMirror loads as an arrival after presentation rather than on idle
or on a first
pointer or key intent. In every measured run it had arrived before the
probe pressed
  `c`.
- The rendering hold covers the load only: an input method still
composing when
CodeMirror lands defers the build to its commit without holding the
page's readiness
  on the user.

## Checks run

On the merge with main at `b1fdabcb4`: `pnpm run check`; the three tests
above;
`test_render_options_addition.py`'s one-line phone case and add-field
preview.

On an earlier merge with main:

- `pnpm run check`: the build check, framework (134 passed), runtime
(562 passed) and
  Worker (85 passed) tests.
- The three tests above (4 runs), and main's

`test_a_scrolling_draft_shows_the_caret_s_row_with_the_padding_beside_it`
in Chromium
  and Firefox (4 passed).
- `-k` selections of `test_render_files.py` (file editor),
`test_render_shift_watch.py`,
`threads/test_layout.py`, `margin/test_card_reply.py`,
`threads/test_rewrites.py` and
`test_chrome_contracts.py` on editor carets, reveals and scrolling
drafts (17 passed).

Earlier, on c7e3d23: `tests/browser/startup/test_modules.py`,
`tests/browser/drafts/test_composer.py`, `test_draft_editing.py`,
`test_keys.py`,
`tests/browser/threads/test_composing.py`,
`tests/browser/test_render_files.py`,
`tests/browser/test_chrome_contracts.py`,
`tests/browser/test_render_export.py`,
`tests/browser/test_render_words_watch.py` (230 passed).

An independent review on 3a095de also checked:

- #4116's row reveal and #3939's WebKit focus guard survive the move
into the
  factory, each with a bug-back check
(`test_sample_editor_focus_preserves_outer_scroll_and_the_caret` passes
in WebKit
  and fails `assert 1386 == 0` without the guard).
- Typing before CodeMirror loads, in Chromium, Firefox and WebKit.
- CI's website build and `leaf-dev verify-site website-worker`, green on
3a095de.

## Not verified

- An input method in Firefox or WebKit; the composition test drives
Chromium's CDP.
- Time to `presented` on the new base.

> _This was written by Claude Code on behalf of max-sixty_

---------

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
max-sixty added a commit that referenced this pull request Oct 27, 2026
…ss lf-ask (#4366)

Leaf had two ways to ask the user a question answered in words: an agent
thread message with `--obligation`, and an `lf-ask` holding no answering
widget, which was itself an obligation answered by the user's next
message in its thread or a comment anchored inside it. The maintainer
asked that Leaf not encourage the second form and never require an
`lf-ask` to put a question on On me. This removes it, so `--obligation`
is the one way to ask in words. Follow-ups to lf-deck (#4331) ride
along.

## `lf-ask` frames, and never asks

- `lf-ask` declares a new registry key, `x-encloses: true`, instead of
`x-awaits: {reply, encloses}`. A frame gives the widgets inside it their
heading and arrival, and asks nothing itself. `x-awaits` now always
names `value` and `answered`; `reply` and `encloses` are gone from its
fields.
- `page check` and message markup refuse an `lf-ask` that holds no
asking widget (`empty-question`), and the finding now points to
`--obligation`. A widget counts inside every frame around it, so an
outer `lf-ask` holding only an inner one that asks is not empty; the
nearest frame still gives the obligation its prompt and arrival.
- Python: `obligations.replied`, `holds_obligations` and the page loop
that settled a bare ask from a comment are deleted;
`answered_in_words(record)` is true only for a message's obligation, and
the `registry` parameters that only fed it (`waiting_about`, `queues`)
are dropped. The runtime's `answeredInWords` matches.
- lf-deck's Reply control served only such cards, so it is removed,
along with the `executeCommand` export only it used.
- **Protocol 30 → 31**: vendored registries and the public package API
change, so older pages re-vendor.

## Shipped instructions

The `lf-ask` entry and `authoring-on-me.md` no longer teach the
widgetless form; the entry sends a question in words to `--obligation`.
A new eval case, `words-question-takes-a-thread`, scores it: at the
merge base, agents asked a free-text question as a bare `lf-ask` in 6/6
runs (3 Claude Code, 3 Codex); with the change, they used `--obligation`
in 6/6, and kept the accompanying choice a widget in every run. Two
rubric lines in `assessment-surfaces-pending-decisions` that said a
thread registers a question "only through an lf-ask" now accept
`--obligation`.

## Other changes

- **Tally wording**: `tallyWords` reads "4 left to answer" (and "· 1 on
Claude"), not "4 of 5 to answer", which beside lf-deck's cards read as
the fifth card's position. `lf-tally` shares it.
- **Status explanation**: kinds that share words now share a count, so a
widget question and a message question read "2 to answer", not "1 to
answer, 1 to answer".
- **lf-deck**: its controls take focus on a press like every other Leaf
control. #4323 draws a role control's frame only when reached by key, so
the mousedown handler that kept focus off them bought nothing.

## Tests

Three model tests that protected only the removed behavior are deleted
(a page question answered by commenting on it; a restated bare ask asked
again; a display-only widget beside one). Tests that used a bare
`lf-ask` as a convenient question now send an `obligation: true`
message, with `message:` ids, or give the ask an answering widget. Ran:
`tests/model` and `tests/process` (2132 passed), `pnpm run test:runtime`
(675 passed), `pnpm run check`, the deck tests, and 33 targeted
browser/journey tests covering each changed fixture.

> _This was written by Claude Code on behalf of max-sixty_

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
leaf-agent added a commit that referenced this pull request Oct 27, 2026
The seated-thread keyboard test focused the fold-all button that #4323
intentionally removed from single-file diffs. Enter through the file
disclosure with Tab instead, then keep the existing assertions that `]`
reaches the old line and `r` resolves its seated thread without moving
focus.

The affected test reproduces the 120-second missing-control timeout
before this change and passes afterward (5.21 seconds). The earlier CI
run 40444131163 passed this case before #4323. No product behavior
changes: the file disclosure retains the single-file folding result.

Closes #4351 — automated triage

Co-authored-by: leaf-agent <[email protected]>
leaf-agent added a commit that referenced this pull request Oct 27, 2026
The PR walkthrough expected a visible button in an empty diff reply
field. #4323 deliberately hid the microphone while that field rests as a
compact Reply press; Send is disabled while empty. The old button count
therefore rejected the intended interface.

The walkthrough now checks that the named Reply textbox is visible,
retaining its disabled-Send check and its navigation through inline and
margin thread seats. The existing diff interaction test covers opening
the compact field by pointer and `c`. No product behavior changes.

The original walkthrough fails on current main with the reported
zero-button diagnostic. With this assertion updated, the walkthrough and
`test_a_diff_conversation_s_reply_rests_as_a_press_that_c_opens` both
pass (2 tests).

Closes #4346 — automated triage

Co-authored-by: leaf-agent <[email protected]>
leaf-agent added a commit that referenced this pull request Oct 28, 2026
)

The retained composition renderer in #4393 inserted
`leaf-composition-field` between the reply row and its editor. The
diff's direct-child selectors still used the old structure, so every
empty reply showed a full editor instead of the compact Reply face
chosen in #4323. Update those selectors to follow the retained renderer,
including the conditions that keep attachments and nonempty drafts open.

Empty, unfocused diff replies now show one compact line without a frame
or microphone. Focused replies and nonempty drafts keep the expanded
editor. The existing regression failed on the base with a 40px field and
visible Dictate control; it passes with the repair, and now also checks
that leaving a nonempty draft preserves its expanded face and words. The
adjacent pinned-header Tab check passes; all 695 runtime tests pass.

Compared and inspected the `diff-file-reply` and
`diff-file-reply-dark-touch` catalogue stills against the base: the
empty second reply becomes compact while the first conversation's active
draft retains its editor. Reproduce with `uv run leaf-dev stills
809f092 --state diff-file-reply --state diff-file-reply-dark-touch`.

Closes #4433 — automated triage

Co-authored-by: leaf-agent <[email protected]>
leaf-agent added a commit that referenced this pull request Oct 28, 2026
#4323 intentionally stopped drawing repeated references when every
option points to the same block. The control-stability fixture still
gave both options that destination, so its option-pick case failed
before measuring any neighbour.

Give the second option a different existing destination so the first
option retains a reference beside its pick. This preserves the intended
interface and the test's non-empty, before/after geometry assertions
without changing production code.

The option-pick case fails before this change and passes after it. The
preceding scheduled run's Linux and macOS JUnit records show this case
passing before #4323.

Closes #4456 — automated triage

Validation: all seven control-stability archetypes pass locally. Ruff
was unavailable in the prepared environment, so its check was not run.

Co-authored-by: leaf-agent <[email protected]>
leaf-agent added a commit that referenced this pull request Oct 28, 2026
The page-free recording journey still expected elapsed time in the
Completion heading after #4323 deliberately consolidated playhead time
in the toolbar. Assert the phase heading and toolbar time separately,
preserving coverage that Next reaches the real driver call's completion
even without pages or images. No product behavior changes.

The exact journey fails on current main with the reported heading
mismatch and passes with this assertion correction. The preceding
scheduled run (40311120380) passed this case on both platforms; #4323's
diff explicitly removes the heading's repeated time, matching the
subsequent failing run's screenshot.

Closes #4459 — automated triage

Co-authored-by: leaf-agent <[email protected]>
leaf-agent added a commit that referenced this pull request Oct 29, 2026
Resolve and Reopen were sizing the margin card's metadata row from
different faces: swapping the 28px symbol for the word button made the
row 30px tall. The row now takes its height from the shared symbol-face
token and its buttons fill it. Resolve keeps its check, Reopen keeps its
word, and the page-thread header keeps its existing minimum room.

This repairs the sizing conflict exposed by #4323's conversion to
role-based control faces without reversing that conversion. All seven
cases reported in #4341 pass locally, including resolution arriving
while a reply is being written and the reverse transition when a diff
outlet disappears. The unchanged inline-thread geometry check also
passes. The existing swap watch exercises the regression on those
journeys.


Validation: `pnpm run check` passes. Before/after stills cover pointer
and keyboard arrival, light and dark cards, and external resolution
during composition. The added catalogue states keep the last transition
reproducible; Reopen's row is 2px shorter and the existing open-card
states are unchanged.

Closes #4341 — automated triage

Co-authored-by: leaf-agent <[email protected]>
leaf-agent added a commit that referenced this pull request Oct 29, 2026
A source `<pre>` lost its formatting context when the shared source
style set `overflow: visible`, letting its floated scrollbar-clearance
spacer escape into later blocks. After #4323 shortened one-file diffs by
removing their filter bar, that float pushed the following draft's first
line down by 10px in the phone case and 6px after a panel; the draft
then shrank at upgrade even though the diff itself kept its box.

The shared source primitive now uses `display: flow-root` to contain the
spacer while preserving its clearance. This keeps #4323's intent and the
existing first-paint stability guarantee. On screen, the following draft
starts at its presented height; the diff's box and its settled controls
stay the same.

Both reported cases fail before the fix and pass after it. All five
first-box cases and focused source-widget and text-scroller checks pass,
as does `pnpm run check`. Startup screenshots of both reported cases
show the corrected first-line position; `leaf-dev stills` finds the
settled `diff-long-lines` and `release-draft-hover` states unchanged.
The repair adds no runtime work or requests.

Closes #4349 — automated triage

Co-authored-by: leaf-agent <[email protected]>
max-sixty added a commit that referenced this pull request Oct 31, 2026
… state fails (#4807)

Fifteen `leaf-dev stills` catalogue states failed to capture on every
run, base and head alike, so no stills comparison covered them, and
nothing said so: the command printed a `failed` line per state and
exited 0. They surfaced while comparing a cascade change across the full
catalogue (#4805).

### The command now fails when a state does

`leaf-dev stills` writes its whole report as before, `faces.txt`
included, then exits 1 if any state failed. Its module header states the
rule, and `test_stills.py`'s failed-driver and failed-analysis tests
expect it.

### Thirteen drivers followed a UI that has since moved

- **plan-option-picked, plan-option-card-picked:** an admitted pick is
announced as "Chose “…”" since #4325, without the "— sent" the driver
waited for.
- **share-link, share-link-dark:** since #4291 a refused copy of the
page's link opens About this page, where the link is read-only text,
rather than a field under the menu's About group. The driver waits for
the dialog's source reading, as page-about does, and the state frames
the dialog's Page details.
- **diff-filter, diff-filter-phone-dark:** #4323 dropped the file filter
from a one-file diff, which `#pr-key-hunk` is; the states filter the
walkthrough's 46-file `#pr-exact-patch`.
- **worktree-summaries (three variants):** since #4724 `lf-worktree`
slots its authored evidence into a shadow disclosure, and the evidence's
own `<details>` also matched the driver's selector. It presses the
widget's `.lf-worktree-summary`.
- **plan-capture (four variants):** area capture opens with no rectangle
until a drag draws one (#3814); `capture_menu` waits for the Capture
area region, as the suite's `open_capture_area` does.

### The contents map has a page again

#4724 moved the feature gallery's contents out of its sidebar into the
reading flow, where it is a folded "On this page" disclosure, so no
example drew the margin map: contents-over-reading failed, and
contents-spine and four more states captured the disclosure instead.
`tests/fixtures/pages/sidebar-contents.html` is a runbook laid out as
the site's docs pages are (`.layout-sidebar` with the contents in `aside
> .layout-track` beside a `.layout-column`), and all eight contents
states read it. As a fixture page it also joins the corpus, which had no
page drawing the map. The gallery's sentence about the map's rings goes,
since its folded disclosure draws none.

### Checks

- The 13 repaired states, the eight contents states and topic-contents
captured on two consecutive runs; each new capture was read by eye (the
filter at "0 of 46", the capture area mid-drag, the closed worktree row,
the picked option, the focused link, the map at rest and revealed over
the column).
- `dev/tests/model/test_stills.py` passes, and fails with the new exit
removed. The fixture passes `leaf page check --render` with no findings.

The gallery's topic-contents sample still says its Full view draws the
map, which it doesn't since #4724; that is left for its own change.

> _This was written by Claude Code on behalf of max-sixty_
max-sixty added a commit that referenced this pull request Nov 4, 2026
…ough browser.screenshot (#5305)

record-demo and refresh-previews took their frames with Playwright's
`caret="hide"`, which reaches fields in the document and open shadow
roots only, so it never hid the composer's caret, drawn inside the text
field's closed root: a README GIF frame or catalog preview with the
composer focused drew the caret or not depending on where its blink
stood. They, `leaf-dev pins` and the arrangement eval's arrival captures
now take each capture through `browser.screenshot`, the function stills
and probe use since #5278, which draws every caret steadily in Chromium.
`screenshot` returns the PNG rather than writing it to a path, so a
caller that composes frames, as record-demo's GIF and refresh-previews'
JPEGs do, takes it the same way as one that saves a file.

These captures drop `animations="disabled"`. Each opens its tab with
`tab`'s reduced motion, under which the theme's guard (`state.css`) and
the runtime (`motion.js`, `motionPlays`) play no motion, and no catalog
page runs motion of its own at rest, so the option finished nothing:
main's frames and this change's differ only in the caret.

record-demo waited for the floating panel to say "Moved to During" after
its board move. Since #4323 a widget's gesture raises no notice
(`notifications.js`), so on main the command timed out there. Its last
frame now waits for the page to apply the server's reading of the move,
which it already waited for after the frame.

A republish changes what the images show in one way: in Chromium a
focused field's caret is drawn in every capture, where it was drawn in
about half of them. That covers the README GIF's composer and thread
reply frames, the README's two stills and the site's link card, whose
reply field has focus, and any catalog preview whose field has focus.

Checked under `taskpolicy -b`, each capture taken 8 times 250 ms apart:

- record-demo's composer frame and thread reply frame: on main the caret
came and went within each burst (5 of 8 captures drew it in both); here
all 8 drew it, and each burst was one image. The run completes and
writes the GIF and its three stills.
- refresh-previews of review-a-plan and triage-board with the composer
focused, main's capture call and this one in the same run: main's drew 2
images of each page, differing only in a 1 by 17 px caret; this one drew
1, identical to main's capture with the caret.
- `leaf-dev pins` and an arrangement-eval arrival capture through the
new path; `dev/tests/model/test_stills.py`.

Thread snapshots, `eval_ui_review.py` and `widget_format_eval.py` keep
their own captures while the user decides what becomes of them.

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

Every message head and progress face in a thread now shows when it was
said: its clock time, with its day unless that is today ("17:52",
"Yesterday 15:35", "15 Aug 09:12"). Before, a thread showed a relative
age only where it changed from the message above, so a day-old thread
read one "1d ago" over replies hours apart, such as "I'm building it
now" at 15:35 and "Built in #6005" at 17:52. Each reply says what was
true when it was sent, so the reader needs each one's moment. The agent
now gets the same: `leaf page state <page> <message>` and a delivery's
thread digest carry each message's `ts`, where before only the batch's
own events did.

To weigh: this reverses the 26 October choice in #4323 to say an age
only where it changes, which answered "72d ago" repeated down a thread;
clock times differ where ages repeat, but a day-old thread now repeats
its day ("Yesterday" on each message). Each time names its own day so a
head read alone (a card's sticky head, or below a first message scrolled
away) never reads as today's. Where a head beside a card's controls
can't hold both, the clock is dropped whole and the day stays
(`surfaces.css`), where an ellipsis cut it to "15 Au…". The digest's
`ts` is optional in the delivery record, so the protocol stays put.

Asked for by the user on a Leaf page; a fresh reviewer read the
before/after captures and Codex reviewed the diff. Tests: `saidAt` unit
cases; the browser tests that read a head's time; the page-state paging
test checks each message's `ts`, and a delivery snapshot gains it.

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

A thread view's head line, on a margin card or in the floating panel,
now reads "Untitled" where the thread has no title and none is on its
way, instead of standing empty. That happens on a page no session holds
(a checkout preview, a page whose session ended) until the agent's first
reply names the thread, and rarely on a held page when the turn stops
before a title lands. On a held page the line reads "Generating thread
name…" from the first frame after Send, so the common path is unchanged.

The maintainer asked for this on a review page ("when do we have a blank
header? it's bad when we do"), and had earlier removed the alternative,
the opening words repeated over the first message (#4323). "Untitled" is
in Leaf's italic voice (`leafSays`, as "Deleted" is) and `--lf-quiet`
ink. `viewHeading` replaces `titleShown`; the panel's thread view is no
longer `quiet`, so a screen reader hears "Untitled" as the heading, with
the thread's group still named by its opening words.

To weigh: whether a title is coming is still inferred in the browser
from the claim and the turn's state (`titlePending`) rather than
declared by the server, so a held page whose title request failed shows
the placeholder until the agent's reply, then "Untitled" if the turn
blocks.

Tests: focused card, panel and title browser tests; panel tests now tell
untitled threads apart by their first message; `pnpm run test:runtime`.

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