Skip to content

Carry #3901's draw-failure findings and grader control into main - #3977

Merged
max-sixty merged 1 commit into
mainfrom
carry-3901-draw-findings
Oct 25, 2026
Merged

max-sixty merged 1 commit into
mainfrom
carry-3901-draw-findings

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

#3901 closed as superseded by #3923, which has merged. #3901 still held findings #3923 lacked; this carries them into notes/agent-usability-evals.md, inside "Widgets plain page check doesn't run, 2026-10-24", and ports #3901's control of the draw-failure grader.

The note

  • Measure which widgets agents write that fail to draw, and keep plain page check's browser run #3901's final counts, with Wilson 95% intervals: text documents 0 of 13 (0–23%), markup-only playgrounds 0 of 9 (0–30%), visual reviews 0 of 13 (0–23%), thread charts 0 of 30 messages (0–11%).
  • 2 of 29 thread-chart samples (7%, 2–22%) had a draft that failed while being written: one with invalid lineAnchor, which the runtime reports, and one with Plot's translate(0.5,NaN), which the runtime of the time didn't.
  • Asked for "a Leaf visual review", 3 of 3 Claude Code authors (44–100%) used lf-shot. So the visual-review rates measure whether the widget draws once chosen, not whether authors find it.

The translate(0.5,NaN) chart

#3901's saved sample (placed-widgets-draw-thread-message-wh5421ar) shows the cause: a Plot.text mark given dy: (d) => (d.region === "us-east" ? 14 : -10). That is the per-datum offset #3956 refuses. Drawn on a page at main d91276596, plain page check reports marks[1] (text) has a dy that is not a number, and thread create would refuse the message. #3901 reported no other NaN drawing, so the after-draw NaN scan #3923's merge dropped would catch nothing these runs show. The note says so, and TODO.md gets no item.

The grader's control

dev/tests/browser/test_draw_failures.py ports the control onto main's dev/leaf_dev/draw_failures.py with the grader unchanged. A playground control at value="40" over max="24" passes plain page check (status 0, no browser), and the grader, reading --render, reports it beside a thread message's lf-chart whose body throws. The message is written to the log directly, since thread create now draws a chart before posting and would refuse it. With the value set back in range, the test fails at the playground assertion.

uv run pytest dev/tests/browser/test_draw_failures.py -q -n0 passes, and pre-commit passes on the changed files.

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

#3901 closed as superseded by #3923, but held three findings #3923 lacked.
The note gains them inside "Widgets plain page check doesn't run": #3901's
final counts, the 2 of 29 thread-chart drafts that failed while being
written, and the 3 of 3 authors who picked lf-shot for "a Leaf visual
review".

The translate(0.5,NaN) chart came from a Plot.text mark given
`dy: (d) => ...`, the per-datum offset #3956 refuses; main's plain
page check reports it, so no TODO item is needed.

dev/tests/browser/test_draw_failures.py ports #3901's control onto
main's draw_failures.py unchanged: a playground control at value 40 over
max 24 passes plain page check without a browser, and the grader reports
it from --render beside a thread chart whose body throws.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@max-sixty
max-sixty merged commit c4cafac into main Oct 25, 2026
4 checks passed
@max-sixty
max-sixty deleted the carry-3901-draw-findings branch October 25, 2026 16:43
max-sixty added a commit that referenced this pull request Oct 25, 2026
A widget whose `setup()` threw no longer throws again when `page check
--render` replays its draw, so the check reports the author's original
failure instead of an unrelated `render-threw`.

**What the author saw.** A playground whose attributes don't parse, such
as a range control with `value="40"` over `max="24"`, shows its failure
box, and `page check --render` reported that failure ("control radius
has a value outside its range"). It also reported `render-threw`,
"Cannot read properties of null (reading 'reflection')", which points at
Leaf instead of the markup. The fixture page in
`dev/tests/browser/test_draw_failures.py` (#3977) reproduces it on main.

**Cause.** `LeafElement` documents that "a `setup()` that throws shows
its failure, and the element draws nothing after it", and `shouldUpdate`
enforces that through `#broken`. `redraw()`, which the render check's
replay (`render-checks/replay.js`) calls to test that a widget draws the
same reading twice the same way, calls `render()` directly and skips
that gate. `lf-playground`'s `render()` reads the state `#build()`
makes, which a failed parse never makes, so the replay hit
`this.#initial === null` in `#reflection()`. The defect is in
`LeafElement`, not the playground: any widget whose `render()` reads
what its `setup()` builds throws the same way.

**Fix.** `shouldUpdate` and `redraw()` now share one predicate,
`#draws()`, for whether the element has a reading to draw. It is false
after a `setup()` that threw, while the reading lacks a declared verb,
and while bound data is undelivered. The replay therefore draws nothing
for an element that draws nothing, and the failure box stays.
`lf-playground` is unchanged. The kernel bundle is rebuilt.

**Behavior change.** The runtime test "a setup that throws shows its
failure and the element draws nothing" now also covers a check's
`redraw()`. It fails on main, where the redraw calls `render()`.

**Checks run.**
- `bin/leaf page check --render` on the #3977 fixture page: on main it
reports `render-threw` in both schemes. With the fix, only the parse
failure (`page-exception` and `console-error`, "control radius has a
value outside its range") and an unrelated `unpointable` advisory
remain.
- `pnpm run test:runtime`: 559 passed on the branch merged with main.
The new assertion fails against main's `leaf-element.js`.
- Focused browser tests (`-n0 -k`): in
`tests/browser/widgets/test_playgrounds.py`, `rejects_range_values`,
`reports_a_contributor_view`, `keeps_one_typed_working_state` and
`authored_defaults_draw`; in `tests/browser/test_render_gate.py`,
`replay_findings_keep_the_throw_site`. All 5 passed.
- `dev/tests/browser/test_draw_failures.py`: passed.
- `pnpm run check:browser`: the committed bundles match a fresh build.
- pre-commit on the changed files: passed.

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

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