Repository navigation
test(harness): busyWindowProof reads a slow tail inside a fast window locally - #9233
Conversation
… locally
A spring settling through a busy window moves 3.6 px a frame on average but
about 1.7 in its tail, on a 1 px cast grid. There a frame delivered early can
show no step, and the next carries two frames of motion: a 2 px catch-up. The
allowance for a run of unchanged frames only accepted a catch-up under 1.5
steps, which assumes motion under one step a frame, so the run counted as a
miss and the proof failed ("moved on 61 of the 62 frames the control moved",
"longest stall 28.8 ms, longer than the control's 25.8 ms").
Where the component moved under two steps a frame over the four frames just
before a run, the change that ends the run may now carry the motion of every
frame the run held at that pace, to the nearest step. The slowing-curve rule
(a run at most one frame longer than the run before it) still applies, so a
two-frame freeze in a slow tail and a repeated frame in a fast window still
fail. The "under two steps" note is read over four frames at a time and names
each slow stretch, so a slow tail inside a fast window shows.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report🔎 Preview ·
|
There was a problem hiding this comment.
Changes requested: the slow-tail allowance fixes the recorded spring run, but it also passes a two-frame freeze that directly follows one credited early frame (positions 50, 50, 54, 54, 54, 59 at 1.75 px a frame, with the control moving on every frame). main fails that case, and the description says such a freeze still fails. Limiting the new branch in underStep to one unchanged frame when the pace is at least one step a frame, (pace < stepPx || unchanged <= 1), makes that case fail while the recorded fixture and the existing unit cases still pass; please add it as a regression test, and move slowStretches above busyWindowProof's doc comment, which the helper now detaches from the function.
[Automated review]
| const shown = | ||
| catchUp < 1.5 * stepPx || | ||
| (pace != null && | ||
| pace < 2 * stepPx && | ||
| catchUp <= (unchanged + 1) * pace + stepPx); |
There was a problem hiding this comment.
This branch also credits a two-frame freeze right after one credited repeat. The slowing-curve rule allows unchanged = 2 once the previous run had one repeat, and the catch-up limit (2 + 1) * pace + stepPx admits it. For example, positions 50, 50, 54, 54, 54, 59 at 1.75 px a frame, against a control that moves every frame, pass here and fail on main. At one step a frame or more, an early delivery can hide only one frame, so consider:
(pace != null &&
pace < 2 * stepPx &&
(pace < stepPx || unchanged <= 1) &&
catchUp <= (unchanged + 1) * pace + stepPx)With this, that case fails, the recorded slow-tail fixture still passes, and all 95 harness unit cases pass. A regression case for it would pin the claim that a two-frame freeze still fails.
There was a problem hiding this comment.
Fixed in a9d3255 with your condition: at one step a frame or more the allowance now credits only a one-frame run (pace < stepPx || unchanged <= 1), so a credited early frame cannot let the next run hold two. Your case (50, 50, 54, 54, 54, 59 at 1.75 px a frame against a control moving on every frame) is a unit case and fails; the recorded slow-tail run and the other 95 harness cases still pass. slowStretches now sits above busyWindowProof's doc comment, so the contract is attached again.
| * `maxMedianFrameMs`, when given, still applies; `minMovedFraction` and the | ||
| * absolute stall, frame and motion limits do not. | ||
| */ | ||
| /** |
There was a problem hiding this comment.
Inserting slowStretches here puts its doc block between busyWindowProof's doc comment (lines 364-450) and export function busyWindowProof. TypeScript attaches only the last doc block before a declaration, so busyWindowProof now has no documentation in editor quick info (0 characters, against 5,076 on main). Moving slowStretches above line 364 keeps the contract attached.
…a slow tail At one step a frame or more, an early delivery hides only the frame it lands on, so the slow-tail allowance now credits a run of one unchanged frame there. Before, the slowing-curve rule let the run after a credited early frame hold two frames, and the catch-up limit admitted it: positions 50, 50, 54, 54, 54, 59 at 1.75 px a frame passed against a control that moved on every frame. That case is a unit test now, and fails. `slowStretches` moves above `busyWindowProof`'s doc comment, which it had detached from the function.
There was a problem hiding this comment.
Changes requested: the follow-up fixes the two-frame freeze at one step a frame and reattaches busyWindowProof's doc, but under one cast step a frame the new branch still credits a two-frame freeze that ends in a three-step catch-up. For example, positions 32, 32, 33, 33, 33, 36 at 0.8 px a frame (or 64, 64, 66, 66, 66, 72 at 1.6 px a frame on a 2 px grid), with the control moving on every frame, pass here and fail on main. Capping that catch-up at two steps, (pace < stepPx ? catchUp < 2.5 * stepPx : unchanged <= 1) in place of (pace < stepPx || unchanged <= 1), makes both fail while the recorded fixture, every single-early-frame case and the existing busy unit cases still pass; please add the 0.8 px case as a regression test. The doc and comment at busy.ts:473-474 and :810-814, the belowStep and componentStallMs docs, and the summary label still describe the old one-step rule.
[Automated review]
| (pace != null && | ||
| pace < 2 * stepPx && | ||
| (pace < stepPx || unchanged <= 1) && | ||
| catchUp <= (unchanged + 1) * pace + stepPx); |
There was a problem hiding this comment.
Under one cast step a frame this gate does not apply, so the only limit on the catch-up is (unchanged + 1) * pace + stepPx, a full step over the run's motion. At 0.8 px a frame on a 1 px grid, positions 32, 32, 33, 33, 33, 36 (honest frames 33, 34, 35, 36) pass here against a control moving on every frame and fail on main: one early frame adds at most one step, so this is a two-frame freeze. Capping the catch-up at two steps there keeps the fixture and every single-early-frame case passing:
(pace != null &&
pace < 2 * stepPx &&
(pace < stepPx ? catchUp < 2.5 * stepPx : unchanged <= 1) &&
catchUp <= (unchanged + 1) * pace + stepPx)There was a problem hiding this comment.
Fixed in 0d6acba with your cap: under one step a frame an early frame adds at most one step, so the catch-up there stays under 2.5 steps (pace < stepPx ? catchUp < 2.5 * stepPx : unchanged <= 1). Your 0.8 px case (32, 32, 33, 33, 33, 36) and the 2 px-grid one (64, 64, 66, 66, 66, 72) are unit cases and fail, one early frame at that pace still reads as moved, and the recorded slow-tail run still passes. The doc and comment you pointed to, the belowStep and componentStallMs docs and the summary label now describe the rule as it is.
| * step too, so the change may carry the motion of every frame the run held | ||
| * at that pace, to the nearest step. The run also has to read as a slowing | ||
| * curve, at most one frame longer than the component's run before it. A freeze ends in a | ||
| * catch-up of more than one step, a stall in a frame-counted animation is |
There was a problem hiding this comment.
This still says a freeze ends in a catch-up of more than one step, while the README now says "more than that"; the file header asks the two to match. The comment at lines 810-814, the belowStep and componentStallMs docs (144-152) and the summary label at 964 ("under one cast step a frame") describe the same old rule.
…e step to a catch-up Under one cast step a frame the slow-tail allowance limited a run's catch-up only by the run's motion plus a step, so a two-frame freeze that ended in a three-step catch-up passed: positions 32, 32, 33, 33, 33, 36 at 0.8 px a frame (or 64, 64, 66, 66, 66, 72 at 1.6 px on a 2 px grid), with the control moving on every frame. An early frame hides one frame's motion, so there the catch-up is now under 2.5 steps. Both cases are unit tests and fail; one early frame at that pace still reads as moved, and the recorded slow-tail run still passes. The docs, the comment and the summary label now describe the rule as it is.
There was a problem hiding this comment.
Recommending approval: both earlier findings are fixed (a two-frame freeze under one cast step a frame now fails, and the field docs and summary label describe the new rule), the recorded slow-tail run passes, and every new freeze case fails. One optional follow-up: the README's busy-main-thread section and busyWindowProof's doc state the pace allowance but not its two limits (only a one-frame run at one step a frame or more, and a catch-up under 2.5 steps below one), which the code comment at busy.ts:856-862 spells out; a sentence in each would explain why a two-frame run at 1.5 px a frame still fails.
[Automated review]
Maintainer impact
busyWindowProoffailed a spring that settles through a busy window: the frames were all there, but the proof counted a freeze ("moved on 61 of the 62 frames the control moved", "longest stall 28.8 ms, longer than the control's 25.8 ms"). A component proof that judges an easing or spring animation through a blocked main thread can fail this way on any runner.Intended invariant
busy.ts's verdict, as the README states it: a frame with no new position counts as moved only where the cast cannot show the motion on every frame; a freeze still fails.Change
busyWindowProof's doc state both.Evidence
busy.test.tsreplays the recorded run (busy.slowtail.fixture.ts: the spring's and the control's frames from one Chromium run). With main'sbusy.tsthe proof fails both checks.busy.test.tsandbusy.control.test.tscase; the harness unit cases pass (97).CI=1,LP_NUM_THREADS=4, one worker) ×10: 50 of 50 passed.busy.tsgave 42 of 50 there in an earlier session). The failure is in a test this change does not reach, and no frame in it was credited by the allowance: frames the main thread committed before the block reach the screen inside it on two starved cores, so the rAF control showed new positions on 2 frames where the test expects at most 1.LP_NUM_THREADS=3, so the software compositor's threads match the cap) the screencast delivers frames 100 to 250 ms apart, and most runs fail on main and here alike (per test, main: 10, 2, 10, 10, 8 of 10 failed; here: 10, 4, 9, 10, 4): a limit of the starved runner, not a pass.Scope
Testing
pnpm exec vitest run --project node internal/interaction-harnessharness.interaction.browser.spec.ts, in Chromium and throughinternal/interaction-harness/scripts/webkit-container.mjs.Local gates at 0d6acba: prettier and strict eslint on the changed files, the harness typecheck, the harness unit cases (97 passed, the recorded slow-tail replay among them), and the five busy-main-thread self-tests under the WebKit CI job's own profile (50 of 50). The whole harness spec passed at f907c0e in Chromium (77) and WebKit (65 passed, 12 skipped).