Skip to content

test(ChatLayout): the rise proof keeps the caret out and names a starved start - #10489

Merged
cixzhang merged 5 commits into
meta:mainfrom
vjeux:test/chat-rise-proof-starvation
Nov 8, 2026
Merged

cixzhang merged 5 commits into
meta:mainfrom
vjeux:test/chat-rise-proof-starvation

Conversation

@vjeux

@vjeux vjeux commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Maintainer impact

Four commits and a merge of main (compare). The chat keyboard's rise proof fails under load on a 2-thread pin (one physical core): on main, 11 of 48 at 4 workers and 17 of 48 at 6.

Intended invariant

spec:AST-099 FR8: in Chrome on Android, the dock rides Gboard's slide with no main-thread layout or paint per frame, counted 125–220 ms after the report. Neither changes.

Change

  • The caret. Chrome's caret blinks every 500 ms from the focus, each blink a main-thread frame; DevTools round trips before the report let the first fall in the window. Now focus, the end of its feedback and the report run in one page step, as on a phone. A report 280 ms or more after the focus fails by name.
  • The ride's start. Under heavier load the report's task ran 82–145 ms, pushing the ride's start into the window. When that task had the main thread for half its wall time or less, the window excludes the ride's own start frames (the report's commit, then at most two restyles with the ride's fingerprint: within three frames of the last, restyling at most two elements, painting only the root layer and code block). A start the page itself delays into the window fails by name. The window needs two judged frames; anything else in it fails as rendering, and a starved start leaving fewer fails by name.

