Skip to content

test(SnapPaging): a held row's stops hold through a retarget - #10927

Merged
cixzhang merged 3 commits into
meta:mainfrom
vjeux:snap-paging-held-stops-retarget-case
Nov 17, 2026
Merged

cixzhang merged 3 commits into
meta:mainfrom
vjeux:snap-paging-held-stops-retarget-case

Conversation

@vjeux

@vjeux vjeux commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

The pager fix landed in #10592, so after this merge of main this pull request holds only its test.

Maintainer impact

Nothing in the browser guards the held row's stop and span fix where it shows. It shows in a row that resizes while the paging holds it, and settles on. Without that fix, the settle misses its stop in both engines. This case moved here from #10592 to keep that pull request under 2,000 lines. It needs #10592's retarget, so it rebases to this case alone once #10592 merges. Until then, this pull request's diff also shows #10592's commit; review the top commit.

Intended invariant

spec:AST-094 FR6's resize rule, with component:Carousel FR7: a held row's retargeted settle ends on its view's layout stop.

Change

One browser case, run in both directions. A drag of 70% of a view and a still lift settle a row of three per view onto its second view. Once two frames show the settle, the page narrows the row by 30 px. The new settle's last keyframe must sit on the view's layout stop, within 0.002 px. Each WebKit run adds the settle's speed times the gap between the stop item's rect and style reads. WebKit resolves each read at its own time, and a gap over a frame fails by name. So does a page that shows the whole settle before the narrowing.

Evidence

  • Failure before the change: a NOT-FOR-LANDING arm (6295988) runs the case over SnapPaging's code before its held-stop fix. It fails every run, 10 of 10 per engine.
  • Success after the change: every run passes (Testing).
  • Product/runtime behavior verified unchanged: no product file changes.
  • CI impact: none; no workflow, action or CI script changes.

Scope

Components: SnapPaging

  • 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

  • The runs ran at 1 worker: Chromium on two pinned cores, WebKit on the CI WebKit job's command. This head (f9d7e57) merges main (3e58ae0) and changes no product file, so its case runs on main's pager, as fix(core): a resize during a pager's settle keeps where it was heading #10592 landed it.
  • This head: 10 of 10 per engine, five per direction. The whole SnapPaging spec passes: Chromium 50 with 5 skips, WebKit 55.
  • A build of d167b64, an earlier head of fix(core): a resize during a pager's settle keeps where it was heading #10592: 10 of 10 per engine, five per direction.
  • A build of 00ed0cf, fix(core): a resize during a pager's settle keeps where it was heading #10592 before its rebase onto main, has the same pager and SnapPaging files. On it, 10 runs per direction: Chromium idle, Chromium with two busy loops, and WebKit all end within 0.0007 px of the stop.
  • Mutation-sensitive proof: each NOT-FOR-LANDING commit removes one of the fix's stop rules, 5 runs per direction per engine.
    • the held stops keeping the children's translate (96fbeab): 0 of 10 pass in either engine.
    • the held stops adding the animator's position (79f84c1): 0 of 10 pass in either engine.
    • a right-to-left row taking the translate off backward (bd49e49): right to left fails 5 of 5 in both engines; left to right passes.
  • Report-only WebKit at 3 CPUs, on the same earlier build: 20 of 20 at 1 worker. At 16 workers, 15 of 16; the other run failed by name, still settling at the narrowing.

vjeux added 2 commits November 9, 2026 16:00
A resize that renumbered a children pager's pages mid-settle left the
settle on its old index, which then named another page: a row of three
per view narrowed mid-settle ran back to the page it had left. A resize
mid-settle also ended the settle at once, with a jump to the new page.

When the spacings between pages all scale by one ratio, as when items
or uniform pages follow the row's width, each page keeps its number
and the settle keeps its fraction of a page. Otherwise the settle
retargets by offset and plays on from where the track shows, at its
velocity. A settle toward the last page ends on the last page, a
target halfway between two pages goes on the way the settle moves, and
the page last at rest keeps its place too. The retarget reads the track
before the pages are measured, as measuring a held row can end its
curves, and starts the new curve at that read's time. A release's
waiting report still goes out two frames after the new settle starts,
and a finger's waiting catch still catches it. A new writing direction
mirrors the track, so a settle in flight then stops and re-places on
its target's offset, as does a track the resize leaves past its new
last page. A finished settle rests exactly on its curve's end.
A row of three per view settling onto its second view is narrowed by
30 px once two frames show the settle. In both directions, the
retargeted settle must end on the view's layout stop: within 0.002 px,
plus, in WebKit, the settle's speed times the gap between the stop
item's rect and style reads. Without the held row's stop and span fix,
the settle misses its stop in both engines.
@vercel

vercel Bot commented Nov 10, 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 17, 2026 4:13pm UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 10, 2026
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 10, 2026
@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · f9d7e57

Storybook · Sandbox · built from this PR's head

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

Not run on this PR: add ci:run-visual for Visual, ci:run-rtl for RTL.


Generated by PR Enrichment workflow | View full report

@astracat-bot

astracat-bot Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 17, 2026, 4:25 PM UTC

@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.

This pull request needs an engineering owner's spec decision before it can be approved, and two changes are required either way.

