Repository navigation
Pass render-probe tests the element declarations the render gate uses - #6242
Merged
Merged
Conversation
… them #6224 declared `button`, `input, select` and `table` in browser/registry.json. The render gate is unaffected: `_render_page` passes its readings `element_declarations(registry)`, which keeps only custom-element names. The tests that call `tinyBoxes` and `undeclaredAttrs` directly passed the whole served registry instead, so `tinyBoxes` took Leaf's own 32px page-menu button for a widget below the 40px floor and `test_the_gate_measures_an_inline_widget_by_its_words` failed on main. A new `page_declarations` helper in the render harness reads the served registry and keeps its element declarations, and those tests use it, so they ask each probe what `page check --render` asks it. No behavior changes. Closes #6240
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.
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.
test_the_gate_measures_an_inline_widget_by_its_wordshas failed on main since #6224 addedbutton,input, selectandtableentries tobrowser/registry.json. The test passed the probe the whole served registry, sotinyBoxestreated every<button>as a widget and held Leaf's own 32px page-menu button to the 40px width floor. The render gate itself never does this:_render_pageinsrc/leaf/render_gate/scheme.pyhands its readingselement_declarations(registry), which keeps only custom-element names (is_element_name). Sopage check --renderraises no falsetiny-boxesfinding, and #6224's registry entries stay as they are.A new
page_declarations(page)helper intests/render_harness.pyreturns the served registry's element declarations. The tests that calltinyBoxesorundeclaredAttrsdirectly now use it, so each test asks the probe what the gate asks. No product code changes.The failing test now passes, and so do the two
undeclaredAttrscallers (test_a_widget_in_a_diff_line_thread_wears_its_package_s_look,test_settled_options_collapse_without_going_out_of_reach). Its two sub-assertions still fire: withx-inlinestripped, and with the gloss flattened.tests/journeys/test_render_projection.pystill passespage_registrytoundeclaredAttrs. I left that journey test alone because it isn't failing and I didn't run that tier here.Closes #6240 — automated triage