Skip to content

Walk one list of threads in the Threads panel, and report one position - #2551

Merged
max-sixty merged 2 commits into
mainfrom
fix-54-thread-walk-count
Oct 12, 2026
Merged

max-sixty merged 2 commits into
mainfrom
fix-54-thread-walk-count

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

The Threads panel's walks now step through one list of threads, and report one position. Before, three readings decided which threads the user walks: the arrows walked every rendered row's focus stop, t/T walked the list model's shown cards, and the n/N/Enter guards and the resolve landing read the DOM's unhidden cards. The arrows also built their "N of M" label apart from t's.

Lit-survey review item 54

The review said the arrows' label counted cards kept outside the current view and t did not. I measured that case and both readings agree: a card kept as news from elsewhere is shown, and both counted it (4 of 4 each way). Two other divergences were real, and both are fixed here:

  • A card folding out after a resolve. For the fold's duration the arrows counted its inert title and t did not, so Home said "Thread 1 of 4" where t walked three, and Home aimed at the folding card and went nowhere.
  • A narrowed list. t said "Thread 2 of 4 shown"; ArrowDown onto the next card said "Thread 3 of 4". The reviewer found this one.

The list view's walkRows() (thread-list-view.js) is now the one reading. It returns each shown card, kept ones included, and each withdrawn notice, each as a focus stop and its card. A card folding out is in none of them. The arrows walk its stops. t/T, n/N, the Enter guard and the resolve landing read its cards. navigationThreads, focusStops and isFocusStop are deleted, and openThreads loses the options only those readers set. rowWalk takes a position reader in place of items: the thread panel passes the thread walk's own reader (navigation.threadPosition), so the arrows and t print the same label, and the Questions panel passes its items' reading.

  • Behaviour changed: during a resolve's fold, the arrows skip the folding card and count the same threads as t. In a narrowed list the arrows' position carries "shown", as t's does. After an arrow walk, the position stays up while focus moves into that card's reply box, as it already did after t.
  • Source lines (hand-written, excluding tests): +61 −63.
  • Test lines: +59 −2. test_the_arrows_and_t_walk_one_list_of_threads walks a list holding a kept card and a folding one with Home, t, ArrowUp, End and T, then a search-narrowed list with ArrowDown, N and End. It checks focus and the label at each step. Its first assertion fails on main with "Thread 1 of 4". With the panel's position reader removed, its narrowed part fails with "Thread 2 of 2" (no "shown").

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

max-sixty and others added 2 commits October 12, 2026 01:32
The arrows, `t`/`T`, and the walk position each read the list on their own:
the arrows walked every rendered row's focus stop, `t` the list model's shown
cards, and the n/N and Enter guards and the resolve landing the DOM's
unhidden cards. A card the list keeps outside the view as news counted in all
of them, but a card folding out after a resolve counted only for the arrows,
so for the fold's duration Home said "Thread 1 of 4" where `t` walked three,
and Home aimed at the folding card's inert title and went nowhere.

The list view's `walkRows()` is now the one reading: each shown card,
kept ones included, and each withdrawn notice, as a focus stop and its card.
The arrows walk its stops, `t`/`T` and every position count its cards, and
the resolve landing and the n/N/Enter guards read the same cards.
`navigationThreads`, `focusStops` and `isFocusStop` go, and `openThreads`
loses its `visibleOnly` and `panelOpen` options, which only these readers set.

