Repository navigation
Draw nothing on a check's redraw of an element whose setup threw - #3983
Merged
Merged
Conversation
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
previously approved these changes
Oct 25, 2026
…-setup # Conflicts: # browser/runtime/leaf-element.js # dist/kernel/kernel.json # dist/kernel/runtime/bundle-answer.js
leaf-agent
approved these changes
Oct 25, 2026
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.
A widget whose
setup()threw no longer throws again whenpage check --renderreplays its draw, so the check reports the author's original failure instead of an unrelatedrender-threw.What the author saw. A playground whose attributes don't parse, such as a range control with
value="40"overmax="24", shows its failure box, andpage check --renderreported that failure ("control radius has a value outside its range"). It also reportedrender-threw, "Cannot read properties of null (reading 'reflection')", which points at Leaf instead of the markup. The fixture page indev/tests/browser/test_draw_failures.py(#3977) reproduces it on main.Cause.
LeafElementdocuments that "asetup()that throws shows its failure, and the element draws nothing after it", andshouldUpdateenforces 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, callsrender()directly and skips that gate.lf-playground'srender()reads the state#build()makes, which a failed parse never makes, so the replay hitthis.#initial === nullin#reflection(). The defect is inLeafElement, not the playground: any widget whoserender()reads what itssetup()builds throws the same way.Fix.
shouldUpdateandredraw()now share one predicate,#draws(), for whether the element has a reading to draw. It is false after asetup()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-playgroundis 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 callsrender().Checks run.
bin/leaf page check --renderon the Carry #3901's draw-failure findings and grader control into main #3977 fixture page: on main it reportsrender-threwin both schemes. With the fix, only the parse failure (page-exceptionandconsole-error, "control radius has a value outside its range") and an unrelatedunpointableadvisory remain.pnpm run test:runtime: 559 passed on the branch merged with main. The new assertion fails against main'sleaf-element.js.-n0 -k): intests/browser/widgets/test_playgrounds.py,rejects_range_values,reports_a_contributor_view,keeps_one_typed_working_stateandauthored_defaults_draw; intests/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.