Repository navigation
fix: stage a diff's refusal in its shadow stage instead of gating its updates - #5346
Conversation
#4800 made the thread surface's Comment opener a second input to `lf-diff`'s update gate, so drawn files gain or lose Comment controls without a reparse. A surface registering on load, or registering again when the diff returns to the page, changed the opener beside a refusal too: the update went through, `LeafElement.update()` removed the error box, and `updated()` correctly skipped re-rendering the unchanged source. Inline diffs never showed their refusal, and bound diffs lost it on reconnect. Only drawn files offer Comment, so the opener now opens the gate only while files are committed. A refusal stands until new evidence or an interrupted rendering redraws it; drawn files still follow the surface. Both variants of test_a_patch_that_failed_stays_failed_when_its_diff_returns fail on main and pass here; bisect between #3987 and main names #4800's merge as the first failing commit. Closes #3986
|
@leaf-agent This adds another refusal-specific
|
|
Done in 80b8425. The refusal now stands as the diff's shadow stage, so only the next One consequence needed a shared fix: the |
`lf-diff` drew its whole-patch refusal through `LeafElement`'s light-DOM failure box, which every update removes, so it kept a `shouldUpdate` gate to skip updates that would clear it. The refusal now stands as the diff's shadow stage, as its files do, so only the next `show` replaces it, and the gate and its Comment-opener bookkeeping go. `render()` still reads the opener so registration and retirement redraw the controls. Page layout can't see into a shadow stage, so the stage's failure placer marks the host `data-lf-failed`, and the rules that give a failed widget the prose measure and lift its reserved height read it beside a light `.lf-error`. This also covers lf-file-editor, lf-file-tree and a bound diff that fails after drawing, whose boxes already stood in the stage. Tests that read a diff's refusal now read it from the shadow root, and the failed-widget room test gains a refused-diff case.
eae9837 to
80b8425
Compare
lf-difflost its whole-patch refusal on updates that changed nothing it draws. The diff showed the refusal throughLeafElement's light-DOM failure box, whichLeafElement.update()removes on every update, whilelf-diffdraws, and fails, asynchronously fromupdated(). #3527 and #3987 kept the refusal by gatingshouldUpdateon 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
showreplaces it: a corrected source, or a rendering a departure cut short. TheshouldUpdateoverride and its opener bookkeeping are gone.render()still reads the opener, so a surface registering or retiring redraws the Comment controls, whichupdated()reconciles as before.Page layout can't see into a shadow stage, so the runtime's stage failure placer (
shadow-stage.js) marks the hostdata-lf-faileduntil the next stage replaces the box. Thelayouts.cssrules that give a failed widget the prose measure and drop its reserveddata-heightread it beside a light.lf-error. That also coverslf-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_roomgains a refused-diff case, which fails without thelayouts.csschange and passes with it.pnpm run test:runtime(777) andpnpm run check:browser.test_a_diff_refresh_keeps_a_selection_in_unchanged_linesfails 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.pythat weren't run here.Closes #3986 — automated triage