Skip to content

fix: return a walk to the stop the user just left - #4332

Merged
max-sixty merged 9 commits into
mainfrom
walk-return-model
Oct 27, 2026
Merged

max-sixty merged 9 commits into
mainfrom
walk-return-model

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

m, Escape, m went on to the next On me item, and t, Escape, t to the next thread. Both now return to the item the user left, and a second press goes on from it.

Every walk (t, m, a tally's Next on me) now pages by one rule, stated in browser/runtime/current-target.js: a press steps off the stop the user is on, where their current location is in the stop's destination (an obligation's place, a thread's view), and arrives at the stop they are only at. Both walks read where the user is from one origin, {node, place, kind} (walkOrigin / currentLocationOrigin), instead of each reading focus for itself.

Three readings had counted "at" as "on":

  • With no current location, walkOrigin labelled the reading in view a current location, so m stepped off whatever obligation the viewport's first block sat in. It now starts at what the user let go of while they still see it (focus.js announces it through onLetGo; current-target.js keeps it until the user stands on another page place or presses, wheels or touches outside Leaf's chrome), else at the reading block, and neither is on a stop.
  • A thread whose card stands beside the user's place (threadHere) counted as the thread they were in, so t from the target Escape lands on stepped past it.
  • Focus in the floating panel read as no place. The panel's held page place, with the place read as the user stepped in, now counts as the user's current location (holdPagePlace); navigation.js's z reads it from current-target.js instead of an injected copy. Entering the panel from nowhere by keyboard holds no place.

The same cause sent Tab after Escape to the top of the view: letGo landed on the first visible block, not beside what it let go of. It now lands beside that node while it is in view (landingPlace in reading-place.js), so Tab and the walk start from the same place. Where several threads stand at one place and none is shown, the thread at it is the one the user was last in (thread/destination.js).

Behaviour changes

  • Reading an obligation in view and pressing m lands on it rather than past it.
  • From a thread's target with its card open, t goes back into that thread.
  • m or t pressed in On me goes on from the place the panel holds.
  • c at an element with several threads and none shown continues the one the user was last in rather than the first (same lookup as the walk).

Tests

New and changed assertions in test_obligation_walk.py, test_key_scopes.py and test_obligations.py, each checked to fail without the change: m, Escape, m (and Shift) with several decisions in view; Tab after Escape; On me after Escape; t from On me; the thread left of two on one passage. Two older tests asserted the reading-as-on behaviour and now assert the new one.

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

max-sixty and others added 8 commits October 26, 2026 16:49
`m`, Escape, `m` went on to the next On me item, and `t`, Escape, `t` to the
next thread. Every walk now pages by one rule, stated in current-target.js: a
press steps off the stop the user is on, where their current location is in
the stop's destination (an obligation's place, a thread's view), and otherwise
arrives at the stop they are at. Three readings had counted "at" as "on":

- With no current location, `walkOrigin` labelled the reading in view a
  current location, so `m` stepped off the obligation the viewport showed. It
  now starts at what the user let go of while they still see it (focus.js
  `letGoneFrom`, recorded by `letGo`), else at the reading block, and both are
  `at`. The reading alone could not return to the item left: an obligation
  reached without scrolling sits below whatever the viewport's first block is.
- A thread whose card stands beside the user's place (`threadHere`) counted as
  the thread they were on, so `t` from the target Escape lands on stepped past
  it. Both walks now stand on a thread only while the user is in it
  (`threadIn`).
- Focus in the floating panel read as no place, and the m walk only stepped on
  from it because the misread reading happened to be the item. The panel's
  held page place, with the place read as the user stepped in, now counts as
  the user's current location (`holdPagePlace`), the one reading `z` already
  used, so navigation.js reads it from current-target.js instead of its own
  injected copy. Entering the panel from nowhere by keyboard holds no place.