Evidence

  • Failure before the change: a probe of the old order (not for landing) failed 7 of 48 at 4 workers: 2 caret blinks, 5 late starts.
  • Success after the change: on main 74f1fb9, this proof passes 48 of 48 at 4 workers and at 6. There the previous head failed 1 and 5; main's own proof failed 11 and 17 at 88ba279. A start the page delays (130 ms of script per visual viewport resize, probe) fails by name here, 3 of 3; the previous head passed it, and main's proof fails it on Paints.
  • Mutants: frame loops during the ride painting the dock's outline (a) or the page background (b) fail as rendering in 12 of 12 at 1 worker and 48 of 48 at 10. One writing nothing (c): 12 of 12 and 47 of 48, its other run named unjudged (12 ms left).
  • Product/runtime behavior verified unchanged: test-only.
  • CI impact: none.

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

  • This head finds a starved report task again: since test(interaction-harness): a long task is the page's own work #10510 the harness keeps a task whose main thread ran 50 ms or less with its stretched tasks, and the proof read only the long ones. With the renderer stopped 45 ms of every 50 ms and about 11 ms of report work (probe), the previous head failed 3 of 3 as "without a starved thread", with no report task. This head finds the starved task 3 of 3 and fails by name as unjudged, since the start fills the window. On the 2-thread pin at main 74f1fb9: 48 of 48 at 4 workers and at 6, against the previous head's 1 and 5 (each a starved start named as page-delayed). ChatLayoutKeyboard spec: Chromium 18 of 18.
  • On main 88ba279: the first two commits are patch-identical to their earlier versions, and test(interaction-harness): a traced Paint names the node it painted #10486's, now merged, is gone. At 13231e9 the rise proof failed 1 of 48 at 4 workers (named, a starved start) and 0 of 48 at 6, against main's 11 and 17. At this head, with the third commit: 48 of 48 at 4 workers and 48 of 48 at 6 on the 2-thread pin; the 130 ms probe fails by name 3 of 3; ChatLayoutKeyboard spec, Chromium 18/18.
  • At the earlier head cc0837d: ChatLayoutKeyboard WebKit (CI-profile container) 12 passed, 6 skipped (Chrome's profile needs the VirtualKeyboard API). The rise proof: 24/24 on a 2-thread pin (one physical core) at 1 worker, 48/48 at 4 workers and 48/48 at 6, and 24/24 in the CI-profile container. On the earlier base, 6 workers once gave 47 of 48; the other failed by name, its report task at 160 ms of wall time for 14 ms of thread time, leaving 11 ms of window.
  • test(interaction-harness): a traced Paint names the node it painted #10486's harness self-test passed on that base.
  • Typecheck 0; strict ESLint and Prettier clean.

@vercel

vercel Bot commented Nov 7, 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 8, 2026 2:12pm UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 7, 2026
@github-actions github-actions Bot added the needs:design-review Affects visuals — Design should review label Nov 7, 2026
@astracat-bot

astracat-bot Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 8, 2026, 2:18 PM UTC

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

github-actions Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · 07d0d52

Storybook · Sandbox · built from this PR's head

Modified components

Component Size LoC Visual · A11y · RTL
ChatComposer 76.7 kB (0) · 12.0 kB CSS (0) — ✓ · ✓ · —
ChatComposerDrawer 17.9 kB (0) · 4.7 kB CSS (0) — ✓ · ✓ · —
ChatComposerInput 74.4 kB (0) · 11.2 kB CSS (0) — ✓ · ✓ · —
14 more components
Component Size LoC Visual · A11y · RTL
ChatComposerTokenElement 74.4 kB (0) · 11.2 kB CSS (0) — ✓ · ✓ · —
ChatDictationButton 59.7 kB (0) · 10.0 kB CSS (0) — ✓ · ✓ · —
ChatLayout 79.3 kB (0) · 10.5 kB CSS (0) — ✓ · ✓ · —
ChatLayoutScrollButton 59.6 kB (0) · 10.1 kB CSS (0) — ✓ · ✓ · —
ChatMessage 17.1 kB (0) · 3.7 kB CSS (0) — ✓ · ✓ · ✓
ChatMessageBubble 7.5 kB (0) · 3.7 kB CSS (0) — ✓ · ✓ · ✓
ChatMessageList 27.5 kB (0) · 7.0 kB CSS (0) — ✓ · ✓ · —
ChatMessageMetadata 20.2 kB (0) · 4.1 kB CSS (0) — ✓ · ✓ · —
ChatSendButton 59.5 kB (0) · 9.9 kB CSS (0) — ✓ · ✓ · —
ChatSystemMessage 7.0 kB (0) · 3.8 kB CSS (0) — ✓ · ✓ · —
ChatTokenizedText 7.2 kB (0) · 4.0 kB CSS (0) — ✓ · ✓ · —
ChatToolCalls 31.3 kB (0) · 8.3 kB CSS (0) — ✓ · ✓ · —
chat — — — · ✓ · —
Chat — — ✓ · ✓ · —

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

API changes: none in this pull request

Committed API report behind this build: cli 29 rows, core 35 rows, theme-butter 1 row, theme-y2k 1 row; run pnpm api:report.

Touched components checked; add ci:run-visual, ci:run-a11y or ci:run-rtl to run the full suites.


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.

Approval waits on an engineering owner's decision on spec:AST-099, and three changes are needed either way.

This head adds ChatLayout verification rows to the current record (docs/specs/AST-099-mobile-keyboard/spec.md lines 401-403, including the FR8 row's no-paint-per-frame failure and the FR3-FR4 row's composer-group and newest-message failures) and ships two behaviors no current clause settles: the composer region becoming an unnamed role="group" that Done parks focus on, and the keyboard module holding the shown height through a stepped hide under Remove animations. An engineering owner records the decision by commenting /approve-spec <full head SHA> on this pull request, and the author may do so if they are an engineering owner.

Required changes:

  • The diff carries 3,228 authored lines (3,005 from #8176) with no Stack: declaration, so declare Stack: #8176 → #10489 in both bodies or rebase once #8176 and #10486 merge.
  • useChatKeyboard.ts:425-454 copies the reveal-pan put-back in keyboardTarget.ts's watchPans, so export watchPans as deliverTap and followsKeyboard already are, and call it.
  • The Effect at useChatKeyboard.ts:354-356 only re-runs commit() after useKeyboardHeight re-renders on a keyboard report, so subscribe commit to the keyboard module's reports in the Effect at :224 (after its guide subscription) and drop useKeyboardHeight and that Effect.

Non-blocking: move the new isKeyboardSurface lines in ChatComposerInput.tsx above the doc comment they now sit under.

[Automated review]

@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 for the stack: #10489's own change is ready, but #8176 below it needs three fixes, and a pull request lands only when it and every pull request below it are approved.

#8176: changes requested

  • useChatKeyboard.ts:435-449 repeats watchPans from keyboardTarget.ts (last height, report() on a change, putBack() on a reveal pan), so please export watchPans as deliverTap and followsKeyboard already are, and call it.
  • The Effect at useChatKeyboard.ts:354-356 only re-runs commit() after useKeyboardHeight re-renders on a keyboard report, so please subscribe commit to the keyboard module's reports in the Effect at :224, after the guide subscription, and drop useKeyboardHeight and that Effect.
  • Miss: spec:AST-099 Platform support asks for Android emulator evidence at the exact head, and the description's Firefox for Android, slow-device (animations on) and interactive-widget=resizes-content takes come from an earlier head, so please retake them at this head.
  • Non-blocking: move the new isKeyboardSurface lines in ChatComposerInput.tsx above the doc comment they now sit under.

#10489: approved on its own, pending CI

The reworked rise proof passes on this head and still fails a frame loop that repaints the dock or the page background. CI has not run on this head yet: a maintainer adds the ci:run label so CI runs.

  • Non-blocking: ridesOnly checks that a start restyle touches at most two elements, not which ones, so its comment should say that.

Whole stack: changes requested until #8176's three items are fixed.

[Automated review]

@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 for the stack: #10489's own change is ready, but #8176 below it still needs device evidence at its current head, and a pull request lands only when it and every pull request below it are approved.

#8176: changes requested

  • spec:AST-099 Platform support asks for Android emulator evidence at the exact head, and the description's Chrome (animations normal and removed, slow-device), Firefox for Android and interactive-widget=resizes-content takes come from earlier heads, before the commit-path change, so please retake them at the current head and say so in the description.

#10489: approved on its own, pending CI

The reworked rise proof passes on this head and still fails a frame loop that repaints the dock or the page background. CI has not run on this head yet: a maintainer adds the ci:run label so CI runs.

Whole stack: changes requested until #8176's Android evidence is retaken at its head.

[Automated review]

vjeux added 2 commits November 7, 2026 17:33
Chrome's caret blinks every 500 ms from the focus, and each blink is a
main-thread frame. The proof focused, then made several DevTools round
trips before the keyboard report, so under load the first blink landed
in its 125-220 ms window. Focus, the wait for the focus feedback and
the report now run in one step, as on a phone. The proof fails by name
when the report comes 280 ms or more after the focus.
Under load the report's own task can run late, and the ride's start
frames then reach the steady window. The proof now places them and
leaves them out of its count: the commit frame of the report's layout,
then up to one restyle frame per ridden element. Each comes within
three frames of the one before, restyles only the dock and the
transcript, and paints only the root layer and the code block. Every
other frame in the window still counts. When a starved main thread
leaves less than two frames to judge, the proof fails by name, with
its evidence.
@vjeux
vjeux force-pushed the test/chat-rise-proof-starvation branch from cc0837d to 13231e9 Compare November 8, 2026 01:47
@github-actions github-actions Bot removed needs:design-review Affects visuals — Design should review needs:spec-owner-review Current knowledge records await owner approval labels Nov 8, 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. Next step: a maintainer adds the ci:run label so CI runs.

The reworked rise proof passes on this head. It still fails a frame loop that repaints the dock's outline or the page background, and it now names a late report or a starved start instead of failing on a bare Paint count.

  • Miss: (non-blocking) a late start the page causes itself now passes: with 130 ms of script in a visualViewport resize listener, main's proof fails on 5 Paints while this one passes, so consider leaving the start frames out only when the report task was starved (thread time at most half its wall time, which starvation() already measures) and failing by name otherwise.

[Automated review]

The ride's start frames reach the window when the main thread is
starved, and the proof left them out wherever they landed. So a late
start the page causes itself, as 130 ms of script in a visual viewport
resize listener does, passed. Now the start frames are left out only
when the report's task had the main thread for half its wall time or
less. A start the page delays into the window fails by name.

@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. Next step: a maintainer adds the ci:run label so CI runs.

The rise proof now leaves the ride's start frames out only when the report's task was starved. With 130 ms of script in a visualViewport resize listener it fails by name, while a starved renderer that fails main's proof 7 of 12 passes 12 of 12 here. It still fails a frame loop that repaints the dock's outline or the page background.

[Automated review]

@cixzhang cixzhang added the ci:run A maintainer lets this outside contributor's pull request run CI (AST-030 FR17) label Nov 8, 2026
@vjeux
vjeux marked this pull request as ready for review November 8, 2026 03:37

@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: since the merge of main, the rise proof's starved-start rule no longer finds a starved report task on this head.

  • Regression: the report task is looked up only in trace.longTasks (ChatLayoutKeyboard.interaction.browser.spec.ts:797 and :152), but since #10510 the harness puts every task with 50 ms or less of main-thread time in trace.stretchedTasks, so a starved start (the description's own example, 160 ms of wall time for 14 ms of thread time) fails as "the ride's start reached the window without a starved thread" with reportTask: null.

Reading [...trace.longTasks, ...trace.stretchedTasks] in one helper shared by both lookups, as the harness's own spec does, should restore the rule; please re-measure the flake rates on the merged main. This pull request changes no spec record, so the /approve-spec on this head leaves the finding above standing. Non-blocking: the comment at :736-738 is stale, since under the coarse-pointer phone profile the composer's focus look no longer animates and that wait does nothing.

[Automated review]

The harness keeps a task whose main thread ran 50 ms or less with its
stretched tasks, and the rise proof looked for the report's task among
the long ones only. So a starved start failed as one the page delayed.
One helper now reads the long and the stretched tasks, for the test and
for starvation(), and the failure detail lists the stretched ones. The
focus wait's comment says it matters only under a fine pointer.
@cixzhang

cixzhang commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

/approve-spec 2f31145

@cixzhang

cixzhang commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

/approve-spec 07d0d52

@vjeux

vjeux commented Nov 8, 2026

Copy link
Copy Markdown
Contributor Author

Fixed in 07d0d52: one helper reads the long and the stretched tasks, for the test and for starvation(), and the failure detail lists the stretched ones. With the renderer stopped 45 ms of every 50 ms and about 11 ms of report work, the previous head failed 3 of 3 with no report task. This head finds the starved task 3 of 3. On merged main, on a 2-thread pin, it passes 48 of 48 at 4 workers and at 6, where the previous head failed 1 and 5. The focus-wait comment now says the wait matters only under a fine pointer.

@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: required checks are still running on this head.

The rise proof now finds the report's task among both the harness's long and stretched tasks through one taskAt helper, so the starved-start rule works again on the merged main, and the focus-wait comment now says the wait matters only under a fine pointer. A start the page delays itself still fails by name, and a dock that lays out or paints per frame still fails as rendering.

Non-blocking: the taskAt JSDoc says a starved task ran its main thread 50 ms or less, but a task the proof counts as starved can run longer (60 ms of thread time in 140 ms of wall time lands in longTasks), so only the wording needs a touch.

[Automated review]

Comment on lines +136 to +137
* The page's task that holds `t`, long or stretched. A starved task ran its
* main thread 50 ms or less, so the trace keeps it with the stretched tasks.

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: a task the proof counts as starved (threadMs <= durationMs / 2) can run its main thread longer than 50 ms; 140 ms of wall time with 60 ms of thread time goes to longTasks and is still starved. The helper reads both lists, so the behavior is right. Wording that states only what holds: "A task whose main thread ran 50 ms or less sits with the stretched tasks."

@cixzhang
cixzhang merged commit c08de54 into meta:main Nov 8, 2026
140 of 142 checks passed
@vjeux
vjeux deleted the test/chat-rise-proof-starvation branch November 8, 2026 17:13

This branch was successfully deployed

1 active deployment
Preview — 07d0d524 Deployed Nov 8, 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