Skip to content

Group a declaration's facts by what they cover, and let an option group ask with no attribute - #6234

Merged
leaf-agent merged 47 commits into
mainfrom
grind/registry-shape
Nov 17, 2026
Merged

leaf-agent merged 47 commits into
mainfrom
grind/registry-shape

Conversation

@max-sixty

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

Copy link
Copy Markdown
Owner

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:

"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:

"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 Let sections, articles and disclosures share the column's room, and let a page float its own sidenotes #6237 merged in, both tab-set files and the three probe tests Pass render-probe tests the element declarations the render gate uses #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.

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.
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.
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.
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.
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.
# Conflicts:
#	browser/styles/components/reading.css
# Conflicts:
#	browser/runtime/kernel-registry.json
#	evals/page-follows-the-work/case.yaml
leaf-agent
leaf-agent previously approved these changes Nov 17, 2026
leaf-agent
leaf-agent previously approved these changes Nov 17, 2026
…oxes widget declarations

The journey test's page registry added `required` beside the facts rather than under
`attributes`, and the server test expected the retired `no-description` wording; both
now read the declaration as it stands. `tinyBoxes` in two tests took the whole served
registry, whose `button` idiom (#6224) it read as a declared tag, so it flagged the
panel's buttons; it now takes the widget declarations, as the page check hands it.
That second pair fails on main too.
leaf-agent
leaf-agent previously approved these changes Nov 17, 2026
An `lf-options` group now takes the user's pick and stands on On Me unless it
is `settled` or quoted in an `lf-sample`. It no longer reads `required`, and
`page check` refuses that attribute on a group as undeclared. `selected` on
`lf-option` and `required` on `lf-draft` keep their meaning. This ports
da66b7d from the fable-options-ask-by-default-trial branch onto the grouped
declaration shape.

What changed for a page:

- A group written without the attribute used to draw option cards the user
  couldn't press, and `page check` accepted the page. It now asks.
- Every group needs an `id`. The attribute schema requires it, in place of the
  `dependentRequired` that asked for one on a `settled` group, so a group
  without an id fails `page check`, in a sample too.
- A `settled` group takes a pick once its disclosure is open whether or not it
  once carried `required`.
- `multiple` depends on no other attribute.

How: the registry's `server.awaits.when` for `lf-options` is
`{"settled": [false]}`, which every Python reader already evaluates through
`matches_when`. `lf-options.js` wires the pick unless the group is quoted.
`options.css` drops `[required]` from each selector and gives the exhibit guard
that attribute's specificity (`:not([data-lf-exhibit] *)` in place of
`:not(:where([data-lf-exhibit]) *)`), 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, 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.

Every consumer moves in this change: about 580 tags lose the attribute across
the registries, examples, docs, notes, evals, instructions, dev tools and
tests. `examples/dynamic-widgets.page/catalog.js` wrote it from an attribute
map and no longer does. The reply handling each delivery carries shows
`<lf-options id="…">`, so five recordings of it are reset.

Tests, by the behavior each protects:

- The shared model page (`tests/interact_support.py` `PAGE`) held a group with
  no id and no attribute as plain content. That group is now `settled` with an
  id (`PAGE_GROUP`), so the page still asks nothing, and a test that needs a
  question replaces that tag.
- A widget that never asked is absent from the obligations, one that stops
  asking is withdrawn, and `restated` cuts that history
  (`test_obligations.py`, `test_interact_document.py`, `test_tabs.py`): these
  stopped a group asking by dropping `required` and now settle it.
- A question frame names what its widget lacks to ask, and a refused reply
  names the attribute its widget asks with (`test_interact_product.py`,
  `test_responses.py`): shown on an unmarked `lf-draft`, the shipped widget
  that still asks by attribute.
- A group needs an id (`test_options_require_an_id`, was
  `test_required_options_require_an_id`): reads the schema's finding.
- A boolean subschema for an attribute validates without crashing
  (`journeys/test_interact_contract.py`): declares its own attribute.
- A list that takes no pick is not drawn as a control
  (`test_render_options.py`): asserted on the quoted rows of the exhibit test,
  in place of an unmarked `ordered` group on the obligation page. That group
  and the unmarked `exhibited` group on the obligations page are removed.
- A pick the page only reports is an image with an accessible name
  (`test_a_pick_the_page_only_reports_can_still_be_pointed_at`): the carried
  decision is quoted in a sample.
