Skip to content

fix(test): give streaming Markdown perf tests explicit timeouts above their budgets - #4099

Closed
sangwook-dev wants to merge 4 commits into
meta:mainfrom
sangwook-dev:fix/markdown-perf-test-timeout
Closed

sangwook-dev wants to merge 4 commits into
meta:mainfrom
sangwook-dev:fix/markdown-perf-test-timeout

Conversation

@sangwook-dev

@sangwook-dev sangwook-dev commented Jul 20, 2026 •

Copy link
Copy Markdown
Contributor

Problem

The test job on main failed in run 29704122332:

FAIL packages/core/src/Markdown/parser.perf.test.ts
  > parseMarkdown performance > streaming full re-parse XL under 30000ms
Error: Test timed out in 5000ms.

The failing commit (2d8ba8b, a Layer fix) is unrelated — this is a latent flake in the perf test itself:

  • The streaming perf tests assert wall-clock budgets via expect(elapsed).toBeLessThan(maxMs) with budgets of 5000–30000ms, but never pass a vitest timeout, and no testTimeout is configured anywhere in the repo. The effective limit is therefore vitest's 5s default, applied before the budget assertion can ever run.
  • On the next healthy run of the same suite (29710649807), the XL full re-parse took 3641ms — already 73% of the effective 5s limit. Any runner contention pushes it over, and vitest kills the test with an unhelpful "timed out" instead of a measured elapsed time.
  • fix(test): stabilize Markdown parser perf budgets under parallel load #3848 stabilized the millisecond-scale budgets with best-of-3 sampling and noted the streaming budgets "carry 10x+ headroom, which contention cannot realistically eat" — but that headroom was illusory: the harness capped every streaming test at 5s regardless of its declared budget.

Fix

  • Pass an explicit per-test timeout at 2x each budget to the four streaming tests, so pass/fail is always decided by the elapsed-time assertion, with a real measurement in the failure message.
  • Tighten the XL budget from 30s to 15s (~4x the observed CI cost). The old 30s figure was never actually enforceable, and 15s keeps the assertion tight enough to catch a real parser slowdown.
  • Give the incremental-vs-full speedup benchmark the same headroom (30s timeout) — it runs six streaming simulations back-to-back and sits closest to the 5s cliff among the remaining tests.
  • Update the fix(test): stabilize Markdown parser perf budgets under parallel load #3848 comment to document the real constraint.

Also in this PR: Table perf benchmarks get the same stabilization

Table.perf.test.tsx asserted tight budgets (100–200ms, 750ms CI) against a single wall-clock sample — the exact pattern #3848 diagnosed as flaky under parallel forks (a 30.9ms sample against a 20ms budget) and fixed in the Markdown suite with best-of-N, but Table.perf was left out. This PR applies the same best-of-3 technique there, with mount/unmount kept outside the timed section so only the measured work is sampled.

Scope check

Audited the rest of the suite for instability along two axes:

