Skip to content

test(richtext): the code block header tests wait for the copy button's tooltip - #8569

Merged
cixzhang merged 1 commit into
meta:mainfrom
vjeux:uikit/c07-richtext-header-wait
Oct 31, 2026
Merged

cixzhang merged 1 commit into
meta:mainfrom
vjeux:uikit/c07-richtext-header-wait

Conversation

@vjeux

@vjeux vjeux commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Maintainer impact

Found when the Spinner and CircularProgress fixes (#8177, #8232) hit this race in CI. Since #8519, CodeBlockHeaderPlugin.test.tsx can fail on a busy CI runner with no rich-text change: a header's text read ['ts', 'js'] instead of ['tsCopy code', 'jsCopy code'] on pull requests that touch neither rich text nor layers, which then needed a re-run.

Intended invariant

Each code block header shows its language label and a copy button whose tooltip reads "Copy code" (spec:AST-061 FR8). The tests assert that text; product behavior stays as it is.

Change

What led to it: a header's text ends with its copy button's tooltip. Since #8519 the tooltip's layer is placed by its own slot one render after the header (the slot gets its mount from a store subscription). Three tests waited for the header to exist, then read its text, so a late slot render left the tooltip out.

Options:

This PR takes the first, since the one-render assumption was the tests', not the product's. The first test already finds the button by its accessible name, present from the start, so it is unchanged.

Evidence

  • Failure before the change: with the slot seeing its mount 30 ms late (a temporary edit in useLayer.tsx), the old tests fail as the failing runs did: expected '' to be 'Copy code', and ['', 'Plaintext'] for ['Copy code', 'PlaintextCopy code'].
  • Success after the change: with the same delay the new tests pass, and without it too.
  • Product/runtime behavior verified unchanged: only the test file 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

What I ran and what it showed:

  1. pnpm exec vitest run --project ui packages/richtext/src/CodeBlockHeaderPlugin.test.tsx: all four tests pass.
  2. With the layer mount store's update in useLayer.tsx delayed 30 ms, its value and its listeners both (a temporary edit): main's file fails three of the four tests; this file passes all four.
  3. Local gates at 7d01151: root build, typecheck, ESLint, Prettier, the duration guard and pnpm test:ui (16,446 tests) pass; in the node project, the only failures are cache.test.mjs's two install-lock cases, a known failure on this machine (fix(cli): a crashed run's release install is recognized by the Node it ran on, whatever its name #8520).

@vercel

vercel Bot commented Oct 26, 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 Oct 30, 2026 10:07pm UTC

Request Review

@astracat-bot

astracat-bot Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Oct 30, 2026, 10:15 PM UTC

vjeux added a commit to vjeux/astryx that referenced this pull request Oct 26, 2026
CI-Rerun: test-ui (4/4) failed on a rich-text test race on main (CodeBlockHeaderPlugin read a header before its tooltip arrived); meta#8569 fixes it. No change here.
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Oct 26, 2026
vjeux added a commit to vjeux/astryx that referenced this pull request Oct 26, 2026
CI-Rerun: test-ui (4/4) failed on a rich-text test race on main (CodeBlockHeaderPlugin read a header before its tooltip arrived); meta#8569 fixes it. No change here.

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

Recommended for approval: each of the three code block header tests now waits for the header's full text rather than for the header element, which removes the race with the copy button's tooltip (rendered one commit after the header) while keeping the same expected strings. No changes are needed.

[Automated review]

@github-actions

github-actions Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

📚 Storybook Preview

View Storybook for this PR

🧪 Sandbox Preview

View Sandbox for this PR

No new or modified components detected.

Bundle Size Summary

Gzip figures measure each package's entry file, not the code an import pulls in.

Package Entry (ESM) Entry gzip before Entry gzip after Delta
@astryxdesign/richtext 1.4KB 746B 746B 0B
Package stylesheet Gzip before Gzip after Delta
@astryxdesign/richtext 3.0KB 3.0KB 0B

Accessibility Audit

Status: The accessibility audit did not run on this pull request. It runs after merges to main and before each release; pull requests that touch components run it with the ci:heavy-lanes label.


Generated by PR Enrichment workflow | Storybook | Sandbox | View full report

…s tooltip

Three tests read a code block header's text right after it appeared. Since meta#8519 the copy button's tooltip arrives one render later, from its own layer slot, so on a busy runner the read could miss it. Each test now waits for the full text inside waitFor.

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

Recommended for approval: the three code block header tests now wait for each header's full text, including the copy button's tooltip that is drawn one commit after the header, so a slow runner no longer reads a header too early, and the expected strings are unchanged. No changes are needed.

[Automated review]

@cixzhang cixzhang added the ci:run A maintainer lets this outside contributor's pull request run CI (AST-030 FR17) label Oct 31, 2026
@cixzhang
cixzhang marked this pull request as ready for review October 31, 2026 00:58
@cixzhang
cixzhang merged commit 7251c04 into meta:main Oct 31, 2026
99 of 100 checks passed
@vjeux
vjeux deleted the uikit/c07-richtext-header-wait branch October 31, 2026 01:29
cixzhang pushed a commit that referenced this pull request Oct 31, 2026
…ns (#8196)

## User impact

Part of making Astryx match iOS, whose progress indicators keep moving while busy. Progress usually arrives while the page is busy, and the fill then freezes and jumps (Chromium, Safari), so the work looks stuck. Now it keeps sliding.

## Problem and solution fit

The fill animated `width`, laid out and painted on the main thread every frame, so a busy page stalls it.

Options:

- Keep `width`: the freeze stays.
- `scaleX` on a full-length fill: compositor, but it stretches the round ends.
- `translateX` of a full-length fill in a clipping track: compositor, round ends. Costs: a tiny fill's end follows the track's curve; a runtime direction flip sweeps the fill across.

This PR takes the third; [cixzhang decided to keep it](#8196 (comment)).

## Expected behavior and authority

`component:ProgressBar`'s targets are unchanged; #6248 moved the marks out of the track, so it can clip. Under Reduce Motion a new value lands at once (`design:reduced-motion` DEC-3).

## Smallest restoration

`ProgressBar.tsx`: the fill transitions `transform` instead of `width`, on the theme's duration and easing; the track clips; the fill mirrors by its own direction. Forced colors keep the width geometry, so the outline stays whole (`architecture:theme-tokens` INV11). No API change.

## Evidence

- iOS simulator, 10 → 90 during a 0.7 s busy script; main (above) freezes at 41%, then jumps:
  ![The fill frozen on main and moving with this PR through the block](https://raw.githubusercontent.com/vjeux/astryx/3134c99c1e4bc50472d453305679242079bb41c3/progressbar-busy.ios-sim.gif)
- Unchanged: an ordinary change, and right to left:
  ![An ordinary change on main and with this PR](https://raw.githubusercontent.com/vjeux/astryx/0fd2ba99fb8619e17ae3b822e02e8cc7cc3f06f5/progressbar-ordinary.ios-sim.gif) ![The fill moving right to left](https://raw.githubusercontent.com/vjeux/astryx/e5923ba312a2fbb63b4c15affa264eb9169ae39c/progressbar-rtl.ios-sim.gif)
- Small values, before above:
  ![Small values before and after](https://raw.githubusercontent.com/vjeux/astryx/14224ce2b930315bfa47175ffaca8afa2fcf2d9d/progressbar-small-values.chromium.png)

## Scope

- [x] One defect is restored.
- [x] Separable contradictory or unsettled tagalongs were removed or split.
- [x] No new public API, visual representation, default, or interaction model is hidden under the bug-fix label.
- [x] Public text and artifacts contain no internal Meta context.

## Testing

What I ran and what it showed:

1. In the ProgressBar story at 10, this console line (preview frame) sets 90 and blocks the page 0.7 s: `__STORYBOOK_ADDONS_CHANNEL__.emit('updateStoryArgs', {storyId: 'core-progressbar--default', updatedArgs: {value: 90}}); setTimeout(() => { const end = performance.now() + 700; while (performance.now() < end); }, 30);` `main` freezes, then jumps; this PR keeps sliding, with no per-frame layout or paint. iOS simulator: the same (above).
2. Chromium tests: the edge at the value in both directions, a 2% fill following the track's curve, a closed forced-colors outline, and an immediate change under Reduce Motion. The busy-page ones fail on `main`.
3. Local gates at f55c39b: root build, typecheck, ESLint, Prettier, Storybook, the ProgressBar Chromium tests (19) and `pnpm test:ui` pass, apart from failures known elsewhere: the rich-text race #8569 fixes, and #8509 and #8520 in the node project.

This branch was successfully deployed

1 active deployment
Preview — 7d011513 Deployed Oct 30, 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