Skip to content

test(Item): the swipe's busy proof judges a held release by its curve - #11735

Merged
cixzhang merged 5 commits into
meta:mainfrom
vjeux:uikit/swipe-busy-held-release
Nov 15, 2026
Merged

cixzhang merged 5 commits into
meta:mainfrom
vjeux:uikit/swipe-busy-held-release

Conversation

@vjeux

@vjeux vjeux commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Maintainer impact

Item's "a release settles on the compositor" proof fails about 1 run in 40 in WebKit:

  • Armed after a flick, the block began 50 to 120 ms into the settle, too late for a fast settle.
  • WebKit's capture switches between about 37 and 75 fps, and the judge read sub-step tail frames as misses.
  • The controls date a frame in 2 px blocks, 3.3 ms of their travel, so an early-dated anchor made the next frame read as held.

Intended invariant

Unchanged: the row settles on the compositor through a main-thread block (spec:AST-094 FR5). FR5's verification row now counts a frame interval as a miss only when the curve moves a full capture step since the last new position. No timeout, retry or skip.

Change

  • The test adds the ahead control and arms the block before a held release past half the open width: one 936 ms curve every run.
  • blockMainThread replays the caught animation for a marker riding its element (rides); busyWindowProof, a shared judge, places it from the cast. It predicts in WebKit too, where a frame predicted under one capture step is too little to judge.
  • Two verniers at four times the controls' speed, half a leg apart, date each frame to a quarter of their reading error. A frame neither dates keeps their time; the proof counts each kind. They take the viewport's bottom 32 px; markers avoid it.
  • A single window whose settle bound ends judging too soon throws BusyWindowTooLateError when judging on would hold enough.

Evidence

  • Failure before the change: armed after a flick, 9 refusals and 3 reds in 520 WebKit runs. The held release without the new rule, 10 tail reds in 240; with it but no vernier, 3 and 4.
  • Success after the change: WebKit, 240 runs each unloaded and under load, and Chromium, 120 runs: all pass, 0 refusals, all predicted. Of 10,309 judged frames, the vernier dated 9,202, the one ahead 1,107, and the controls none.
  • Known gap: no test judges a flick's settle under a block. 14 of 240 WebKit flicks met the settle bound 60 to 89 ms into judging, with 3 to 5 control frames. "a flick hands the row’s velocity, the finger’s, to the settle" covers the velocity-seeded settle.
  • Product/runtime behavior verified unchanged: only tests and the harness change.
  • CI impact: none.

Scope

Components: busyWindowProof, Item's swipe spec, spec:AST-094 FR5.

  • No intended public API, product behavior, visual direction, or policy change.
  • Product changes discovered during the work were removed or split.
  • Public text and artifacts contain no internal Meta context.

Testing

  • pnpm exec vitest run --project node internal/interaction-harness: 18 files, 327 tests pass. The three rider tests fail against the previous busy.ts. The 75 fps tail passes, with 3 or more tail frames under one step. A full-step hold fails. A replay that travels twice as far falls back by name.
  • A pooled test of a short travel that settles early inside an on-time block passes. Against the previous judge, it fails as "0 of 3 runs judged".
  • The vernier tests: it gives the exact time on the right leg 10 ms from a turn, and nothing within a few px of one. There, the vernier ahead gives a frame its exact time. A proof with both counts the judged frames each dated, and none fall back. On a recorded WebKit run, the proof fails without the vernier ("moved on 11 of the 12"). It passes with it, and still fails a real one-step hold.
  • pnpm exec tsc --noEmit for internal/interaction-harness and packages/core: no errors.
  • WebKit, unloaded: CI=1 node internal/interaction-harness/scripts/webkit-container.mjs packages/core/src/Item/__tests__/ItemSwipeActions.interaction.browser.spec.ts --workers=1 --repeat-each=240 -g "a release settles on the compositor".
  • WebKit under load: the same command beside 8 busy threads.
  • Chromium: pnpm exec playwright test -c playwright.interaction.config.ts packages/core/src/Item/__tests__/ItemSwipeActions.interaction.browser.spec.ts --project=chromium --workers=1 --repeat-each=120 -g "a release settles on the compositor".
  • Each run's busy prediction and busy vernier annotations give its prediction or fallback and its vernier counts, read from a blob report.
  • The batches ran at this head under the box's one heavy-job lock. Earlier batches ran when that lock didn't cover every job. Light overlaps with other jobs can't be ruled out there, since no container history exists. The 10-minute load average stayed between 3.6 and 9.9 on 40 cores.
  • The pooled proofs with a settle bound ran 3 times each at this head. They are Switch's toggle, track colour and recorded casts, Lightbox's dismissal and page settle, usePager's settle and PageControl's window slide. All pass in Chromium. In WebKit, the toggle, usePager and PageControl proofs skip by their own specs, and the rest pass. The four controls, where a slowed page settle must fail the proof, pass in both engines.