CI history — all 9 failures in the last 50 Deploy runs on main classified:

  • 2 genuine test flakes: this Markdown perf timeout, and the Selector empty-state query (already fixed in fix(selector): scope empty-state test query to the listbox #4089).
  • 5 deterministic breaks, each fixed by a follow-up commit (6ec65fbb3, 20b7402f1) — not flaky tests.
  • 2 deploy-job failures pushing gh-pages (cannot lock ref — a concurrent-push race). Infra, not test code; out of scope here.

Static sweep — no other test shares either defect:

  • Wall-clock budget assertions exist only in the Markdown and Table perf suites (both addressed here) and a 100ms ReDoS guard in docPropLiterals.test.ts, which sits far below the 5s default.
  • The real-sleep waits in Tooltip/HoverCard/Tokenizer tests are all negative assertions ("waited N ms, X must NOT have happened") — contention only lengthens the sleep, which strengthens rather than flips them.
  • Per-test durations from a healthy run (29710649807) and the contended failing run (29704122332): the slowest remaining tests are CLI project-scaffolding tests at ~2.0s healthy / ~2.6s contended — about 2x margin under the 5s default even on a bad runner. Those declare no budget, so the 5s cap is their only guard against slowness creep and is deliberately left alone.

Verification

pnpm exec vitest run packages/core/src/Markdown/parser.perf.test.ts --project ui — 11/11 pass locally (~3.2s). A regression in the parser now fails on expect(elapsed).toBeLessThan(...) with the measured time, not on a harness timeout.


Closes #4337

… their budgets

The streaming perf tests assert wall-clock budgets of 5-30s but never set a vitest timeout, so the 5s default killed the test before the budget assertion could run. The XL full re-parse takes ~3.6s on a healthy CI runner, leaving no headroom: any runner contention pushed it past 5s and failed main (run 29704122332).

Pass an explicit per-test timeout at 2x each budget so pass/fail is always decided by the elapsed-time assertion, and tighten the XL budget from 30s to 15s (~4x observed CI cost) so the assertion still catches a real parser slowdown. The speedup benchmark gets the same headroom since it runs six streaming simulations.
@vercel

vercel Bot commented Jul 20, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
astryx Ready Ready Preview, Comment Jul 20, 2026 2:11pm

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Jul 20, 2026
@github-actions github-actions Bot added community Authored by a community contributor (not on the eng/design team) needs:code-review High-risk change (new package/component/API) — needs human code review before merge labels Jul 20, 2026
@github-actions

github-actions Bot commented Jul 20, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

Modified Components

Markdown
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 2853 -
Complexity N/A Very High (199) -
Table
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 1905 -
Complexity N/A Very High (101) -

Bundle Size Summary

Package Size (ESM) Size (CJS) Gzipped
@astryxdesign/core N/A 4.7KB 0B

Accessibility Audit

Status: 1 accessibility violation(s) found — 1 serious.

Table - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 4/24 stories · Learn more
    • WCAG: 1.4.3 (Level AA)

Generated by PR Enrichment workflow | View full report

…nforced budgets

The measureBest comment still claimed the streaming budgets carry 10x+ headroom that contention cannot eat — disproved by the 5s-default-timeout incident this branch fixes, and stale now that the XL budget is 15s (~4x observed CI cost) with explicit per-test timeouts.
The Table render benchmarks asserted tight budgets (100-200ms, 750ms CI) against a single wall-clock sample — the exact pattern meta#3848 diagnosed as flaky under parallel forks and fixed in the Markdown perf suite, but Table.perf was left out. Apply the same best-of-3 technique: the fastest of three runs approximates the un-contended cost while a real regression still raises the minimum. Mount/unmount happen outside the timed section so only the measured work is sampled.
…oid-type

Both call sites return a cleanup callback, so require it instead of allowing void — which @typescript-eslint/no-invalid-void-type rejects as a union constituent.
sangwook-dev added a commit to sangwook-dev/astryx that referenced this pull request Jul 20, 2026
sangwook-dev added a commit to sangwook-dev/astryx that referenced this pull request Jul 29, 2026
sangwook-dev added a commit to sangwook-dev/astryx that referenced this pull request Jul 29, 2026
sangwook-dev added a commit to sangwook-dev/astryx that referenced this pull request Jul 31, 2026
sangwook-dev added a commit to sangwook-dev/astryx that referenced this pull request Aug 20, 2026
cixzhang pushed a commit that referenced this pull request Aug 22, 2026
…atalog (#4101)

* chore(deps): prune stale pnpm overrides, move workspace pins to the catalog

Re-verified every override entry by removing it, re-resolving the lockfile, and running pnpm audit. The entries that no longer do anything useful are removed: stylex, tmp, @babel/core, hono, both scoped js-yaml floors and the picomatch trio carried over from yarn resolutions all resolve identically without the override, and prettier and minimatch were dedup-only forces whose removal lets consumers follow their own declared ranges.

brace-expansion ^2.1.2 goes too. It was added in #4398 as a security floor, but 2.x sits below the declared range of every consumer in the graph — minimatch@10 (via @eslint/config-array) declares ^5.0.5, minimatch@3 (via @babel/cli) declares ^1.1.7 — so it was a downgrade, not a floor. It stayed invisible only because the equally stale minimatch ^9.0.7 force held minimatch on a line that still used brace-expansion's default CJS export. Dropping minimatch alone lets @eslint/config-array resolve minimatch 10, which calls the named `expand` that 2.x does not have, and ESLint dies with "brace_expansion_1.expand is not a function". Dropping both lets each consumer resolve inside its own range (5.0.7 and 1.1.16) and ESLint runs clean.

The entries that guard live advisories stay, documented with the dependent that pins the vulnerable version and the condition for deleting them: postcss ^8.5.18 (next@15 pins 8.4.31), dompurify ^3.4.12 ([email protected] pins 3.2.7, 16 advisories), esbuild >=0.28.1 ([email protected] resolves 0.27.7), fast-uri ^3.1.4 (#4398), sharp ^0.35.3 (#4449), and the read-yaml-file 2.x lift.

Both js-yaml chains move to ^5.2.2, adopting the fix in #4402 — the previous '>=4.2.0' floor was unbounded and resolved onto js-yaml 5.2.1, inside the vulnerable >=5.0.0 <=5.2.1 range. Written as a caret rather than '>=' so a future js-yaml 6 cannot repeat that. [email protected] is added to minimumReleaseAgeExclude so the floor can resolve.

Workspace-wide version pins that lived in overrides move to the pnpm catalog alongside vite: @stylexjs/stylex, @stylexjs/babel-plugin, prettier, esbuild. Peer ranges stay untouched — they are consumer contracts, not workspace pins.

pnpm audit goes from 12 findings to 10; the remaining 10 match main's baseline exactly.

� Conflicts:
�	pnpm-workspace.yaml

* chore: retrigger CI (known Markdown perf-test flake, fixed by #4099)

* chore(deps): address #4101 review, prune 6 more pnpm overrides

Per cixzhang's review: floor brace-expansion on the 5.x line (^5.0.9, inside minimatch@10's own ^5.0.5) instead of re-pinning 2.x and forcing minimatch alongside it — minimatch now resolves on its own. Also move @stylexjs/postcss-plugin into the catalog; it was left literal next to the now-catalog stylex/babel-plugin pins and would have silently drifted on the next bump.

Re-verified every remaining override against the current lockfile the same way: drop it, re-resolve, check what actually lands. hono, @changesets/parse>js-yaml, fast-uri, ip-address, and nanoid all resolve to safe versions unforced now, so they're pruned (hono also drops out of minimumReleaseAgeExclude). @hono/node-server and read-yaml-file (+ its js-yaml floor) stay — pnpm audit reports clean without them, but the actual resolved versions without the override are vulnerable (@hono/node-server 1.19.17, read-yaml-file 1.x pulling js-yaml 3.x), which audit's advisory feed doesn't catch.

pnpm install --frozen-lockfile, pnpm audit (0 findings), and eslint all pass on the result.

* chore(deps): bump docsite's MCP SDK to drop the @hono/node-server override

@modelcontextprotocol/sdk 1.30.0 widens its @hono/node-server range to '^1.19.9 || ^2.0.5', so the patched 2.x line resolves on its own now — no override needed to hold it there. Verified: @hono/node-server resolves to 2.1.0, hono to 4.13.1, pnpm audit stays clean.

pnpm install --frozen-lockfile and eslint pass on the result.

This branch was successfully deployed

1 active deployment
Preview — 9397d91e Deployed Jul 20, 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. community Authored by a community contributor (not on the eng/design team) needs:code-review High-risk change (new package/component/API) — needs human code review before merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Streaming Markdown perf tests are capped by vitest's 5s default, not their declared budgets

1 participant