Skip to content

Draw nothing on a check's redraw of an element whose setup threw - #3983

Merged
max-sixty merged 2 commits into
mainfrom
redraw-skips-a-failed-setup
Oct 25, 2026
Merged

max-sixty merged 2 commits into
mainfrom
redraw-skips-a-failed-setup

Conversation

@max-sixty

@max-sixty max-sixty commented Oct 25, 2026 •

Copy link
Copy Markdown
Owner

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 Carry #3901's draw-failure findings and grader control into main #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

LeafElement says a setup() that throws leaves the element drawing nothing,
and shouldUpdate gates on #broken, but redraw() (the render check's replay)
called render() directly. lf-playground's render reads what #build makes, so a
playground whose attributes failed to parse threw "Cannot read properties of
null (reading 'reflection')" on replay, and page check --render reported an
opaque render-threw beside the real parse failure.

shouldUpdate and redraw now share #draws(): no reading to draw after a failed
setup, a reading missing a declared verb, or undelivered data. The runtime test
for a throwing setup now also covers a check's redraw.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent
leaf-agent previously approved these changes Oct 25, 2026
…-setup

# Conflicts:
#	browser/runtime/leaf-element.js
#	dist/kernel/kernel.json
#	dist/kernel/runtime/bundle-answer.js
@max-sixty
max-sixty merged commit ac89ab7 into main Oct 25, 2026
4 checks passed
@max-sixty
max-sixty deleted the redraw-skips-a-failed-setup branch October 25, 2026 18:28
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