Repository navigation
Make Lit DOM dependencies explicit and preserve review state - #3676
Merged
Merged
Conversation
# Conflicts: # dist/kernel/kernel.json
leaf-agent
approved these changes
Oct 23, 2026
leaf-agent
added a commit
that referenced
this pull request
Oct 23, 2026
The selection-restoration browser test now expects Threads to remain open after the user invokes Restore selection from its borrowed menu. #3676 made the menu close while preserving its underlying view, the same outcome as invoking the command by key; the old assertion still expected the whole panel to close. `test_restore_selection_has_touch_route_and_does_not_carry_draft` failed at that assertion in [main CI run 39917870081](https://github.com/max-sixty/leaf/actions/runs/39917870081) and passes locally with `uv run pytest -q -n0 tests/browser/navigation/test_reading_place.py::test_restore_selection_has_touch_route_and_does_not_carry_draft`. The test still requires the restored selection, touch route, saved draft, and subsequent keyboard routes. Refs #3695; this changes no product behavior. Co-authored-by: leaf-agent <[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.
Leaf’s presentation pass ordered renderer starts without guaranteeing that the DOM a later renderer reads had committed. This change retains Lit and its native lifecycle, and separates explicit DOM dependencies from the existing semantic presentation ledger. It also makes visual-review captures available offline and preserves unfinished replies when search is opened through the Page menu.
Changes
updateComplete; imperative Lit renderers commit synchronously. Dependencies follow replacement and stay transitive through owners that do not repaint. Optimistic cyclic moves cannot block rendering before server refusal.cases[].beforeandcases[].afterin the visual-run resource contract. The existing export mechanism embeds captures for unopened cases too; no export-specific collector is added.Relation to the experiment
This uses the Solid 2 experiment and its assessment at dfd113f as behavioral references. Hidden-in-place summary folds, retained search editors, shared
lf-shotinspection, indexed/off-document diff preparation, and logical versus visible focus already exist on main. They remain intact and are not new work here. Solid’s lifecycle/error adapters and upstream adaptations are unnecessary for Lit.Public widget API exports and record/draft formats are unchanged. The branch inherits main’s protocol 20; this work needs no protocol bump. Lit, SignalWatcher, AsyncDirective, native computed selections, keyed templates and WebAwesome remain.
Validation
GitHub
relay,reviewandtestchecks pass oncdc3b672aaba6f43069af0711434177f5b20b94a; the automated reviewer approved that exact head without findings.Local validation includes
pnpm run check(134 framework/build tests, 528 runtime tests and 85 Worker tests), every pre-commit gate, and focused real-browser selections covering offline export, search retention, stale image loads, parent ordering, widget lifetime, frozen thread widgets and input attribution. A separate seven-case selection exercises all three search routes, keyboard-reference retention, menu dismissal, version navigation and copying a link.Regression cases distinguish native DOM completion from held proof, follow-up updates, idle intermediaries, supersession/disconnection and late failures. Retention checks assert search focus before
fill()and wait for native stale-image load events before checking that current captures survive. Offline checks decode all four images, switch cases, use the keyboard comparison slider and observe no HTTP requests with networking disabled. Existing Chromium/WebKit iframe document and selection-retention cases pass.Desktop-light and 390×844 dark-touch journeys exercise decision/undo, On me, and comment/reply search round trips with identical editor nodes, draft values and caret positions. Both have zero console errors and no horizontal overflow. The menu/reply defect was reproduced on main before the fix.
After integrating main at
783d3c150, the complete local check and applicable pre-commit gates pass again. A served startup comparison against that main uses 46 code requests (44 JavaScript) on both sides through widget upgrade and first server presentation. The candidate adds 1,820 code bytes, including 1,682 JavaScript bytes; all loaded bytes increase by 1,919. Both have zero startup layout shifts and console errors. Total requests vary from 51 to 53 because of polling; the single heavily loaded run is not timing evidence. The added code coordinates native completion on the path where another renderer needs that DOM.The final visual sweep covers the shipped review example and focused search fixture, with Chromium/WebKit retention checks. It does not establish full-corpus, Firefox, print or physical mobile-keyboard behavior.
The resulting Lit implementation is a net improvement in correctness and ownership: it removes numeric ordering and the redundant annotation proof wait, keeps one native completion producer, and fixes concrete export, menu and reentrancy failures. No timing improvement is claimed; native completion adds necessary waiting only where a consumer actually needs that DOM.