Skip to content

Stop reporting gallery sample cancellation as an error - #2388

Merged
max-sixty merged 5 commits into
mainfrom
lit-runtime-cleanups
Oct 11, 2026
Merged

max-sixty merged 5 commits into
mainfrom
lit-runtime-cleanups

Conversation

@max-sixty

@max-sixty max-sixty commented Oct 11, 2026 •

Copy link
Copy Markdown
Owner

Closing or navigating away from the gallery while a sample is loading could report sample destroyed as a page failure. Sample cancellation can occur while the old figure remains connected, so the gallery now follows the sample owner's AbortError contract for loading and playback commands, as lf-sample already does.

This is a finishing follow-up to survey item 14, found while verifying the final preview. Runtime source measures 340 → 341 lines (+1, including the cancellation contract comment); the browser regression adds 29 lines.

Validation: the held-allocation departure regression fails before the fix with "Could not play" and a page error, then passes after it. After integration with main, that regression and the phone diff-header journey pass, along with all 336 runtime tests. Independent source and integration reviews found no issues. CI runs the complete landing gates.

CI also exposed a synchronization race in the retry regression introduced by #2365: observing a browser request precedes its Python route callback. The two held retry steps now wait for the collected route through the existing holding helper before reading the attempt count. All count and focus assertions remain; the focused retry journey passes. The diff-controls test module stays 521 → 521 lines.

This was written by Codex on behalf of max-sixty

leaf-agent
leaf-agent previously approved these changes Oct 11, 2026
max-sixty and others added 2 commits October 11, 2026 05:02
Main's vulture hook, which arrived beside #2345, flags it; pluggy passes a hook
implementation only the arguments it names.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent
leaf-agent previously approved these changes Oct 11, 2026
leaf-agent
leaf-agent previously approved these changes Oct 11, 2026
@max-sixty
max-sixty merged commit 921e039 into main Oct 11, 2026
6 checks passed
@max-sixty
max-sixty deleted the lit-runtime-cleanups branch October 11, 2026 13:52
max-sixty added a commit that referenced this pull request Oct 12, 2026
…departure its own error (#2501)

A gallery sample whose document reloaded while the gallery was loading
left the demo on a disabled "Loading…" for good. The gallery had
swallowed every `AbortError` since #2388, and `sample.js` used
`AbortError` both for its owner's own cancellation and for the child
document departing, so the gallery treated a reload as if it had
cancelled the load itself. Nothing ever sent `gallery.configure` to the
reloaded document. The same was true of a reload after loading: the
toggle kept its old word, and pressing it reached an unconfigured child.

**Review item 20 (Lit follow-up round).** What changed:

- `sample.js` now rejects `ready` and calls with `AbortError` only when
the host's owner cancels them (destroy, or a reset replacing the
allocation). When the child document departs, through an authored
navigation or a reload, they reject with a new `SampleDepartedError`. A
call aimed at a document that is gone rejects with the reason its
connection closed, which replaces the mixed "sample unavailable"
`AbortError`, and a child failure that retires the allocation rejects
pending calls with that failure. A departure still leaves the browser's
destination in the frame rather than retiring the allocation. The header
states the contract.
- The interaction gallery configures every document the sample presents:
the first, and each one a reload announces with `loading`. While a
document is gone, the toggle reads "Loading…". Only real failures show
"Could not play".
- `lf-sample` treats a departure as its departed notice already draws
it, and doesn't report it as a failure. `page-authoring.md` names
`SampleDepartedError` and says `lf-sample-ready` fires again after a
reload.

The new browser test reloads the sample document during the gallery's
load and again after it, and plays each time. On `main` it stops at
"Loading…"; here it plays. The native-departure test now expects
`SampleDepartedError` where it expected `AbortError`.

Line deltas (from `git diff --numstat`): hand-written source +99 / −56
(net +43) across `interaction-gallery.js`, `sample.js` and
`lf-sample.js`. Tests +30 / −3 (net +27).

> _This was written by Claude Code on behalf of max-sixty_

---------

Co-authored-by: Claude Opus 5.5 (1M context) <[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.

2 participants