Approval waits on the spec:AST-094 FR6 resize rule this diff carries from #10592. The rule says a resize during a pager settle retargets it; pages that scale with the row keep the page and its fraction; otherwise a settle toward the last page ends there, and any other ends on the page nearest its target's offset, a tie going the way it moves. It also adds an FR6 gap and an "FR6 resize" verification row. An engineering owner records the decision by commenting /approve-spec <full head SHA> on this pull request, and the author may do so as an engineering owner.

Required changes:

  • The changeset says a resize mid-settle "no longer stops at once", but a resize that leaves the row past its new last page still lands it at once, as this pull request's own tests assert. Reword it, for example: "…no longer runs back to an earlier page and, unless the resize leaves it past its new last page, no longer stops at once."
  • The diff has 2,105 authored changed lines, and 1,917 of them are #10592's commit. Add Stack: #10592 → #10927 to both descriptions, or land #10592 first and rebase so only the browser case remains.

The new unit cases fail on main and pass here. A narrowed three-per-view row now ends at its new end instead of running back. CI has not run on this draft head yet.

[Automated review]

Comment thread packages/core/src/hooks/usePager.ts Resolved
Comment thread packages/core/src/hooks/usePager.ts Resolved
@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Nov 17, 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, because the pull request is a draft on a fork branch. Once it is marked ready for review, a maintainer adds the ci:run label so CI runs.

The new case checks the current FR6 resize rule and passes 10 of 10 in Chromium, ending 0.00075 px from the stop, and it fails against each of the three held-stop mutants in the directions it covers.

  • Miss (non-blocking): WebKit's tolerance (speed * pairGap, with the gap capped at one frame) can reach about 3.4 px at this settle's speed, more than the 2.0 px and 2.9 px misses two of the mutants produce, so consider capping the gap well under a frame, or dropping the allowance now that the held stop reads its translate on both sides of the rect.
Claims and files checked

Review mode: full; reason: spec-record

  • Claim: the pager fix has landed, so the diff holds only the test. Verified: one test file, 188 added lines.
  • Claim: no browser case guarded a held row's stops through a resize retarget. Verified: the other resize and held-finger cases cover other paths.
  • Claim: without the held-stop fix the settle misses its stop. Verified at this head in Chromium with three one-line mutants (misses of 2.0 to 104 px); the author's pre-fix arm was not rerun.
  • Claim: the case was split from the pager pull request to keep it under 2,000 lines. Consistent with the branch history.
  • Claim: the case checks the FR6 resize rule with Carousel FR7's stops. Verified against both clauses.
  • Claim: one case, run in both directions. Verified.
  • Claim: a 70% drag with a still lift settles the three-up row onto its second view. Verified in the case and its runs.
  • Claim: the row narrows by 30 px once two frames show the settle. Verified.
  • Claim: the new settle's last keyframe sits within 0.002 px of the stop. Verified: 0.00075 px measured.
  • Claim: WebKit adds the settle's speed times the rect-to-style read gap, and a gap over a frame fails by name. Verified in the code; see the note on its size.
  • Claim: a page that shows the whole settle before the narrowing fails by name. Verified.
  • Claim: no product, CI, public API or internal-context change. Verified.
  • Claim: this head passes 10 of 10 per engine. Verified in Chromium; WebKit not reproduced.
  • Claim: the whole spec passes, Chromium 50 with 5 skips and WebKit 55. Verified in Chromium (50 passed, 5 skipped); WebKit not reproduced.
  • Claim: the mutants fail (two in both engines, the right-to-left one only right to left). Verified at this head in Chromium; WebKit not reproduced.
  • Claim: runs on earlier builds, under busy loops and at 16 WebKit workers. Author-run; not reproduced.
  • File: packages/core/src/SnapPaging/__tests__/SnapPaging.interaction.browser.spec.ts: clear, one non-blocking note.

Automated review (maintainer link)

Comment on lines +1634 to +1640
let bound = 0.002;
if (browserName === 'webkit') {
expect(
pairGap,
"the stop's item's rect and style reads lie within a frame (ms)",
).toBeLessThanOrEqual(1000 / 60);
bound += speed * pairGap;

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.

Non-blocking: with pairGap capped at one frame, this WebKit bound can reach about 3.4 px at the settle's measured 0.204 px/ms. That is more than the 2.0 px and 2.9 px misses that the held-stops-keep-the-translate and right-to-left-backward mutants produce at this head in Chromium. The pager's heldRead now reads the translate on both sides of the rect and reads again when they differ, so a split read no longer reaches the stop. Consider capping the gap well under a frame (for example 2 ms), or dropping the allowance if WebKit holds 0.002 px without it, and updating the comment above.

@vjeux
vjeux marked this pull request as ready for review November 17, 2026 16:32
@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 17, 2026
@vjeux
vjeux marked this pull request as draft November 17, 2026 16:35
@vjeux
vjeux marked this pull request as ready for review November 17, 2026 17:17
@cixzhang
cixzhang merged commit da1d07b into meta:main Nov 17, 2026
209 of 213 checks passed
@vjeux
vjeux deleted the snap-paging-held-stops-retarget-case branch November 17, 2026 18:31

This branch was successfully deployed

1 active deployment
Preview — f9d7e57c Deployed Nov 17, 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