Skip to content

Write required and selected where a page asks, as HTML does - #5968

Closed
max-sixty wants to merge 35 commits into
mainfrom
fable-package-interface
Closed

max-sixty wants to merge 35 commits into
mainfrom
fable-package-interface

Conversation

@max-sixty

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

Copy link
Copy Markdown
Owner

This is now one change: the attributes a page asks with take HTML's names. choose on lf-options and needed on lf-draft become required, and chosen on lf-option becomes selected. The rest of what this branch held has landed: the registry and API cuts as #6134, and the comment-box fold as #6105.

It stays a draft because the names are still Max's decision. The review bot found a trap in required on lf-options: in HTML a group can be picked with or without required, while in Leaf a group without it can't be picked at all, so an author who knows HTML would leave it off a question the user may skip and get cards nobody can pick. Almost every group carries the attribute (1 of 103 in the shipped tree lacks it; 9 of 1,205 on 211 real pages, 8 of those settled). The options in front of him:

  • keep main's names (close this);
  • take these names as they are (this diff);
  • let a group ask with no attribute, so only selected and a draft's required are written. That is built as a trial on fable-options-ask-by-default-trial, which predates this branch's merges with main.

What the diff holds: the three names across markup, selectors, schema and registry entries, references, examples, eval wording and tests (about 230 files), and one browser fix only the name selected needs: the scan for an authored pick counts only Leaf elements, as the server's does, so a native <option selected> inside a widget isn't read as a pick.

A page still writing choose, chosen or needed fails page check as an unknown attribute. The eval cases that write the attributes are reworded and not rerun.

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

A package example could carry sample values for the sources it binds, for
package check --render to serve. No bundled, example or site declaration
wrote one in the three weeks since #3997 added it, so the key, its
validation and the render check's per-page data store go.

Behavior changed: a worked example's bound source is always unset in the
render check, as every shipped example's already was.
Every declaration had to write x-upgrade, and in each of the tree's 76
entries it only repeated whether widgets/<tag>.js existed. Composition now
derives that from the files it composes and writes it into the vocabulary
as $modules, tag to module path: the layer's widgets/<tag>.js, or a
page's own page/widgets/<tag>.js, which wins. Readers ask upgraded() in
Python and upgrades() in the browser.

