Repository navigation
fix: retain bound diff errors across reconnect - #3987
Merged
Merged
Conversation
Deliver bound values before a widget decides whether to update, so a diff can skip an unchanged source without losing its subscription. The shared failure lifecycle still clears a refusal on the next real draw. Extend the reconnect regression to cover recovery on new bound data and interrupted bound preparation. Release the held parser before awaiting updateComplete, which now includes asynchronous drawing after #3982. Closes #3986
This was referenced Oct 25, 2026
leaf-agent
added a commit
that referenced
this pull request
Oct 25, 2026
The datum-navigation fixture loaded its patch from a bound source after the page presented. Its first drawing moved the Context paragraph down 137px before the navigation gesture, so shift-watch teardown failed even though the navigation assertions passed. Use an inline patch, whose initial renderer reserves the drawing's geometry, to keep this test focused on a visible datum interrupting pending thread motion. The competing `navigateToDatum` call and focus/viewport assertions remain unchanged. The original focused test reproduced the reported 137px shift on current main; the revised test passes at normal speed and with Chromium CPU throttled 6×. No watch credit or tolerance changes. This follows the diff's existing first-paint behavior in `packages/diff/initial/lf-diff.js` and `packages/diff/styles/theme.css`. It changes only the fixture, without reverting #3987's bound-value update gating or changing source delivery behavior. Closes #4096 — automated triage Co-authored-by: leaf-agent <[email protected]>
leaf-agent
added a commit
that referenced
this pull request
Oct 25, 2026
…te (#4103) A bound diff could move the paragraph below it by 355px after Leaf reported its initial presentation complete. Lit leaves `hasUpdated` false after an update skips drawing while data is unread, so the first signal-driven retry could start without a presentation ticket. Its asynchronous `updateComplete` then held no barrier. `LeafElement` now claims each connected update at its draw gate when it has no existing ticket. This preserves the asynchronous drawing guarantee introduced in #3982 while retaining the bound-value gating in #3929 and #3987. The external resolution behavior and shift tolerances are unchanged. The new runtime regression fails before the fix and passes afterward. The reported browser case reproduces the 355px shift before the fix and passes afterward, both normally and with 6× CPU throttling. The data-readiness failure case, all 562 runtime tests, and `pnpm run check` pass. Rebuilt the committed kernel. A served `worktree-diffs` comparison against the base loads the same 53 code requests through upgrade and initial server presentation, with 107 additional code bytes (17 JavaScript bytes) and no layout shifts in either arm. The added claim makes readiness wait for drawing already underway; it adds no resource dependency. Closes #4097 — automated triage Co-authored-by: leaf-agent <[email protected]>
leaf-agent
added a commit
that referenced
this pull request
Nov 4, 2026
… updates (#5346) `lf-diff` lost its whole-patch refusal on updates that changed nothing it draws. The diff showed the refusal through `LeafElement`'s light-DOM failure box, which `LeafElement.update()` removes on every update, while `lf-diff` draws, and fails, asynchronously from `updated()`. #3527 and #3987 kept the refusal by gating `shouldUpdate` on a changed source, and #4800 added the Comment opener to that gate, so a thread surface registering beside a refusal (on load for an inline patch, on return for a bound one) cleared it again. The refusal now stands as the diff's shadow stage, as its drawn files do, so only the next `show` replaces it: a corrected source, or a rendering a departure cut short. The `shouldUpdate` override and its opener bookkeeping are gone. `render()` still reads the opener, so a surface registering or retiring redraws the Comment controls, which `updated()` reconciles as before. Page layout can't see into a shadow stage, so the runtime's stage failure placer (`shadow-stage.js`) marks the host `data-lf-failed` until the next stage replaces the box. The `layouts.css` rules that give a failed widget the prose measure and drop its reserved `data-height` read it beside a light `.lf-error`. That also covers `lf-file-editor`, `lf-file-tree`, and a bound diff that fails after drawing, whose failure boxes already stood in the stage unseen by those rules. Verification: - `test_a_patch_that_failed_stays_failed_when_its_diff_returns` (inline and bound) passes; it now reads the refusal from the shadow root. - `test_a_widget_that_failed_soft_claims_no_room` gains a refused-diff case, which fails without the `layouts.css` change and passes with it. - Diff comment-control, preparation-on-return, retry, plain-host and native-metadata tests pass, as do `pnpm run test:runtime` (777) and `pnpm run check:browser`. - `test_a_diff_refresh_keeps_a_selection_in_unchanged_lines` fails identically on the previous head without this change. Other tests that read a diff's refusal from light DOM now read the shadow root, including two in `tests/journeys/test_render_anchors.py` that weren't run here. Closes #3986 — automated triage --------- 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.
A reconnect cleared a bound diff's completed refusal even though its source was unchanged:
LeafElement.update()removed the error box, thenlf-diff.updated()correctly skipped parsing the same source. The diff now skips the whole update for unchanged evidence. Leaf delivers bound properties beforeshouldUpdate, allowing that gate to read the current value while retaining its subscription to later deliveries. Interrupted preparation still retries, and a corrected bound patch replaces the refusal.The reconnect regression fails on main and passes here. Extended coverage checks recovery after a new bound value, interrupted preparation for both inline and bound patches, and retained finished rows. The held-parser test now releases its response before awaiting completion, preserving #3982's guarantee that
updateCompleteincludes asynchronous drawing. The runtime test checks gating on delivered values and subsequent delivery after a skipped draw.Validation: five focused browser cases pass;
pnpm run checkpasses, including all 559 runtime tests and the Worker checks. Rebuilt the committed kernel. A servedworktree-diffscomparison against4f51fe9fe50ad8d418cafcb5e78397b1604387bdreaches presentation with the same 53 code requests (50 JavaScript requests), 61 additional JavaScript bytes, and no layout shifts in either arm. The added code puts delivery before the update decision; it adds no resource dependency.Closes #3986 — automated triage