Repository navigation
Keep inline diff errors visible after reconnect - #3527
Merged
Merged
Conversation
Inline patches are authored once. Their readingPaint owns retries when a departure cuts rendering short; the Lit reconnect update has no source to redraw and was clearing a retained parse error. Settle the presentation claim through LeafElement.shouldUpdate but skip that empty inline update after first draw. The existing inline and bound reconnect cases in test_render_diff_controls fail before this change and pass after it.
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.
An inline diff with an invalid patch kept its parse error until it left and rejoined the page. Lit's reconnect update then cleared the failure box even though the authored patch had not changed, and the error disappeared. This change lets the base element settle its presentation claim while skipping that empty Lit update for an inline diff after its first draw. The inline reader still retries work a departure interrupted; bound diffs continue to update from delivered data.
The existing inline and bound reconnect regression cases failed before this change and both pass after it (
uv run pytest -q tests/browser/test_render_diff_controls.py::test_a_patch_that_failed_stays_failed_when_its_diff_returns).