# Conflicts:
#	browser/layouts.css
#	browser/registry.json
#	browser/types/contract.d.ts
#	packages/default/registry.json
#	packages/reading/registry.json
#	src/leaf/registry/contract.py
#	src/leaf/registry/kernel.py
#	src/leaf/registry/widgets.py
#	src/leaf/revision_delivery.py
#	src/leaf/schema.py
#	src/leaf/validation/instances.py
#	tests/browser/test_render_aim.py
#	tests/browser/test_render_commands.py
#	tests/browser/test_render_options_settled.py
#	tests/browser/widgets/test_diffs.py
#	tests/render_cases_layout.py

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

The description still describes the branch before 1235a53, and merging squashes with it as main's commit message. Three passages now say the opposite of the code:

  • The opening paragraph says choose on lf-options becomes required. On this head an option group takes no attribute to ask, required stays only on lf-draft, and page check refuses required on a group as undeclared.
  • The before/after JSON for lf-options shows required in properties, dependentRequired: { "multiple": ["required"] } and awaits.when: { "required": [true], "settled": [false] }. The head's entry has "required": ["id"] with no dependentRequired, and when: { "settled": [false] }.
  • "#5968's names and its trap" says the trap still stands and the choice is still open. 1235a53 makes that choice: it ports the ask-by-default trial and removes the trap. It also adds behavior the description leaves out: every group now needs an id, and a group without one fails page check.

The code in 1235a53 checks out. The CSS guard keeps each rule's specificity, no reader still checks required on a group, and tests/model -k "options or registry or obligation" passes (275). Once the description matches the head, this can be approved.

The group that held what an action on a widget means and what waits on the user
was named `server`, after one of its readers. It is named by what it covers now:
`state`, holding the widget's verbs, what it asks the user, and how their answers
retire. Its fact `state` becomes `verbs`, so no path reads `state.state`, and the
facts are `state.verbs`, `state.awaits`, `state.retired-when`, `state.encloses`,
`state.exhibit`, `state.shows`, `state.work` and `state.history`, beside the
layer's `$state`, which documents each verb's fields. The group's `$keys` entry
says what it covers, that the server needs these declared because it can't run
the widget's module, and that the browser reads them too.

The rename touches only declaration fact paths and the reads of a declaration's
group: the registries, `$keys`, `$marks`, `FACT_GROUPS` and `DECLARATION_KEYS`,
`FACT_NEEDS` (`state.retired-when needs markup.owners`), `declared_fact` and
`declaredFact` paths, `entry.state?.…` and `entry["state"]["verbs"]` reads, finding
texts, references, the site's pages, tests and fixtures. Prose that called a verb
"a server.state verb" now says "a verb (state.verbs)". The word "server" stays
wherever it names the page server, `server.py` or a server command, and `$state`,
`applicationState` and other `state` names are untouched. No `server.` fact path
is left in the tree.
@max-sixty max-sixty changed the title Group a declaration's facts by the reader that needs them, and ask with required and selected Group a declaration's facts by what they cover, and let an option group ask with no attribute Nov 17, 2026
@leaf-agent
leaf-agent merged commit 43334fc into main Nov 17, 2026
5 checks passed
@leaf-agent
leaf-agent deleted the grind/registry-shape branch November 17, 2026 04:23
max-sixty added a commit that referenced this pull request Nov 17, 2026
Brings in #6234 (grouped declarations; an `lf-options` asks with no attribute;
`selected` and `required`), #6238, #6244, #6232 and #6214.

- Each named group stays, with main's attributes inside it: no `choose`, `selected`
  for `chosen`, `required` for `needed`, swept over the branch's own converted
  examples, fixtures, evals and tests.
- `lf-ask` stays deleted, and with it `state.encloses`, which only `lf-ask`
  declared: dropped from the declaration schema, `$keys` and the generated types.
- Main's `author.instructions` and examples carry the branch's text: the named group
  in place of `lf-ask` for `lf-options`, `lf-option`, `lf-draft`, `lf-tally`,
  `lf-deck` and `lf-playground`.
- The kernel marks take main's `paint.flow`, which the earlier merge had dropped, so a
  tab set written `flow="page"` is painted as one again.
