Skip to content

Fix six faults in Leaf that package-author trials hit - #6781

Merged
max-sixty merged 6 commits into
mainfrom
agent-a58dcc2cadeca90ab
Nov 23, 2026
Merged

max-sixty merged 6 commits into
mainfrom
agent-a58dcc2cadeca90ab

Conversation

@max-sixty

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

Copy link
Copy Markdown
Owner

Six agents each wrote a package from the shipped references, and six faults they hit were Leaf's own, not the references'. Each is small and has its own commit.

  • page check --render reported a DevTools issue about an unnamed <textarea> on every page. The fields are Leaf's: the panel's first-paint field, and the textarea inside every leaf-text, which is also what a package gets from offer(TEXT_FIELD, …), so an author could clear neither. Both now carry a name. I named the fields rather than filtering the finding, since a filter would also hide a real issue Chrome raises in Leaf's fields later.
  • leaf package init wrote an empty overrides.css and four empty directories, and no defaults.css, where the references send a theme's and a widget's rules. It now writes registry.json and defaults.css, and --widget adds the module. The starter's declaration is unchanged.
  • "Unknown Leaf action" and "Unknown Leaf icon" now list the valid names; an author who asked for drag had to guess move.
  • themes.toml may name reading as its default without listing it, since every page can select reading unlisted.
  • package check refuses a position record whose within names the widget's own tag. It passed before, and the first drop threw in the browser, because a container is an element inside the widget. One journey case declared exactly that and is removed; it never worked in a browser.
  • The ungrouped-question advice said On Me selects the widget "without its premise", which is false of a widget that holds its own premise. It now says a premise standing outside the widget belongs in a group with it.

Max hasn't read this. A subagent wrote it and ran each fix: the render check in Chrome before and after on a plain page and on one with an author's own unnamed fields, which are still reported; package check --render on a widget asking for an unknown action; theme list and page init on a catalogue with default = "reading"; package check on every bundled package. I read the diff. Tests: the installed-Chrome render journey, which fails on main; new model tests for the theme default and the container refusal; the runtime test of an unknown action; tests/model/test_interact_layer.py and tests/model/interact_contract; pnpm run check.

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

Every `page check --render` in installed Chrome carried a `devtools-issue`
advice finding, FormEmptyIdAndNameAttributesForInputError at `<textarea>`,
on pages that author no field. Two textareas of Leaf's raised it, and the
finding's place collapsed them into one:

- the served panel row's `lf-fp-served-field`, which a page shows at first
  paint and the panel replaces;
- the empty line's place (`#rest`) inside every `leaf-text`'s closed shadow
  root: the page's comment box, each reply and edit box, and each text field
  a package widget builds with `offer(TEXT_FIELD, …)`. The host's `name`
  never reached it, so neither a name nor a label on the host cleared it.

The served row's field now carries the page editor's name, `comment`, and
`#rest` a fixed name of its own, `words`. Naming the markup fixes the cause
the issue states. A filter in `issueNode` that skipped issues inside Leaf's
own controls would also have hidden a real one Chrome raises there later.

Leaf's generated fields were named in #434, and the render gate's
`unnamedFormFields` probe guarded that until #1239 cut it as a duplicate of
Chrome's own issue. The suite draws with the headless shell, which never
raises autofill issues, so both fields since added without a name passed
it. The installed-Chrome arm of
`test_check_render_refuses_what_only_a_browser_can_see` now asserts that a
clean page reports no DevTools issue; it fails on main with this finding.

Observed with `bin/leaf page check --render` in Chrome on a page holding a
heading and a paragraph: before, one `devtools-issue` at `<textarea>`;
after, none. On a page also holding an unnamed `<textarea>` and
`<input type=text>` of the author's and a package widget's offered text
field, before: four findings; after: the author's two only.
`leaf package init PKG` wrote `registry.json`, an empty `overrides.css`
and empty `instructions/`, `runtime/`, `vendor/` and `widgets/`
directories, and no `defaults.css`, the sheet a theme's element rules and
a CSS-only widget's rules belong in (package-themes.md, packages.md). An
author writing a theme deleted the empty files and created the sheet.
`overrides.css` was the old `theme.css`, renamed with the sheets in #4653
rather than chosen; the directories came with the layout in #274. Every
part of the layout is optional, so nothing reads an absent directory.

Now plain `package init` writes `registry.json` and `defaults.css`, the
two files docs/extending.html's CSS-only widget uses, and `--widget TAG`
writes its declaration in `registry.json`, `defaults.css` and
`widgets/TAG.js`. An author adds any other part of the layout when it has
something to hold. Both starters still pass `package check` and
`package check --render`.

