Skip to content

State the rule for porting a widget from Lit to Effect UI - #7461

Merged
max-sixty merged 2 commits into
mainfrom
agent-af81c334b3ba95f0c
Nov 27, 2026
Merged

max-sixty merged 2 commits into
mainfrom
agent-af81c334b3ba95f0c

Conversation

@max-sixty

@max-sixty max-sixty commented Nov 27, 2026 •

Copy link
Copy Markdown
Owner

browser/AGENTS.md gains "Renderers", which names both renderers (a bundled widget is a LeafElement or a defineWidget component, and the chrome draws with Lit) and the rule Max picked ("Port by the rule above") on the Effect UI direction review page on 27 November 2026. Under it, a port deletes the Lit view it replaces, and a service it adds calls the same owner as its widget-api.js function. It names what it made easier and benches a page full of its widget, base beside head, within root AGENTS.md's "Responsiveness" budgets. A widget that decorates the author's children tries a light-DOM part first. The chrome moves only once @effect/ui ships a release whose mount and component APIs aren't experimental. A widget that can't meet the rule is the point to stop and raise it. The section replaces the two statements that prescribed Lit alone, packages/AGENTS.md points ports to it, and two comments that contradicted it change: lf-options.js no longer calls its shadow roots the shape of every decorating widget, and build/vendor.mjs no longer says the chrome draws with Effect UI. The bench item comes from #7417, which ported lf-options without one and made a page of 1,024 options take 15.5 s to load (#7446 fixed the scan behind that).

A temporary A/B scored it: headless Opus plans for porting lf-tabs and for moving the Page Map dialog, three runs per arm per task, base text beside this branch, judged by Opus and corrected by reading the quotes. Base passed 3/3 on deleting the Lit view, 0/3 on naming what the port made easier, 3/3 on benching base beside head, 0/3 on trying a light-DOM part first, and 0/3 on holding the chrome back. Head passed 3/3 on every one. Every base lf-tabs plan took shadow roots, citing the old lf-options header line, and every base Page Map plan went ahead and rewrote the Lit rule. Every head lf-tabs plan found that defineWidget appends its light box after the authored children, where a tab strip can't stand. Root AGENTS.md already sends both arms to leaf-dev bench. The runs cost $23.86.

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

browser/AGENTS.md gains "Renderers". It names both renderers: a bundled widget is
a LeafElement or an Effect UI component that defineWidget defines, and the chrome
draws with Lit. It states the goal, one renderer, Effect UI, reached one widget at
a time and the chrome last, by ports that each pay for themselves. And it states
the rule a port follows:

- it deletes the Lit view it replaces, and a service it adds calls the same owner
  as its widget-api.js function, which stays the form plain widgets and page
  scripts use;
- it names in its commit what it made easier to build, verify or maintain, and
  doesn't otherwise grow the widget;
- it benches a page full of its widget, base beside head, and keeps the budgets
  and growth root AGENTS.md sets under "Responsiveness";
- a widget that decorates the author's children draws in a light-DOM part beside
  them first and takes a shadow root only where that fails;
- the chrome moves only once @effect/ui publishes a release whose mount and
  component APIs no longer carry `@stability experimental`.

A widget that can't meet the rule is the point to stop and raise it with the
maintainer.

The section replaces two statements that prescribed Lit alone. "Readable content
comes before activation" said each widget owns one Lit view, and now says one view.
The first paragraph of "Working on the runtime" moves into the section, and its
one-renderer-per-component rule now names either renderer. packages/AGENTS.md
points a port to the section.

Two comments contradicted the rule. lf-options.js said its shadow roots are the
shape every decorating widget takes, lf-tabs' and lf-board's included, and now
points to the section instead. build/vendor.mjs said the chrome draws with Effect
UI, and now says ported widgets do.

Max picked this rule ("Port by the rule above") on the Effect UI direction review
page on 27 November 2026. The bench item comes from #7417, which ported lf-options
without a bench and made a page of 1,024 options take 15.5 s to load; #7446 fixes
the scan behind that.

