Skip to content

test(a11y): run the audit CLI fixtures on an OS-assigned port - #7765

Merged
cixzhang merged 1 commit into
meta:mainfrom
vjeux:audit-port-zero
Oct 21, 2026
Merged

cixzhang merged 1 commit into
meta:mainfrom
vjeux:audit-port-zero

Conversation

@vjeux

@vjeux vjeux commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

Maintainer impact

.github/scripts/accessibility-audit.integration.test.mjs starts the audit CLI's static server on 40000 + (pid % 10000), one port per fixture. That range sits inside Linux's ephemeral port range (32768–60999 by default), where the kernel picks source ports for outgoing connections, so on a busy machine another process can already hold the chosen port. The CLI then exits with listen EADDRINUSE before it reaches the behavior under test, and the suite fails with no change to the code it covers. The full pnpm test runs reported in #7651 and #7694 both hit this, and both passed when the file was rerun alone.

Intended invariant

The fixtures exercise the CLI's readiness, routing and report paths. Which port its server binds is incidental, so a fixture run should fail only for a defect in those paths.

Change

  • accessibility-audit.js accepts --port 0, the usual way to ask the OS for a free port. It builds the story URLs and the expected origin from the port its server actually holds (server.address().port). Every other --port value behaves as before, and the default stays 6007.
  • The fixtures pass --port 0 and drop the PID-derived counter.
  • The mock browser's goto now fetches the URL it receives, so a fixture passes only when the audit opens the port its server holds. A new case asserts that the server reports a real port.

No workflow passes --port, so CI audits are unchanged.

Evidence

  • Failure before the change: Error: listen EADDRINUSE: address already in use :::43064 at accessibility-audit.js:195, in a full local run beside parallel builds. The two affected cases pass alone. This test file run against main's script fails 11 of 11 cases with Invalid --port value: 0.
  • Success after the change: 11 of 11 pass.
  • Mutation check: building the story URL from the requested port instead of the bound one fails 9 of 11 cases (fetch failed).
  • Product/runtime behavior verified unchanged: no package source changes, and the default and explicit-port paths are untouched.

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

  • pnpm exec vitest run --project node .github/scripts/accessibility-audit.integration.test.mjs: 11/11 pass (on main's script: 11/11 fail).
  • pnpm exec vitest run --project node .github/scripts: 64 files, 1,150 tests pass.
  • pnpm -F @astryxdesign/core typecheck, ESLint on both files, pnpm check:repo: pass.
  • Prettier: both files already differ from Prettier's output on main. This change adds no new differences, and the files are not reformatted.

The accessibility-audit CLI fixtures started the CLI's server on
40000 + (pid % 10000), inside Linux's ephemeral port range, so another
process's socket could already hold the port and the CLI died with
EADDRINUSE before reaching the behavior under test.

accessibility-audit.js now accepts --port 0 and builds its story URLs and
expected origin from the port its server actually holds. The fixtures pass
--port 0, and the mock browser fetches the URL it is sent, so a fixture
passes only when the audit opens the bound port.
@vercel

vercel Bot commented Oct 20, 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 20, 2026 9:40pm UTC

Request Review

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

astracat-bot Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

AI review status for this pull request.

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

@github-actions

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

No component packages changed.

Accessibility Audit

Status: No accessibility violations detected.

Visual Regression

40 of 486 shot(s) changed.

A change here is a question, not a failure: check whether the after is the
picture you intended. Record that review on the PR. Baseline maintenance is an
explicit dispatch of CI; this report never rewrites the baseline or adds a release gate.

component story theme mode pixels
Selector Indicator Space Bottom Sheet Narrow End RTL neutral light 754,077
Selector Indicator Space Bottom Sheet Wide Start neutral light 740,188
Chat Full AI Chat probe light 230,823
Chat Full AI Chat probe dark 229,805
RichTextEditor Markdown parity: side by side probe dark 94,866
RichTextEditor Markdown parity: side by side probe light 89,762
Collapsible Dividers probe dark 66,445
Collapsible Dividers probe light 66,445
Chat Default neutral dark 36,304
Chat Default neutral light 35,767
Chat Empty State probe light 23,531
Chat Empty State probe dark 22,622
ChatAutoScroll Scroll Behavior Comparison neutral dark 15,378
ChatAutoScroll Scroll Behavior Comparison neutral light 14,107
Chat With Attachments probe light 13,406
Chat With Attachments probe dark 11,232
ProgressBar With Target Mark probe dark 7,895
ProgressBar With Target Mark probe light 7,895
Markdown Default neutral dark 7,573
Markdown Default neutral light 7,566

and 20 more.


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

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks ready to merge. The fixtures now bind an OS-assigned port and the audit addresses the port its server actually holds, so a busy machine can no longer fail them with EADDRINUSE, while every CI invocation keeps the default port 6007. The fetching goto mock also makes the fixtures fail if the audit ever opens a different port. Nothing else is needed from you.

[Automated review]

@cixzhang
cixzhang merged commit e4e0c60 into meta:main Oct 21, 2026
50 checks passed
@vjeux
vjeux deleted the audit-port-zero branch October 21, 2026 14:31

This branch was successfully deployed

1 active deployment
Preview — 6db200d9 Deployed Oct 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants