Skip to content

Keep inline diff errors visible after reconnect - #3527

Merged
leaf-agent merged 1 commit into
mainfrom
fix/ci-39682247234-inline-diff-reconnect
Oct 22, 2026
Merged

leaf-agent merged 1 commit into
mainfrom
fix/ci-39682247234-inline-diff-reconnect

Conversation

@leaf-agent

Copy link
Copy Markdown
Collaborator

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).

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
leaf-agent merged commit 84fb29a into main Oct 22, 2026
4 checks passed
@leaf-agent
leaf-agent deleted the fix/ci-39682247234-inline-diff-reconnect branch October 22, 2026 04:06
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant