Skip to content

test(BottomSheet): the drag-restyle proof names each oversized restyle's invalidations - #13721

Merged
cixzhang merged 5 commits into
mainfrom
lane2/drag-restyle-evidence
Nov 24, 2026
Merged

cixzhang merged 5 commits into
mainfrom
lane2/drag-restyle-evidence

Conversation

@cixzhang

@cixzhang cixzhang commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Maintainer impact

BottomSheetDragRestyle.interaction.browser.spec.ts fails on some CI runners only: each move of the drag restyles about 51 elements against a limit of 6. The failure prints only element counts, so a maintainer cannot tell what restyled the sheet's content or why. The same drag on a clean Chromium restyles at most 4 elements per move, at 60 Hz and at 30 Hz.

Intended invariant

A move of a touch drag restyles the dialog, its backdrop, the panel and the edge tint, never the sheet's content (the proof's existing limit of 6 elements per recalculation). This PR keeps that limit and its meaning unchanged.

Change

  • internal/interaction-harness/src/trace.ts: traceRendering takes trackInvalidations, which adds the trace category that names each invalidation's node and reason. The new restyleSources(trace, from, to) gives each style recalculation in the window its element count and the style invalidations since the previous one.
  • BottomSheetDragRestyle.interaction.browser.spec.ts: the proof traces with {keepEvents: true, trackInvalidations: true}, reads the drag's restyles through restyleSources, and puts the first three oversized restyles, with the invalidations before each and the sheet's element count, in its failure message; restyle-sources.json keeps every one. It also reports the scrim opacity that the dialog, the sheet and the sheet's first content element compute: the sheet ends that property's inheritance, so a value on the content shows the dialog's per-move writes reaching it. On a failure it also lists every rule and inline style that sets that property on the sheet and on its first content element, or on an ancestor they inherit it from, with its origin, layers and stylesheet, as the DevTools protocol matches them, which names any rule that wins over the reset. These go in the message and in restyle-sources.json, beside the existing rendering events.
  • The element count still decides the pass or fail, not the node an invalidation names: an inherited write on the dialog restyles the content below it, and its invalidation names only the dialog.

Evidence

  • Failure before the change: the CI failure message showed only [51,1,51,1,…].
  • Success after the change: the new unit test fails without restyleSources and passes with it. In Chromium 149 (Playwright 1.61.1) on fd1bd437, the proof passes 20 of 20 runs.
  • Forced failure: with the sheet's two 'initial' custom-property resets removed, the proof fails. restyled alternates 1 and 51 on a 45-element sheet, and each oversized restyle follows the dialog's inline style write. That is the same signature as the CI failures, so the new message shows the mechanism.
  • Product/runtime behavior verified unchanged: only test and harness files change.

Scope

Components: interaction-harness, BottomSheet (test only)

  • 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

  • vitest run internal/interaction-harness/src/trace.restyleSources.test.ts internal/interaction-harness/src/trace.layoutSources.test.ts: 7/7 passed, and the new test was red before restyleSources existed.
  • playwright test --config playwright.interaction.config.ts packages/core/src/BottomSheet/__tests__/BottomSheetDragRestyle.interaction.browser.spec.ts --project=chromium --workers=1 --repeat-each=20 on fd1bd437: 20 passed.
  • On a8322101, the same forced failure ran the failure-only diagnostics without error: scrimOpacity was 1 on the dialog, the sheet and the content, and scrimRules named the dialog's inline write as inherited by the sheet (from: 1) and the content (from: 2). This head lists each declaration once.
  • The same proof with the two resets removed from BottomSheetPanel.tsx ('--_sheet-scrim-opacity': 'initial' and '--_sheet-scrim-duration': 'initial') and Storybook rebuilt: 1 failed, with the message above.

Overlap checked: #8693 (a ContextMenu feature PR that also edits the harness trace module and README; this PR only adds invalidation tracking and restyleSources for the BottomSheet drag proof, with no ContextMenu change)

…e's invalidations

