Skip to content

Read the busy fade on the animation's clock rather than on a deadline from the press - #241

Merged
max-sixty merged 1 commit into
mainfrom
fix/ci-33726571939
Sep 3, 2026
Merged

max-sixty merged 1 commit into
mainfrom
fix/ci-33726571939

Conversation

@leaf-agent

Copy link
Copy Markdown
Collaborator

Problem

The nightly leg of ci failed on run 33726571939 (e71fa11) with ten cases. Nine are already owned by open PRs — four by #236 (test_a_widgets_label_takes_a_comment_inside_the_control_it_labels, test_a_selection_around_a_targets_buttons_does_not_deaden_them, test_a_closed_leaf_clears_itself_off_the_tray, test_the_leaves_tray_takes_the_keyboard), four by #239 (test_every_passage_in_a_real_page_can_be_quoted[feature-gallery], both parameters of test_ask_addresses_follow_the_feature_gallery_s_visible_margin_controls, test_the_shipped_long_thread_opens_beside_its_source_in_the_right_margin), and the ring walk by #239's ship-review precondition ahead of #236 and #240. The tenth is unowned and is what this takes: test_render_widgets.py::test_a_wait_the_reader_would_notice_says_so_and_a_short_one_says_nothing, first seen on this run and absent from the three nightlies before it (33722764498, 33718675826, 33714432132).

AssertionError: a wait worth noticing said nothing: [0.702361, 0.642718, 0.583432, 0.523789, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5]

The test took performance.now() just before the press and asked that every frame past 400ms had settled at 0.5. The rule it reads is [aria-busy="true"] { animation: … 140ms linear 200ms both; } — 340ms in all — but that clock starts at the first frame the busy attribute is painted in, not at the press. #inFlight sets the attribute synchronously and then renders the controls and updates the margin in the same task, so the animation's start time is the first frame after all of that. Measured here, the fade begins at 233ms and completes at 383ms: 17ms inside the deadline. The reported sample is that whole timeline slipped about 120ms, which is what a loaded nightly worker costs — the frames past 400ms are still mid-fade rather than absent.

Solution

Read the fade on the rule's own clock. Each sampled frame now records the animation's currentTime and playState beside the opacity. The delay is the frames before currentTime reaches 150ms, including the ones before the animation exists at all; the fade is the frames the animation itself reports finished. Both halves of the claim survive intact — nothing paints while the wait is too short to notice, and the wait that is long enough ends at 0.5 — and neither is a deadline the machine has to beat. This is tests/CLAUDE.md's A wait consumes a fact the system states applied to a reading that was inferring from elapsed time, using the getAnimations() route that section names.

The sampling window goes 500ms → 700ms so a start that slips still leaves frames on the far side of the fade; it is a bounded setTimeout inside the page, not an awaited animation.finished.

Testing

uv run pytest tests/test_render_widgets.py --run-nightly is green on this branch (82 passed) and uv run pytest tests was green (808 passed, 6 skipped) on the commit the run failed on. ruff check and ruff format at the pinned v0.16.1 pass on the changed file.

Not vacuous, checked from both sides against the rule in chrome-style.js:

The two negations
rule changed to what fails
… 140ms linear 0ms both (delay removed) the wait was announced before it was one: {1, 0.94, 0.88, …} — the early half
selector changed so nothing matches a wait worth noticing said nothing: [] — the late half
The frame samples, before and after

Sampled locally under three spinning cores, on the original wall clock (ms since t0, opacity):

(200.3, 1), (217.0, 1), (223.8, 0.999939), (240.5, 0.940296), … (357.1, 0.523868), (373.7, 0.5), (390.5, 0.5), (407.1, 0.5)

The fade runs 223→383. The assertion's threshold is 400, so the margin the reading had was one frame. On the animation's clock the same run reads currentTime 0 at the frame the attribute paints in, 200 where the fade starts and 340 where it ends and holds — the same numbers the rule is written with.

Worth a maintainer's eye rather than a fix here: about 120ms of main thread between the press and the frame the busy attribute paints in is a lot for SUGGESTION_PAGE, which is a small fixture. #inFlight calls #renderControls and this.#margin?.update() after setting the attribute, and the animation cannot start until both have finished. The rule is designed for exactly the heavy-page case, so it still does the right thing for the reader — but the cost is the layer's, and it is not visible from any assertion that reads the rule alone.


Automated fix for failed run

test_a_wait_the_reader_would_notice_says_so_and_a_short_one_says_nothing
timed its samples from performance.now() taken just before the press and
asked that every frame past 400ms had settled at 0.5. The rule is 200ms of
delay and 140ms of fade, but that clock only starts at the first frame the
busy attribute is painted in, and the press does the layer's own work —
control render, margin update — before that frame arrives. Locally the fade
lands at 383ms, 17ms inside the deadline; on the nightly runner the first
frame is about 120ms late and the samples past 400ms are still mid-fade.

Each frame now records the animation's own currentTime and playState beside
the opacity. The delay is read as the frames before currentTime reaches
150ms, including the ones before the animation exists, and the fade as the
frames the animation itself reports finished, so the reading consumes a fact
the page states rather than a deadline it has to beat.
@max-sixty
max-sixty merged commit dca452b into main Sep 3, 2026
3 checks passed
@max-sixty
max-sixty deleted the fix/ci-33726571939 branch September 3, 2026 09:48
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