Skip to content

Land on a seated thread in its seat, and test every way back from a settlement on every surface - #5427

Merged
max-sixty merged 15 commits into
mainfrom
settle-undo-matrix
Nov 5, 2026
Merged

max-sixty merged 15 commits into
mainfrom
settle-undo-matrix

Conversation

@max-sixty

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

Copy link
Copy Markdown
Owner

A thread drawn in a seat that an x-thread-seat widget keeps now opens in that seat when the user walks to it or takes back a settlement. One test now covers every surface a thread can be resolved or reopened on, against every way of undoing or refusing that, and checks which surface shows the thread and where focus stands.

What the user sees change

  • Resolve a thread in a seat, scroll away and press z: the first press shows the seat with the thread focused, and the second takes the Resolve back there. Before, the thread opened in the floating panel, then in a margin card.
  • t or Shift+t to a seated thread lands on it in the seat and opens no card. Before, a margin card opened beside the element showing the same thread.
  • A walk to a resolved seated thread opens the seat's Resolved disclosure before it lands.
  • A walk to a seated thread brings in the whole element when it fits the window. Where the seat makes the element taller than the window, the walk leaves the thread in view. Before, the landing on the element could scroll the thread back out.

A reviewer reading the code found one more effect of the shared lookup, which no test here checks: from an open thread's subject, r now settles its seated thread and c enters its reply.

How

  • pageSeatThread (thread/inline.js) names the card a page-owned seat draws for a thread. surfaceFocusTarget falls back to it after the widget outlets, so every route that asks for a surface finds the seat, and the margin's seatedOnPage calls it instead of repeating the query.
  • destination.js opens the disclosure holding a drawing before travelling to it.
  • scrollToThread (anchor-travel.js) skips the landing on the thread's place when the focused part stands inside a place taller than its room (fitsWhole).

The test

test_every_way_back_from_a_settlement_returns_the_user_where_they_made_it crosses four surfaces (margin card, floating panel, seat, package reader) with Resolve and Reopen and five ways back: z right after the settlement's landing, z with the thread in view, z that shows first and takes on the second press, the notice's Undo, and the server refusing. Of the 40 cells, 31 run. These 9 have no route:

  • Reopen in a card (5): no card draws a resolved thread.
  • Reopen then z right after landing, in the panel, seat and reader (3): the caret stands in the reply box, so z is a typed letter.
  • Reopen then the notice's Undo in the panel (1): the panel's field keeps the notice out of sight while it holds the caret.

The test replaces five tests of single cells: test_z_puts_the_user_back_in_the_thread_they_resolved, test_z_leaves_the_user_in_a_seated_thread_they_resolved, test_z_shows_a_settlement_the_user_left_before_taking_it, test_a_thread_resolved_in_the_panel_comes_back_to_the_panel and test_z_shows_a_thread_resolved_in_its_card_by_its_passage.

package_workspace moves to render_cases_interaction.py, so the test reaches it without importing another test module; the move changes nothing else. test_primary_package_reader_retains_native_widgets_drafts_and_creation now expects "0 waiting on me", since #5331 removed the to-do it counted.

Left as it is

On a page with both a seat and a package reader that accepts the thread, undoing a Resolve made in the seat returns the user to the reader, because the route asks the reader first. A reviewer found this by reading the code, and it has not been run. Pages with both are rare, so this change leaves it.

A seated thread keeps its margin marker, whose card draws the same thread beside the seat. A Resolve made in that card now comes back in the seat rather than the card, because a route to the page finds the seat first, as Show on page does since #5415. The underlying fix is for a seat to claim its threads as a widget outlet does, which leaves one drawing per thread. It would also take the marker away from a seated thread, so it waits on a decision.

Testing

The type check, the runtime tests, the test above, test_a_walk_lands_on_a_thread_in_its_seat_in_view, the package tests and the Show on page tests pass locally. The browser tests ran in Chromium, with no narrow window and no touch input. The test's longest case takes 4.4 s on a loaded host. A separate reviewer used the seat journeys on a live page in Firefox and Chromium, before the commit that lands a fitting element whole.