Scored with a temporary A/B in scratch, base (the merge base's text) beside head.
Each headless Opus run (`claude -p --safe-mode`, read-only tools, SOUL.md and root
AGENTS.md in its system prompt) got its arm's passage and a subset of the tree, and
planned one of two tasks. An Opus judge scored the plans, and each judge miss found
on reading the quotes was corrected. Three runs per arm per task:

| Criterion                                   | base | head |
| ------------------------------------------- | ---- | ---- |
| lf-tabs: deletes the Lit view                | 3/3  | 3/3  |
| lf-tabs: names what the port made easier     | 0/3  | 3/3  |
| lf-tabs: benches base beside head            | 3/3  | 3/3  |
| lf-tabs: tries a light-DOM part first        | 0/3  | 3/3  |
| Page Map dialog: holds until a release       | 0/3  | 3/3  |

Every base lf-tabs plan took shadow roots and cited lf-options' header line as the
reason. None named what the port made easier; each justified it by what it removes,
such as a second render per switch, or by lf-options' precedent. Every base Page Map
plan went ahead with the move and rewrote the Lit rule in browser/AGENTS.md as part
of it.

Every head lf-tabs plan drew the strip in the light DOM. All three found that
defineWidget appends its light box after the authored children, where a tab strip
can't stand, and each proposed moving that box before them, or asking first. Every
head Page Map plan declined until @effect/ui ships a stable release, citing the
experimental snapshot pin. Root AGENTS.md's "Responsiveness" already sends both arms
to `leaf-dev bench`. The runs cost $23.86.

> _This was written by Claude Code on behalf of max-sixty_
Only LeafElement extends LitElement, so the section's list of a Lit
element, a LeafElement and an Effect UI component counted one kind twice.

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

#7435 is open beside this one. It rewrites the same "Readable content comes before activation" bullet ("Each widget updates one view while it is mounted"), and it states the Effect UI move a second time, in root AGENTS.md under "Keep the package interface small": "A bundled widget Leaf adds or rewrites that draws a view of its own is an Effect UI component." That sentence makes the move unconditional, while "Renderers" here says a port must pay for itself and stops at a widget that can't meet the rule. Whichever PR lands second should keep one statement of the move and point the other file to it.

@max-sixty
max-sixty merged commit 034ed3e into main Nov 27, 2026
6 checks passed
@max-sixty
max-sixty deleted the agent-af81c334b3ba95f0c branch November 27, 2026 23:31
max-sixty added a commit that referenced this pull request Nov 27, 2026
…#7468)

`browser/AGENTS.md`, "Renderers", held Leaf's chrome on Lit until
`@effect/ui` published a release whose mount and component APIs were no
longer experimental, and moved it last. Max asked on the Effect UI
direction review page to remove that gate: the work should establish
practices and patterns for moving each view, not wait on anything
external. The section now ports the chrome's views by the same rule as
the widgets.

#7461's scored runs already measured this item: with the gate, all three
plans for moving the Page Map dialog declined; without it, all three
went ahead. The other four items are unchanged.

Tests: `tests/model/test_owner_index.py`, the one test that reads
`browser/AGENTS.md`.

> _This was written by Claude Code on behalf of max-sixty_
max-sixty added a commit that referenced this pull request Nov 28, 2026
…ter it

Max said Leaf intends to move everything to Effect UI, and `browser/AGENTS.md`,
"Renderers" (#7461), now states that move, chrome included. Root's paragraph
under "Keep the package interface small" points there instead of restating it,
and says what the interface keeps once the move ends: Lit and `LeafElement`
leave once Leaf's packages and example pages no longer draw with them, while
the protocol's events and the `widget-api.js` functions a Command service
repeats stay, since a plain element or a page script can't issue a Command
service. The earlier text said such a function leaves with its last bundled
caller, which contradicted the rule "Renderers" states; that sentence now
lives in root alone. The rule that a widget Leaf adds or rewrites is an Effect
UI component goes, since "Renderers" makes each port pay for itself and stop
where it can't.

The root-guidance situation becomes `service-and-function-for-one-act`: a
survey that finds `KeepInTab` and `tabStore.set` keeps both after the bundled
`LeafElement` callers are ported. It passes 3/3 on head and 0/3 on base; no
other cell loses a rule (field-editor-keys went 3/3 to 2/3 on a judge reading
unrelated to this paragraph). The final wording passes the five interface
situations 15/15.

> _This was written by Claude Code on behalf of max-sixty_
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