Repository navigation
Flatten a declaration's facts, recognise a conditional fact by its shape, and give $marks.paint and $state names of their own - #6257
Merged
Conversation
…e and the verb fields for what they hold Four follow-ups to #6234's grouped registry. A fact declared `{when: {attribute: [values]}}` is now recognised by that shape in one place per runtime: `registry.contract.holds_for` (with `fact_condition` for the condition) and `holdsFor` in `registry.js`. Delivery's `mark_declared`, the browser's `markDeclared` and the predicate validator apply it to every mark in `$marks`, so the lists naming `state.exhibit` and `paint.flow` are gone, and the browser's message paint no longer knows only `state.exhibit`. The declaration schema still says which facts may take the form: `_conditional` wraps `paint.flow` and `state.exhibit`, and only a mark may take it, since its non-mark readers would read the condition as true. `$marks` names each mark's painted DOM attribute `attribute`, not `paint`, since 7 of its 13 marks are facts outside the `paint` group. The layer fact documenting a verb's fields is `$verbs`, as `$awaits` documents `state.awaits`. `$states`, composition's stamp of each verb's writer and definition, keeps its name: it belongs with `state_definition`, `stampedState` and `sameStateDefinition`, the verb's state definition an admitted event records. The key table in `passages.py`'s header and the bullets in `aimableAt`'s comment are lists again. `options.css`'s 21 live-group guards are weightless again, `:not(:where([data-lf-exhibit]) *)` as `board.css` and `draft.css` write it, rather than carrying the weight `[choose]` used to give. The two competitions that weight decided now say so where they happen: a picked card's caption room takes the card rule's weight (`:where([selected])`), so a live card's padding replaces it, and the titled card's `top: 8px` on its key badge, which the live seat's `top` always overrode, is gone. 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 on feature-gallery picked (titled and bare), opened settled, under keyboard focus, touch, dark, with a picked quoted card and on paper, except `top` on the key-badge spans paper hides (`display: none`).
Only a mark has its `{when}` painted where it holds and its condition held
to the declared attributes, since the condition check loops over `$marks`.
A non-mark fact wrapped in `_conditional` would have gone unchecked and
reached its readers as an object that reads as true. `leaf.schema` now
fails at import when a fact in `FACT_GROUPS` takes the form and `$marks`
doesn't name it, so the rule is structural rather than a docstring's.
Wrapping `state.encloses` raises "only a mark ($marks) may take the {when}
form: ['state.encloses']".
…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`.
$marks.paint and $state names of their own$marks.paint and $state names of their own
…ntrols journey The journey's page script asked `declarationFor(…)?.state?.verbs`, which the flat declaration never holds, so the optional chain read every press as sent and the playground's second press failed as sending nothing. It reads `?.verbs` now. A search of tests, dev, hooks, packages and browser for other optional- or get-chained group reads found none.
…s sections in the docs
Fixes from the schema and independent reviews of the flat declaration.
An `invalid-declaration` refusal now says where in the declaration the
value it refused stands, which the schema's own words leave out:
`<lf-activity> is not a valid declaration ($keys) at `bound`: 'top' is not
one of ['start', 'end']`, and `at `verbs.pick.detail`` for a verb detail
missing `additionalProperties`. A misplaced fact at the top, such as one
left in its old group, keeps the schema's words, which name it. Findings
that name a fact by its key mark it as code, since a flat name such as
`says` read as English.
The reference's six section headings move out of the registry into
`dev/leaf_dev/docs.py` (`KEY_SECTIONS`), each placed before the key it
opens on with one line on who needs its keys declared, plus an Element
heading over `attributes` and `content` so no key sits under no heading.
`$keys` carries no layout again: the lint's `sections` skip and the
reserved name go, so `$verbs.sections` and a section naming an unknown key
can no longer pass. Sections are h3 headings with the keys as h4 entries
beneath them, rather than rows beside the keys.
Every flag fact is `const: true`: `exhibit`, `verbatim`, `shadow` and
`inline` were booleans, though no declaration wrote `false` and readers
test truthiness. `exhibit` keeps its `{when}` form.
`{when}` is now described as it behaves. 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 it reads the declaration: for `exhibit`, whether widgets
inside put anything on On Me (`obligations.shown_in`). The interactive
sample needs the two apart (its widgets take input and ask nothing), so
the fact stays one; `$keys.exhibit` says which reader asks which.
`shows` names the attribute that names its widget `reference`, as an
input's `reference` names the element it reads; both are an attribute
`refers` declares.
# Conflicts: # browser/registry.json # browser/runtime/declared-words.js # browser/runtime/obligations/view.js # browser/runtime/thread/messages.js # browser/runtime/widget-elements.js # browser/types/contract.d.ts # packages/deck/registry.json # packages/default/registry.json # packages/default/styles/ask.css # packages/playground/registry.json # skills/leaf/references/module-reading.md # skills/leaf/references/package-data.md # src/leaf/findings.py # src/leaf/obligations.py # src/leaf/registry/widgets.py # src/leaf/schema.py # src/leaf/validation/admission.py # src/leaf/validation/instances.py # tests/browser/test_render_anchors.py # tests/browser/widgets/test_obligations.py # tests/model/test_interact_product.py
# Conflicts: # browser/registry.json # browser/runtime/thread/messages.js # packages/default/registry.json # skills/leaf/references/package-data.md # src/leaf/gesture_words.py # src/leaf/validation/instances.py
max-sixty
marked this pull request as ready for review
November 17, 2026 09:36
leaf-agent
approved these changes
Nov 17, 2026
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A widget's registry entry now holds every fact beside
description,attributesandcontent, 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.verbsisverbs,data.inputsisinputs,author.exampleisexample,words.wordisword.lf-optionsonmainand here:The 29 fact names are all distinct (
enclosesleft withlf-askin #6256), and none isdescription,attributesorcontent. Readers use plain property access (entry.get("verbs"),entry.verbs), sodeclared_fact,declaredFact,FACT_GROUPS, the group-path joins inDECLARATION_KEYSand the_factshelper are gone.$marksis 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-factfinding are gone too. The declaration schema now says it withdependentRequired:retired-whenneedsowners, andshowsneedsownersandrefers. The refusal reads:A declaration refusal names where it points.
invalid-declarationadds the path the schema's words leave out, and findings that name a fact by its key mark it as code: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,shadowandinlinewere booleans no declaration wrotefalseto), andexhibitkeeps its{when}form.showsnames the attribute naming its widgetreference, as an input'sreferencedoes; both are an attributerefersdeclares.What
{when}conditions. A reader asking of one occurrence reads a fact throughholds_for: delivery's paint, and forexhibitthe quoting (input, admission, compound membership). A reader asking whether the tag declares the fact reads the declaration: forexhibit, 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, soexhibitstays one fact and$keys.exhibit,holds_forand the schema now say which reader asks which.$keysis 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 overattributesandcontent) live indev/leaf_dev/docs.py(KEY_SECTIONS), each placed before the key it opens on with one line on who needs its keys declared;docs.pyrefuses a section that opens on a key$keysdoesn't document. Sections are h3 headings over h4 key entries. Each entry's anchor is the fact's name (/extending/#verbs), each section'skeys-<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 ownpage/registry.jsonin the grouped shape failspage checkwithinvalid-declaration.The four earlier fixes
{when: {attribute: [values]}}, inholds_forandholdsFor. Delivery, the browser's message paint and the condition check apply it to every mark, so the three lists namingexhibitandfloware gone. Only a mark may take the form, andleaf.schemafails at import when a fact$marksdoesn't name takes it.$marksmember naming each mark's DOM attribute isattribute(waspaint), and the layer fact documenting a verb's fields is$verbs(was$state), as$awaitsdocumentsawaits.src/leaf/passages.py's header and the bullets inaimableAt's comment are lists again.packages/default/styles/options.cssare weightless,:not(:where([data-lf-exhibit]) *), asboard.cssanddraft.csswrite 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 atop: 8pxthe 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, excepttopon the key-badge spans paper hides.Calls to reverse
$keysfalls in the section before it; an Element heading coversattributesandcontent, which no section held.exhibitkeeps 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 withstate_definition,stampedStateandsameStateDefinition.verbsmap isVERBS_SCHEMA(wasSTATE_SCHEMA).{when}rather than letting any boolean mark take it, sinceverbatimandinlinehave readers outside delivery that would each needholds_forfirst.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") andtest_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?.verbsnow.page checkon all 55 authored sources and product documents, built as pages: pass.leaf package check --renderon the 13 bundled packages with a registry: status 0; the 12keeps-first-boxadvice 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.inlinescope, a message event'sevent.data.height, and the Python callwords.says(event).Evals, Claude Code, head beside
main, two runs each:package-text-widget-keeps-the-measure,recorded-effect-payloadsandwidget-checked-before-handoffpass 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 (verbatimandverbsbesideattributes, no group object) and every base answer the grouped one;widget-checked-before-handoffanswers 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/model3,614 passed,pnpm run checkpassed,page checkon seven sources with their own registries or the reference passed,package check --renderon 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
mainthrough Keep "group" for a question's group, check each group once, and keep a page tab's end room #6284 (Name a question by the group its author declares, and retire lf-ask #6256 retiredlf-askandencloses):pnpm run checkpassed (1,007 runtime tests),tests/model3,615 passed, the obligation, option, sample, pressed-controls and message-mark browser tests and the browser tests Keep "group" for a question's group, check each group once, and keep a page tab's end room #6284 changed passed, andpage checkon seven sources andpackage check --render packages/defaultpassed. Everythingmainadded 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.