Behaviour the tests protect that changed: a fresh package holds exactly
`defaults.css` and `registry.json`
(`test_package_is_the_unit_that_init_creates_checks_and_vendors`), and
re-running init keeps an existing `defaults.css`. Tests that wrote into a
directory init used to make now make it, and `add_test_widget` makes
`widgets/` for an upgraded widget, as `package init --widget` does.

The starter's declaration is unchanged: it still declares `verbatim` and
describes a prose block, which #274 made it on purpose ("One useful
upgraded prose block, ready for a package author to specialize").
leaf-agent
leaf-agent previously approved these changes Nov 22, 2026
"Unknown Leaf action: drag" named no valid choice, so an author whose
module asked for `drag` had to guess `move`. The refusal now lists every
name, sorted, and the icon refusal does the same. A list of about fifty
short names reads in one look, where a pointer to `ACTIONS` in
`runtime/icon-paths.js` sends the author to a file they may not have.

The author reads it where the module failed: `package check --render` on
a widget offering `{action: "drag"}` now reports

  unreadable-examples | widget examples could not be drawn: TypeError:
  Unknown Leaf action: drag. Leaf's actions are accept, add, arrange,
  back, … move, next, … zoom-in, zoom-out

The runtime test of a press naming no action now asserts the list.
A catalogue with `default = "reading"` was refused ("default 'reading'
must be in themes") unless it also listed `reading`, though every page
may take `reading` unlisted (`selected_theme`). The catalogue now accepts
Leaf's own theme as a default, and refuses any other unlisted default
with "default 'X' must be in themes, or be 'reading'".

With `themes = []` and `default = "reading"`, `leaf theme list` now marks
`reading` the default and `leaf page init` creates the page; before,
both refused. A model test covers both arms.
A position record's `within` names the element that holds the units it
orders, which the browser finds among the widget's descendants
(`initialState`, projection/authored.js). A record naming the widget's own
tag passed `package check`, since the check asked only that the tag be
declared, and the first drop then threw "Unknown position container" in
the browser. The check now refuses it under `record-within`, whose words
say what a container is, true of an undeclared tag as of the widget's own:

  <lf-stack> verb `move` (`verbs`) records a position within <lf-stack>,
  but a position's container is a declared element inside the widget,
  whose children are the units it orders

Every bundled package still passes `package check`.

Behaviour that changed in tests: the `recording-column-position` arm of
`test_the_widget_that_records_a_parts_position_is_the_one_that_places_it`
had `lf-column` record positions within `lf-column` to show a nearer
recorder taking the slot from the board. That declaration is now refused
and never worked in the browser, so the arm is gone;
`test_nested_member_records_refuse_foreign_selection_and_position` covers
a nearer recorder of the same slot with containers inside each widget. A
model test covers the new refusal.
…ies its premise

The advice said On Me "selects the widget without its premise", which is
false where the widget holds its own premise, as one author's sign-off
items each did, and who got the advice seven times. What the advice is for
(authoring-on-me.md, "On the page") is that `m` selects only the widget,
so a premise written outside it is out of view. It now says that, and asks
for a group only where the premise stands outside:

  <lf-options id=sign-off-api> (line 1): asks the user, but no group holds
  its question, so On Me names it by the widget's label alone and selects
  only the widget; where its premise stands outside it, write that premise
  and this widget in <lf-group id="…" label="…">, its label asking the
  question

The check still reads no meaning off the widget's words, so the advice
fires on the same widgets as before; only its words changed.
`question_errors`'s docstring says the same.
@max-sixty max-sixty changed the title Name Leaf's own text fields, and have package init write only the files a package uses Fix six faults in Leaf that package-author trials hit Nov 23, 2026

@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 becomes main's commit message on squash. It covers the first two commits, but not the four pushed after them, and each of those changes what an author sees:

  • ada23b7 makes leaf page check refuse a position record whose within names the widget's own tag (record-within). It also drops the recording-column-position case from test_the_widget_that_records_a_parts_position_is_the_one_that_places_it, because that registry now fails at check time instead of at admission. Per root AGENTS.md, "Stage", the commit should say which behavior the test change moved.
  • cfaf584 lets themes.toml name reading as its default without listing it.
  • abbb57b makes an unknown icon or action name list Leaf's choices in its error.
  • 6db1ded rewords the ungrouped-question advice and the record-within message.

Could you add a line for each to the description?

@max-sixty
max-sixty merged commit c07f17d into main Nov 23, 2026
6 checks passed
@max-sixty
max-sixty deleted the agent-a58dcc2cadeca90ab branch November 23, 2026 03:32
max-sixty added a commit that referenced this pull request Nov 23, 2026
…tion's premise is left out

#6781 lets `themes.toml` name `reading` as its default without listing it, and
reworded the `ungrouped-question` advice: `m` leaves a premise out only where it
stands outside the widget. Both sentences here said less than the code now does.
max-sixty added a commit that referenced this pull request Nov 23, 2026
Agents that wrote packages from the shipped references alone were left
stuck or guessing in places where the references were silent, wrong or
pointed nowhere. This corrects those places, from two rounds: six faults
that two earlier trials found, and the documentation gaps from a trial
in which six agents each wrote a different kind of package (a widget
that asks, one bound to data, a reordered list, a drawing with parts, a
theme, a widget that also runs off Leaf).

What an author now finds: the shape of a target's `placement`, of
`consumeAnnotations`' entries and items, and of the `placePageThreads`
handle (`module-annotations.md`); `keeps-first-box` and how to reserve a
first box, what `verbatim` says, how `--package` reads a path, and where
the install keeps the files these references link to (`packages.md`);
that a `value` record's attribute is a string, which keywords a verb's
`detail` takes, what a position record's container is and what page
state gives for it, and that a stamp records a `restated` retraction
(`package-data.md`); where the user undoes, when a widget calls
`defer()`, and what `this.state` does off Leaf (`module-state.md`); what
a revision keeps in a widget that declares `lfPatch`, which the text
overstated (`module-authoring.md`, "Revisions"); and how to try a theme
while writing it and see its dark scheme (`package-themes.md`).

Three statements in #6161's wording, which first carried four of these
corrections, are false on `main` and are left out: that every thread
with a place arrives as a target, that `update()` can be awaited, and
that `reveal` is a callback passed at registration.

To stay under the 30,000 characters the skill's size test allows a file,
the last commit moves the `views` helpers from `module-authoring.md` to
`module-state.md` word for word and cuts ten sentences that repeated a
neighbour or described a helper's internals; its message quotes each.
`module-input.md` is seven characters under. Three sentences follow
fixes to Leaf's own code that have merged: a keyed control in a shadow
root belongs to its widget (#6785), `themes.toml` may name `reading` as
its default, and `m` leaves a question's premise out only where the
premise stands outside the widget (both #6781). Other faults the trial
found in Leaf's code are not fixed here.

Max hasn't read this. A subagent wrote it and confirmed most added
statements by running them with `leaf-dev probe` or the command
concerned, and its commit messages say which it only read; a fresh agent
then answered seventeen author questions from the skill alone, sixteen
from the text. I read both diffs. Tests: the reference tests in
`tests/model/test_interact_layer.py`,
`tests/model/test_theme_tokens.py`, `tests/runtime/widget-api.test.mjs`,
and pre-commit.

> _This was written by Claude Code on behalf of max-sixty_
max-sixty added a commit that referenced this pull request Nov 24, 2026
…ds two tags (#7007)

A position record's `within` may now name the widget's own tag, so a
list the user reorders needs two tags, the list and its item, instead of
a container element between them. The maintainer chose to lift the
refusal #6781 added.

That refusal guarded a real crash: the browser looked for containers
only among the widget's descendants, so the first drop threw in
`rankAt`. The lookup now reads containers at or inside the widget, and
in both runtimes a container belongs to the nearest element at or above
it that records positions (`projection.container_owner`, and `closest`
in `projection/authored.js`). That is the rule a unit's owner already
follows, started one step earlier, so a container and its units always
have one owner. The position-container advice counts the widget itself,
and an Undo offer names such a move's list once ("moved “X” in the
list").

A ranking that needed `lf-ranking` > `lf-rank-list` > `lf-rank-item` is
now `lf-ranking` (`content: "members"`, `move` within `lf-ranking`) >
`lf-rank-item` (`owners: ["lf-ranking"]`).

Ran `pnpm run check`, pre-commit, the model contract tests (649), and
browser tests by node id: a two-tag fixture
(`tests/fixtures/packages/sortable`) records a drag and a key move,
keeps them across a reload and undoes the last, in Chromium and Firefox;
the board's three-tag moves still pass in both. `leaf-dev probe` reads
the same state in both engines.

> _This was written by Claude Code on behalf of max-sixty_
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants