Skip to content

test(core): layout starts read back from the browser allow round-off - #10188

Merged
cixzhang merged 1 commit into
meta:mainfrom
vjeux:test/animated-layout-start-round-off
Nov 6, 2026
Merged

cixzhang merged 1 commit into
meta:mainfrom
vjeux:test/animated-layout-start-round-off

Conversation

@vjeux

@vjeux vjeux commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

Maintainer impact

One animated-layout case fails on CI by round-off: "a swap whose parts ride the glide starts them with the glide, on the start read for the change, however late in its frame the change is made". In #9699's pr-interaction (2/2), animatedLayout.interaction.browser.spec.ts:1013 reported "Expected: 63.79999999998836, Received: 63.79999999998835". The code writes the change's start into animation.startTime, and layoutStartFor returns the same number. But the case reads the start back from the browser, which keeps it in its own units:

  • Chromium converts it to seconds and back: (63.79999999998836 / 1000) * 1000 is 63.79999999998835, CI's value.
  • WebKit rounds it to the microsecond: it reads 63.8.

The block case at line 949 ("a change made after a block that follows an earlier layout motion…") has the same exposure: it compares a start read back with a performance.now() reading it can equal.

Intended invariant

What each case checks is unchanged: the glide and the copy start on the change's start, and a change after a block starts after the block. No product code changes, and no timeout or retry changes.

Change

  • Lines 1013 and 1014 compare to six digits: toBeCloseTo(run.startedAt, 6) allows a difference under 5e-7 ms.
  • Line 949 lets the start sit 5e-7 ms below the clock reading.

Both tolerances stay at round-off scale. A bound of a few units in the last place would fail WebKit's microsecond rounding.

Evidence