test_replies_held_in_a_page_seat_show_when_the_user_turns_to_them[replied-browser] fails locally at teardown, on the shift watch's leaf-text.lf-ui moved without input by (0, 138)px. It fails the same way with main's versions of the runtime files this change edits, so it is inherited.

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

…s undone or refused

`z` on a Resolve, and the log refusing one, returned the user to the thread by
a route that chose a surface from the thread as it then stood, not from where
the user had it. A thread resolved in its margin card came back in the
floating panel, where resolved threads open: the reported case, in which the
agent had picked the Resolve up, so `z` showed it before taking it. A thread
about a passage that the user resolved in the panel's view came back in a card
beside the passage, after `z` and after a refusal alike.

The surface that settles a thread now names the reader the user had it in
(`reader`, thread/folding.js): the panel's view names the primary reader, a
margin card the page. folding.js returns the user there when the log refuses
the settlement, and undo.js keeps the reader under the gesture's attempt:
showing the settlement opens it there, and so does taking it back, by any of
`z`'s three ways or the notice's Undo. The thread destinations own the route:
`openPageThread`'s `page: true` becomes `reader: "page"`, and the new
`reader: "primary"` asks the primary reader to show the thread as its last
resort is asked, without handing it back to the page once the page could draw
it, and closes the page's card, so one thread stands open. Seats and a primary
reader's parts name no reader and keep the route's own choice. A settlement
from another tab or before a reload has no reader and opens as a route opens
it.

Behavior changes:
- Resolve in the panel's view, then `z` or a refusal: back in that view, not
  in a card.
- Resolve in a card, then `z` once the user has scrolled away or the agent has
  picked it up: the first press shows the passage and the second opens the
  card, with no turn through the panel.
- Taking back a settlement this tab made returns the user to its thread even
  when its place was already in view, as when a small scroll cleared the
  landing's arm.
- A settlement's notice names the thread by its name, as `z` names the same
  gesture; it named it by the words it is about, so the two notices gave one
  thread two names. The panel row's notice now ends long words in an ellipsis
  before Undo, where it wrapped to two lines and stood Undo over its key.

Known gap: resolve in a card, narrow the window until no card can stand, then
`z`: the thread reopens and the user lands on its margin marker, as Show on
page lands on a narrow window, rather than in the panel.

Tests: `test_a_thread_resolved_in_the_panel_comes_back_to_the_panel` and
`test_z_shows_a_thread_resolved_in_its_card_by_its_passage` fail on the base
and pass here. Undo, resolve, refusal, notice, row and fold selections in
test_resolving.py, test_render_outbox.py, test_render_floating_panel.py,
test_render_aim.py and test_render_reactions.py pass, except five that fail
the same way on the base:
`test_a_remote_resolve_disarms_the_open_reply_list_it_takes_away`,
`test_z_names_what_it_takes_and_how_long_ago_in_a_fresh_tab`,
`test_a_pointer_folds_the_panel_from_its_corner` and both
`test_borrowed_scroll_stops_leave_code_selection_and_marks_with_their_owners`
cases. `pnpm run check` and `pnpm run test:runtime` pass.
# Conflicts:
#	dist/kernel/kernel.json
#	dist/kernel/runtime/bundle-data.js
Only the rebuilt kernel conflicted; it is main's, rebuilt from the merged sources.

Brought this branch's additions up to main's conventions: the two new tests read the
panel's thread by `data-lf-thread` (#5244), and the two comments that pointed at
destination.js's `page` option now name `reader: "page"`, its name on this branch.

