Repository navigation
Carry #3901's draw-failure findings and grader control into main - #3977
Merged
Merged
Conversation
#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]>
leaf-agent
approved these changes
Oct 25, 2026
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]>
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.
#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
invalid lineAnchor, which the runtime reports, and one with Plot'stranslate(0.5,NaN), which the runtime of the time didn't.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: aPlot.textmark givendy: (d) => (d.region === "us-east" ? 14 : -10). That is the per-datum offset #3956 refuses. Drawn on a page at maind91276596, plainpage checkreportsmarks[1] (text) has a dy that is not a number, andthread createwould 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, andTODO.mdgets no item.The grader's control
dev/tests/browser/test_draw_failures.pyports the control onto main'sdev/leaf_dev/draw_failures.pywith the grader unchanged. A playground control atvalue="40"overmax="24"passes plainpage check(status 0, no browser), and the grader, reading--render, reports it beside a thread message'slf-chartwhose body throws. The message is written to the log directly, sincethread createnow 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 -n0passes, and pre-commit passes on the changed files.