- `PAGE` keeps main's settled `PAGE_GROUP` inside the branch's named groups.
- Main's fixtures whose option groups now ask stand in named groups where they were
  bare on a page.
max-sixty added a commit that referenced this pull request Nov 17, 2026
Two files conflicted, and main's #6234 broke the page-margin scenario
without a textual conflict.

- annotation-layer.js: this branch moved it from annotation-overlay/ to
  browser/runtime/ and rewrote it around watchAnnotationLayer; main's #6245
  changed it in place so that setAnnotationsHidden toggles
  `data-lf-annotations-hidden` on the chrome's root instead of writing
  `data-lf-annotations="hidden"` on html. The moved file takes #6245's
  write (chromeRoot.toggleAttribute) and its header paragraph saying why,
  and the annotation-overlay/ copy stays deleted. The branch's readers of
  the old html attribute move to the chrome root's, as #6245 moved its
  tests: tests/runtime/annotation-layer.test.mjs, and the two `o` checks
  in test_thread_surfaces.py's page-presentation and gallery tests. The
  gallery's lf-x-margin reads the layer through its watcher, not the
  attribute, so it needed no change.
- feature-gallery.html: main's #6237 took `layout-flow` out of the
  author vocabulary, so the #bg-page-margin section drops the class, and
  #bg-native-replies keeps main's plain section.
- #6234 regrouped registry declarations and removed `choose` from
  lf-options. lf-x-margin's gallery entry moves to the new shape
  (`attributes`, `content`, `author.instructions`, `author.example`), and
  the scenario's and its test's option groups drop `choose`.
max-sixty added a commit that referenced this pull request Nov 17, 2026
…d content

A widget's registry entry holds every fact beside `description`,
`attributes` and `content`, with no group objects, as Max chose after
the design review of #6234. Each fact keeps its own shape and loses only
its group: `state.verbs` is `verbs`, `data.inputs` is `inputs`,
`author.example` is `example`, `words.word` is `word`. The 30 names are
distinct, and none is `description`, `attributes` or `content`.

Readers use plain property access, so `declared_fact`, `declaredFact`,
`FACT_GROUPS`, the path joins in `DECLARATION_KEYS` and `_facts` go. The
needs table and its `needs-fact` finding go too: the declaration schema
says it with `dependentRequired` (`retired-when` needs `owners`, `shows`
needs `owners` and `refers`), refused as `invalid-declaration` with
"'owners' is a dependency of 'retired-when'". `$marks` is keyed by fact
name, and the `{when}` form and its import-time rule read flat names.

`$keys` is flat and keyed by fact name, in the site reference's order. A
`sections` member, documentation only, gives each section's title, the
key it opens on and the description its group entry carried; the lint
skips it as it skips `description`, and `docs.py` renders a section entry
before each one's first key. Reference anchors are the facts' names.

