Skip to content

Keep pressed controls live while their gesture travels - #4561

Merged
max-sixty merged 4 commits into
mainfrom
playground-submit-flicker
Oct 28, 2026
Merged

max-sixty merged 4 commits into
mainfrom
playground-submit-flicker

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

A press on a Leaf control should draw its own result at once and stay live while the gesture travels; the runtime already orders pending gestures, undoes a pending one by its attempt, restores the server's state on a refusal and says why in the notice seat. Three widgets instead kept their own in-flight state, which marked the pressed control busy or disabled until the server answered and flashed the cursor and the control under the pointer on every press (the playground's submit got the same fix in #4516).

Done and reaction chips. lf-options' Done and the reaction chips no longer wear aria-busy while their gesture is in flight, and Done drops its in-flight guard, so a second press does what Done then says rather than being swallowed. Measured in Firefox on ideas-to-implement, Done went pointer → progress → pointer within 45–60 ms on every press; it now keeps its pointer and paints pressed in ~11 ms.

Busy controls keep their cursor. marks.css gives the progress cursor to busy reading content only (a message being sent, an upload); a control a package marks busy keeps its cursor and takes chrome.css's existing delayed fade, so a fast answer shows nothing. No delay is added.

lf-suggestion. Accept and Reject no longer leave a disabled, busy Undo in the pressed entry's seat (in Firefox on release-notes: progress cursor and 0.55 opacity for ~45 ms). The widget's #deciding, #staging and #undoing state and its own refusal UI go (168 lines): Undo is live from the press, a refusal returns Accept and Reject, and pressing Accept again is the retry. The decision names itself through the dispatch's says, so the runtime announces it and names it on undo.