A declaration and its module can no longer disagree, so the two refusals
for that go (missing-module, and compose_vocabulary's check). What only a
module provides is still refused without one, as needs-module, wherever a
composed vocabulary is validated.

Behavior changed: a registry.json writing x-upgrade is refused as an
unknown key; a tag whose module file exists is upgraded.
A widget entry is a JSON Schema over its attributes. With x-upgrade
derived, x-content was the one Leaf key every entry still had to write,
and 28 of the tree's entries wrote the value HTML gives any element: the
author's markup. Composition now writes that default into each entry
(complete_declarations), so readers still read a complete declaration, and
an entry names x-content only for members, data or empty.

Behavior changed: a declaration without x-content is valid and holds
markup.
…-name, x-language and x-tone

Three keys each mapped a widget's own attribute name onto a meaning Leaf
supplies: the element's title, a code language, a tint. Every declaration
in the tree named the same attribute for each (label 16 times, language
twice, tone once), so the names are now fixed, as HTML's global attributes
are, and documented in the registry's $attributes: a widget that takes
label is named by it, and one that takes language or tone is held to the
layer's list by declaring the attribute.

Behavior changed: lf-trace, which takes label without having declared
x-name, is now named by it. A package can no longer use label, language or
tone for another meaning.
…d-surface

The key was a constant true that said the module defines threadOutlets,
which the element itself says. Leaf now watches every tag a module
upgrades and registers the elements that have the method, over the same
arrival lifetime as before.

Behavior changed: a widget needs no registry key to seat threads beside
its data. The refusal for a declaration without the method goes with the
declaration; the widget-thread-outlets eval's rubric is reworded to match
and has not been rerun.
Removed from widget-api.js and portable-api.js, none with a consumer in packages, examples or docs: PRESSABLE, TEXT_BOX, actionName, afterScript, alignText, clockValue, dataBody, foldBlock, fragmentUrl, holdAuthoredBody, iconElement, notice, openLayer, openerOf, projectedDatum, quietSince, regionScrollBehavior, relabel, reportsPresented, revisionLabel, saidAt, shortAgo, watchReadingRegionTransitions, whenLeft, CONTRIBUTION_ENTRY_SCHEMA. Their references documentation went with them.

Implementation deleted: relabel (generatedElement plus keepsText covers it) and reportsPresented. Every other implementation stays, used by the runtime. holdAuthoredBody stays too, because authoredBody's readers in version.js and the framing render check, and the registry's x-patch text, still rest on it; with no package calling it, that mechanism is now unreachable.

Render checks and browser tests that read TEXT_BOX, regionScrollBehavior, watchReadingRegionTransitions, alignText, clockValue and the contribution grammar now read them through check-api.js; lf-suggestion imports its helpers from their owners; the work fixture's worker row reads quiet and heard from readWork, so its roster's running states now include waiting.

consumeAnnotations, placePageThreads and contributionItemKey stay exported: they are the whole surface of data-annotations=page, and removing them kills that mode.
A composition that reused the validation of unchanged declarations skipped
the needs-module refusal, so removing page/widgets/<tag>.js from under a
stateful declaration served a widget with nothing to draw it. That part of
validation depends on files, not declarations, so every composition now
asks it (validate_modules).

openLayer and openerOf return to the widget API with their reference
paragraph. No package calls them, but the widget-list-keeps-focus eval
scores an author for using them and fails one who keeps the opener in a
variable, which is what the reference said after the cut.
html, render, nothing and ten more of Lit's names were public twice: from
Lit's own module, which a package may import, and re-exported by the
widget API. Ten package and example modules already imported the first and
eighteen the second. The re-exports go, and every module, inline script
and test fixture that used them imports /vendor/lit.js.

Behavior changed: a module importing a Lit name from widget-api.js or
portable-api.js fails to load, which package check --render reports.
x-word took either a fixed word or the value module, which said the
element has an lfWord method. The method says that itself, as
threadOutlets does for a thread surface, so the three declarations that
wrote module drop the key and x-word is only a fixed word.

Behavior changed: an upgraded element with lfWord or lfSays is asked
whether or not its entry declares x-word.

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

Removing x-upgrade also removes the only check that caught a widget whose module isn't where its tag says. A misnamed or missing module on a widget that declares only markup now passes every check, and the page draws its raw markup. Inline below.

Comment thread src/leaf/registry/page.py Resolved
A composition that reuses a validation runs in a harness hook, which loads
no schema validator, and the check it now makes there imported
registry/widgets.py and jsonschema with it. The check reads only the
vocabulary, so it lives beside MODULES in registry/contract.py.
An unpinned prettier had reflowed template expressions in seven modules
while the import lines changed. Their bodies return to main's text.
With x-upgrade gone, a module under a mistyped name, or left under its old
name after its tag was renamed, was loaded by nothing and reported
nowhere: the widget drew as plain markup and every check passed. Composing
a layer now refuses a widgets/lf-*.js that no declared tag is named for
and no module imports, and a page's own declarations refuse a
page/widgets/lf-*.js the same way (unnamed-module).

Behavior changed: removing a widget's declaration means removing its
module file too.
A page now writes HTML's names for three attributes that carry HTML's meaning:

- `<lf-options required>` makes a group take the user's pick (was `choose`).
- `<lf-option selected>` marks an option the version carries as picked (was
  `chosen`).
- `<lf-draft required>` makes a draft ask the user for an edit (was `needed`).

Leaf reads no alias: `page check` refuses the old names as undeclared
attributes. No behavior changes. The verb a pick records is still `choose`, in
events, `x-awaits.value`, `x-awaits.answered.choose` and keys such as
`[ship, ship, choose]`; the attribute that verb writes back,
`x-state.choose.record.attr`, is now `selected`. A served gesture's `chosen`
field and the place preview's `data-lf-chosen` keep their names, since a page
writes neither.

Every consumer moves in this change: the registries, the option and draft
styles and modules, the examples, site pages and notes, the shipped
instructions, and the pages the tests write. Two tests named for `choose` take
the new name. Three comments said a pick mark reads "chosen"; they now say
"selected", the mark's word.

The eval fixtures and rubrics name the new attributes. They were reworded and
not rerun.
The browser read a group's authored pick from every descendant with an id that
carries the record's attribute. With the attribute now `selected`, valid HTML
reaches that scan: a native `<option id="m" selected>` inside an option's card
gave the browser a pick the server, which indexes only Leaf elements, never
read. The browser now counts only Leaf elements, as the server does.
The widget API stopped exporting Lit's names (9aaab75) and `notice`
(d59e50c), and sixteen browser and journey tests still read them off
`window.__lfWidgetApi()`. A pull request's test job runs a browser test only
when its own source changed, so one of them ran there and failed, and the rest
would have failed after landing. They now take Lit's names from /vendor/lit.js
and `notice` from check-api.js, which gains that export. No assertion changes.

Main's new allocation test (#5820) asks with `required`, as pages now do.

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

On lf-options, required doesn't mean what it means in HTML, so the rename sets a trap the old name didn't. Inline below.

"properties": {
"id": { "type": "string" },
"choose": {
"required": {

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.

In HTML, a <select> or a radio group can be picked whether or not it has required. required only adds that an answer must be given. Here it decides whether the group can be picked at all. lf-options.js sets this.#choosable = this.hasAttribute("required") && !exhibited, and without it the module has "nothing to press": each mark is drawn as a span and no keys are bound.

An agent that knows HTML will read required as "an answer is mandatory" and leave it off a question the user may skip. The page then shows option cards the user can't pick, and page check accepts it, because a group without the attribute is valid markup. choose named the thing it switched on. The new name points at a different meaning, which contradicts the description's claim that these are "HTML's names for the same meanings". Nothing in x-instructions says what the attribute does, so the name is all an agent goes on.

The lf-draft rename (needed → required) and chosen → selected match HTML. This one doesn't. Two ways out:

  • Keep choose on lf-options.
  • Make a group pickable by default and mark the exception instead, since the non-pickable form is a group that only shows what a decision looks like.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed: required reads as "an answer is mandatory", and on lf-options it also decides whether the group can be picked, so the name sets this trap.

I counted how often a group is written without it. In examples docs evals skills packages it is 1 of 103, and that one stands inside an lf-sample. On 211 real pages it is 9 of 1,205, and 8 of those are settled. That fits your second way out: a group asks unless it is settled or exhibited, and no question writes the attribute.

I'm building that as a trial on its own branch. Which of the two this pull request takes is the maintainer's decision, and it is now on his review page with these counts. Until he picks, this commit stays as it is.

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

Three conflicts. In addressable-names.js, main's new `titledElement` block goes
in above `declaredName`, which keeps the branch's reading of `label`. The
feature gallery's wide option group and the option group's instructions take
main's additions under the branch's names (`required`, `selected`).

Three of main's new lines still used names the branch removed: a runtime test
declared `x-name`, module-reading.md named it, and a journey's page asked with
`choose`. They now use `label` and `required`.
A pull request's test job runs a later-tier test only when its own source
changed, so these ran only in a dispatched run of every tier:

- The projected-link test adds `keepsText` to its fixture module's import by
  string replacement, which matched nothing once that import was respaced.
- The portable-element test took Lit's `html` from portable-api.js through a
  dynamic import; it now takes it from /vendor/lit.js.
- The rendering-jobs test read `afterScript` off the widget API by a computed
  name; check-api.js now exports it and the test reads both entries.

No assertion changes.
Nine conflicts. In `addressable-names.js`, main's new function tail goes above the
branch's reading of `label`. In `options.css`, main's `--lf-` tokens stand under the
branch's `[required]` and `[selected]` selectors. Seven test files conflicted because
main moved the tests the branch had edited to `tests/journeys/` (#6038); the moved
copies take the branch's edits, and `test_a_widget_module_under_another_name_is_refused`
stays in `tests/model/`.

Main's new lines move to the branch's names: `choose` and `chosen` in the test,
eval and stills sources main added or moved become `required` and `selected`.

`afterScript` returns to the portable API, since main's `lf-tabs` now imports it, and
leaves `check-api.js`, which had kept it for tests while nothing else read it.
…moved test

The export-documentation test holds every public export to a module reference, and
the branch had removed afterScript's passage with its export.
…x-patch

x-patch: members said that a module builds beside its widget's direct
authored children, so a revision may edit inside them in place. Only the
browser acts on it, when it patches a revision into an open page, and
every declarer has a module. The module now says it as a static field of
its element's class, `static lfPatch = "members"`, which version.js reads
from the tag's defined class as answer.js reads `answerWords`. lf-tabs,
lf-deck, lf-pane, lf-worktree, lf-worktree-diffs and lf-motion declare it,
and lf-parts inherits it from lf-tabs.

The module of every widget standing in the page has run before a patch
asks: startup awaits each import before it starts the state feed, and an
activation awaits the arriving revision's. With lf-tabs.js held back, a
revision stamped meanwhile waited, then edited the open tab in place.

The schema held x-patch to x-content members or markup, and to a tag with
a module. A class field needs no module check. The content rule follows
the fact to its reader: version.js honors the field only where the content
is the author's, so a widget that draws its own data is still replaced by
a revision of that data. Without the rule such a widget kept a drawing of
the old text beside a <pre> holding the new.

Behavior changed: x-patch is refused like any unknown key, and a data or
empty widget whose class declares lfPatch is replaced whole rather than
refused at composition. The registry test of that refusal becomes a
browser test of the replacement.
x-retired-when, on a member, named the outcome of its owner's decision
that removes it, and x-withdrawn-as, on the owner, the outcome that
declines the proposal without closing its thread. Both qualify the
owner's one deciding verb, so they move into that verb's declaration
under x-state, beside `decides`: `retires` maps an outcome to the member
tags it removes, and `withdraws` names the declining outcome. The server
still reads both from the registry. `$decisions`, which the browser
reads, keeps its shape and is now a copy of the verb's `retires`.

    "decide": {
      "decides": true,
      "retires": { "accept": ["lf-old"], "reject": ["lf-new"] },
      "withdraws": "reject",
      ...
    }

Validation keeps what it held. `withdraws` and each `retires` outcome is
a value of the verb's `outcome` field (withdraws-outcome,
retires-outcome, for withdrawn-as and retired-when). Each retired tag
declares the widget among its x-owners (retires-member), where the
schema required x-owners of a member declaring x-retired-when. The
schema admits both fields only on a verb that `decides`. The rule that
every owner of a retiring member decides that outcome goes with the
member's claim: each owner's verb now names what it retires, so no
member can retire under one owner and be undecidable under another.

Behavior changed: x-retired-when and x-withdrawn-as are refused like any
unknown key. A layer that adds a retiring member to a widget another
layer declares restates that widget's entry, where it used to declare the
key on its own member. The test of a parent and its members reporting a
verb without outcomes in one run goes, since one declaration now holds
both. retirement_holders no longer carries `withdrawn_as`, which nothing
read.
x-measured tied a value in authored content to the data run that produced
it by naming an x-data input and the attribute holding that run's
receipt, so the input was named twice. The input now carries the fact
itself: `measured` names the receipt attribute, beside `source`.

    "x-data": {
      "measurement": {
        "contract": "measured-scalar",
        "source": "source",
        "measured": "run"
      }
    }

Validation keeps what it held of the join: the input's source attribute
is required (measured-source), the receipt attribute is required and a
nonempty string (measured-run), and no value record writes it
(run-written). That x-measured names one of the widget's inputs
(measured-input), and that it needs x-data, are now true of every
declaration, so both checks go. A child a `creates` verb adds still
can't be measured, since it can't declare x-data.

Behavior changed: x-measured is refused like any unknown key, and each
input of a widget may be measured, where a widget had one x-measured.

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

Moving x-retired-when onto the owner's verb makes the owner–member relation something both sides declare, and a package can no longer add a retiring member without copying the owner's entry. Details inline.

Comment thread browser/registry.json Resolved
One conflict, in the generated contract types: main changed the served state's line
and the branch the verb's and the declaration's, so each line takes the side that
changed it.
82df91c moved x-retired-when off the member and onto its owner's
deciding verb, as `retires`. A review found what that cost. A layer adds
a member to a widget another layer declares, and an entry replaces the
earlier one whole. So two layers that each restated lf-suggestion to add
a retiring member were both admitted, and the later entry dropped the
earlier layer's member, which then never retired; reversing the order
dropped the other. With x-retired-when on each layer's own member, both
retire in either order. The pair was also stated twice, in the member's
x-owners and the owner's `retires`, with a check (retires-member) to
hold them together, and the move added lines without removing a
mechanism.

This restores x-retired-when as it stood before that commit: its $keys
entry, its schema and x-owners requirement, the retired-when check that
every owner decides the outcome, `$decisions`' derivation from the
members, and the readers in construction.py, passages.py and
projection.py. `retires`, retires-outcome and retires-member go.

`withdraws` stays on the verb with withdraws-outcome, since the outcome
that declines the proposal is the owner's own fact, so x-withdrawn-as
stays gone.

Behavior changed: a member again declares the outcome that retires it,
and a `retires` on a verb is refused like any unknown field. A new test
composes two layers that each add a retiring member, in both orders.
…erence room

The "Revisions" section of module-authoring.md said what Leaf compares
when a class declares lfPatch, but not what follows for an author: a
module that draws from which children it has, or from their attributes,
declares `x-content: members` or `x-views`, or it keeps its first
drawing of a child a revision changed. The First-paint bullet folded
into the section said so, and the section says it again.

The file stood 5 characters under the 30,000 a skill file may hold, so
its next edit would have failed. It now has 383 to spare. What went
repeated its neighbour, another reference or the registry:

- that kernel implementation lives outside the helper surface, beside
  "don't import the runtime's other modules";
- starting later drawing in `updated()`, which module-state.md, "The
  widget controller", owns and "Drawing what a widget reads" now points
  to;
- `PendingTaskEvent` for either host, which "A widget that also runs
  off Leaf" gives;
- how delivery shows a view member before modules load, and what a
  shadow root attached without x-shadow loses, both in the registry's
  entries for those keys;
- how a fold opens, which module-scroll-and-motion.md, "Travel and
  history", owns.
max-sixty added a commit that referenced this pull request Nov 16, 2026
…ad outlet, and what whenLeft hears (#6103)

Corrects three places where the package references misdescribe the code.
A trial that built a margin widget against the public package interface
alone ran into each of them.

- `packages.md`, "A widget", now says a registry key declares a widget
only when it is `lf-` followed by hyphen-separated lowercase words, and
that any other key is read as an idiom's selector. A widget declared as
`x-margin` is refused today with "idiom 'x-margin' registry: Additional
properties are not allowed", which doesn't name the rule.
- `module-input.md`, "How scopes compose": a key pressed inside an
outlet Leaf fills with a Thread stops at the outlet, so the widget
holding the outlet never receives it.
- `module-input.md`, `whenLeft`: it hears focus leave the focused
element or a shadow host, and not a control among the element's
children.

#5968 edits the same two files. It deletes the `whenLeft` sentence,
since that export leaves the public interface there, and rewords the
paragraph below the new one in `packages.md`, so whichever of the two
lands second takes a small conflict.

Max asked for this on the Leaf page about the margin. No code changes.
Each statement was checked by a run: `leaf-dev probe` in Chromium for
the key scopes and `whenLeft`, and `leaf page check` for the refusal;
the commit message has the readings.

> _This was written by Claude Code on behalf of max-sixty_
holdAuthoredBody let a module move its widget's authored children into a
wrapper of its own and have a revision patch them there. d59e50c took
it out of the widget API, and since then only a runtime test called it,
so no module could register an authored body and every reader of one saw
none.

What only it reached goes with it: `authoredBody` and its store, the
patch's `body` rule and `holder` in dom-children.js, the authored-body
term in version.js's `reachesMembers`, the check API's re-export, the
allowance the apparatus-among-authored render check made for boxes a
module built around an authored body, and the two runtime tests of the
helper and of the patch writing inside such a body.

Behavior changed: none a page or package could reach. A widget whose
module moves its authored children out of their place is still replaced
whole when a revision changes it, as before.
Two conflicts. In , main's settled tokens stand under the branch's
 and  selectors. In , the sentence main reworded
about  stays deleted, since the branch removed that export.
Leaf compares only each direct child's tag and attributes when it patches a
revision into an open widget, so a module drawing from a child's contents, or
one that can declare neither `members` nor `x-views`, has to read its children
again itself, as `lf-pane` does. The Revisions section had stopped saying so.
max-sixty added a commit that referenced this pull request Nov 16, 2026
…x-thread-seat` (#6105)

A widget had two routes for showing Leaf's comment box and its threads
inside itself: a `threadOutlets` method (with `x-thread-surface`), which
`lf-diff` and `lf-visual-review` use, and the `x-thread-seat` registry
key with the `threadBox` export, which only the Command Hub example and
a test fixture used. This folds the second into the first and deletes
it. `threadOutlets` is now also offered the widget's own target,
`outlet.lfHold` gives the box in that outlet its second send, and
`threadSurface(owner).open(owner)` opens it. One registry key and one
export go, and 137 lines outside tests.

What a Command Hub user sees: a `talk` task ends in a Comment control
where a field stood at rest, opened by a press or `c` on the task. After
Send & pause the box gives way to its thread and focus is on it, and a
thread on a task has no margin entry, since the task draws it.

To weigh:

- Admission of `holds` no longer reads a declaration. It requires that
`holds` names the widget the comment is anchored to, with no passage,
datum or part, so a comment may hold a widget whose module offers no
hold. Only Leaf's box where a module set `lfHold`, a page's own script
or a raw POST can send one, and every reader takes the field alone.
- No protocol bump. The comment event keeps its shape. Words left unsent
in a seat's box (browser storage, `say:<widget id>`) are no longer
offered in the row; `g i` moves them into the page's comment field.
- Three changes for a user that are left as built: Alt-click on a tall
goal's title scrolls to the goal's foot, where `main` floats a box
beside the title; a half-typed reply in a task's thread has no margin
entry, though Threads and On Me list it; and Tab keeps its native order
in a box that offers a second send (`keyboard/AGENTS.md` now says so).
- Every `lf-atlas-task` registers as a thread surface, 25 on the hub
page where none did. Measured there with five threads open: the thread
pass takes 0.04 to 0.08 ms longer and a place lookup about 0.5 µs
longer.
- `module-annotations.md` changes how a package author seats a thread
about the widget itself. It has not been scored with the authoring
evals.

Max asked for this after comparing both rows on the page for
#5968 (its Decision 4), where it was first built; this is
that change moved onto `main`. An independent reviewer used the rows
cold in Firefox beside `main`, wrote a self-seating widget from the
reference, and read the code. The second commit is its findings: a
thread surface with no `id` showed a dead Comment control that no check
reported, and now reports the missing id; the hold's notice used Command
Hub's words on the public route; and a second comment box sat flush
under a thread's reply box.

Tests: `pnpm run check`; the model and process tests for the changed
modules; and 534 browser and journey cases by node id (every test the
fold edits, every test naming the fixture task widgets, a seat, Send &
pause or Command Hub, the diff and visual-review comment-box tests, and
the hold-still matrix in both engines), of which the 4 that fail also
fail on `main`. `lf-diff`'s comment box is pixel-identical to `main`'s
in seven states.

> _This was written by Claude Code on behalf of max-sixty_
Main gained #6105, which folds the `x-thread-seat` route into `threadOutlets` and
deletes it. This branch had already dropped the `x-thread-surface` key, so the fold
lands here as it did on main with one difference: a widget declares nothing. An
upgraded element with a `threadOutlets` method is a thread surface, and
`lf-atlas-task`, `lf-test-task` and `lf-verdict` say nothing of it in their entries.

## Conflicts

- `browser/registry.json`: this branch's `$keys` and `$awaits`, less the `x-thread-seat`
  member and the seat's mention in `answered` ("A thread about the widget is not an
  answer."). Main's `x-thread-surface` description is not taken, since the key is gone
  here. `$keys` holds 32 `x-` keys.
- `browser/runtime/thread/surfaces.js`: registration stays by method, over every tag a
  module upgrades. Main's two additions go around it: an export registers nothing,
  and an instance with `threadOutlets` and no `id` is reported as its widget's failure
  and not registered.
- `browser/styles/components/surfaces.css`: main's side, the `.lf-thread-seat` and
  `.lf-say` rules deleted.
- `browser/types/contract.d.ts`: regenerated by `pnpm run build:browser`.
- `examples/command-hub.page/registry.json`, `tests/fixtures/packages/work/registry.json`:
  the `x-thread-seat` declaration deleted and nothing put in its place; `x-content` and
  `x-upgrade` stay out, as this branch has them.
- `examples/command-hub.page/widgets/lf-atlas-task.js`,
  `tests/fixtures/packages/work/widgets/lf-test-task.js`: main's modules, with `nothing`
  imported from `/vendor/lit.js`.
- `skills/leaf/references/module-annotations.md`: main's text, opening on "A widget whose
  element has a `threadOutlets` method" and keeping "The method is the declaration, and
  the registry says nothing."
- `src/leaf/registry/state.py`: neither thread key among a created child's owner keys.
- `src/leaf/registry/widgets.py`: this branch's `require_module` call; `x-thread-seat`
  leaves its list in `registry/contract.py`.
- `src/leaf/render-checks/widgets.js`: `matchesWhen` leaves the import, and `TEXT_BOX`
  stays in the `check-api.js` import where this branch reads it.
- `tests/model/interact_contract/test_registry_door.py`: `required` kept where main
  writes `choose`; the seat's malformed-extension row deleted; the seat's module row
  becomes `("lf-note", "x-shadow", True)`.

## Main's other lines, in this branch's terms

- `tests/browser/startup/test_thread_surfaces.py`: the new no-id test's entry declares
  no `x-content`, `x-upgrade` or `x-thread-surface`, and its module imports `nothing` from
  `/vendor/lit.js`.
- `tests/render_cases_interaction.py`: `lf-verdict` declares no `x-thread-surface`.
- `tests/browser/controls/test_command_routes.py`: takes `lf-verdict`'s entry as it
  stands, since there is no thread key to filter out for a module that seats nothing.
- `skills/leaf/references/package-data.md`: a created child is refused for declaring
  state, obligations, work, history, data or visual parts; a thread surface is no
  longer something an entry declares.
@leaf-agent

Copy link
Copy Markdown
Collaborator

A note on reports.js from tonight's nightly survey, since this PR rewrites the comment over that code. With reportsPresented gone, reportWidgets has one caller, reportsReady, and for a widget with an id its walk can only collect target.id. reportTarget(el) is {kind: "widget", id: el.id}, so the loop adds entry.e.widget only when it equals target.id, and the .filter((widget) => widget !== target.id) then removes it. No widget:<other>:render region is ever awaited.

What remains is a walk of currentProjection().classified on every render of a reporting widget. That costs O(events), so the render grows with how long the session has run, which "Responsiveness" rules out. The new comment's "any other widget the reports name" also describes something that never happens.

The walk changes the result only for a LeafElement without an id. There reportTarget returns null, so it waits on every reporting widget's render, which matches reportSequence reading every report for that element. If that case isn't meant to be supported, reportsReady can await just projection:chrome and widget:${target.id}:preparation, and reportWidgets can be deleted.

One conflict, in : main reworded how a question answered in words leaves
On Me, and the branch names a draft's attribute  in the same paragraph. Main's
wording stands, with .
max-sixty added a commit that referenced this pull request Nov 16, 2026
…dy state, and 35 widget API exports (#6134)

A widget's registry entry had to restate facts found elsewhere, and the
browser API exported names nothing called, or exported them twice. This
removes nine registry keys (41 to 32, with none a declaration must
write) and 35 exports (271 to 236). It is the settled part of
#5968. The attributes a page asks with keep the names they
have on `main` (`choose`, `needed`, `chosen`): that rename is still
Max's to decide there.

**Registry keys removed**

- `x-upgrade`: a module file at `widgets/<tag>.js` makes a widget
upgraded, and composition writes `$modules`.
- `x-name`, `x-language`, `x-tone`: `label`, `language` and `tone` mean
one thing on every widget that takes them (`$attributes`).
- `x-thread-surface`: an element with a `threadOutlets` method is a
thread surface.
- `x-patch`: the module's class declares `static lfPatch = "members"`.
- `x-withdrawn-as`: the deciding verb declares `withdraws`.
- `x-measured`: an `x-data` input declares `measured`.
- `x-example-data`: no declaration used it.

`x-content` now defaults to `markup`, and `x-word` holds only a fixed
word, since an element with an `lfWord` method is asked directly.

**The widget API**

Lit's thirteen names come from `/vendor/lit.js` alone, and 22 names with
no consumer in a package, an example or the site are gone.
`holdAuthoredBody`, which then had no caller, is deleted with the
patching only it reached.

**To weigh**

- Three attribute names are reserved. `lf-trace`, which takes `label`
and never declared `x-name`, is now named by it.
- A registry writing a removed key is refused as unknown, and a module
importing a Lit name from `widget-api.js` fails to load, which `package
check --render` reports.
- A module's name is what ties it to its tag, so composition refuses a
`widgets/lf-*.js` no tag is named for and no module imports, and
removing a widget's declaration means removing its module file.
- A module can no longer wrap its authored children in its own light-DOM
box and still be edited in place by a revision; a shadow root with slots
is the route for a wrapper.
- The `widget-thread-outlets` eval's rubric was reworded and not rerun.

Where to look: `src/leaf/registry/contract.py` (`MODULES`, `upgraded`,
`module_paths`, `validate_modules`), `registry/layer.py` and
`registry/page.py` where composition writes them,
`browser/runtime/thread/surfaces.js`, and `reachesMembers` in
`browser/runtime/version.js`.

Max asked for the cut, and on 15 November for the settled part to land
apart from the rest. The branch it comes from was read by an independent
Codex review, by the review bot on #5968, whose findings are fixed, and
by a fresh reviewer of the key moves, who ran the composition case that
sent `x-retired-when` back to its member. This split takes that branch
and restores main's lines wherever the two differ only by the rename. I
checked both directions: against `main` no rename-only difference
remains, and what separates this from the branch is the rename and the
one browser fix only `selected` needs.

Tests: `pnpm run check`; the model and process tests for registry,
schema, validation, authored markup, obligations, document and layer
(2,652 pass); about 180 browser and journey cases by node id around
picking options, drafts, thread surfaces, revisions inside tabs and
panes, suggestions and the measured number; the render check on the
`default` and `playground` packages and three example pages. The two
that failed locally, one in `test_render_options.py` and a teardown
error in `test_render_initial_delivery.py`, fail on `main` too.

> _This was written by Claude Code on behalf of max-sixty_
Main now holds this branch's settled cuts, squashed as #6134. Two conflicts, where both
sides made the same cut and the branch also carries the rename: the branch's lines stand.
What separates the branch from main is now the rename alone.
@max-sixty max-sixty changed the title Shrink the package interface: six registry keys and 36 exports that restated what files, names and methods already say Write required and selected where a page asks, as HTML does Nov 16, 2026
@max-sixty

Copy link
Copy Markdown
Owner Author

Superseded by #6234, which carries these names together with the registry's grouped declaration shape.

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

@max-sixty max-sixty closed this Nov 17, 2026
leaf-agent pushed a commit that referenced this pull request Nov 17, 2026
…up ask with no attribute (#6234)

A registry entry now holds its attributes' JSON Schema under
`attributes`, which every declaration must have, and groups its other
facts by what they cover: `state`, `markup`, `words`, `paint`, `data`
and `author`. Each fact is declared because some part of Leaf needs it
without running the widget's module. The `x-` prefix is gone, a fact's
name is its path (`state.verbs`), and `$keys` documents each fact and
each group by that path. The page also takes HTML's attribute names, as
#5968 had them: `needed` on `lf-draft` becomes `required` and `chosen`
on `lf-option` becomes `selected`. And an option group now asks with no
attribute at all: an `lf-options` stands on On Me unless it is `settled`
or quoted in a sample, which Max chose over #5968's `required`. Max
chose to do all of it as one sweep, so the interface changes once. This
supersedes #5968.

## One entry, before and after

`lf-options` on `main`:

```json
"lf-options": {
  "description": "Alternatives the user can choose individually or as a set to answer a question.",
  "x-instructions": "…",
  "type": "object",
  "properties": { "id": …, "choose": { "type": "boolean" }, "multiple": …, "closed": …, "across": …, "settled": …, "restated": … },
  "dependentRequired": { "settled": ["id"], "multiple": ["choose"] },
  "additionalProperties": false,
  "x-content": "members",
  "x-awaits": { "value": "choose", "when": { "choose": [true], "settled": [false] }, "retired": "settled", "key": "value", "answered": { … } },
  "x-state": { "choose": { "unit": "widget", "record": { "kind": "attribute", "attr": "chosen" } }, "add": { … }, "answer": { … } },
  "x-example": "…"
}
```

On this branch:

```json
"lf-options": {
  "description": "Alternatives the user can choose individually or as a set to answer a question.",
  "attributes": {
    "type": "object",
    "properties": { "id": …, "multiple": …, "closed": …, "across": …, "settled": …, "restated": … },
    "required": ["id"],
    "additionalProperties": false
  },
  "content": "members",
  "state": {
    "awaits": { "value": "choose", "when": { "settled": [false] }, "retired": "settled", "key": "value", "answered": { … } },
    "verbs": { "choose": { "unit": "widget", "record": { "kind": "attribute", "attr": "selected" } }, "add": { … }, "answer": { … } }
  },
  "author": { "instructions": "…", "example": "…" }
}
```

The verb is still `choose`.

## The groups as built

| Key | What it covers | Declared because, without running the module |
| --- | --- | --- |
| `description` | what the element is for | every reader shows it |
| `attributes` | the attributes' JSON Schema | `page check` and message
markup hold each occurrence to it |
| `content` | `markup`, `members`, `data` or `empty` | the server, `page
check`, the passage reader and first paint all read it |
| `state` | `verbs`, `awaits`, `retired-when`, `encloses`, `exhibit`,
`shows`, `work`, `history`: the widget's verbs, what it asks the user
and how their answers retire | the server admits actions and keeps the
On lists and can't run the module; the browser reads them too |
| `markup` | `owners`, `unique`, `refers`, `reading-role`: where the
element stands and what it names | `page check` and message markup
refuse markup; the server and browser read them too |
| `words` | `says`, `verbatim`, `shadow`, `inline`, `visual`,
`text-format`, `word`: how its words read | the server's passage reader,
the render check, and the browser reading an element no module drew |
| `paint` | `views`, `space`, `height`, `bound`, `spine`, `flow`,
`prepaint`: how its box is laid out before the module draws | the first
paint comes before any module runs; delivery paints most as marks |
| `data` | `inputs`, `outputs`: the typed values it reads and publishes
| the server checks bindings and the browser delivers values |
| `author` | `example`, `instructions` | the agent reads them after
choosing the element |

The group first built as `server`, after one of its readers, is named by
what it covers, and its fact `state` became `verbs`, so no path reads
`state.state`; it sits beside the layer's `$state`, which documents each
verb's fields. `paint.flow` takes `main`'s new conditional form (#6237):
`lf-tabs` declares `{"when": {"flow": ["page"]}}`.

`$keys` is keyed by path (`"state.verbs"`), with an entry of its own for
each group, so its lint is the same set comparison `main` has. `$marks`
names each mark by its fact's path (`paint.space`). Python reads a fact
with `registry.contract.declared_fact(entry, "state.verbs")`, the
browser with `entry.state?.verbs`, and `declarationFor(el)` returns the
whole entry. Two facts read through others are checked explicitly. On
`main` a missing one read "registry extensions are invalid: 'x-owners'
is a dependency of 'x-retired-when'"; it now reads "state.retired-when
needs markup.owners", and a view without its reference "state.shows
needs markup.refers".

## An option group asks with no attribute

The trap #5968's reviewer found is gone: in HTML a group without
`required` can still be picked, while in Leaf it drew cards nobody could
press, and `page check` passed the page. Now `state.awaits.when` for
`lf-options` is `{"settled": [false]}`, `lf-options.js` wires the pick
unless the group is quoted, and `required` on a group is refused as
undeclared. Every group needs an `id`, which the schema now requires in
place of the `dependentRequired` that asked for one on a settled group,
and `multiple` depends on nothing. `required` on `lf-draft` and
`selected` on `lf-option` keep their meaning. This ports
`fable-options-ask-by-default-trial` (da66b7d) onto the grouped
shape; about 580 tags lose the attribute across registries, examples,
docs, notes, evals, instructions, dev tools and tests.

`options.css` drops `[required]` from each selector and gives the
exhibit guard an attribute's specificity, so every rule keeps its
weight. On feature-gallery, alert-review and ship-review, every computed
property of every group and every element inside it (cells, marks,
badges, the add field, their `::before` and `::after`) is the same
before and after: 257, 241 and 43 elements, read with `leaf-dev probe
--authored --base`. The `lf-options` instructions and
`authoring-on-me.md` now say a group asks with no attribute and that
`settled` records the decision and stops it asking.

## Single-declarer keys

| Key | Declared by | Verdict |
| --- | --- | --- |
| `state.encloses` | `lf-ask` | kept: a form or survey widget from
another package can frame questions, and without it core would name
`lf-ask` |
| `state.exhibit` | `lf-sample`, and the feature gallery's page widget |
kept: already has a second declarer |
| `state.shows` | `lf-card` | kept: a timeline or roadmap card could
show an answer the same way |
| `state.work` | `lf-card` | kept: any task-list widget could take the
agent's to-dos |
| `state.history` | `lf-activity` | kept: the server needs it to serve
the history reading only to pages that show it |
| `markup.reading-role` | `lf-pane` | kept: its own contract says
packages contribute panes under their own tags |
| `words.text-format` | `lf-draft` | kept: any widget whose body is
Markdown words needs the server to read it rendered |
| `paint.prepaint` | `lf-text-document` | kept, moved to `paint`: a file
viewer from another package could draw Markdown at first paint |
| `paint.spine` | `lf-toc` | kept: removing it takes away the automatic
narrow sidebar |
| `data.outputs` | `lf-diff`, and three example pages' widgets | kept:
#5981, which replaces it with a property and a `change` event, hasn't
landed |

`paint.flow`, single-declarer when this started, now has `lf-ask`,
`lf-tab` and conditional `lf-tabs`.

## Calls to reverse

- No single-declarer key is removed (table above).
- `elementsDeclaring` is gone from the public API: nothing called it,
and it was `declaredElements` without its root.
- Finding codes: `invalid-declaration` replaces `invalid-extensions` and
`no-description`, which the declaration schema now covers, and
`attributes-schema` replaces `declaration-schema`.
- `attributes` is required, so a declaration without it fails `page
check`.
- Prose that called a verb "a server.state verb" now says "a verb
(state.verbs)", and finding texts name "verb `move` (state.verbs)".
- No page protocol bump: the layer's entries come from the Leaf that
serves the page, and a page's own `page/registry.json` in the old shape
fails `page check` with `invalid-declaration`, which the agent fixes
like any check failure.

## Checks

- `pnpm run check`: pass (998 runtime tests, worker 91, types, build
check).
- `uv run pytest tests/model`: 3,601 passed after each commit and merge.
- Browser, by file or node id: after ask-by-default, the option,
obligation and On panel tests (159 passed); after `main`'s #6237 merged
in, both tab-set files and the three probe tests #6242 touched (48
passed); after the rename, the option, obligation, On panel, board,
playground and command-route files and every browser test whose fixture
the rename changed (247 passed), and the journey tests it changed, by
node id (16 passed). Earlier in the sweep, about 1,300 more across the
files the shape change touched.
- `page check` on all 47 authored sources, built as pages, and `leaf
package check --render` on the 13 bundled packages with a registry: all
pass. No `server.` fact path is left in the tree.
- Evals for ask-by-default, Claude Code, the branch beside the commit
before it, two runs per arm: `thread-choice-takes-a-press`,
`proposals-get-individual-decisions` and
`decision-record-after-its-work` pass 6 of 6 on each arm, $2.67 for the
authors plus grading. No head output writes `required` on a group;
base's proposals pages wrote it on all six groups. In
`thread-choice-takes-a-press`, base's replies wrote `<lf-options
id="yoy-baseline">` without `required` in both runs, which on base draws
cards nobody can press (the rubric is head's, so it passed them). Only
the proposals runs opened the changed instructions (`leaf page
instructions`, `authoring-on-me.md`, `threads.md`), on both arms; the
decision-record runs settled every answered group, and the thread runs
used no tools.
- Evals for the shape, earlier: `package-text-widget-keeps-the-measure`,
`recorded-effect-payloads` and `widget-checked-before-handoff` pass 12
of 12 across both arms, $3.14.

Not run: the rest of the journeys tier and `tests/browser`, Codex evals,
`leaf-dev bench`, Firefox.
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