Skip to content

Report widget quality to a package's author, and hold Leaf's own widgets to it - #1474

Merged
max-sixty merged 8 commits into
mainfrom
widget-quality-report
Sep 30, 2026
Merged

max-sixty merged 8 commits into
mainfrom
widget-quality-report

Conversation

@max-sixty

@max-sixty max-sixty commented Sep 30, 2026 •

Copy link
Copy Markdown
Owner

A set of widget quality checks, the first of which measures whether a widget "reserves the final size before upgrade": first paint should already have each widget's upgraded geometry, and upgrade should add behavior but no size. The report is advice for a widget's author. It never refuses anything and stays out of page check --render, whose reader can't fix a widget's internals.

For a package author. leaf package check PACKAGE --render renders the worked examples (x-example) of the tags the package's own registry.json declares, using the layer the package appears in, and prints one line per finding: the tag, the check and the measured fact. Exit status ignores findings. Examples share a page where their ids don't collide, so one example can point at another's element, and each page costs one render. A blank image stands in for each media name an example uses; a reference that is not a media name refuses the page.

The checks (render_gate/widget_quality.py, CHECKS, which later checks join):

  • example: a tag no worked example shows.
  • keeps-first-box: the widget's border box at first paint (entry held, authored HTML plus theme laid out, html[data-lf-live] set by the inline bootstrap) differs from its box once the page presents and settles. The pre-upgrade proof now waits for the whole document to parse and keeps each authored widget's box (firstBoxes in render-checks/driver.js), and changedBoxes in render-checks/widgets.js compares the two. A holder is named only for the change left once the changed widgets inside it are put back to their first sizes (the probe sets them, reads the holder, and restores them); a holder of a changed inline widget, whose old line breaks no size restores, is named beside it, since nothing proves its change was the widget's, and a widget the page hides once presented (an inactive tab) is left to the widget that hid it.

Leaf's own widgets. tests/test_widget_quality.py runs the report over assets and every bundled package. tests/known_widget_findings.py lists today's findings by package, tag and check. A new finding fails the test, and so does a stale entry. A second test drives the CLI on a planted package.

Plumbing. vendoring.start_throwaway_page vendors an already-composed layer into the scratch page, and page init's JSON line moves up to cmd_init. render_gate.command.in_browser is the browser launch without a preview server. The docs are in references/packages.md "Seeing it", the Stability rule in assets/AGENTS.md, and tests/AGENTS.md. A new eval case, widget-checked-before-handoff, scored 0/3 on the base guidance and 3/3 on this change.

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

🤖 Generated with Claude Code

max-sixty and others added 2 commits September 30, 2026 13:53
…ets to it

`leaf package check PACKAGE --render` now draws the worked examples of the
widgets the package's own registry declares and prints one line per finding:
the widget, the check, and what it measured. A finding is advice for the
widget's author and leaves the exit status alone; it stays out of
`page check --render`, whose reader cannot change a widget.

The checks share one list (`render_gate/widget_quality.py`, `CHECKS`):
`example` names a tag no worked example shows, and `keeps-first-box` names a
widget whose border box at first paint differs from its box once the page
presents. The pre-upgrade proof now waits for the whole authored document to
parse and keeps each authored widget's box (`firstBoxes` in the driver);
`changedBoxes` compares, attributing a change to the innermost widget and
leaving a widget the page hides once presented to the widget that hid it.

`test_widget_quality.py` runs the report over the base layer and every
bundled package against `tests/known_widget_findings.py`, which lists today's
findings as defects waiting on their fix and fails on a new finding or a
stale entry. `vendoring.start_throwaway_page` vendors a composed layer for
the report's scratch page, and `page init`'s JSON line moves to `cmd_init`.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

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

  1. The synthetic media write trusts paths from x-example. check_package accepts <img src="/media/../../outside.png">; after lstrip("/"), that path resolves outside the temporary page, and --render overwrites the host file there with a blank image. Resolve and confine each media destination to the temporary page before writing it.

  2. The nested-box attribution subtracts child size changes from a holder's change even when they are independent. If a fixed-width holder grows from 100 to 120 pixels while its child independently grows from 50 to 70, the child's 20-pixel delta cancels the holder's and keeps-first-box omits the holder. The check needs to preserve independently changed holders; summing absolute child deltas cannot establish which change caused the holder's new box.

