Repository navigation
Cut runtime rechecks of Leaf's own output, unrecorded-fault retries and argument type guards, and the unused x-paints key - #2555
Conversation
… and x-paints The browser repeated checks that a stronger mechanism already makes, and recovered from states no Leaf writer produces. Each input now fails through the parser, schema, or TypeError already in its path. - Drawings: `validDrawing` asks only for the current format. Admission holds a comment's drawing to the schema, and drawing.js clamps a draft to the same bounds, so the format alone separates a draft an older runtime saved. - Spot checks of the server's answers go: the registry's `$layer` and `$` keys, a state reading's `taken`/`through_seq`/revision, the data shape, the deferred manifest and response echo (the server refuses and builds its reply from the request; `loadDeferred` keeps both race checks), the export payload, version comparison's projections and single `main`, the media path, and summary contiguity, which `events.py` builds by slicing. - Thread list: no retry inside `presentList`, no `RetainedThreadListError` and no fail-soft proof. A failed paint restores the committed list and leaves the region pending for the next reading; the sibling-cohort rollback stays. The Question banner no longer restores its faces itself, so view.js's rule that an obsolete attempt restores nothing is the one that governs. - file-editor builds its merge view once, from `original`: the comparison editor always has one and the primary never does. lf-diff drops four assertions about the vendored Pierre's output; `renderedLines`' check stays. - Module-API type guards the next line would throw on anyway go, across projection, thread actions/mirrors/surfaces/landing, keyboard scopes and dispatch, and the visual-review and playground packages (whose control schema already holds name, kind and range bounds). Kept: the projection root's id, `setReaction`'s boolean, `declaredScope`'s Escape enum, double registration, duplicate keys, and `requireReference`. - The torn-thread clause leaves thread/model.js, the publisher's comment and module-authoring.md, with the publisher test that covered only that case. - `x-paints` goes: nothing declared it since lf-task left. Its registry and schema entries, the renderQuiet half, the render check's half, and docs/registry.html. Behavior changes in tests: the deferred-load tests inject an HTTP 500 instead of a mismatched echo; the thread-list and banner failure tests expect the failure reported once and the next reading to paint; an older-format drawing draft keeps its words without its mark. Deleted: the drawing validator's test, the summary contiguity test, the torn-thread browser and publisher tests, and the x-paints tests. Depends on the Python change that refuses a reply to a withdrawn message and deletes `build_threads`' torn-thread recovery. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…failing reading A datum's key and identity become a comment's anchor and nothing past projectData reads them again: an object passed as an identity stamps "[object Object]", the same as the object that replaces it, so an admitted comment would follow an unrelated datum. The non-empty-string checks come back for those two fields only; tests/runtime/project-data.test.mjs holds them. The choose-earlier case of the list-candidate test let the first failure reject before the choice's own readings had started. Every failing reading now waits at a gate: the test waits for both of the choice's readings to start, releases the superseded first attempt and lets it settle, then releases the rest, in one script so the restore still answers the press. A fixed wall clock and held state reads keep any other reading from superseding them. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The test injects renderer failures, and on a loaded host the restore after one lands outside the 500ms window the shift watch credits to the press. The movement then reads as unprompted, though the injected fault caused it. Only that variant drops "moved without input" reports from its error assertion; every other report, and every other variant, stays watched. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts: # build/browser/application.test.mjs # skills/leaf/assets/runtime/keyboard/scopes.js # skills/leaf/assets/runtime/thread/thread-list-view.js # skills/leaf/assets/runtime/version.js # skills/leaf/packages/playground/initial.js # skills/leaf/packages/playground/vendor/lf-playground-initial.js # skills/leaf/references/module-authoring.md # tests/test_interact_contract.py
# Conflicts: # skills/leaf/assets/registry.json # skills/leaf/packages/visual-review/widgets/lf-visual-review.js
leaf-agent
left a comment
There was a problem hiding this comment.
The choose-earlier branch now removes every moved without input report from the browser error collector. If retention or the following reading introduces a real layout shift, this test passes while the reader sees the card move; the filter cannot distinguish that regression from movement caused by the injected failure. tests/AGENTS.md says, “Fix what moved rather than consuming the report; shift reports have no per-test allowances.” Please keep the shift verdict intact and arrange the fault sequence or restoration so the test can assert both the retained reading and its stability.
…on screen leaf-agent's review rejected dropping the variant's "moved without input" reports: shift reports have no per-test allowances. What moved was kept-thread, down 34px. The first failing reading painted its candidate, which withdraws selected-thread, and then stood on screen at its gate while the user opened another card; that choice dismissed the withdrawn row and moved kept-thread up. The restore put selected-thread back above it, moving it down again, and on a loaded host that landed past the 500ms the shift watch credits to the press. No renderer exception leaves a candidate standing across a gesture, since it throws while it paints. So in this variant each failing reading now waits at its gate before it paints, and paints and fails in one turn once released: the choice is made on the committed list, and nothing a reader sees moves when the last failing reading restores it. The reports stay watched: with an 800ms hold before the release the old arrangement reported the shift on every run and this one on none, and the variant fails if the view's retention does nothing. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…is not input (#2556) Most of what the complication-weight sweep cut (#2500, #2507, #2555) was a reader re-checking a value another Leaf module produced, as if it came from outside: the browser re-validating the server's answers, the Worker the manifest its own build wrote, Python the rules admission already enforced. AGENTS.md's "Validate once and share readings" names the boundaries but not which seams aren't one. This adds that to "Let the agent correct its own input" in `/developing-leaf`, with the one exception (records an older Leaf left in the state home) and the matching rule for recovery from states no Leaf writer produces. **Scored before landing** (scratch A/B, the section with and without the paragraph, `claude -p` with no tools): both arms passed every case, so the paragraph shows no measurable change on cold prompts — a browser reader of a server answer (7/7 each arm, with and without the user's global instructions loaded), the same reader written beside a neighbour that over-validates (8/8 each), an unproducible-state recovery (3/3 each, "leave"), and a control where a package-supplied anchor identity should keep its check (3/3 each, "refuse"). The control shows the rule doesn't over-apply. It lands as the statement reviewers and later sweeps can cite; the defensive code it describes accumulated in incident fixes the cold cases don't reproduce. > _This was written by Claude Code on behalf of max-sixty_ Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts: # skills/leaf/assets/runtime/projection-watch.js # skills/leaf/assets/runtime/thread/thread-list.js
leaf-agent
left a comment
There was a problem hiding this comment.
The PR description's Tests paragraph still says choose-earlier drops “moved without input” reports. This commit removes that filter and waits for all three failing readings before they paint. Please update the paragraph to describe the current test: the description becomes the squash commit message, and the existing claim would record the opposite of what the test now asserts.
# Conflicts: # skills/leaf/assets/runtime/keyboard/scopes.js
# Conflicts: # skills/leaf/assets/runtime/thread/presentation.js # skills/leaf/assets/runtime/thread/thread-list.js
# Conflicts: # skills/leaf/assets/runtime/keyboard/scopes.js # skills/leaf/assets/runtime/version.js
…parison paint to one report (#2588) `main`'s push `ci` has not completed green since #2568. The last two completed runs ([38235572771](https://github.com/max-sixty/leaf/actions/runs/38235572771) on 1ace63b, [38244446941](https://github.com/max-sixty/leaf/actions/runs/38244446941) on e5aca3e) failed three `main`-tier tests. Two are already fixed on `main`; this PR fixes the third and tightens one of the fixed ones. ## Behaviour that changed - **`test_an_export_keeps_its_quiet_words_off_screen` runs again.** #2555 removed the `x-paints` key and the `state` property from `declared_reading_package`, but this test still wrote `<lf-reading state="done">`, so `page check` refused the page before the export ran (`Additional properties are not allowed ('state' was unexpected)`). The test is `main`-tier and lives in a file #2555 did not edit, so `--changed-since` never selected it. It now takes its quiet word from a highlighted `lf-code` line, which the default package draws, and drops the fixture. With `.lf-quiet`'s clip removed from the theme, the test fails, as it did before. - **A failed comparison paint must be reported exactly once.** `test_a_comparison_mark_that_failed_on_return_keeps_following_the_comparison` counted only `leaf:` reports, and its comment expected a second, uncaught record of the throw. Since #2575, `readingPaint` reports the failure once and nothing escapes. On current `main` the page records one error, `leaf: paint failed for lf-tabs#views: …`. The test now requires exactly that error. A paint that also rethrows from a microtask fails it. The other two failures need nothing more. `test_a_reaction_on_a_visual_part_names_that_part` was fixed by #2582, and the comparison test's arrangement by #2581. ## Evidence - On `main` 4f81e81, the export test fails with the refusal above. With this change it passes. - `leaf-dev flake` (18 copies, six at a time) passed 18/18 for the export test, the comparison test and the reaction test. A flake run of `tests/test_render_words_watch.py` also passed 18/18 for every test. That file's `TypeError: Cannot read properties of null (reading 'present')` did not reproduce on `main` and is not in either failed run's log. - The other two `declared_reading_package` tests still pass (`test_the_render_gate_catches_a_declared_word_that_never_reached_the_page`, `test_a_word_the_revision_adds_to_a_surviving_element_is_said`). Hand-written source delta: 0 lines. Test delta: +10 −12 (`tests/test_render_export.py` +8 −10, `tests/test_render_options_settled.py` +2 −2). > _This was written by Claude Code on behalf of max-sixty_ Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
Main deleted the lost-opening-message thread test (#2555) beside the branch's reopen test; the merge keeps the reopen test only. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…, and correct the claims the code contradicts (#2612) `module-authoring.md` is the package author's reference for the helpers `widget-api.js` exports. #2538 documented every authoring export, adding each to the section that owned its topic, so the reference had grown piecemeal. It now follows the task a package author is doing rather than `widget-api.js`'s order, which groups exports by owning file and scatters one task across the list. Each helper is documented once, with its signature and return value where it was only named before, and other sections point at it by name. Mechanism a package author doesn't act on is cut. The file goes from 1657 to about 1770 lines. Every behavioral claim was checked against the runtime, and a second pass tried to refute about 110 of them. Claims the code contradicted are corrected, among them: - `readingRegion(id)` was documented but is not exported. - `motion()` returns null only under reduced motion or before presentation; the restored-state case went in #2332. - `quietWord`: Leaf writes quiet words on elements it marks rewritten, changed by the user, or reported. `x-paints` went in #2555. - `renderState` runs only while the widget has a subscriber, and a throwing `renderState` or subscriber replaces the widget with its fail-soft box. - Only subscriptions built on the owner lifetime pause while the owner is away; `watchDraft`, `onUserInput`, `watchReadingRegionTransitions`, `claimTraversals` and `boundFile.watch` do not. - `afterScript` coalesces by function identity, so a new arrow each call runs each time. - `watchDraft` takes `{input}`, which the restructure first dropped: it hands the user's caret to the replacement box across a live revision. Its callback also fires with `null` when the box's own send goes. - `threadActions.open` tries the registered primary reader, then the open Threads panel, then inline, then Threads. - `reach` is read from a row only; `readWork().done` is a count; `compareImages` also returns `width` and `height`; `alignedNodes` renders `same` runs as spans; the contribution kind is `ask`. `tabStore` has its own section, "Tab-local working state", and "Sticky headers" is its own section, which the glossary now cites. `assets/AGENTS.md` cites "Retained nodes" for the placement guarantees. `motion.js`'s header loses the same stale restored-state clause. `tests/runtime/widget-api.test.mjs` let `readingRegion(id)` through: when a following code span opened with a brace, it read the call as a method an example defines. A method head must now sit on one line; the test fails on the old reference and passes on the new one. Tests: `node --test tests/runtime/widget-api.test.mjs` and `pnpm run test:runtime` pass; pre-commit passes. > _This was written by Claude Code on behalf of max-sixty_ --------- Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
Browser-runtime and package code that re-checked what Leaf's own server, composer or producers already guarantee, retried or rolled back faults nothing records, or type-checked arguments the next line would reject anyway. It goes; checks that stop bad input passing silently into admitted events, stored decisions or anchors, guards against hangs, and
current()race checks stay. Part of the complication-weight sweep (#18, #22, #23, #25 and #27 there); follows #2507.#18 Re-checks of Leaf's own output
validDrawingre-validated every drawing against the full comment schema on each paint, though admitted drawings passed it at the append door,drawing.jsclamps every bound, and the versionedformatseparates old drafts. It is now the format check; the generated bound constants stay.drawing-record.test.mjsgoes; the malformed-draft browser test now uses aleaf-drawing/2draft.$layerfacts, four/api/statefields, the deferred-data reply echoing its request, the export payload and "a single main" (whichpage checkrefuses) go fromwidget-loader.js,state-application.js,data.js,context.js,version.jsandlayer-client.js.loadDeferredkeeps its twocurrent()checks. The two deferred-load tests now inject an HTTP 500 instead of a bad echo.summary-ranges.jsstops re-checking the contiguityevents.pybuilds.#22 Retry and rollback for faults nothing records
RetainedThreadListErrorand itsrecoveredplumbing) goes; a failure restores the committed list once and is reported, and the next reading paints. The sibling-cohort rollback stays.view.js's rule that an obsolete attempt must not roll a newer reading back;view.jsis now the one owner.Compartmentcould never switch; the merge view is built once.renderedLines' row check, which keeps a datum key off the wrong row, stays.#23 (runtime half) The torn-opening-line thread recovery, which #2507 made unreachable by refusing a reply to a withdrawn message, goes from
thread/model.js's contract,module-authoring.mdandapplication.ts, with its runtime test.#25 Argument type guards About sixty
typeof/instanceofchecks on module-API arguments, including bundles only the runtime passes, go acrossprojection/,thread/,keyboard/and the top-level runtime, and in lf-visual-review, lf-playground and lf-diff. Kept because they guard a rule rather than a type:projectData's non-empty key and identity (a package passing an object would otherwise anchor a stored comment to an unrelated datum; newproject-data.test.mjs),setReaction's boolean,declaredScope's Escape enum, double registration, visual-part uniqueness andrequireReference.#27 The
x-paintsregistry key, which no tag in the tree declares since lf-task left, goes with its runtime reader, render-check half, schema, docs and tests.Not cut:
canonicalBinding's"Space"alias, which is what makes the non-canonical check refuse a binding that would otherwise never fire.Tests: with the retry gone, the
choose-earlierboundary variant holds each failing reading at a gate before it paints, so the user's choice happens on the committed list and one release fails all three readings; the shift watch stays on and the test asserts both the retained reading and its stability.