The proof's failures on CI runners showed only element counts. The harness's
rendering trace can now track invalidations, and restyleSources gives each
style recalculation its element count and the invalidations before it. The
proof records them and puts the oversized restyles, with their invalidations,
in its failure message.
@vercel

vercel Bot commented Nov 24, 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 24, 2026 11:52am UTC

Request Review

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

astracat-bot Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 24, 2026, 12:08 PM UTC

@github-actions

github-actions Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · 6dfbb04

Storybook · Sandbox · built from this PR's head

Modified components

Component Size LoC Visual · A11y · RTL
BottomSheet 77.2 kB (0) · 7.8 kB CSS (0) — ✓ · ✓ · —
BottomSheetSwitcher 19.6 kB (0) · 3.4 kB CSS (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-a11y for Accessibility, ci:run-rtl for RTL.


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.

Changes requested: one statement in the description no longer matches the code at this head.

  • The description says the failure message carries every oversized restyle with its invalidations, but the last commit trims the message to the first three (BottomSheetDragRestyle.interaction.browser.spec.ts:212-216), so reword that bullet (all of them stay in restyle-sources.json) and mention the new scrim-rule dump, or restore the full list.

The harness additions read correctly, and the proof's limit and pass criterion are unchanged. CI has not run on this head because the pull request is a draft; it runs once the pull request is marked ready.

Claims and files checked

Review mode: full; reason: no-earlier-review

  • Claim: the proof fails on some CI runners at about 51 restyled elements against a limit of 6. Not verifiable at this head, because no CI run exists. It is consistent with the proof's own comment.
  • Claim: the base failure prints only element counts. Verified: the base message is the bare list of counts.
  • Claim: a clean Chromium restyles at most 4 elements per move at 60 and 30 Hz. This is the author's measurement and was not reproduced.
  • Claim: the limit and its meaning are unchanged. Verified (BottomSheetDragRestyle.interaction.browser.spec.ts:46, :236-239).
  • Claim: traceRendering takes trackInvalidations, which adds the trace category that names each invalidation. Verified (trace.ts:349-359, :377-379).
  • Claim: restyleSources gives each recalculation in the window its element count and the invalidations since the previous one. Verified (trace.ts:287-318 and the new unit test).
  • Claim: the proof traces with both options and reads its restyles through restyleSources. Verified (BottomSheetDragRestyle.interaction.browser.spec.ts:164-185).
  • Claim: the failure message carries each oversized restyle with its invalidations and the sheet's element count. False: :212-216 keeps only the first three.
  • Claim: the proof reports the scrim opacity that the dialog, the sheet and its first content element compute. Verified (:186-200). The element it reads is the Handle, the sheet's first child.
  • Claim: the sheet ends that property's inheritance. Verified (BottomSheetPanel.tsx:395-401).
  • Claim: a failure also writes restyle-sources.json beside the rendering events. Verified (:221-234).
  • Claim: the element count decides pass or fail, not the node an invalidation names. Verified (:40-46, :236-239).
  • Claim: the new unit test fails without restyleSources and passes with it. Verified from the source; the test was not run at this head.
  • Claim: the 20-of-20 run and the forced failure. These are the author's runs at the first commit and were not reproduced at this head.
  • Claim: only test and harness files change, with no public API or product change. Verified: four files change, and the harness package is private.
  • Claim: the two harness test files pass 7 of 7. Not verified at this head.
  • Claim: the overlapping pull request edits the harness trace module and README. Verified.
  • File internal/interaction-harness/README.md: clear.
  • File internal/interaction-harness/src/trace.ts: clear.
  • File internal/interaction-harness/src/trace.restyleSources.test.ts: clear.
  • File packages/core/src/BottomSheet/__tests__/BottomSheetDragRestyle.interaction.browser.spec.ts: the stale description claim above.

Automated review (maintainer link)

@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; it runs once the pull request is marked ready for review.

The description now matches the failure message, and the new walk over inherited declarations reads the protocol's ancestor entries in order, so each entry's from is the right ancestor distance. The proof's limit and pass criterion are unchanged.

  • Optional: the "first content element" the scrim probes read is the sheet's handle bar (BottomSheetPanel.tsx:1301-1309), not its content area, so "first child" in the description and the comments would say what is read.
  • Miss: the forced-failure evidence says the sheet has two 'initial' resets, but the panel sets three (BottomSheetPanel.tsx:399-401), so "two of the panel's three resets" would match the Testing bullet (optional).
Claims and files checked

Review mode: incremental; reason: none

  • changed rules (0): none
  • Claim: the proof fails on some CI runners at about 51 restyled elements against a limit of 6. Not verifiable here, since no CI run of it exists for this pull request; it matches the proof's own comment.
  • Claim: the base failure prints only element counts. Verified: the base message is the bare list of counts.
  • Claim: a clean Chromium restyles at most 4 elements per move at 60 and 30 Hz. The author's measurement; not reproduced.
  • Claim: the limit and its meaning are unchanged. Verified (BottomSheetDragRestyle.interaction.browser.spec.ts:46, :274-278).
  • Claim: traceRendering takes trackInvalidations, which adds the invalidation-tracking trace category. Verified (trace.ts:349-359, :377-379).
  • Claim: restyleSources gives each recalculation in the window its element count and the invalidations since the previous one. Verified (trace.ts:287-318 and the new unit test).
  • Claim: the proof traces with both options and reads its restyles through restyleSources. Verified (:222, :224).
  • Claim: the failure message carries the first three oversized restyles with their invalidations and the sheet's element count, and restyle-sources.json keeps every one. Verified (:245-259, :265-269).
  • Claim: the proof reports the scrim opacity that the dialog, the sheet and its first content element compute. Verified (:225-239); the first child is the handle bar.
  • Claim: the sheet ends that property's inheritance. Verified (BottomSheetPanel.tsx:395-401).
  • Claim: on a failure the proof lists every rule and inline style that sets the property on the sheet, its first child or an ancestor they inherit from, with origin, layers and stylesheet. Verified (:84-163, :244).
  • Claim: these go in the message and in restyle-sources.json, beside the existing rendering events. Verified (:250, :264-269).
  • Claim: the element count decides pass or fail, not the node an invalidation names. Verified (:40-46, :274-278).
  • Claim: the new unit test fails without restyleSources and passes with it. Verified from the source, which imports and pins restyleSources; not run here.
  • Claim: Chromium 149 with Playwright 1.61.1 passes the proof in 20 of 20 runs at an earlier commit. The author's run; the lockfile pins Playwright 1.61.1; not reproduced.
  • Claim: with the resets removed the proof fails, alternating 1 and 51 on a 45-element sheet, each oversized restyle after the dialog's inline write. The author's run; not reproduced; the panel sets three resets and the run removed two.
  • Claim: at an earlier commit the forced failure showed scrim opacity 1 on all three elements, and the dump named the dialog's inline write as inherited by the sheet and its first child at distances 1 and 2. The author's run; consistent with the markup, where the panel is the dialog's child and the handle bar the panel's.
  • Claim: this head lists each declaration once. Verified (:146-155).
  • Claim: only test and harness files change, with no public API, product behavior or policy change. Verified: four files change, and the harness package is private.
  • Claim: the two harness trace test files pass 7 of 7. The files hold 7 cases (3 and 4); not run here.
  • Claim: the overlapping ContextMenu pull request also edits the harness trace module and README. Verified.
  • File internal/interaction-harness/README.md: clear.
  • File internal/interaction-harness/src/trace.ts: clear.
  • File internal/interaction-harness/src/trace.restyleSources.test.ts: clear.
  • File packages/core/src/BottomSheet/__tests__/BottomSheetDragRestyle.interaction.browser.spec.ts: the two optional wording notes above.

Automated review (maintainer link)

@cixzhang
cixzhang marked this pull request as ready for review November 24, 2026 12:11
@cixzhang
cixzhang merged commit d63c249 into main Nov 24, 2026
162 checks passed
@github-actions
github-actions Bot deleted the lane2/drag-restyle-evidence branch November 25, 2026 06:04

This branch was successfully deployed

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

Labels

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.

1 participant