The arrows also computed their position label apart from `t`'s, so in a
narrowed list `t` said "Thread 2 of 4 shown" and ArrowDown "Thread 3 of 4".
`rowWalk` now takes a `position` reader in place of `items`; the panel passes
the thread walk's own (`navigation.threadPosition`), and the Questions panel
passes its items' reading.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@max-sixty
max-sixty merged commit 08f89a6 into main Oct 12, 2026
3 checks passed
@max-sixty
max-sixty deleted the fix-54-thread-walk-count branch October 12, 2026 08:45
max-sixty added a commit that referenced this pull request Oct 12, 2026
… two leftovers (#2565)

A widget driven by `widgetController` now draws on return by the same
rule as `watchData` and `watchProjection`: only a reading that changed
while it was away draws again, so a `renderState` that failed is
reported once. `clocked` now follows its owner's lifetime, so no widget
pauses and resumes its clock by hand. Two leftovers go: an optional
Thread panel path nothing used, and the misleading `openThreads`. These
are items 60–63 of the Lit survey follow-up review, numbered in that
review rather than as GitHub issues.

## Behaviour that changed

- **Item 61: the controller's return rule.** `widget-controller.js`
cleared its rendered reading on departure, so every return ran
`renderState` and its subscribers again, and a failing render was
reported again each time. It now paints through `readingPaint`, keyed by
the reading. A return to an unchanged reading draws nothing and settles
its presentation ticket; a reading that changed while away draws as
before. `defer()`, an ancestor's `refresh` and the last unsubscribe owe
a fresh draw (`forget()`). Time readings in `renderState` or a
subscriber now subscribe to the shared clock, which module-authoring.md
already said they did. A tick claims the draw through the controller's
own `publish`, so it waits out a deferral or drag like any other
reading.
- **Item 63: `clocked` follows its owner.** `clocked` holds a
`watchOwner` lifetime from construction. Its readings pause while the
owner is away, and the next tick after a return repaints what aged.
Before, the tick dropped a departed owner's paint for good, so
lf-pr-brief stopped and resumed it by hand; that code and
`render.resume()` are gone. `stop()` takes a paint off the clock until
it paints again. `tickClock` now skips, rather than drops, an owner
removed before its departure reaches the arrival batch. To avoid an
import cycle, `readingPaint` moves from arrivals.js to presence.js
beside `clocked`. presence.js imports `watchOwner`, and arrivals.js no
longer imports presence.js. No other caller managed a clock's lifetime
by hand.
- **Item 62: the optional Thread panel path is deleted.**
`registerPanel({required: false})` nested its own `clocked` paint inside
`watchThreads` and discarded its promise. Its only caller was
`test_two_standard_thread_lists_share_updates_but_not_local_state`, so
that test goes too. `required` is gone from `registerPanel` and
`registerThreadPanel`: every panel joins the thread presentation.
- **Item 60: `openThreads` is split into two functions named for what
they return.** It returned every card with the panel open, and the open
cards in page order with it shut. The t/T walk with the panel shut now
calls `openThreadsInPageOrder()`. The queue walk's arrival by id looks
among `threadCards()` when the panel is open and among
`openThreadsInPageOrder()` when it is shut. The comment #2551 added to
explain the old function is gone.
- **module-authoring.md** states the return rule once for data,
projection and controller subscriptions. The `clocked` paragraph no
longer tells authors to call `.stop()` and `.resume()`.

## Measured

Hand-written source excludes tests, Markdown and the generated
`corpus.page` copy.

| Item | Source | Tests |
|---|---|---|
| 61 | widget-controller.js +72 / −60, plus `invalidate` passed through
`readingPaint` (≈ +3 / −2) | +60 / −3 |
| 63 | presence.js, arrivals.js, data.js, projection-watch.js,
lf-pr-brief.js: ≈ +95 / −81. About 62 lines of each side are
`readingPaint` moving files. | +35 / −1 |
| 62 | presentation.js, application.js, leaf.js: +13 / −58 | +2 / −166 |
| 60 | thread-list.js, navigation.js, leaf.js: +18 / −17 | +2 / −2 |
| Total | +204 / −219 (net −15) | +99 / −172 |

## Validation

-
`test_a_returning_controller_widget_draws_again_only_a_changed_reading`
failed on `main` in both of its halves. An unchanged return redrew the
widget. After a failing `renderState`, a return ran it again and
reported the failure again. It passes here.
- The Node test "a clock paint pauses while its owner is away and ticks
again on its return" failed on `main` (`[0]` where `[0, 1]` was
expected): with no manual resume, the returned paint never ticked. It
passes here.
- `test_page_owned_registry_and_widget_use_the_captured_public_api`
asserted the old unconditional redraw after another widget's action. It
now asserts that the unchanged return draws nothing.
- `pnpm run test:runtime` passes. These browser runs pass: all of
`test_render_application_boundary.py`, the data and projection return
tests, the clock paint tests, the required-panel startup tests, the PR
brief clock and remount tests, report narration, the thread and queue
walk tests, and the widget, options and controls lifetime selections.
`test_primary_reader_revision_replaces_owner_without_losing_thread_draft`
fails ("The page already has a Thread presentation") as it did before
this change, per #2552.

## Not changed

`watchComparison` (version.js) re-reads on every return through
`whileConnected`. A callback that throws retires its subscription, so
nothing is reported twice. Moving it onto `readingPaint` would need a
comparison generation to key on. lf-diff's inline patch keeps the same
rule in its own `settled` flag. Moving it onto `readingPaint` means
exporting `readingPaint` to packages, which adds a public API.

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

---------

Co-authored-by: Claude Opus 5.5 (1M context) <[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