Every commit below is evidence, not for landing.

  • Failure before / success after, on a probe that writes CI's start and reads it back:
    • ca6d85c271 (main plus the probe, exact compare) fails 3 of 3 in each engine, with the values above.
    • 7eac81c8fa (the probe with this change's compare) passes 3 of 3 in each engine.
  • The tolerances still catch a wrong start:
    • 5fdc599df4 starts every layout animation 0.1 ms late. The swap case fails 3 of 3 in each engine.
    • dac0908315 starts a change after a block on the timeline's held frame time, the regression the block case guards. It fails 3 of 3 in each engine, starting about 1000 ms early.
    • 76cb9be7c6 starts it 0.1 ms early. The swap case fails 3 of 3 in Chromium. The one-sided block case still passes 3 of 3 per engine: its change starts over 0.1 ms after the block.
  • Product/runtime behavior verified unchanged: a test-only change.
  • CI impact: none; no workflow changes.

Scope

  • 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

Two animated-layout cases compared a start time read back from the
browser with a number the page holds. The browser keeps a start time in
its own units: Chromium converts it to seconds and back, and WebKit
rounds it to the microsecond. So the read back can differ by round-off.
CI read 63.79999999998835 for 63.79999999998836 in "a swap whose parts
ride the glide starts them with the glide, ...". That case now compares
to six digits. "a change made after a block that follows an earlier
layout motion ..." now lets its start sit 5e-7 ms below the clock
reading. A start 0.1 ms off still fails the swap case, and a start on
the pre-block frame time fails the block case.
@vercel

vercel Bot commented Nov 6, 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 6, 2026 12:29am UTC

Request Review

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

astracat-bot Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 6, 2026, 12:36 AM UTC

@github-actions

github-actions Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · afa60a0

Storybook · Sandbox · built from this PR's head

Package size: measured; main has no measurement of the merge base to compare yet.

API changes: cli +14 · ~5 · −0 (against the merge base's committed report)

Committed API report behind this build: cli 19 rows, core 23 rows; run pnpm api:report.

19 API changes (advisory)
Package Where Signature Usage
+ cli ./api · Types · type SearchResultEntry deprecated?: ComponentDeprecation | undefined import type {SearchResultEntry} from '@astryxdesign/cli/api'; const x: SearchResultEntry = {deprecated: …}
+ cli ./authoring · Types · interface ComponentDeprecation interface ComponentDeprecation import type {ComponentDeprecation} from '@astryxdesign/cli/authoring'
+ cli ./authoring · Types · interface ComponentIconSlotDoc interface ComponentIconSlotDoc import type {ComponentIconSlotDoc} from '@astryxdesign/cli/authoring'
+ cli ./authoring · Types · interface ComponentIconSlotStateDoc interface ComponentIconSlotStateDoc import type {ComponentIconSlotStateDoc} from '@astryxdesign/cli/authoring'
+ cli ./authoring · Types · interface MultiComponentDoc deprecated?: ComponentDeprecation import type {MultiComponentDoc} from '@astryxdesign/cli/authoring'; const x: MultiComponentDoc = {deprecated: …}
+ cli ./authoring · Types · interface SingleComponentDoc deprecated?: ComponentDeprecation import type {SingleComponentDoc} from '@astryxdesign/cli/authoring'; const x: SingleComponentDoc = {deprecated: …}
+ cli ./doc · Types · interface ComponentBaseDoc deprecated?: ComponentDeprecation import type {ComponentBaseDoc} from '@astryxdesign/cli/doc'; const x: ComponentBaseDoc = {deprecated: …}
+ cli ./doc · Types · interface SubComponentDoc deprecated?: ComponentDeprecation import type {SubComponentDoc} from '@astryxdesign/cli/doc'; const x: SubComponentDoc = {deprecated: …}
+ cli ./doc · Also exported from an earlier entry point · ComponentDeprecation ComponentDeprecation (./authoring) import {ComponentDeprecation} from '@astryxdesign/cli/doc'
+ cli ./doc · Also exported from an earlier entry point · ComponentIconSlotDoc ComponentIconSlotDoc (./authoring) import {ComponentIconSlotDoc} from '@astryxdesign/cli/doc'
+ cli ./doc · Also exported from an earlier entry point · ComponentIconSlotStateDoc ComponentIconSlotStateDoc (./authoring) import {ComponentIconSlotStateDoc} from '@astryxdesign/cli/doc'
+ cli ./template · Also exported from an earlier entry point · ComponentDeprecation ComponentDeprecation (./authoring) import {ComponentDeprecation} from '@astryxdesign/cli/template'
+ cli ./template · Also exported from an earlier entry point · ComponentIconSlotDoc ComponentIconSlotDoc (./authoring) import {ComponentIconSlotDoc} from '@astryxdesign/cli/template'
+ cli ./template · Also exported from an earlier entry point · ComponentIconSlotStateDoc ComponentIconSlotStateDoc (./authoring) import {ComponentIconSlotStateDoc} from '@astryxdesign/cli/template'
~ cli ./api · Functions · function search function search: (query: string, options?: { cwd?: string | undefined; type?: "template" | "component" | "hook" | "theme" | "doc" | undefined; limit?: number | undefined }) => Promise<SearchResponse> → function search: (query: string, options?: { cwd?: string | undefined; type?: "template" | "component" | "doc" | "theme" | "hook" | undefined; limit?: number | undefined }) => Promise<SearchResponse> import {search} from '@astryxdesign/cli/api'; search(…)
~ cli ./authoring · Types · interface MultiComponentDoc theming?: { container?: boolean; targets: ComponentThemingTarget[]; vars?: ComponentThemingVar[]; derived?: ComponentThemingDerivedVar[] } → theming?: { container?: boolean; targets: ComponentThemingTarget[]; vars?: ComponentThemingVar[]; derived?: ComponentThemingDerivedVar[]; componentIcons?: ComponentIconSlotDoc[] } import type {MultiComponentDoc} from '@astryxdesign/cli/authoring'; const x: MultiComponentDoc = {theming: …}
~ cli ./authoring · Types · interface SingleComponentDoc theming?: { container?: boolean; targets: ComponentThemingTarget[]; vars?: ComponentThemingVar[]; derived?: ComponentThemingDerivedVar[] } → theming?: { container?: boolean; targets: ComponentThemingTarget[]; vars?: ComponentThemingVar[]; derived?: ComponentThemingDerivedVar[]; componentIcons?: ComponentIconSlotDoc[] } import type {SingleComponentDoc} from '@astryxdesign/cli/authoring'; const x: SingleComponentDoc = {theming: …}
~ cli ./doc · Types · interface ComponentBaseDoc theming?: { container?: boolean; targets: ComponentThemingTarget[]; vars?: ComponentThemingVar[]; derived?: ComponentThemingDerivedVar[] } → theming?: { container?: boolean; targets: ComponentThemingTarget[]; vars?: ComponentThemingVar[]; derived?: ComponentThemingDerivedVar[]; componentIcons?: ComponentIconSlotDoc[] } import type {ComponentBaseDoc} from '@astryxdesign/cli/doc'; const x: ComponentBaseDoc = {theming: …}
~ cli ./doc · Types · interface SubComponentDoc theming?: { container?: boolean; targets: ComponentThemingTarget[]; vars?: ComponentThemingVar[]; derived?: ComponentThemingDerivedVar[] } → theming?: { container?: boolean; targets: ComponentThemingTarget[]; vars?: ComponentThemingVar[]; derived?: ComponentThemingDerivedVar[]; componentIcons?: ComponentIconSlotDoc[] } import type {SubComponentDoc} from '@astryxdesign/cli/doc'; const x: SubComponentDoc = {theming: …}

Not run on this PR: add ci:run-visual, ci:run-a11y or ci:run-rtl to run them.


Generated by PR Enrichment workflow | View full report

@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. It runs once the pull request is marked ready for review and a maintainer adds the ci:run label.

The tolerances stay at round-off scale. Chromium reads 63.79999999998836 back as 63.79999999998835, as CI reported, and both cases pass at this head. A start moved by 1 µs still fails the swap case, and a start kept on the frame before the block still fails the block case.

[Automated review]

@vjeux
vjeux marked this pull request as ready for review November 6, 2026 00:48
@cixzhang cixzhang added the ci:run A maintainer lets this outside contributor's pull request run CI (AST-030 FR17) label Nov 6, 2026
@cixzhang
cixzhang marked this pull request as draft November 6, 2026 00:52
@cixzhang
cixzhang marked this pull request as ready for review November 6, 2026 00:52
@cixzhang
cixzhang merged commit e895770 into meta:main Nov 6, 2026
194 of 205 checks passed
@vjeux
vjeux deleted the test/animated-layout-start-round-off branch November 6, 2026 02:19
cixzhang added a commit to vjeux/astryx that referenced this pull request Nov 6, 2026
cixzhang added a commit that referenced this pull request Nov 7, 2026
…tracking hook, extended for Lab's TabBar, and a tab-bar string joins the catalog (#9699)

* chore(lab): Lab's animator hook, over Core's internal touch entry

Internal entries land with their first user, per #8562. Lab
components, TabBar first, animate with Core's motion engine and read
the touch presentation and the writing direction as Core does.
`@astryxdesign/core/internal/touch`, which already carries the pan
recognizer, its hook, the engine and the rubber band for Lab's refresh
control (#9807), gains by name:

- `useTouchPresentation` and `TOUCH_QUERY`, the finger-or-mouse decision
  in render and outside it;
- `isRtlElement`, the writing direction a pan mirrors by;
- UIKit's `UIKIT_GESTURES` table.

The engine's factory is renamed from `createMotionAnimator` to
`createMotionEngine` at its source and in every internal caller, with its
types `MotionEngine` and `MotionEngineOptions` (the engine's `Animator`
and `AnimatorOptions`), so the engine and the public `createAnimator`
differ by more than one word (architecture:react-component-runtime INV13).

Named re-exports of code already on main, plus that rename: no behavior
changes, no public docs, no root re-export, and the
`@astryx/no-core-internal-import` lint rule already limits the entry to
Core and Lab. The entry's tests check it re-exports the same values Core
imports by path and carries no public factory's name; the touch-support
bundle test keeps every Lab-only name out of the root entry.

One Lab module those components share comes with them:
`internal/useMotionEngine`, a stable motion engine bound to an element
through a callback ref. Lab's refresh control now uses it in place of its
own identical `RefreshControl/useMotionAnimator.ts`.

* chore(core): Core's internal touch entry re-exports the action-group tracking hook, extended for Lab's TabBar, and a tab-bar string joins the catalog

Re-exports only on the entry: @astryxdesign/core/internal/touch adds
useActionGroupTracking and its options type. So Lab's TabBar presses
through the hook AlertDialog uses: a second finger ends the press with
nothing acting, and focus follows the lift.

The hook gains options for a group that draws its own highlight. All are
optional, and without them the hook runs as before, so AlertDialog does
not change. A no-paint option leaves the highlight to the group. Press
callbacks report the action under the press as it begins and after each
move, the lift before its action runs, and a cancel.

Core's message catalog gains TabBar's badged-tab name. It lands ahead of
the Lab component, so the Lab batch changes only Lab. The entry stays
outside the public API: no docs, no root re-export, and the
@astryx/no-core-internal-import rule keeps it to Core and Lab.

* Merge branch 'main' into c09/core-touch-entry-lab-animator

* Merge the updated lower stack branch into tabbar/core-touch-entry

* Merge main (#9754 landed) into tabbar/core-touch-entry

# Conflicts:
#	packages/core/src/internal/touch.test.ts
#	packages/core/src/internal/touch.ts

* Merge main into tabbar/core-touch-entry

# Conflicts:
#	packages/core/src/hooks/useActionGroupTracking.ts

* Merge main into tabbar/core-touch-entry

# Conflicts:
#	packages/core/src/internal/touch.test.ts
#	packages/core/src/internal/touch.ts

* Merge main into the TabBar lab entry branch (#10188 landed)

* Merge main into tabbar/core-touch-entry

# Conflicts:
#	packages/core/src/internal/touch.ts

* Merge main into tabbar/core-touch-entry

# Conflicts:
#	packages/core/src/internal/touch.test.ts
#	packages/core/src/internal/touch.ts

* Merge main into tabbar/core-touch-entry

# Conflicts:
#	packages/core/src/internal/touch.ts

* Merge branch 'main' into tabbar/core-touch-entry

* Merge main into tabbar/core-touch-entry

* Merge main into tabbar/core-touch-entry

Co-authored-by: Cindy Zhang <[email protected]>
cixzhang added a commit that referenced this pull request Nov 7, 2026
… and press tracking (#9700)

* chore(lab): Lab's animator hook, over Core's internal touch entry

Internal entries land with their first user, per #8562. Lab
components, TabBar first, animate with Core's motion engine and read
the touch presentation and the writing direction as Core does.
`@astryxdesign/core/internal/touch`, which already carries the pan
recognizer, its hook, the engine and the rubber band for Lab's refresh
control (#9807), gains by name:

- `useTouchPresentation` and `TOUCH_QUERY`, the finger-or-mouse decision
  in render and outside it;
- `isRtlElement`, the writing direction a pan mirrors by;
- UIKit's `UIKIT_GESTURES` table.

The engine's factory is renamed from `createMotionAnimator` to
`createMotionEngine` at its source and in every internal caller, with its
types `MotionEngine` and `MotionEngineOptions` (the engine's `Animator`
and `AnimatorOptions`), so the engine and the public `createAnimator`
differ by more than one word (architecture:react-component-runtime INV13).

Named re-exports of code already on main, plus that rename: no behavior
changes, no public docs, no root re-export, and the
`@astryx/no-core-internal-import` lint rule already limits the entry to
Core and Lab. The entry's tests check it re-exports the same values Core
imports by path and carries no public factory's name; the touch-support
bundle test keeps every Lab-only name out of the root entry.

One Lab module those components share comes with them:
`internal/useMotionEngine`, a stable motion engine bound to an element
through a callback ref. Lab's refresh control now uses it in place of its
own identical `RefreshControl/useMotionAnimator.ts`.

* chore(core): Core's internal touch entry re-exports the action-group tracking hook, extended for Lab's TabBar, and a tab-bar string joins the catalog

Re-exports only on the entry: @astryxdesign/core/internal/touch adds
useActionGroupTracking and its options type. So Lab's TabBar presses
through the hook AlertDialog uses: a second finger ends the press with
nothing acting, and focus follows the lift.

The hook gains options for a group that draws its own highlight. All are
optional, and without them the hook runs as before, so AlertDialog does
not change. A no-paint option leaves the highlight to the group. Press
callbacks report the action under the press as it begins and after each
move, the lift before its action runs, and a cancel.

Core's message catalog gains TabBar's badged-tab name. It lands ahead of
the Lab component, so the Lab batch changes only Lab. The entry stays
outside the public API: no docs, no root re-export, and the
@astryx/no-core-internal-import rule keeps it to Core and Lab.

* feat(lab): TabBar, iOS 26's floating tab bar, with its selection lens and press tracking

TabBar shows an app's top-level sections as iOS 26's floating capsule above
the bottom edge, with a selection lens that slides to the chosen tab. Each
TabBarItem has an icon, a label and an optional badge. Under a finger, on
iOS and Android alike, the lens moves on the springs measured from UIKit on
iOS 26.2: it lifts into glass as a finger lands, follows a finger dragged
across the tabs and settles on the tab nearest the lift, while the bar
flexes. A pen in the touch presentation does the same. Under a fine
pointer a press is a plain button press: a click chooses a tab and the lens
follows the theme's motion. Sliding off the bar cancels: a press lifted off
it chooses nothing. Choosing the selected tab again is reported apart, so a
screen can return to its root.

Core's action-group tracking owns the press, in the touch presentation
only: the tab under it, running that tab at the lift, a second finger's
cancel and focus after the lift. TabBar draws the lens. With no tab
selected there is no lens, so a held finger paints the tab under it. A tab
names the panel it controls through panelId, rendered as aria-controls.

TabBar's UIKit values live beside it in uikitTabBar.ts, each with its
source, and uikitTabBar.test.ts checks that every value names one. Core's
gesture and motion pieces come through Core's internal touch entry.

* Merge branch 'main' into c09/core-touch-entry-lab-animator

* Merge the updated lower stack branch into tabbar/core-touch-entry

* Merge the updated lower stack branch into tabbar/lab-bar-lens

* Merge main (#9754 landed) into tabbar/core-touch-entry

# Conflicts:
#	packages/core/src/internal/touch.test.ts
#	packages/core/src/internal/touch.ts

* Merge the updated lower stack branch into tabbar/lab-bar-lens

* Merge main into tabbar/core-touch-entry

# Conflicts:
#	packages/core/src/hooks/useActionGroupTracking.ts

* Merge the updated lower stack branch into tabbar/lab-bar-lens

* Merge main into tabbar/core-touch-entry

# Conflicts:
#	packages/core/src/internal/touch.test.ts
#	packages/core/src/internal/touch.ts

* Merge the updated lower stack branch into tabbar/lab-bar-lens

* Merge main into tabbar/lab-bar-lens

# Conflicts:
#	packages/lab/src/index.ts

* Merge main into the TabBar lab entry branch (#10188 landed)

* Merge the updated lower stack branch into the TabBar branch (own diff unchanged)

* Merge main into tabbar/core-touch-entry

# Conflicts:
#	packages/core/src/internal/touch.ts

* Merge the updated lower stack branch into tabbar/lab-bar-lens

* fix(lab): TabBar's finger paint fades on the compositor

With no tab selected, a held finger paints its tab, and the paint fades
after the lift on the theme's exit duration and curve. The fade was a
background-color transition, which runs on the main thread. The paint is
now a layer, and only its opacity fades, so the compositor runs the fade
through a main-thread block. Its timing is unchanged: at once on the
touch, then the theme's exit duration and curve at the lift, within
200 ms under Reduce Motion.

Also: TabBar calls itemWidthCss directly, the test-only nearestIndex is
gone (the shared tracker decides the tab a lift commits), and the Reduce
Motion case cites design:reduced-motion DR2.

* Merge main into tabbar/core-touch-entry

# Conflicts:
#	packages/core/src/internal/touch.test.ts
#	packages/core/src/internal/touch.ts

* Merge the updated lower stack branch into tabbar/lab-bar-lens

* Merge main into tabbar/core-touch-entry

# Conflicts:
#	packages/core/src/internal/touch.ts

* Merge the updated lower stack branch into tabbar/lab-bar-lens

# Conflicts:
#	packages/lab/src/index.ts

* Merge branch 'main' into tabbar/core-touch-entry

* Merge the updated TabBar base branch (main merged) into the TabBar presentation branch

* Merge main into tabbar/core-touch-entry

* Merge the updated lower stack branch into tabbar/lab-bar-lens

* Merge branch 'main' into tabbar/lab-bar-lens

* test(lab): TabBar's spring cases name the motion each hold judges

Main's interaction harness now requires every hold sent from a test
to name the motion it judges. Each TabBar case names what it samples
after the hold:
- the keyed slide: the lens body's and the lens copy's translate;
- the finger landing: the capsule's scale, the lens body's scale and
  translate, and the lens clip's ::before opacity;
- the lift: the capsule's and the lens body's scale;
- the selection storyboard: the lens body's translate.

* Merge main into tabbar/core-touch-entry

* Merge the updated lower stack branch into tabbar/lab-bar-lens

Co-authored-by: Cindy Zhang <[email protected]>

This branch was successfully deployed

1 active deployment
Preview — afa60a0e Deployed Nov 6, 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) 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