test_z_shows_a_thread_resolved_in_its_card_by_its_passage now waits for the page to
scroll to the card before resolving it. After this merge, Shift+t focused the card before
the page had scrolled there, and Home pressed during that scroll lost to it in two runs
out of three under xdist.
…ery way back from a settlement on every surface
# Conflicts:
#	browser/runtime/undo.js
#	dist/kernel/kernel.json
#	dist/kernel/leaf.js
#	dist/kernel/runtime/bundle-data.js
#	dist/kernel/runtime/bundle-page-layout.js
…ery surface

The settlement grid in test_resolving.py now counts open threads from the page it
starts on (the package reader's page holds a second thread), runs the notice's Undo
after a Reopen in a seat or a package reader, where the panel's field doesn't hide
the notice, checks where focus stands after the `z` that shows, and asserts that a
refused Reopen in a seat leaves the user in the seat (the thread stays drawn open
while the caret is in its reply).

Travel to a thread (anchor-travel.js, `scrollToThread`) landed the part it focuses,
then the thread's place wherever the window couldn't show the place whole. Routes now
reach the seat an x-thread-seat widget draws a thread in, which stands inside that
element, and a seat with a few threads makes its element taller than the window: a
walk to its last thread focused it 300px below the window's foot. A part inside its
place now skips the place's landing (`test_a_walk_lands_on_a_thread_in_its_seat_in_view`).

Behavior change: `t` from a thread standing in its seat lands on it there, not in a
margin card beside the seat (`test_replies_held_in_a_page_seat_show_when_the_user_turns_to_them[onto]`).
# Conflicts:
#	browser/runtime/annotation-overlay/margin-projection.js
#	browser/runtime/thread/surfaces.js
#	tests/browser/threads/test_resolving.py
# Conflicts:
#	browser/runtime/anchor-travel.js
#	tests/browser/test_render_application_boundary.py
…wered

#5331 took the user's to-dos out of Leaf, and with them the proofread to-do
the package workspace fixture put on the user. The journey still expected
that to-do to stay due after one reply answered both questions, so it read
"1 waiting on me" against the page's "0 waiting on me". The count now
expects nothing waiting; the three answers and the Email summary are
checked as before.
# Conflicts:
#	browser/runtime/annotation-overlay/margin-projection.js
#	browser/runtime/thread/surfaces.js
#	tests/browser/test_render_read_state.py
# Conflicts:
#	browser/runtime/thread/destination.js

@leaf-agent leaf-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

On this host, test_every_way_back_from_a_settlement_returns_the_user_where_they_made_it[seat_surface-reopen] fails in every run (six runs, serial and under -n 4), at the notice subtest. The cause is in the test, not the runtime: undoing the seen cell's Reopen folds the thread back into the seat's Resolved disclosure. enter reads reopen.is_visible() while that fold is still running, sees True with details.open already false, and skips the click on the summary. The disclosure then finishes closing, and reopen.click() waits until its 120 s timeout on a button that is no longer visible. When enter waits for the fold to finish (suggestion inline), the cell passes 2 of 2 with all four of its ways back. The other six cells, the runtime tests and test_threads.py -k seat pass.

Comment thread tests/browser/threads/test_resolving.py Resolved
… what they wait on

A walk to a seated thread skipped the landing on the thread's element whenever the
thread stood inside it, whatever the element's height, so a short widget could land
with its title cut off. The skip now applies only where the element is taller than its
room (`fitsWhole`), the case it exists for. The seat cell's show step asserts the whole
element in view, and fails with a ratio of 0.62 without this.

Two test setups depended on timing. A Reopen cell read Reopen's visibility while the
last way back was folding the thread into its closed disclosure, then timed out on a
button that went away; it now waits for the seat's motion to end. The seat cell and the
walk test reached the page's end with a wheel aimed past it, whose glide runs on while
the page stands at its end, reads as settled and takes back the next landing's scroll;
they now press End.
@max-sixty
max-sixty merged commit 1d78801 into main Nov 5, 2026
6 checks passed
@max-sixty
max-sixty deleted the settle-undo-matrix branch November 5, 2026 09:03
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