Both walks now read where the user is from one origin, `{node, place, kind}`,
rather than each reading focus for itself, so "on a thread" follows the
panel's held place too. The let-go place is kept in current-target.js
(focus.js announces it through `onLetGo`) until the user stands on another
page place or presses, wheels or touches outside Leaf's chrome. Where several
threads stand at one place and none is shown, the thread at it is the one
the user was last in (destination.js), so the walk returns to the one left.

Behaviour changes the tests record: reading an obligation in view and pressing
`m` lands on it rather than past it; from a thread's target with its card
open, `t` goes back into that thread; letting go of a thread and pressing `t`
reopens it; `m` or `t` pressed in On me goes on from the place the panel holds.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts:
#	dist/kernel/kernel.json
#	dist/kernel/runtime/bundle-dom-move.js
# Conflicts:
#	dist/kernel/kernel.json
#	dist/kernel/runtime/bundle-surfaces.js
# Conflicts:
#	dist/kernel/kernel.json
leaf-agent
leaf-agent previously approved these changes Oct 27, 2026
leaf-agent
leaf-agent previously approved these changes Oct 27, 2026
# Conflicts:
#	dist/kernel/kernel.json
@max-sixty
max-sixty merged commit fbd2284 into main Oct 27, 2026
3 of 4 checks passed
@max-sixty
max-sixty deleted the walk-return-model branch October 27, 2026 04:26
leaf-agent added a commit that referenced this pull request Oct 27, 2026
The On me reading-position test still expected the first `m` press to
skip Question 0. #4332 intentionally made a walk with no focused
location enter the visible obligation instead; the failing CI screenshot
shows Question 0 focused.

Expect that first obligation and keep the existing panel scrolling,
repaint and resize assertions. This preserves #4332's navigation
behavior without changing the runtime. The original test reproduced the
reported focus failure locally (125.22s); the corrected case passed on
current main plus this change (5.71s), including the scroll-retention
checks.

Closes #4367 — automated triage

Co-authored-by: leaf-agent <[email protected]>
leaf-agent added a commit that referenced this pull request Oct 28, 2026
Closing Threads can leave focus on `document.body`. The landing lookup
introduced in #4332 treated that as a selected passage and scanned the
entire document, choosing the workspace heading ahead of the pane the
user was reading. Body now takes the existing reading-region fallback,
so Escape keeps the pane and `d`/`u` continue scrolling it. Landing
beside a real selected destination remains intact.

The reported journey fails before the correction and passes afterward;
the related thread-exit and obligation-walk checks also pass. The
journey now explicitly checks the region before opening Threads. All 695
runtime tests and `pnpm run check` pass. The kernel is rebuilt. Local
Ruff and Prettier executables are unavailable; PR CI owns those checks.

A served `release-notes` comparison against the starting main retains 42
code requests through widget upgrade and server-state presentation, adds
26 JavaScript bytes, and reports no startup layout shifts or console
errors. The guard adds no startup task or dependency.

Closes #4458 — automated triage

Co-authored-by: leaf-agent <[email protected]>
leaf-agent added a commit that referenced this pull request Nov 1, 2026
The trace journey's wheel gesture clears the remembered thread-walk
position, as #4332 deliberately requires. Its following `t` therefore
selects the saved-button thread rather than the frame thread. Assert
that first landing, then take the next `t` walk step to return to the
frame comment, preserving the exact-image assertion and the intended
walk behavior.

Once that assertion reaches index refresh, the retained Viewer still
holds an image object from the previous delivery. Looking it up in the
new image array produces index -1 and an invalid data-origin path.
Reusing the Viewer now also replaces its image record with the current
delivery's record. The viewer, its zoom and its DOM remain retained.


The later drawing-return check now selects its thread through Threads →
Show on page rather than assuming hidden image parts occupy a fixed
position before the timeline in the thread walk.

Validation: the original journey failed on current main; after
correcting its first navigation step, the refresh assertion exposed the
invalid-origin error. With both repairs, the complete journey passes
(48.84 s). The existing thread-walk regression passes, all 737 runtime
tests pass, and the browser type check, Ruff and whitespace checks pass.

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