Writing rubric results

The one edit is a sentence in spec:AST-094 FR5's verification row.

R1 narration: none; the sentence states the judging rule in the present tense.
R2 research: none.
R3 evidence: the row names no pull request, issue or commit.
R4 rejected alternatives: none added.
R5 change references: none.
R6 open questions: none touched.
R7 project status: none.

Public and internal API delta

None public. In the internal harness: BlockedWindow.animation gains an optional rides. BusyWindowTooLateError gains controlFrames and controlFramesWithoutSettle when a settle bound ends judging. startBusyControl and trackControl take vernier, and with ahead too, the vernier ahead. busyWindowProof and pageTimesOnControls take vernier and vernierAhead frames, and the proof returns vernier counts. vernierTime, vernierColor, VERNIER_CONTROL_RGB, VERNIER_AHEAD_CONTROL_RGB, ControlTimesOptions, VernierDating, BusyFrameDating and BusyVernierRead are new exports.

  • Size: +1,515/−122 lines in 7 files: busy.ts +650/−67, its tests +514, and a recorded WebKit run as a fixture +260. Item's spec is +46/−10, and AST-094 +45/−45 (one sentence; prettier re-pads the table). No product code.

The release-settles proof armed blockMainThread after a flick, so the
block began 50 to 120 ms into the settle. A fast settle then came within
its settle bound before the control moved on enough frames, and the
judge named that starvation. The test now arms the block before the
gesture and plays a held release past the middle of the open width,
which settles from rest on the same curve every run. A flick's settle
starts at the release velocity, which the touch timing varies, and its
fastest approaches come within the bound too soon to judge at WebKit's
capture rate.

busyWindowProof, a shared judge, changes in two ways. It throws
BusyWindowTooLateError when a settle bound ends judging that soon and
judging on to the block's end would hold enough of the control's
frames, as a held curve that ends too soon already does. And a frame
interval counts as a miss only when the animation's own curve moves at
least one capture step across it. The replay now serves a marker that
rides the caught element and places itself from the cast, so it
predicts in WebKit too. AST-094's FR5 verification row says so.
@vercel

vercel Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Nov 14, 2026 6:40pm UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 14, 2026
@astracat-bot

astracat-bot Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 14, 2026, 6:49 PM UTC

@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 14, 2026
@github-actions

github-actions Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · 92c7e5c

Storybook · Sandbox · built from this PR's head

Modified components

Component Size LoC Visual · A11y · RTL
Item · Storybook 20.3 kB (0) · 6.0 kB CSS (0) 949 (0) ✓ · ✓ · —

Package size: no published package changed; no new dependencies.

Touched components checked; for the full suites, add ci:run-visual for Visual, ci:run-rtl for RTL.


Generated by PR Enrichment workflow | View full report

@cixzhang

Copy link
Copy Markdown
Contributor

/approve-spec 9bad492

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Nov 14, 2026

@astracat-bot astracat-bot Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested: the Item test rework and the owner-approved FR5 verification row look right, but one change in the shared busy-proof judge breaks pooled proofs.

  • The new settle-bound BusyWindowTooLateError in judgeBusyWindow (internal/interaction-harness/src/busy.ts, lines 3113-3138) also runs for each run of pooledBusyProof, so a starved but on-time run of a short travel is dropped as "began too late" and a pool that passes today can fail (the pooled Switch toggle, Lightbox dismiss and paging, usePager and PageControl proofs use a settle bound); raise it only from busyWindowProof's single-window path, or skip it for pooled runs, and add a pooled test whose short travel settles inside an on-time block.

Until that is fixed, the description's "CI impact: none" does not hold. Optionally, the FR5 sentence would match the harness more exactly as "since the last frame that showed a new position", because a hold whose sub-step moves add up to one step still fails.

