Skip to content

Add lf-timeline: step through an authored sequence of events in lanes - #3973

Merged
max-sixty merged 9 commits into
mainfrom
fix/3172-lf-timeline
Oct 25, 2026
Merged

max-sixty merged 9 commits into
mainfrom
fix/3172-lf-timeline

Conversation

@max-sixty

@max-sixty max-sixty commented Oct 25, 2026 •

Copy link
Copy Markdown
Owner

Agents explaining a sequence of events, such as two jobs racing on one row, had no widget for it, so they hand-drew timelines in SVG whose labels collided with each other and with the playhead, and the render check couldn't see it. A new optional timeline package adds lf-timeline: lanes of authored events on a shared time axis, which the reader steps through.

An lf-event is an instant at at, or a span from at to end, in milliseconds. Previous and Next, the Left and Right arrows, Home and End, a row of the step list and a press on a mark set the step. Each instant and each span's start is one step, events that start together share it, and a span's end is not a step, so an author who needs a moment such as "A's write lands" writes it as an instant. Overlapping spans need no rule of their own, since they start at different times. The step is tab-local view state, never a page event. There are no modes and no continuous play: a before/after comparison is two timelines in an lf-tabs, and continuous playback, if needed later, belongs in lf-motion.

Every event is drawn at every step, so stepping moves only the playhead: earlier events are drawn done, a span the playhead is inside is done up to it, and later events are faint. Labels sit in rows of their own above each lane's bars and take greedy rows by measured width, so none overlaps a bar or another label; a label that would pass the axis end reads back from its mark, and labels stand in front of the playhead, so the line never crosses words. The initial renderer draws the whole widget before first paint, and the module adopts it. Each event is a visual part event:<id>, and following a comment to one steps to it.

The axis geometry the Playwright trace's timeline kept privately (tick steps and labels, greedy rows, text measurement) moves to browser/runtime/time-axis.js, which the trace imports through widget-api.js's internal exports and lf-timeline's initial bundle compiles in. An eslint exemption lets package initial sources import it, as they already import motion-icon-paths.js.

Since the prototype:

  • Print. The prototype offered the widget's whole view as a control box, and paper drops offers, so a printed page lost the chart and the step list. The view is now plain generated chrome, the step rows are marked as the page's words so paper keeps them as text, and only Previous and Next drop. Positions along the track are fractions of its width rather than pixels, so marks and the playhead stay inside a printed page narrower than the screen, and the widget lays labels out again when Chromium switches to print media at the paper's width. Marks are painted backgrounds, so the chart asks for print-color-adjust: exact.
  • Stepping controls. The step position, whose width changes with each step, now follows both buttons, so Next stays under the pointer while the reader presses it repeatedly. lf-lane no longer declares an id, which nothing reads.
  • Example. examples/lost-update.html is the race page from the prototype: a lost update between two jobs, before and after a row lock, as two timelines in tabs. It joins the specialized catalog, the Timeline card on the Extending page links to it, and the catalog stills are refreshed.
  • Tests. tests/browser/widgets/test_timeline.py drives every stepping route (button, arrows, Home/End, a step row, a mark, arrows carrying focus along the list, the step surviving a reload) and checks that no label is clipped, leaves the track, or overlaps another in its row, at desktop width, at 390 px and under print media. Putting the offered view back makes the print assertion fail.

Checked by hand in Chromium and Firefox, light and dark, at 1100 px, 390 px and 320 px: tapping a step row, a mark and a label goes to that step, the buttons step at 390 px, and step rows are 44 px tall under a coarse pointer. Firefox prints from a static copy and runs no script, so a printed page there keeps the screen's label rows; positions are fractions, so marks stay correct, but labels laid out for a much wider screen could overlap on paper.

Left as is: the two tabs of a comparison each scale to their own duration, so equal spans draw at different lengths across tabs; a shared scale would need an option the design left out.

Tests run: leaf package check packages/timeline --render, pnpm run test:runtime, pnpm run check:browser, the new tests/browser/widgets/test_timeline.py, and the Playwright trace tests that read the shared axis (test_trace_overview_shows_every_row_and_preserves_page_scrolling, test_timeline_tooltips_keep_their_words_above_marks_inside_the_timeline, test_trace_render_gate_restores_the_zoomed_time_window, and in tests/journeys, test_trace_dense_moments_keep_the_axis_usable_and_page_scoped and test_trace_zoom_and_pan_stay_within_the_fitted_recording).

Closes #3172

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

max-sixty and others added 5 commits October 24, 2026 20:35
A new `timeline` package adds `lf-timeline`, with `lf-lane` and `lf-event`
members. An event is an instant at `at` or a span from `at` to `end`, in
milliseconds. Previous and Next, the Left and Right arrows, Home and End,
the step list's rows and a press on a mark all set the step. Each instant
and each span's start is one step; events that start together share it,
and a span's end is not a step. The step is tab-local view state.

Everything is drawn at every step, so stepping moves only the playhead:
earlier events are drawn done, a span the playhead is inside is done up to
it, and later events are faint. Labels sit in their own rows above each
lane's bars, take greedy rows by measured width so none overlap, read back
from their mark near the axis end, and stand in front of the playhead, so
the line never crosses words. The initial renderer draws the whole widget
before first paint; the module adopts it. Each event is a visual part
`event:<id>`, and following a comment to one steps to it. The playhead
glides between steps unless the reader asked for less motion.

The axis geometry the Playwright timeline kept privately (tick steps and
labels, greedy rows, text measurement) moves to `browser/runtime/time-axis.js`.
The Playwright timeline imports it through widget-api.js's internal
exports, and lf-timeline's initial bundle compiles it in. The trace keeps
its own label clustering, since its lanes hold one row each.

Prototype for #3172; not for landing as is.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts:
#	dist/kernel/kernel.json
#	dist/kernel/runtime/widget-api.js
leaf-agent
leaf-agent previously approved these changes Oct 25, 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.

Next moves under the pointer after stepping; the inline suggestion keeps the stepping controls in place.

@max-sixty
max-sixty merged commit 3fa4fd3 into main Oct 25, 2026
6 checks passed
@max-sixty
max-sixty deleted the fix/3172-lf-timeline branch October 25, 2026 17:06
leaf-agent added a commit that referenced this pull request Oct 26, 2026
The export audit reported five module-local helpers and one real reader
it could not follow. Keep the helpers private, and teach the audit to
follow a dynamic import's fulfilled namespace through `catch` and
`finally`. This preserves `resolvePlace`, which Page diagnostics uses to
reveal a captured location, instead of removing a working navigation
path.

The timeline helpers came from #3973; #4198 added the diagnostics reader
through `import(...).catch(...)`. Their intended behavior stays intact.
Rebuilding changes only two source hashes in the kernel manifest;
compiled runtime and package bundles are byte-identical.

Verified locally: the original six-export failure reproduces on main and
passes after this change; a focused checker regression fails before the
fix and passes afterward, including an unread-export control. All 668
runtime tests, the diagnostics captured-location browser test, and the
browser build/type checks pass.

Closes #4250 — automated triage

Co-authored-by: leaf-agent <[email protected]>
leaf-agent added a commit that referenced this pull request Oct 26, 2026
Timeline step rows contained the event text inside native buttons,
preventing the reader from selecting a passage. The step list now uses
Leaf's existing selectable control primitive, with Enter and Space
activation supplied by each step's command scope. Clicks, arrows, saved
step position and printed event text keep their behavior; dragging
across a step's words leaves the playhead unchanged.

The selectable constructor now lives beside the other initial-render
control constructors, so early drawing and live widget modules use the
same implementation. This preserves #3973's stepping and print behavior
while fixing its inaccessible event text.

Validation: the reported `test_page_fixture_renders[lost-update]` failed
on main and passes with this change. Both timeline tests pass, including
real passage selection, Enter/Space activation, arrow focus, resizing
and print. `pnpm run check` and the configured pre-commit checks pass
(including 668 runtime tests). The served startup comparison uses 44
requests in both arms; code loaded before presentation changes from
2,842,898 to 2,842,996 bytes.

All four before/after still pairs are unchanged: the initial timeline, a
keyboard-focused active step in light and dark, and the initial phone
view. Independent code and browser review found no actionable issues.

Closes #4243 — 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.

A sequence of events over time has no widget, so agents hand-draw timelines whose labels collide

2 participants