Every registry, fixture and JSON example in the tree is flattened, and no
dotted fact path is left: in prose each became the fact's name in code
formatting. `STATE_SCHEMA` is `VERBS_SCHEMA`, after its fact. No page
protocol bump: a page-owned registry in the grouped shape fails `page
check` with `invalid-declaration`.
max-sixty added a commit that referenced this pull request Nov 17, 2026
…ape, and give `$marks.paint` and `$state` names of their own (#6257)

A widget's registry entry now holds every fact beside `description`,
`attributes` and `content`, with no group objects, as Max chose after a
design review of #6234. The PR also carries four smaller fixes from that
review.

## The flat declaration

Each fact keeps its own shape and loses only its group: `state.verbs` is
`verbs`, `data.inputs` is `inputs`, `author.example` is `example`,
`words.word` is `word`. `lf-options` on `main` and here:

```json
"lf-options": { "description": …, "attributes": …, "content": "members",
  "state": { "awaits": …, "verbs": … }, "author": { "instructions": …, "example": … } }

"lf-options": { "description": …, "attributes": …, "content": "members",
  "awaits": …, "verbs": …, "instructions": …, "example": … }
```

The 29 fact names are all distinct (`encloses` left with `lf-ask` in
#6256), and none is `description`, `attributes` or `content`. Readers
use plain property access (`entry.get("verbs")`, `entry.verbs`), so
`declared_fact`, `declaredFact`, `FACT_GROUPS`, the group-path joins in
`DECLARATION_KEYS` and the `_facts` helper are gone. `$marks` is keyed
by fact name. The `{when}` form, and the import-time refusal of it on a
fact that isn't a mark, read flat names.

The needs table and its `needs-fact` finding are gone too. The
declaration schema now says it with `dependentRequired`: `retired-when`
needs `owners`, and `shows` needs `owners` and `refers`. The refusal
reads:

```text
main:  registry.json: <lf-old> state.retired-when needs markup.owners
here:  registry.json: <lf-old> is not a valid declaration ($keys): 'owners' is a dependency of 'retired-when'
```

**A declaration refusal names where it points.** `invalid-declaration`
adds the path the schema's words leave out, and findings that name a
fact by its key mark it as code:

```text
main:  <lf-activity> is not a valid declaration ($keys): 'top' is not one of ['start', 'end']
here:  <lf-activity> is not a valid declaration ($keys) at `bound`: 'top' is not one of ['start', 'end']
main:  <lf-log> is not a valid declaration ($keys): Additional properties are not allowed ('bound' was unexpected)
here:  <lf-log> is not a valid declaration ($keys) at `views`: Additional properties are not allowed ('bound' was unexpected)
```

A fact left in its old group, a misplacement at the top, reads the same
on both: `Additional properties are not allowed ('paint' was
unexpected)`.

**Smaller shape fixes.** Every flag fact is `const: true` (`exhibit`,
`verbatim`, `shadow` and `inline` were booleans no declaration wrote
`false` to), and `exhibit` keeps its `{when}` form. `shows` names the
attribute naming its widget `reference`, as an input's `reference` does;
both are an attribute `refers` declares.

**What `{when}` conditions.** A reader asking of one occurrence reads a
fact through `holds_for`: delivery's paint, and for `exhibit` the
quoting (input, admission, compound membership). A reader asking whether
the tag declares the fact reads the declaration: for `exhibit`, whether
widgets inside put anything on On Me (`obligations.shown_in`). An
interactive sample needs the two apart, since its widgets take input and
ask nothing, so `exhibit` stays one fact and `$keys.exhibit`,
`holds_for` and the schema now say which reader asks which.

**`$keys` is flat and carries no layout.** It is keyed by fact name, and
its members run in the site reference's order. The reference's section
headings (State, Structure, Words, Paint, Data, Authoring, and Element
over `attributes` and `content`) live in `dev/leaf_dev/docs.py`
(`KEY_SECTIONS`), each placed before the key it opens on with one line
on who needs its keys declared; `docs.py` refuses a section that opens
on a key `$keys` doesn't document. Sections are h3 headings over h4 key
entries. Each entry's anchor is the fact's name (`/extending/#verbs`),
each section's `keys-<title>`.

Every registry in the tree is flattened: the bundled packages, the
examples' page-owned registries, the fixtures, and the JSON in the
references, site pages and eval cases. No dotted fact path is left
anywhere. Bare paths in prose became the fact's name in code formatting,
and a parenthetical that only repeated its word ("verbs
(`state.verbs`)") became the name alone. No page protocol bump, as with
#6234: a page's own `page/registry.json` in the grouped shape fails
`page check` with `invalid-declaration`.

## The four earlier fixes

- **A conditional fact is recognised by its shape**, `{when: {attribute:
[values]}}`, in `holds_for` and `holdsFor`. Delivery, the browser's
message paint and the condition check apply it to every mark, so the
three lists naming `exhibit` and `flow` are gone. Only a mark may take
the form, and `leaf.schema` fails at import when a fact `$marks` doesn't
name takes it.
- **Two renames.** The `$marks` member naming each mark's DOM attribute
is `attribute` (was `paint`), and the layer fact documenting a verb's
fields is `$verbs` (was `$state`), as `$awaits` documents `awaits`.
- **Two lists.** The key table in `src/leaf/passages.py`'s header and
the bullets in `aimableAt`'s comment are lists again.
- **The option guard.** The 21 live-group guards in
`packages/default/styles/options.css` are weightless,
`:not(:where([data-lf-exhibit]) *)`, as `board.css` and `draft.css`
write them. The two competitions their weight decided now say so where
they happen: a picked card's caption room takes the card rule's weight
(`:where([selected])`), and a `top: 8px` the live seat always overrode
is deleted. Every computed property of every option group and each
element and pseudo-element in it matches base on feature-gallery,
alert-review and ship-review, at rest and in nine other states, except
`top` on the key-badge spans paper hides.

## Calls to reverse

- The reference's sections are placed by the key each opens on, so a key
added to `$keys` falls in the section before it; an Element heading
covers `attributes` and `content`, which no section held.
- `exhibit` keeps both meanings in one fact; splitting asking from
quoting would add a fact for the interactive sample alone.
- `$states`, composition's stamp of each verb's writer and definition,
keeps its name: it belongs with `state_definition`, `stampedState` and
`sameStateDefinition`.
- The schema of the `verbs` map is `VERBS_SCHEMA` (was `STATE_SCHEMA`).
- The schema names each fact that takes `{when}` rather than letting any
boolean mark take it, since `verbatim` and `inline` have readers outside
delivery that would each need `holds_for` first.

## Checks

- `pnpm run check`: pass (1,006 runtime tests).
- `uv run pytest tests/model -n 4`: 3,612 passed.
- Browser, by file or node id: the three option files, obligations,
tabs, sample delivery, live samples, render gate, revision delivery,
workspaces and bounds, the message-mark, bounded-reply and
inline-suggestion tests, and the 78 browser tests whose body or fixture
the flattening changed: 373 passed, 4 xpassed. Two fail, and fail the
same way on a snapshot of `main`:
`test_the_state_wait_covers_a_status_that_moves_neither_log_nor_data`
(the leaf reads "Claude awaits" where the test expects "Ready") and
`test_a_tab_strip_is_named_as_the_chrome_names_its_set`.
- `tests/journeys/widgets/test_pressed_controls.py`, all 16 packages'
params: pass. Its page script had read `?.state?.verbs`, which the
optional chain hid; it reads `?.verbs` now.
- `page check` on all 55 authored sources and product documents, built
as pages: pass.
- `leaf package check --render` on the 13 bundled packages with a
registry: status 0; the 12 `keeps-first-box` advice findings (diff,
playground, timeline) are the same on base.
- A tree-wide search finds no dotted fact path. Its three matches name
other things: CodeMirror's `markup.inline` scope, a message event's
`event.data.height`, and the Python call `words.says(event)`.
- Evals, Claude Code, head beside `main`, two runs each:
`package-text-widget-keeps-the-measure`, `recorded-effect-payloads` and
`widget-checked-before-handoff` pass 6 of 6 on each arm, $3.06 for the
authors. In the two cases whose answers write declarations, every head
answer writes the flat shape (`verbatim` and `verbs` beside
`attributes`, no group object) and every base answer the grouped one;
`widget-checked-before-handoff` answers write none.
- Independent Codex reviews of each round found no issues; the schema
and independent reviews' findings are folded in.
- After the review fixes: `tests/model` 3,614 passed, `pnpm run check`
passed, `page check` on seven sources with their own registries or the
reference passed, `package check --render` on default, playground, diff
and reading unchanged, and the board, sample and message-mark browser
tests passed.
- The option-guard proof, the `{when}` import check and the earlier
rounds' checks are in the commits.

- After merging `main` through #6284 (#6256 retired `lf-ask` and
`encloses`): `pnpm run check` passed (1,007 runtime tests),
`tests/model` 3,615 passed, the obligation, option, sample,
pressed-controls and message-mark browser tests and the browser tests
#6284 changed passed, and `page check` on seven sources and `package
check --render packages/default` passed. Everything `main` added is
flat, including a new runtime test's fixture, and no dotted fact path is
left.

Not run: the rest of `tests/browser`, the journeys tier, Codex evals,
Firefox.

> _This was written by Claude Code on behalf of max-sixty_
max-sixty added a commit that referenced this pull request Nov 18, 2026
…cell and widget cases' threads

Since #6234 an lf-options asks with no attribute, so the gallery fixture's
choice became an obligation that m walked to before the threads on the
table cell and on the choice itself, and those six case-windows timed out
waiting for a card on every arm. An authored selected answers it, as the
fixture's unasking choice did before.
max-sixty added a commit that referenced this pull request Nov 18, 2026
…s answer as the thread lands (#6010)

Two cases where `m` (Next On Me) from far away left the user unable to
read what it went to.

**A long question opened over its words.** A walk opens its card before
its landing brings the words in from below the window, so the card chose
its side and made its room where all the room was above the words, and
the landing then carried the words up under it. A card is now opening
once more for the first move Leaf starts in its scroller before any
later input (`scrollStarts`, scrolling.js), so `makeRoom` runs again
where that landing leaves the words. It reads the room where the page is
headed (`scrollGoal`) and folds its move into the glide under way
(`glideTo`), so the page lands once. The card keeps the side it chose:
choosing again at the landing put a card under a tall obligation, over
the choices
`test_walking_to_an_obligation_shows_its_discussion_clear_of_its_choices`
keeps clear. A scroll a later input makes, or one Leaf doesn't start,
makes no room, so a growing card still never moves the page.

**A question in an agent's answer stayed off screen.** `m` to options in
a card's answer, on words far below, focused them while the card stood
by its words below the window, and the page stayed at its top: the card
is fixed over the page, and the obligation's arrival scrolled the boxes
around the question, which move nothing. The arrival now lands as an
arrival at the thread does, in one step: into the card, then the
thread's words centred unless shown, with the departure recorded so Back
returns. That landing has one home, `threadLanding` (anchor-travel.js),
which `scrollToThread` builds from too, landing on main's focus element
for a drawing's part; `offFlow` (off-flow.js) tells a card from the
floating panel, whose list keeps its own landing.

The branch also marks one option of `leaf-dev placement cards`' fixture
choice `selected`. Since #6234 an `lf-options` asks without an
attribute, so `m` from the top stopped at that choice, and the `cell`
and `widget` cases timed out on main as well.

### Evidence

- `leaf-dev placement cards --base` against main: 7 of 51 case-windows
differ, all at 1000×700. A long question, in each of the four Layouts,
covers 81 px of its words' block on main and stands clear here; a
question on a choice widget (21 px) and on a table cell (6 px) stand
clear too. `scrolled` (the long question, then a 300 px scroll down)
covers 81 px where main covered 20, under the kept rule that a card
stays where it stood through the reader's scroll.
- The two tests in `tests/browser/margin/test_card_reply.py` pass here
and fail on main's runtime: the card stood over the words, and the
options were focused but 0% in view. Reverting either fix alone fails
only its own test.
- `pnpm run check` passes, and 17 browser tests on obligation arrival,
card placement and thread travel pass.

### Known gaps

- A key pressed between the card's first placement and the landing's
first move cancels the reopen. A Shift pressed right after `m` didn't
reproduce it.
- Words in a pane inside a page that also scrolls: the reopen and
`makeRoom` read only the boundary's scroller, so a landing that moves
only the page makes no room. Inferred from the code, not probed.
- A thread whose target isn't drawn has its card by the margin row and
no place to land, so `m` there neither moves the page nor records a
departure, as `t` doesn't.

> _This was written by Claude Code on behalf of max-sixty_
max-sixty added a commit that referenced this pull request Nov 21, 2026
Main holds everything this branch changed: the registry and API cuts landed as
#6134, the comment-box fold as #6105, and #6234 carried the rename to `required`
and `selected` with the pick scan that counts only Leaf elements, and let an
option group ask with no attribute. The merge therefore takes main's tree whole.
max-sixty added a commit that referenced this pull request Nov 21, 2026
Main dropped the `x-` prefix and flattened a widget declaration (#6234,
#6257), so the branch's keys move with it: an input lives under `inputs`,
an output under `outputs`, a relation under `refers`.

Two of the branch's additions go in the port, to keep the declared
interface as small as #6134 left it:

- `x-commands` and its check are gone. A widget names the custom
  commands it handles in its `instructions`; `page check` no longer
  refuses a `commandfor` with no target or an undeclared `--` command.
  The wt-merge film still takes `--seek` from its steps' buttons.
- The `body` flag on an input is gone. A `content: data` widget's `<pre>`
  stands in for its input that names a `source`, since that is the input
  an authored value could replace; an input bound only by reference, as
  lf-code's `playhead` is, leaves the `<pre>` alone. Python's registry and
  markup checks and the browser's first read follow the same rule.

Main's new output readers, lf-text-document and lf-file-tree, drop their
`output` name and bind their producer's one output of the contract, as
the branch does for every reader. lf-code keeps main's wrapping and notes
toolbar, and the playhead mark takes the theme's prefixed accent tokens.
`notes/named-widget-interfaces.md` stays as main has it, since #4065 was
closed as postponed with that note as its plan.
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