max-sixty and others added 2 commits September 30, 2026 14:07
…t against what its widgets span

The report wrote a blank image wherever an example's /media/ reference
pointed, so a name with ../ could write outside the scratch page; only a
name the server serves gets a stand-in now, and any other refuses the page.

A holder was excused for any change no larger than the summed absolute
changes of the widgets inside it, which also excused an independent change
of the same size. Width is now always the widget's own, and a holder is
named for its height where its change differs from the change in the
height its changed widgets span.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…t sizes

Subtracting the height its changed widgets span still excused a holder
that set its own height by the same amount a widget inside it grew. The
probe now sets each changed widget inside a holder to the size it first
painted at, reads the holder, and restores them: what remains is the
holder's own change, in either axis and whatever its layout. The playground
now reports its own rearrangement at upgrade, and joins the known list.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

@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 new holder attribution still names a parent for a change caused entirely by an inline child. With lf-holder { display: block } and lf-grow { display: inline }, changing only the child's font size from 16px to 32px makes the holder's line box grow. The width and height overrides in withFirstSizes do not restore an inline element's line metrics. Running the current changedBoxes in Chromium reported both widgets (holder height 18→37px), even though the holder has no independent change. This gives the package author a false keeps-first-box finding on the holder; the attribution needs to account for layout changes that fixed width and height cannot reverse.

… holder

An inline element takes no width or height, so pinning it left its grown
type in the holder's line and named the holder for its line growing.
While the holder is read, an inline widget stands as an inline-block of
its first size at the top of its line.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

@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 inline replacement in withFirstSizes still gives a holder a keeps-first-box finding for a change made only by its child when the inline text wraps. An inline box can span lines, but inline-block is atomic, so forcing its old aggregate width and height does not recreate the old line breaks or the holder's height. In Chromium, a 120px-wide holder around wrapping text measured 120px tall before its inline child changed from 16px to 32px; putting the child back through this probe left the holder 137px tall. The new one-line fixture passes, but this common wrapped case leaves the attribution's central claim false. The probe needs to preserve the child's original inline layout, or avoid asserting an independent holder change when it cannot reconstruct it.

An inline widget runs through its holder's lines, and no fixed size puts
its old line breaks back, so the probe could not separate a holder's own
change from what a wrapped inline child did to it. A holder with a changed
inline widget inside it is now left to that widget, which is named. The
playground's output, which holds its inline values, leaves the known list
on this rule.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

@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 inline-child shortcut also suppresses a holder that changes on its own. I reproduced this in Chromium with a 120px-wide lf-holder containing an inline lf-word: doubling the word’s font size while adding 20px of padding to the holder made both boxes grow, but changedBoxes() returned only lf-word. A package author would miss the holder’s independent keeps-first-box defect. The attribution needs to retain that finding when the holder itself changes, even if an inline descendant also changes; returning false for every such holder trades the previous false positive for a false negative.

…changed

Leaving every such holder to its inline widget missed a holder that also
changed on its own. The pre-upgrade reading now keeps each widget's
computed sizing styles (`sizing` in the driver, computed so an auto height
stays auto), and a holder whose changed widgets include an inline one is
named where those styles changed. The playground's output, whose own
styles change at upgrade, returns to the known list.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