Claims and files checked
  • Item's proof fails about 1 run in 40 in WebKit: unverified, the author's WebKit batches
  • Armed after a flick, the block began 50 to 120 ms into the settle: the base test arms after a flick (verified); the timing is the author's
  • WebKit's capture switches between about 37 and 75 fps, and the judge read sub-step tail frames as misses: verified in the recorded fixture's 26.7 and 13 ms intervals and the 75 fps tail test, which falls back on the base judge
  • FR5's invariant is unchanged and its verification row adds the miss rule: verified, spec.md:1118
  • No product code changes; no timeout, retry or skip: verified, no packages/*/src file outside a test
  • The test arms the block before a held release past half the open width: verified, ItemSwipeActions spec :1093-1097 (0.6 × the open width)
  • The held release settles on one 936 ms curve every run: the fixture uses 935.9 ms; the real-run claim is the author's
  • The ahead control dates each frame for the prediction: verified, spec :1082, :1103, :1113 and busy.ts:2241-2250
  • The replay serves a marker that rides its element, placed from the cast, so it predicts in WebKit: verified, busy.ts:1159-1194, :1338-1340, :1850-1864, :2228-2238 and the rider tests
  • A settle bound that ends judging too soon throws the too-late error when judging on would hold enough frames: verified, busy.ts:3113-3138 and the new control test
  • An annotation names each run's prediction or fallback: verified, spec :1120-1124
  • Batch results before and after (WebKit and Chromium run counts, reds, refusals): unverified, the author's runs; CI has not run at this head
  • Each remaining red is one held 53 to 57 ms frame across which the curve moved a full step: unverified, the author's runs
  • Known gap: no test judges a flick's settle under a block: verified, the held release is the spec's only blocked run
  • CI impact: none: false, the settle-bound error changes pooled proofs' verdicts (the blocking finding)
  • Harness unit tests: 17 files, 317 tests pass, and the three rider tests fail against the previous judge: verified; the new control test fails against it too
  • The 75 fps tail passes, a full-step hold fails, and a replay that travels twice as far falls back by name: verified, the three rider tests
  • tsc --noEmit for the harness and Core: no errors: verified, both exit 0
  • The batches ran at an earlier commit that differs from this head only in comments, a named fallback and a rebase: verified, that commit's patch differs only in comments and the more-than-one-marker split
  • Internal API delta: optional rides, and controlFrames and controlFramesWithoutSettle on the too-late error: verified, busy.ts:747 and :3133-3134
  • Size +437/−71 in 5 files: verified, numstat
  • Writing rubric: one present-tense sentence with no references or project status: verified, the FR5 row text
  • docs/specs/AST-094-touch-presentations/spec.md: clear; owner-approved; optional wording note
  • internal/interaction-harness/src/busy.ts: finding, the settle-bound too-late error breaks pooled proofs
  • internal/interaction-harness/src/busy.control.test.ts: clear; no pooled case for the new error
  • internal/interaction-harness/src/busy.predicted.test.ts: clear
  • packages/core/src/Item/__tests__/ItemSwipeActions.interaction.browser.spec.ts: clear; the flick-under-block case is replaced, as disclosed

Automated review (maintainer link)

The settle-bound guard sat in judgeBusyWindow, which pooledBusyProof
also calls for each run. So a pooled run of a short travel that came
within its settle bound early threw BusyWindowTooLateError. The pool
then left it out as late, and a pool that passes failed as "0 of 3 runs
judged". Only a single window throws now. A pooled run adds its few
frames to the pool, as before the guard.
FR5's verification row states the judging rule as the harness applies
it: a frame interval counts as a miss only when the animation's own
curve moves at least one capture step since the last frame that showed
a new position. A hold whose sub-step moves add up to one step still
fails. busyWindowProof's description says the same.
The slow controls date a WebKit frame to within about 3.75 ms: the cast
often reads a box in 2 px blocks, which is 3.3 ms of their travel. In a
settle's tail that rough time can read an anchor early. A frame that
shows exactly its curve's position then counts as held.

startBusyControl's vernier runs four times as fast on the first
control's timeline, in a strip at the viewport's foot. With ahead too,
it starts the vernier ahead, half its leg ahead in the strip above.
busyWindowProof takes their frames as vernier and vernierAhead. Each
frame the slow controls read takes the vernier's time where its two
legs are told apart (vernierTime), else the time of the one ahead. A
frame neither dates keeps the slow controls' time. The proof's vernier
and its notes count the judged frames each vernier dated, and say how
each miss and its anchor were dated. A recorded WebKit run whose early
anchor failed the proof passes with the vernier, and a real one-step
hold there still fails. Without a vernier, nothing changes, and a
pooled proof takes none.
The held-release proof starts the vernier and the vernier ahead at the
viewport's foot, clear of the row, and passes them to busyWindowProof.
Each run notes how many judged frames the verniers dated, and how each
miss and its anchor were dated.
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 14, 2026
@cixzhang

Copy link
Copy Markdown
Contributor

/approve-spec 92c7e5c

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Nov 14, 2026

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved pending CI: CI has not run on this head yet. This draft comes from a fork, so a maintainer adds the ci:run label and the pull request is marked ready for review to start it.

The held-release proof, the replay that follows the row's marker and the vernier dating all match the touch-presentations spec's FR5, and the FR5 verification sentence carries an engineering owner's approval for this head. The earlier pooled-proof regression is fixed, and its new test fails on the previous judge and passes now.

Claims and files checked

Review mode: full; reason: spec-record

Claims:

  • About 1 WebKit run in 40 failed when the block was armed after a flick: author's browser batches; not rerun here (no browser run in this review).
  • The block is now armed before a held release past half the open width, one curve every run: verified in the Item swipe spec (0.6 of the open width, block armed before the drag).
  • The replay serves a marker that rides the caught element, is placed from the cast and predicts in WebKit too: verified in the harness and by the three rider tests.
  • Two verniers run at four times the controls' speed, half a leg apart, in the viewport's bottom 32 px: verified in the harness (100 ms leg, 50 ms offset, two 16 px strips).
  • A frame neither vernier dates keeps the slow controls' time, and the proof counts each kind: verified in the harness and the vernier tests.
  • A single window whose settle bound ends judging too soon throws the late-block error, and pooled runs do not: verified by the harness tests at this head.
  • The FR5 verification row counts a miss only when the curve moves a full capture step since the last new position: verified as the row's text and as what the harness does.
  • Only tests, the harness and the record change, with no public API: verified from the file list, the build's test exclusions and a built-surface comparison.
  • The harness suite has 18 files and 327 tests that pass: verified.
  • The three rider tests fail against the previous judge: verified on the base judge.
  • The pooled short-travel test fails on the previous judge with every run dropped as too late: verified on the first commit's judge.
  • The vernier tests date frames exactly away from a turn, defer near one, fail the recorded run without the vernier, pass it with the vernier, and still fail a real one-step hold: verified, all pass at this head.
  • Typecheck is clean for the harness and for Core: verified.
  • Browser batch results (480 WebKit and 120 Chromium runs, frame-dating counts, the other pooled proofs): author-reported; not rerun here.
  • 1,515 lines added and 122 deleted across 7 files: verified.

Files:

  • docs/specs/AST-094-touch-presentations/spec.md: clear (owner-approved sentence; the rest only re-pads the table).
  • internal/interaction-harness/src/busy.ts: clear.
  • internal/interaction-harness/src/busy.control.test.ts: clear.
  • internal/interaction-harness/src/busy.predicted.test.ts: clear.
  • internal/interaction-harness/src/busy.vernier.fixture.ts: clear.
  • internal/interaction-harness/src/busy.vernier.test.ts: clear.
  • packages/core/src/Item/__tests__/ItemSwipeActions.interaction.browser.spec.ts: clear.

Automated review (maintainer link)

@cixzhang cixzhang added ci:run A maintainer lets this outside contributor's pull request run CI (AST-030 FR17) ci:run-a11y Run the accessibility suite on this PR; write access, next push (AST-030 FR12) labels Nov 14, 2026
@vjeux
vjeux marked this pull request as ready for review November 15, 2026 09:16
@cixzhang
cixzhang merged commit 64806d0 into meta:main Nov 15, 2026
152 checks passed
@vjeux
vjeux deleted the uikit/swipe-busy-held-release branch November 15, 2026 10:09

This branch was successfully deployed

1 active deployment
Preview — 92c7e5c2 Deployed Nov 14, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:run A maintainer lets this outside contributor's pull request run CI (AST-030 FR17) ci:run-a11y Run the accessibility suite on this PR; write access, next push (AST-030 FR12) CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants