Skip to content

Read arrival at a thread from where the user stands - #1920

Merged
max-sixty merged 2 commits into
mainfrom
arrival-opens-held-replies
Oct 6, 2026
Merged

max-sixty merged 2 commits into
mainfrom
arrival-opens-held-replies

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

Held thread news showed on arrival only where a route remembered to call showHeld, and routes that put the user back opted out with a carried flag or a restoringFocus() check. This reads arrival once, from where the user stands.

  • runtime/focus.js publishes each change to where the user stands (onStanding), labeled return (a hold restoring, a chrome placement, returningFocus, handBack, or the platform returning focus from a layer it closed), press (focus landing where the last press was), or move (a key's own move or a route). Each shadow stage reads its own focusin (watchStandingIn, called from shadowStage), since a move inside one shadow tree reaches the document as no event.
  • thread/held-news.js subscribes: coming to stand in a thread from outside it, by a move or a press on its title, shows what any seat holds of it. Coming back to the thread the user stood in, and any move within it, is a stay. The release runs inside the focus() call, before each route measures its landing.
  • The five showHeld call sites, carried, and the title choice's check are gone. showHeld stays only where the destination is itself held (a message or an Ask in a held turn); showHeldThread shows a thread a seat holds whole where no surface draws it, so a walk to it lands in its outlet.
  • The More menu's hand-back of borrowed focus goes through returningFocus.

This reverses the record #1780 wrote in held-news.js (arrival as the routes that call showHeld), at the user's decision on the held-news case-study page; the header now records the rejected alternative.

Behavior that moved: t/T onto the thread the user already stands in, going to an Ask from inside its thread, and Escape out of a panel card's reply box onto its title are stays, so held news stays behind its notice; a press into a thread's reply box keeps what it holds. The commit message lists each with its test.

Tests: the earlier attempt's two gaps each have a test that fails without the fix (an in-stage return in the diff-thread read test, without watchStandingIn; test_a_dialog_handing_the_user_back_to_a_thread_is_no_arrival, without the closed-layer return), as does the outlet walk (test_a_walk_to_a_thread_a_diff_line_holds_lands_in_its_outlet). Locally test_render_threads.py, test_render_read_state.py, test_render_drafts.py and test_render_reactions.py pass (491), as do npm run test:runtime and pre-commit; a wider run over navigation, margin, widgets and aim showed only load flakes and two aim failures that fail the same way on main.

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

Held thread news showed on arrival only where a route remembered to call
`showHeld`: the t/T walk's panel path, `openPageThread`, the panel's
`showThread`, `materializeAsk`, and the panel list's title choice. Two
different checks kept a route that puts the user back from releasing
anything: a `carried` flag threaded through `replyDestination`,
`openPageThread`, `showThread` and the panel's continuation, and a
`restoringFocus()` test in the title choice. Each new route was one more
place to forget.

`focus.js` now publishes each change to where the user stands
(`onStanding`), with what moved them: `return` for the runtime putting them
back or handing them across (a hold restoring, a chrome placement,
`returningFocus`, `handBack`, or the platform returning focus from a dialog
or popover it closed), `press` for the platform's own focus on the node a
press landed on, and `move` for everything else, a key's own move or a route.
Each shadow stage reads its own `focusin` (`watchStandingIn`), since a move
between two nodes of one shadow tree reaches the document as no event; such
a move now also counts as a placement for waiting holds.

`held-news.js` subscribes once: coming to stand in a thread from outside it,
by a `move` or by a `press` on its title, shows what any seat holds of it.
Coming back to the thread the user stood in is a stay, whatever puts them
there, and so is any move within it. The release runs inside the
`focus()` that moved the user, before the route measures its landing. The
call sites, `carried` and the title choice's check are gone. The
More menu's hand-back of the focus it borrowed (`restoreBannerStanding`)
now goes through `returningFocus`, so it reads as the return it is. `showHeld`
stays for a destination that is itself held, a message or an Ask in a held
turn, which has no node to focus until it shows. A thread a seat holds whole
is the third such destination: `openPageThread` shows it (`showHeldThread`,
which shows a seat's held new threads and nothing it holds of threads it
draws) where no surface draws the thread, so a t walk to the second thread
an outlet holds on a diff line still lands in the outlet
(`test_a_walk_to_a_thread_a_diff_line_holds_lands_in_its_outlet`, which
opened Threads without it).

This reverses the record #1780 wrote in `held-news.js`'s header, that
arrival is the routes calling `showHeld`; the header now records the
user's decision and the rejected alternative. #1780's record named two
gaps in the earlier attempt, and each now has a test:
- focus moving inside one shadow tree: the diff-thread read test's new
  `return` case Shift+Tabs to the file's header and walks back with t,
  both moves inside the widget's shadow tree, and fails without
  `watchStandingIn`;
- a dialog handing focus back: the new
  `test_a_dialog_handing_the_user_back_to_a_thread_is_no_arrival` opens
  and closes the command reference from a thread holding a reply, and
  failed until a closed layer's own return read as `return`.

Behavior that moved:
- t/T at the end of the list, onto the thread the user already stands in,
  is a stay, so its news stays held, with the panel open
  (`test_walking_to_a_thread_shows_the_replies_it_held[*-onto]`) or shut
  (`test_replies_held_in_a_page_seat_show_when_the_user_turns_to_them[onto]`). A new
  `return` case walks back onto a card that stood open throughout, from
  outside it, and shows its news.
- Going to an Ask from inside its own thread is a stay too; the
  `standing-ask` case now starts with the user standing nowhere.
- Focusing a page seat's thread from outside it is an arrival, so the
  held-reopening test now stands the user in the thread before the reply
  comes, and `r` there reopens it as before.
- A press into a held diff thread's reply box keeps the reply held under
  it; the test presses rather than focusing from script.
- Escape out of a panel card's reply box lands on its title, a move within
  the thread, so the card keeps holding what it held; a press on the title
  the user already stands on, and Enter or Space there, show nothing either.
  The two drafts tests whose panel card held an agent's resolution now
  press its "Resolved" notice after Escape, as the inactive-agent case did.
- A route from a thread's page seat to its panel or margin card is a stay,
  and the gallery's `showView({thread})`, which takes no focus, shows
  nothing held.
- A t walk to a thread a page seat holds whole lands in the margin card, as
  on main, and that arrival shows the thread the seat held
  (`test_a_thread_the_agent_starts_in_a_page_seat_waits_in_the_row_it_would_follow[box-walked]`).

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent
leaf-agent previously approved these changes Oct 6, 2026

@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.

The test job is red on this head in two places, so my approval no longer stands. CI log.

  • test_a_news_resolved_card_keeps_its_place_after_an_offscreen_draft_is_cleared still expects Escape from the reply box to remove its editor immediately. Under this PR's arrival rule, Escape lands on the same card and leaves its resolution held behind the notice. The test times out waiting for leaf-text to disappear; update that expectation to release the notice before checking removal, as the changed draft tests do.
  • test_the_register_is_the_only_way_a_key_enters_the_runtime finds the new standalone keydown listener in focus.js. The key register contract permits the existing shared input listener, not another global key listener. Clear pressedPath through that existing listener so the contract stays intact.

@leaf-agent
leaf-agent dismissed their stale review October 6, 2026 18:22

CI test job failed: one outdated expectation and a new keydown listener violate the current gate.

…held settlement by its notice in the chrome contract test

The key register allows the runtime's existing input listener, not another
global keydown listener, so the press path is read and cleared there.

Escape out of a resolved card's reply box is a move within the thread, so
the card keeps the agent's settlement behind its notice;
test_a_news_resolved_card_keeps_its_place_after_an_offscreen_draft_is_cleared
now presses the notice before checking the editor is gone, as the drafts
tests do.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@max-sixty
max-sixty merged commit 5cfde36 into main Oct 6, 2026
4 checks passed
@max-sixty
max-sixty deleted the arrival-opens-held-replies branch October 6, 2026 19:05
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