Skip to content

Share Lit views across initial delivery and live updates - #4545

Merged
max-sixty merged 2 commits into
mainfrom
codex/lit-render-ownership
Oct 28, 2026
Merged

max-sixty merged 2 commits into
mainfrom
codex/lit-render-ownership

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

Initial widget delivery and live updates used separate painting methods and copied DOM references. They now render the same retained Lit view into the same root, including widgets arriving through revisions and frozen messages.

  • Replace handwritten playground and worktree DOM construction with shared Lit templates. Remove the tree, editor and trace placeholder producers; CSS reserves their space until the live view starts.
  • Capture revision descriptors once and let each frozen message own its preparation promise, including overlapping state reads.
  • Supply Lit for every declared initial renderer, removing the dependency manifest and its build/server lookup machinery. Update the page-local gallery and package-author contract; bump the page protocol to 35.

Authored revision reconciliation and frozen-widget surface ownership remain: they preserve source identity and native user state. On a geometry-only diff page, supplying Lit earlier moves approximately 32 KB into the document, with under 1 KB added overall and no additional requests in the measured startup comparison.

Validation includes independent Opus review, runtime and Worker tests, and focused browser journeys covering initial node retention, streaming TOC geometry, revisions, frozen-message races, playground interaction, editor caret retention, and recording reveal. The playground user test exercised choosing, saving, reloading and undoing a treatment.

This was written by Codex on behalf of max-sixty

…rship