Behavior changes, each with its test rewritten to pin the new behavior:

  • A second press while the first is in flight acts on what the control then says (Done, the suggestion's Undo), instead of being swallowed.
  • A refused suggestion decision or undo shows the delivery notice ("Couldn't take this — …") and the restored controls, with no Failed receipt, Retry or Cancel.

browser/AGENTS.md now states the rule these follow.

Resolve and Reopen still single-flight: a pending settlement gates reply, edit, resolve and reopen (thread/model.js, thread/actions.js, thread/folding.js, thread/thread-card.js) and is tied to where the user lands, so lifting it is its own change.

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

A press on lf-options' Done, or on a reaction chip, flashed the
progress cursor for one delivery round trip, and a chip also dimmed to
0.55: each control wore `aria-busy` while its gesture was in flight,
and `marks.css` gave every busy element, buttons included, the progress
cursor at once. Measured in Firefox on ideas-to-implement, Done went
pointer → progress → pointer within 45–60 ms on every press.

Neither press waits on the log for its result: Done's pressed state and
a chip's pressed state paint from the pending gesture, so they are no
longer marked busy (the playground's submit made the same change in
#4516). Done also drops its in-flight guard, so a second press does
what Done then says, withdrawing or giving the answer, rather than
being swallowed; its test now pins that.

A button that still waits on the log keeps its own cursor:
`marks.css` gives the progress cursor to busy reading content only,
leaving busy action controls to chrome.css's existing delayed fade.
This removes the cursor flash for the remaining busy buttons, such as
a pending Resolve or a suggestion's Undo entry, without adding a delay.
Pressing Accept or Reject on a suggestion put a disabled, busy Undo in
the pressed entry's seat until the server answered: in Firefox on
release-notes the control under the pointer went to the progress cursor
and 0.55 opacity for ~45 ms on every press. The widget kept its own
in-flight state (`#deciding`, `#staging`, `#undoing`) and a second
refusal UI (a Failed receipt with Retry and Cancel), though the runtime
already orders pending gestures, undoes a pending one by its attempt,
restores the server's state on a refusal and says why in the notice
seat.

The suggestion now draws everything from its reading, the pending
decision included: Undo is live from the press, a refusal returns
Accept and Reject, and pressing Accept again is the retry. The decision
names itself through the dispatch's `says`, so the runtime announces it
on admission and names it on undo. 168 lines go.

Behavior change: no Failed receipt, Retry or Cancel after a refused
decision or undo; the delivery notice ("Couldn't take this — …") and
the restored controls take their place. Tests that pinned the failure
controls and the busy Undo now pin the restored state and a live Undo.

browser/AGENTS.md states the rule the playground, Done, reactions and
now the suggestion follow: a pressed control draws from the reading,
stays live while its gesture travels, and a second press does what it
then says; aria-busy is for content whose result only the log can
supply, and for controls a package marks busy.
# Conflicts:
#	dist/kernel/kernel.json
#	tests/browser/margin/test_clusters.py
# Conflicts:
#	browser/widgets/lf-suggestion.js
#	dist/kernel/kernel.json
@max-sixty
max-sixty merged commit b3d7868 into main Oct 28, 2026
4 checks passed
@max-sixty
max-sixty deleted the playground-submit-flicker branch October 28, 2026 07:57
max-sixty added a commit that referenced this pull request Oct 28, 2026
…s answer held (#4608)

#4516 and #4561 made the playground's submit, Done, reaction chips and
the suggestion's controls stay live while their gesture travels. This
finishes the job for Resolve and Reopen, and adds a suite test that
presses every bundled control with the server's answer held, so the next
widget that keeps its own "sending" state fails before review.

**Resolve and Reopen stay live.** A resolve or reopen marked its thread
as settling until the server answered. While it was set, the card's and
panel's settle button wore a busy or disabled face for one round trip, a
second press was dropped, and replies and edits on the thread were
refused. The settling mark goes, with the thread's `offers` (which only
combined `resolved` with it), the busy and disabled faces, the drop in
`settleThread` and `pendingForParent`. A press while one is in flight
sends the opposite settlement after it, as the pending ledger orders
them; a reply or edit sends as usual, and a reply reopens the thread as
the server already does. `settleThread` now waits on its own attempt
rather than any settlement of the thread.

**Every bundled control is pressed with its answer held.**
`tests/browser/widgets/test_pressed_controls.py` presses each control in
each bundled package's worked examples, and the margin entries Leaf
draws for them, with the event POST held. A control whose press sends a
gesture must keep the cursor and the available, idle face it had before
the press, and where the same control stays under the pointer, a second
press must send again. A small states page adds a `multiple` group,
since no worked example shows Done. Restoring `aria-busy` or an
in-flight guard on the playground's submit, or the pre-#4561
`lf-suggestion` or `lf-options`, fails it. It runs only in the suite, so
`page check` and `package check` pay nothing for it; each package takes
at most about 3.5 s.

**`package check --render` works again.** Since #4551,
`start_throwaway_page` was handed the composed layer where it expected
the selection, so the check raised `TypeError` for every package. It now
selects the package as `page init` would, by its installed or bundled
name or else by path, with no theme, so the reading is the same on every
machine. The sweep serves examples through
`widget_quality.served_examples`, split out of `_page_findings`.

Behavior changes, with their tests:

- Pressing Reopen while the resolve travels sends `unresolve` after
`resolve`, instead of nothing
(`test_a_settlement_in_flight_leaves_its_opposite_live`, replacing the
test that the control stopped being busy once a poll accounted it).
- Packages read `thread.resolved` rather than `thread.offers`
(`module-annotations.md`).

With the render check working, the nightly
`test_bundled_widgets_meet_the_widget_quality_checks` reports first-box
findings for `lf-worktree` (#4475), `lf-timeline` (#4476) and `lf-dial`;
`test_a_widget_first_paints_the_box_it_presents[diff-*]` already fails
on main (#4349).

> _This was written by Claude Code on behalf of max-sixty_
max-sixty added a commit that referenced this pull request Oct 29, 2026
…ge (#4660)

#4608 added a suite test that presses every bundled widget's controls
with the server's answer held. This extends the same check to Leaf's own
controls that send a reader's gestures, which stand in the floating
panel: On me's answers and to-do Done, and in each thread's view its
Resolve or Reopen and its reactions.

**The panel sweep.** `tests/journeys/test_pressed_controls.py` (nightly)
opens On me, then each thread the Threads view lists, on every corpus
page served with its log, and presses every control in the view with the
event POST held. Each control must keep its cursor and its available,
idle face while its gesture travels, and a second press on the same
control must send again. The test also fails if On me lists an item and
nothing was pressed, or if any thread's sweep didn't check a Resolve or
Reopen, so it can't pass by reaching nothing. All 44 corpus pages pass
in about 80 s on four workers.

A thread's card in the margin isn't swept: its Resolve and reactions
remove the control they were pressed on, so there's no face left to
compare.

**The shared sweep.** `press_each_control` in
`browser/widgets/test_pressed_controls.py` now takes an open page and a
selector for the elements whose controls count. It presses the controls
a press revealed first, such as a reaction palette's buttons after its
trigger. It passes over a control the pointer can't reach. When nothing
is left, it presses Escape and calls the caller's `restore`, which
reopens a thread's view that a control such as Show on page took away.
An earlier version that pressed every control on the whole page reached
thread controls only by luck: two runs of one page pressed 39 and 11
controls, and several pages never reached Reopen. Opening each view by
its own route makes the reach the same on every run. The package test
takes about 8% longer than before.

**Bug-back controls.** Each of these broken versions made a sweep fail:

- the panel's Resolve/Reopen showing `aria-busy`, or ignoring a second
press;
- lf-options' Done showing busy, or ignoring a second press;
- the playground's submit showing busy, or ignoring a second press;
- lf-suggestion's Undo standing disabled after Accept.

**Two failures on main fixed:**

-
`test_a_pressed_control_keeps_its_face_and_takes_the_next_press[reading]`
has failed since #4637 added `reading`, a package with no widgets. The
test now expects no presses from a package with no own tags, and two
packages drop off its hand-kept list.
- `test_an_older_settlement_cannot_repaint_over_a_newer_decision` has
failed since #4561, which made lf-suggestion name its decision through
the dispatch's `says`. The runtime now announces "Accepted suggested
change" when Accept is pressed, so the live region still holds it after
the other tab's reject arrives. The test read the live region for the
old behavior, where the widget announced in its send's continuation. It
now checks what protects the user: once the late accept is answered, the
suggestion still shows the reject. It also drops a fixed 100 ms wait.

> _This was written by Claude Code on behalf of max-sixty_
leaf-agent added a commit that referenced this pull request Oct 29, 2026
The queued Done refusal test still expected the busy face deliberately
removed by #4561. It now requires Done to remain enabled without
`aria-busy` while its optimistic answer is pending. Both ordered
refusals and their independent rollback assertions remain unchanged; no
product behavior changes.

The original test failed locally at the stale busy assertion. After the
correction, it and the neighboring recorded/recordless refusal and
held-Done tests pass (3 tests).

Closes #4675 — automated triage

Co-authored-by: leaf-agent <[email protected]>
leaf-agent added a commit that referenced this pull request Oct 29, 2026
The accepted-state fault test still expected the suggestion-specific
“Undo failed” receipt, Cancel and Retry controls deliberately removed by
#4561. It now checks the shared wait notice and unchanged accepted
outcome when Undo is blocked, then retries the refused decision through
Accept. No runtime behavior changes.

The original test reproduces the reported missing-receipt failure on
current main. With the correction it passes, preserving the injected
required-reading commit fault, single-send assertion, presentation hold
and eventual recovery/undo checks. It also passes with Chromium slowed
sixfold. Ruff lint and formatting checks pass.

Closes #4676 — automated triage

Co-authored-by: leaf-agent <[email protected]>
leaf-agent added a commit that referenced this pull request Oct 29, 2026
The undo-settlement test treated retained live-region text as evidence
that an older Accept response repainted the suggestion. #4561 moved that
announcement into the shared dispatch path, independent of whether the
accepted decision still stands. The test now waits for delivery and
rendering to complete, then checks the suggestion's state, authored old
text and absent Undo offer after releasing the stale response. No
runtime behavior changes.

#4660 already made the corresponding correction for the newer-Reject
case. The remaining undo case reproduced the reported announcement
failure before this change; both affected cases pass afterward. Ruff
lint, formatting and Python compilation pass. Review and CI follow-up
use the queued workflows with `await_ci: false`.

Closes #4677 — 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