Repository navigation
Close the reference gaps that package-author trials found - #6777
Merged
Merged
Conversation
…e portable helpers and symbol names are listed Agents that wrote Leaf packages from the shipped references alone hit gaps in them. This corrects six in the references, as `main` behaves today. #6161, closed unmerged, drafted wording for four of them beside behaviour changes that never landed, so its sentences were checked against `main` one by one and several are not carried over (below). `module-annotations.md`: - A Thread's `anchor`: `null` for a comment on the whole page, else a `section` and optionally a `datum`, a `visual` part or a `quote` with its `prefix` and `suffix`, with a link to `src/leaf/events.md`, "Anchors", which no package reference linked. - `placePageThreads`: which threads are targets (those whose subject Leaf finds, resolved ones too, and the open comment box; not a whole-page comment, nor one Leaf places only as a fallback), and what a target's `placement` holds: `place`, and for a passage `ranges`, one live `Range` per text node. - `consumeAnnotations`: that `render(entries, view)` must not return a promise, what an entry (`key`, `title`) and an item (`kind`, `text`, `label`, `thread`) hold, `view.target(entry)`, and that `view.place(entry, row)` throws unless the row already stands inside the owner. - The handles: what `read()` and `update()` do, and on the `placePageThreads` handle `open(node)` and `reveal(key)`, and that its `update()` returns nothing to await, so work that follows a placement goes in `onCommit`. `module-authoring.md`: `browser/runtime/portable-api.js` is the list of the helpers a widget that also runs off Leaf may import, and `widget-api.js` does not load off Leaf. `module-reading.md`: the action and icon names are the keys of `ACTIONS` and `ICONS` in `browser/runtime/icon-paths.js`, now a link a reader can open. `main` already named `ACTIONS` there (#4547), by a path that resolved from nowhere, and did not say that an action goes by its key or where the icon names are. Not carried over from #6161, because `main` does otherwise: every thread with a place arriving as a target with a `status` (only exact placements arrive), `placePageThreads(owner, render, {reveal})` and a `reveal` callback (the handle has `reveal(key)`, which opens the thread), an awaitable `update()` (it returns `undefined`), `view.place(entry, row, item)` taking a row before it is appended (it throws), `threadSummary`'s `line`, `progress` and `unread`, `anchorTo`, `watchAnnotationLayer`, and "Leaf reads no pointing or pressing on a passage's words on such a page" (`page-layout.md` says it still does). Verified by running, not by reading, except where noted. `leaf-dev probe` journeys registered both presentations on a page built from this tree with `data-annotations="page"` and a log of five comments, and read back: the handle's keys; `update()`'s return and the pass it starts; the targets and each placement's keys, for a passage, a passage across an `<em>`, an element, a resolved thread, a whole-page comment and a fallback placement; the comment box's target after `open(node)` and after a selection; `open` from a node with no id and from `body`; where `reveal(key)` lands with and without an outlet; `onCommit` seeing its outlets filled; the entries, items, controls and `view.target` with and without outlets; `view.place` before the row is appended; and an asynchronous annotation `render`. A plain host page serving the smoke test's install imported `portable-api.js` (83 names) and failed to import `widget-api.js` (`window.lfStorage` is undefined there). `offerAction` and `iconTemplate` were called with unknown names. By reading only: a datum's and a visual part's `open(node)` and placement (`anchor-resolution.js`, `aimTargetAt` and `resolveAnchor`), and that `view.items` leaves out the items a control stands for (`margin-model.js`, `annotationItems`). A fresh agent then read only the skill and wrote a module that places threads, opens the comment box, reveals a thread, draws the annotation rows and builds a Resolve symbol; it ran on the probe page with every step correct and no console error. Its list of guesses and of sentences it read twice shaped the final wording. Tests: `tests/runtime/widget-api.test.mjs`, and in `tests/model/test_interact_layer.py` the three tests that read the references (`test_the_skill_routes_every_reference_it_ships`, `test_every_skill_file_reads_in_one_command`, `test_controls_are_built_by_role_and_never_by_face`), and `tests/model/test_theme_tokens.py`, all pass.
leaf-agent
previously approved these changes
Nov 22, 2026
Six fresh agents each wrote a package (asks, data, compound, drawing, theme, portable) from the corrected references and listed where the references failed them. This fixes the entries that were gaps or misleading sentences in a reference, each as `main` behaves. `packages.md`: - `--package`: a name is lowercase letters, digits and hyphens, so a bare `pkg` is a name; a path is relative to where `page init` runs. An installed package goes by its directory's name. - "Seeing it" lists `keeps-first-box` again, with its remedies: a `:not(:defined)` rule sized from the theme's tokens, or `height`, with `true` and an occurrence's `data-height`, and that the advice may stand for content no rule can size. #4724 dropped the bullet while the check stayed. The examples draw with no data, and a package with no widget has nothing to draw. - `verbatim`, which the starter declares and no reference mentioned, and what a module may add to a verbatim widget. A member tag names its holders in `owners`. - Where the install's `browser/runtime/` and `browser/vendor/` are (`leaf --root`), so the references' links under `browser/` and `src/` can be opened and a plain host mapped to them. - "Widget interface" points at the roles that give a press Leaf's face. `package-data.md`, "User state": - A version retracts a decision with `restated` and a stamp records it; a widget with a whole-widget user verb declares the attribute. - A `value` record's attribute is a string or string enum. - A position container is a declared tag inside the widget, never the widget itself. `page state` gives each move's rank, not the order, and how the ranks order. A version that re-authors a container stops earlier moves placing their members, so its author writes them. - A verb's `detail` schema holds only `type`, `properties`, `required` and `additionalProperties`, so `if`/`then` is refused. - An input may name a source, a reference with its output, or both. - "Views of an answer" called the `shows` key `attr`; it is `reference`. `module-state.md`: - Undo is ⌘Z or the leaf's menu row, and shows a gesture's `says` only in the tab that made it. - `defer()` is for a gesture in which the module changes the nodes itself; `render()` doesn't run while it holds, so a widget that previews through `render()` leaves it alone. - Off Leaf `this.reading` is `null` and `this.state` and `this.controller` throw. - Leaf moves no member of a position record; `render()` places them. - `drawn`'s detail holds one key, the input's property. `module-authoring.md`: `svg` among Lit's names, which read as a closed list; in a template `offeredAction`'s `label` is only a symbol's or mark's accessible name, so the template writes the words. `module-annotations.md`: when to call `registerVisualParts`, how a user picks a part, and that a part must take a hit across its area. `module-input.md`: `onPress`'s `begin` is a passive listener. `package-themes.md`: tokens go in `defaults.css`; `default` names a listed theme and `reading` needs no listing; `--package ./path` tries a theme without installing and reads no `$theme.base`; a texture goes on `body`; `page check --render` draws the light scheme only. `page-authoring.md`: pointing at something is Alt-click or Select mode. `module-authoring.md` and `module-input.md` stand 1 and 2 characters under the 30,000 a skill file may hold (`test_every_skill_file_reads_in_one_command`), so the first-box remedy, the install's layout and recorded state off Leaf went to the references beside them, and the clarifications of `offered`'s label and the draft helpers were left out. Verified by running: `leaf package check` on scratch registries (a number `value` record, a missing `restated`, `if`/`then` in a detail, a rule inside one property); `package check --render` for the first-box advice before and after the `:not(:defined)` rule, and for a widgetless package; `page init` with `pkg`, `./pkg`, `pkg/` and from a subdirectory; `theme list` and `page init` over three `themes.toml` files, `--package ./theme` with a base that isn't installed, and `--theme` after install; `page state` on a recorded ranking; `page check --render` on a verbatim widget adding marked and unmarked words and a control; and `leaf-dev probe` journeys for what `offerAction`, `offerActionElement` and `offer` write for a label, `defer()` holding `render()`, `registerVisualParts` twice, `preventDefault()` in `onPress`, ⌘Z after a pick, Alt-click, `says()` over added words, and the page's ground on `html` and `body`. A plain page served beside the tree mapped `/runtime/` and `/vendor/` to `browser/` and drew a `LeafElement`, whose `reading` was `null` and whose `state` and `controller` threw. By reading only: the render check's light scheme (`render_gate/scheme.py`), the Undo row in the leaf's menu and its words after a reload (`undo.js`), Select mode's key (`composing/target-picker.js`), how a re-authored container absorbs moves (`projection.py`), and `fill: none` hit-testing. A fresh agent then answered seventeen questions an author would ask of these passages from the skill alone. Sixteen were settled by the text, and its guesses and re-reads shaped the final wording, including the `shows` correction. Tests: `tests/runtime/widget-api.test.mjs`, the three tests of `tests/model/test_interact_layer.py` that read the references, and `tests/model/test_theme_tokens.py` pass.
leaf-agent
previously approved these changes
Nov 22, 2026
max-sixty
added a commit
that referenced
this pull request
Nov 22, 2026
#6777 holds every reference correction from the package-author trials, and two of the files this branch edited sit at the size the skill's test allows there. The edits go onto that branch, and this one keeps the runtime fix and its test.
… the room for it Another agent ran a ranking widget through revisions and found what `lfPatch = "members"` keeps. Its corrections are carried here in its wording; this commit did not run them again. `module-authoring.md`, "Revisions": a revision replaces the whole widget unless its class declares `lfPatch`, and Leaf then patches the markup inside it. Inside such a widget Leaf still replaces a nested widget with a module of its own, unless that class declares `lfPatch` too, and an element that no longer holds every node the author wrote, the whitespace between its children included. A module that moves its authored members itself declares nothing. A revision doesn't redraw a widget it keeps, so a module that draws from what its children hold reads them again, as `lf-pane` does with a `MutationObserver`. "Retained nodes": `setChildren` makes `nodes` the parent's only children, removing every other child, whitespace included. `package-data.md`: one statement of where a position container stands, merged from this branch's and the other agent's. `module-input.md`: a `data-lf-carry` key in a widget's shadow root is scoped to the widget. That holds once the runtime fix on `agent-a70c3cafd8e6d2cf3` (`browser/runtime/carry.js`) lands. Both files stood within two characters of the 30,000 a skill file may hold, and the new text needed 1,320 in `module-authoring.md` and 70 in `module-input.md`. Room came from one move by topic and from sentences that repeated something: - The `views` helpers (`viewMembers`, `openingView`, `keepView`) moved word for word from "First paint" to `module-state.md`, "State only this tab keeps", which owns how the user looks at a widget in a tab; "First paint" keeps the declaration and points there. - The paragraph on folding with `hidden="until-found"` repeated `module-scroll-and-motion.md`, "Travel and history"; its two facts that section lacked (print shows it open, and a folded Tab stop leaves the Tab order) moved there. - Cut from `module-authoring.md`: three sentences saying a named helper also loads through `portable-api.js`, which "that file's exports" now says once; `LeafElement`'s lifecycle off Leaf, already given in "Connection lifetimes" and "Drawing what a widget reads"; "`this. controller` is the widget controller", which `module-state.md` owns; why `shadowStage` removes children one at a time; "the document paints its authored HTML while browser modules load", which the section above says; and a restatement of which `wear` wins. - Cut from `module-input.md`: the timeline example of `lands(from)` in "Walks", which "Command rows" gives. `module-authoring.md` is now 29,760 characters and `module-input.md` 29,991. Tests: `tests/runtime/widget-api.test.mjs`, which requires every exported helper to stay named in a module reference, the three tests of `tests/model/test_interact_layer.py` that read the references, and `tests/model/test_theme_tokens.py` pass.
leaf-agent
reviewed
Nov 22, 2026
leaf-agent
left a comment
Collaborator
There was a problem hiding this comment.
Holding the verdict on the ordering the description states. #6785 has to merge first, and it is still open. The sentence this head adds to module-input.md, "Focus and layers" ("For a control in a widget's shadow root, that ancestor is the widget"), describes carry.js as it will be after #6785. Merged before it, the reference tells package authors something main doesn't do. Once #6785 lands, this head has nothing else outstanding.
max-sixty
added a commit
that referenced
this pull request
Nov 23, 2026
…revision (#6785) A revision that replaces a widget gives focus back to a control the widget's module keyed with `data-lf-carry`, but not when the module draws that control into the widget's shadow root: focus landed on the widget's host, or on `body`. An agent writing a reordered list from the references hit this with a grip in each item's shadow root. `captureCarry` read the focused element in the page's own tree, which for a shadow control is the host, and `restoreCarry` searched only the owner's light tree. Capture now reads the focused control in whichever tree holds it and finds its owner out through the shadow root, and restore also looks in the owner's shadow root. The board's grips gain `data-lf-carry="grip"`: with focus on one card's grip, a revision that reworded another card dropped focus to `body`. The same investigation found that the references promised more in-place patching under `lfPatch` than the runtime does; that correction is in #6777, and the runtime is unchanged there. Max hasn't read this. A subagent wrote it after reproducing ten cases of the ranking widget through revisions; I read the diff. Tests: `test_a_replaced_widget_gives_focus_back_to_the_grip_its_module_drew`, whose shadow arm fails on `main`; sixteen browser tests by node id that hold focus across a revision; `pnpm run check`. > _This was written by Claude Code on behalf of max-sixty_
…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.
leaf-agent
previously approved these changes
Nov 23, 2026
# Conflicts: # skills/leaf/references/package-data.md
leaf-agent
approved these changes
Nov 23, 2026
leaf-agent
pushed a commit
that referenced
this pull request
Nov 23, 2026
`main` fails `test_every_skill_file_reads_in_one_command`: `skills/leaf/references/module-input.md` is 30,004 characters, 4 over the 30,000 a skill file may be. #6777 left it 7 under and #6816 added to it; each passed its own checks, and they merged ten minutes apart. Every pull request's `test` job fails on it until this lands. This cuts one sentence from the `onPress` paragraph, "Keep press-local work in these callbacks.", which gave a rule with no reason beside the two callbacks it names. The file is 29,962 characters. The file has sat at the limit since #6777, so the next addition breaks it again. Max hasn't read this. Tests: `tests/model/test_interact_layer.py -k reads_in_one_command`, which fails on `main` and passes here. > _This was written by Claude Code on behalf of max-sixty_
max-sixty
added a commit
that referenced
this pull request
Nov 23, 2026
…m into the rule's home (#6885) max-sixty chose this on the session's Leaf page: give each rule that the `/leaf` skill's references state twice one home. A survey of the references on 21 Nov found 28 second copies it judged movable. This makes 12 of them, across 11 files, for 105 fewer words. Each second copy becomes a pointer to the rule's home or folds its extra facts into it, and one goes where its own file states the rule again: the `handling` clause opening `harness-codex.md`, the `leaf page claim` sentences in `event-batches.md` and `codex-setup.md`, the sidebar's spine and a table's sideways scroll in `page-layout.md`, content beside `main` in `page-authoring.md`, the page with no theme in `package-themes.md`, `mountSample`'s host in `live-samples.md`, the turn-writer route in `threads.md`, a removed passage's thread in `authoring-revisions.md`, the reading face's effect on controls in `page-layout.md`, and each record kind's payload in `module-state.md`. What the diff doesn't show: - **Six copies stay, two of them on a score.** With the sentence that opens `authoring-evidence.md` removed ("select the package that adds it"), 7 of 16 authors of `source-code-readable/text-edit` used the diff widget, against 12 of 16 on main; restored, 7 of 8 against 6 of 8. The option card's `label` sentence in `authoring-on-me.md` stays because its case, `audit-calls-are-proposals`, wrote question headings on 0 of 4 pages against 2 of 4, too few runs to tell and not worth more for ten words. Four stay on reading: each addresses a reader its home doesn't reach, says more than its home, or would point at a section that covers half of it. - **Two were already made on main** (#6777, #6706). **Eight wait on #5979**, which edits `conversation-loop.md`. - **`mountSample`'s host keeps two facts in `live-samples.md`**, because `module-authoring.md`, their home, is 108 characters under the 30,000 a skill file may be. - **Two homes say more than either copy did**, each checked against the code: a wrapped sidebar shows the contents map as a disclosure (`toc.css`), and a move's `unit` and `value` are ids (`projection/model.js`). - **Other scores**, main against this branch, Claude Code: `playwright-recording-shows-its-trace` 6 of 8 each; `recorded-effect-payloads` 6 of 6 each; `generated-preview-keeps-its-state` 4 of 4 against 3 of 4, the one failure unrelated to the sample host. The other moves have no covering case. Two fresh readers read each changed file cold and then the diff; their findings are folded in, among them three claims in my first draft that the code contradicted. max-sixty asked for the merge from a summary on that page and hasn't said he read the diff. Tests: `tests/model/test_interact_layer.py`, `test_theme_tokens.py`, `test_themes.py` and `tests/runtime/widget-api.test.mjs`. > _This was written by Claude Code on behalf of max-sixty_
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.
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, ofconsumeAnnotations' entries and items, and of theplacePageThreadshandle (module-annotations.md);keeps-first-boxand how to reserve a first box, whatverbatimsays, how--packagereads a path, and where the install keeps the files these references link to (packages.md); that avaluerecord's attribute is a string, which keywords a verb'sdetailtakes, what a position record's container is and what page state gives for it, and that a stamp records arestatedretraction (package-data.md); where the user undoes, when a widget callsdefer(), and whatthis.statedoes off Leaf (module-state.md); what a revision keeps in a widget that declareslfPatch, 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
mainand are left out: that every thread with a place arrives as a target, thatupdate()can be awaited, and thatrevealis 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
viewshelpers frommodule-authoring.mdtomodule-state.mdword for word and cuts ten sentences that repeated a neighbour or described a helper's internals; its message quotes each.module-input.mdis 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.tomlmay namereadingas its default, andmleaves 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 probeor 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 intests/model/test_interact_layer.py,tests/model/test_theme_tokens.py,tests/runtime/widget-api.test.mjs, and pre-commit.