# Conflicts:
#	dist/kernel/kernel.json
#	dist/kernel/runtime/bundle-data.js
#	dist/kernel/runtime/bundle-disclosure.js
#	packages/default/initial/lf-shot.js
#	packages/default/vendor/lf-shot-initial.js
#	packages/default/widgets/shot-view.js
#	packages/playground/initial/lf-playground.js
#	packages/playground/widgets/lf-playground-output.js
#	packages/playground/widgets/lf-playground.js
#	packages/playwright/widgets/lf-trace.js
#	packages/timeline/initial/timeline-view.js
#	packages/timeline/vendor/lf-timeline-initial.js
@max-sixty
max-sixty merged commit 1842107 into main Oct 28, 2026
4 checks passed
@max-sixty
max-sixty deleted the codex/lit-render-ownership branch October 28, 2026 03:41
max-sixty added a commit that referenced this pull request Oct 28, 2026
…l everywhere (#4547)

Every button that shows a symbol now names its action rather than an
icon. `ACTIONS` in `browser/runtime/icon-paths.js` is the single place
where each action's symbol and name are set, so an action can no longer
show a different symbol on a different surface. The survey in #4514
found several that had drifted: Discard drawn as an undo arrow in one
editor and ✕ in another, Save drawn as ✓ or as the save mark, and Reopen
shown as a word on one surface and a check on another. Each of those had
been fixed by hand. With this change a symbol can only come from its
action.

## The contract

- `offerAction(role, className, label, {title, action})` and
`offeredAction(...)`: a `"symbol"` or `"mark"` press must name an
action. It draws that action's symbol itself and says the action's name
as its tooltip and accessible name, unless `label` says more ("Retry
source inspection"). A symbol press without an action, or with an
unknown action, throws. A word or commit press that passes an action
throws too. Templates drop their `${iconTemplate(...)}` content, because
the writer draws the symbol, and leaves it untouched when it's already
right, so later renders write nothing.
- `actionOffers(base)` in `icon-paths.js` builds both constructors. The
runtime wraps the prepaint ones with it, and so do first-paint producers
(timeline, playground, `lf-shot`), so the inline prepaint stays
glyph-free.
- Presses that build their own face draw through
`actionTemplate(action)`, `actionElement(action)` and
`showAction(control, action)`. These cover the floating panel's buttons,
message controls, video controls, the copy control's slot and motion's
play. `showAction` handles a press whose action follows its state, such
as Expand all ↔ Collapse all or the deck's Next ↔ Start, and replaces
the hand-rolled symbol swaps in `lf-deck`, `lf-sample`, `lf-diff` and
`lf-call-diff`.
- `contributionEntry` takes `action` beside `glyph` and `icon`. `icon`
stays for an entry that shows what it holds, such as a margin entry's
kind. `responseAction`, `wireInput`, `copyControl` and page-control exit
rows name an `action` in place of an `icon`.
- Icons no action names (kinds, states, the chevrons beside worded rows)
keep `iconTemplate` and `iconElement`.

Whether a press is a word or a symbol stays the author's call. An
earlier commit also refused a word button whose label was an action's
name. A page's own to-do "Done" tripped it in
`test_a_rewrite_keeps_the_message_as_it_stood`, so that refusal is gone:
it was taste enforced on authors, which `/developing-leaf` "Leave taste
to the authoring agent" rules out.

## Protocol

`offerAction`'s `icon` option became `action`, which is a change to the
public package API that a page vendored earlier would break on, so this
bumps `$events.protocol` to 35.

## Checks

- `pnpm run check` passed, including the new
`tests/runtime/action-offers.test.mjs`.
- 37 focused browser tests passed, rerun after merging #4545: page
search steps, folding the panel, Image options, call-diff and diff
fold-all, diff Retry, deck, timeline, motion, playground reset and
instruction, sample full view and reset, Reopen on margin cards and
threads, rewrites, `lf-draft` editing, suggestions, dial, code copy,
video, On me, the menu's Undo, added options, and the About dialog's
Show on page and Retry, and three `lf-trace` render tests.
- `leaf-dev stills`: the timeline state came out pixel-identical. The
other states timed out on both arms at a load average above 100, so I
stopped the run.

> _This was written by Claude Code on behalf of max-sixty_
leaf-agent added a commit that referenced this pull request Oct 28, 2026
The quoted-playground test now checks rendered text with
`use_inner_text=True`. #4545 moved initial delivery and live updates
onto a shared Lit view; it retains option labels beneath hidden
controls, so the old `textContent` assertion reads words that occupy no
visible box. This preserves that renderer and the quotation behavior
introduced by #3276.

The original assertion reproduces the reported failure locally. Browser
inspection confirms the control has `display: none`, a zero-sized
rectangle, and no contribution to the settings box's `innerText`; the CI
failure screenshot also shows only the expected sentence. With the
corrected reading, the reported test and the related static-preview test
pass (2 passed). All control-visibility, empty-box and stage-spacing
assertions remain.

Closes #4567 — automated triage

Co-authored-by: leaf-agent <[email protected]>
leaf-agent added a commit that referenced this pull request Oct 29, 2026
The quotation-isolation test still called `renderValues`, removed by
#4545 when playground delivery and live updates moved to one shared Lit
view. Call `render({values})` instead, retaining every assertion that
quoted controls are excluded and quoted values remain independent when
the surrounding tone changes.

The reported test failed on main with the exact CI exception and passes
with this change. The authored-defaults/node-retention and
static-quotation checks also pass. The separate quoted-settings text
assertion fails on main and remains tracked in #4567.

Closes #4566 — automated triage

Co-authored-by: leaf-agent <[email protected]>
max-sixty added a commit that referenced this pull request Oct 31, 2026
Main moved the playground's initial producer into widgets/playground-view.js
(#4545), lets page CSS reach every control (#4490), draws presses from their
actions (#4547, #4563), registers commands through lfCommands, and already
lets a playground run with no lf-playground-control. The PR's prose about
offer() and data-controls, its relaxed control check and its deleted
initial/vendor producer files take main's side.

What stays from the PR is actions="page", now built in the Lit view:

- playground-view.js draws no actions bar under actions="page", and no rail
  unless controls are written there; the instruction renders after the stage,
  where it was written. `give({submit, reset})` takes the page's buttons, and
  render writes the submission's words into the page's button from the same
  template Leaf's own submission uses (submit-label, then Undo choice).
- lf-playground.js's registerActions hands the buttons to the view and sets
  the playground's commands then, since a Decision command needs its control:
  the 1 key, Alt+0 and On me's arrival reach the page's buttons. A page that
  never calls registerActions still fails after first presentation.
- The copy control and popover wiring run only when Leaf draws the popover.
- The PR's test and corpus fixture pass the contributor editor main's
  registerContributor now requires.

Behavior from main kept: the submit no longer disables while a submission is
in flight (#4516), so a page's button follows the same rule.
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