Skip to content

Read the interaction gallery's on-screen state from the observer's latest record - #871

Merged
max-sixty merged 1 commit into
mainfrom
fix/ci-35490092549-gallery
Sep 20, 2026
Merged

max-sixty merged 1 commit into
mainfrom
fix/ci-35490092549-gallery

Conversation

@leaf-agent

Copy link
Copy Markdown
Collaborator

nightly on main went red at 41d012d on two independent browser cases (run 35490092549). This is the second: test_the_interaction_gallery_drives_real_widgets waited for the gallery to report Playing and read Ready for five seconds. The gallery reads whether it is on screen from the first record of an IntersectionObserver delivery rather than the last, so one stale record settles it as off screen for the rest of the page's life.

([entry]) => { onScreen = entry.isIntersecting; … } takes the oldest record in the delivery. A delivery carries every record accumulated since the previous one, and only its last says where the gallery is now. Nothing follows to correct a wrong answer, because the observer reports crossings rather than a state: the flag keeps a position the gallery has already left until it crosses that boundary again, and a gallery standing still in front of the reader never does. The callback now reads the last record.

threshold: 0.2 goes with it. The flag was read as isIntersecting, true for a single visible pixel, so the declared ratio governed nothing and only added deliveries at a boundary nobody read — a second reading of the same fact, free to disagree with the deliveries maintaining it. Whether any of the gallery is in view is the question playback asks, and that is now the boundary the observer reports. No behaviour moves with it.

That Ready names the off-screen state is #770's finding on this same surface: on screen, the task that writes Ready goes on to call play(), which sets playing synchronously, so the browser never paints it. CI polled Ready seven times across its wait, so the flag stood false for all of it. The gallery's own arrival supplies the crossings that make it false — under a throttled CPU the observer delivers [true, 0.267] at the fragment position, [false, 0] as the page settles, then [true, 0.841] once the semantic arrival pass scrolls to it — and Chromium coalesces records for a single target when the main thread is busy between two rendering updates, which a direct probe on a plain page reproduces as a delivery of [[true, 0.5], [false, 0]]. Coalescing the last two arrival crossings leaves the flag on false.

That interleaving would not come out of this host, which is quieter than CI's two-worker runner, so test_the_interaction_gallery_reads_where_it_is_now states the delivery shape rather than waiting for it: it arrives with the gallery off screen, carries each observer record into the delivery after it, and scrolls the gallery into view. Against main the status stays at Ready, the reading CI reported; with this change it reaches Playing.

The first failure in that run, a response-surface case with an unrelated cause, is in a separate PR.

…test record

A delivery carries every record the observer accumulated since the last one, and only its last says where the gallery is now. Read at the first, the flag kept a position the gallery had already left, and since the observer reports crossings rather than a state nothing came afterwards to correct it. The threshold goes with it: the flag was read as isIntersecting, so the declared ratio governed nothing.
@max-sixty
max-sixty merged commit cd75fdf into main Sep 20, 2026
4 checks passed
@max-sixty
max-sixty deleted the fix/ci-35490092549-gallery branch September 20, 2026 17:37
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