@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 sizing fingerprint cannot establish whether an inline widget's holder changed on its own. In Chromium, a 120px lf-holder gains a line when its own letter-spacing changes to 3px (height 54→90px with its child untouched). When its inline lf-word also grows from 16px to 32px, the holder reaches 165px, but sizing(holder) is unchanged because letter-spacing is absent from the list; changedBoxes() reports only lf-word. The package author misses the holder's independent keeps-first-box defect. A fixed subset of computed properties leaves the same gap for other text-layout inputs, so this attribution needs a way to distinguish the holder's own layout change from the child's rather than treating equality of this fingerprint as proof that the holder did not change.

…gerprint

A fixed list of computed properties cannot tell a holder's own text layout
from what an inline widget inside it did, so leaving the holder out on an
unchanged fingerprint missed real changes. A holder is now left out only
where putting its changed widgets back to their first sizes puts its box
back. That cannot be done for an inline widget, so its holder is named
beside it: a finding the author can dismiss rather than one they never see.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@max-sixty
max-sixty merged commit 57434eb into main Sep 30, 2026
5 checks passed
@max-sixty
max-sixty deleted the widget-quality-report branch September 30, 2026 22:51
max-sixty added a commit that referenced this pull request Oct 1, 2026
The widget quality check (#1474) found every Command Hub widget changing
size between first paint and presentation. This fixes the three whose
final size the authored page already settles, each by its cause rather
than per widget.

**Goal layout keyed on markers the upgrade wrote.** `lf-command.js`
stamped `data-lf-command-goal` and `data-lf-command-worker`, and the
package theme hung a goal's layout on them: a block title, a contained
float, and workers shut behind the crew chip. The markers derive from
the authored tree, so the theme now selects that tree (`lf-command
lf-task`, `lf-task > lf-agent`) and the markers are gone. Hiding a
goal's workers is scoped to `html[data-lf-live]`, since a reading
without the runtime has no crew chip to open them. A package adding its
own goal or worker widget to `$command.widgets` lays it out in its own
theme.

**Generated parts with no room held for them.** Where the authored tree
says a part will be drawn, the theme holds its room at the place the
upgrade draws it, until it is drawn:

- an agent's live line, now one line of the row's own type tall, which
is also the height a `doing` clause sets, so a report fills the line
instead of growing the row;
- a worktree's shut head;
- the chip row of a task outside a command, when it has a non-empty
owner, `when` or tags, or subtasks: one row of chips, under the title or
at the top of a task with none. Chips that wrap onto a second row are
not held, since how many fit on a line is known only once they are
drawn; the base layer's lf-milestone (#1484) holds its `.lf-chips` row
the same way. Holding a wrapped row would take either a chip row that
never wraps or the server drawing the row, and neither is in this
change;
- a `talk` goal's composer.

**The composer's height lived inside one rule.** It is now
`--lf-compose-h` in `shadow.css`, stated at the root for a widget
holding a composer's room, and on each field, so a field whose context
sizes its action (lf-options' Add row) still derives its own.

lf-agent, lf-task and lf-worktree leave
`tests/known_widget_findings.py`. lf-command and lf-command-readings
stay, with the reason beside them: the readings hold a row per stopped
goal and live worker and a tile for quiet ones, and the command model
reads those from the log and the clock, which first paint has neither
of. The command's worked example gains `talk`, so the check now covers
the composer's held room (turning the reservation off brings back
`goal-feeders` 27→75).

Visible change: an agent row is about 5px taller, because its live line
is one line of the row's type. `leaf-dev stills` shows no other
difference.

**Also: main's red tab test.** Since #1472,
`test_a_revision_inside_one_tab_keeps_the_tab_set_and_every_other_tab`
fails on main: a revision that adds a tab rebuilds the page's tab set,
and the outgoing set withdrew `--lf-root-headers` from `html` before its
replacement declared it again, a remove-and-restore the write watch
refuses. `lf-tabs.js` now withdraws the header once the operation that
disconnected the set is over, and only if no strip took its place.

> _This was written by Claude Code on behalf of max-sixty_

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
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