Skip to content

Serve lf-activity a history reading instead of folding the log in the browser - #1078

Merged
max-sixty merged 1 commit into
mainfrom
served-history-reading
Sep 24, 2026
Merged

max-sixty merged 1 commit into
mainfrom
served-history-reading

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

lf-activity folded the raw watchHistory log in the browser. It walked
parent to find thread roots, collected undo.undoes, read titles from
conversation_title, and worded widget gestures from the live DOM
(getElementById(event.widget) and its x-state). Python already owns each
of these readings: build_threads/thread_roots, taken_back, and
GestureWords, which reads a gesture's ids in the gesture's own document.
Because the widget read the live DOM, a later version changed what a past
gesture said. Reproduced on main: pick "Fast path", then stamp a revision
that rewords the option (restated), and the row reads "chose “Quick
route”". Remove the question and the row reads "recorded “choose” on
route".

leaf/history.py now derives one served row per move, newest 50 first.
Each row carries the actor, its thread with the thread's current title,
whether a later undo withdrew it, and for a widget gesture the record form
and names from the gesture's own document. GestureWords gains name
(x-name, else the leading summary/heading/strong, else the words),
declaration, and operation (a request's offered child), and reads
revisions through a reader, so browser_state can serve it from the
documents it already holds. lf-activity words the rows it receives and
names on the live page only the places it links to.

The reading costs payload only on pages that render it. A new registry key,
x-history, gates it: browser_state serves history only when a served
document holds a widget declaring it. lf-activity declares it.

The transcript already reads GestureWords and taken_back directly and
prints every edit with its raw detail. Switching it to the 50-row feed
would drop rows and remove no parallel derivation, so it keeps its own
readings.

Behavior that moved:

  • watchHistory delivers the served history rows, not raw events. A page
    with no x-history widget gets an empty feed.
  • An action row keeps the words from the version the user acted on, and a
    retired widget's pick keeps its verb form ("chose …" rather than
    "recorded “choose” on …").
  • A request or receipt row names its operation from the request's own
    document, so it survives removing the holder.
  • New tests: a browser case for the reword/remove sequence and a fold test
    for the undone row and the x-history gate. docs/registry.html is
    regenerated for the new key.

Tests: uv run pytest tests 1355 passed; npm run test:runtime green.

🤖 Generated with Claude Code

… browser

lf-activity folded the raw `watchHistory` log in the browser. It walked
`parent` to find thread roots, collected `undo.undoes`, read titles from
`conversation_title`, and worded widget gestures from the live DOM
(`getElementById(event.widget)` and its x-state). Python already owns each
of these readings: `build_threads`/`thread_roots`, `taken_back`, and
`GestureWords`, which reads a gesture's ids in the gesture's own document.
Because the widget read the live DOM, a later version changed what a past
gesture said. Reproduced on main: pick "Fast path", then stamp a revision
that rewords the option (`restated`), and the row reads "chose “Quick
route”". Remove the question and the row reads "recorded “choose” on
route".

`leaf/history.py` now derives one served row per move, newest 50 first.
Each row carries the actor, its thread with the thread's current title,
whether a later undo withdrew it, and for a widget gesture the record form
and names from the gesture's own document. `GestureWords` gains `name`
(`x-name`, else the leading summary/heading/strong, else the words),
`declaration`, and `operation` (a request's offered child), and reads
revisions through a reader, so `browser_state` can serve it from the
documents it already holds. lf-activity words the rows it receives and
names on the live page only the places it links to.

The reading costs payload only on pages that render it. A new registry key,
`x-history`, gates it: `browser_state` serves `history` only when a served
document holds a widget declaring it. `lf-activity` declares it.

The transcript already reads `GestureWords` and `taken_back` directly and
prints every edit with its raw detail. Switching it to the 50-row feed
would drop rows and remove no parallel derivation, so it keeps its own
readings.

Behavior that moved:

- `watchHistory` delivers the served history rows, not raw events. A page
  with no `x-history` widget gets an empty feed.
- An action row keeps the words from the version the user acted on, and a
  retired widget's pick keeps its verb form ("chose …" rather than
  "recorded “choose” on …").
- A request or receipt row names its operation from the request's own
  document, so it survives removing the holder.
- New tests: a browser case for the reword/remove sequence and a fold test
  for the undone row and the `x-history` gate. docs/registry.html is
  regenerated for the new key.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@max-sixty
max-sixty merged commit e2b8b5b into main Sep 24, 2026
5 checks passed
@max-sixty
max-sixty deleted the served-history-reading branch September 24, 2026 04:22
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