Skip to content

An open source design system that's fully customizable and agent ready

TypeScript

fix(ci): split browser accessibility receipts (#8729)

Cindy Zhanga7d5cbda8375
diff --git a/.changeset/status-color-roles.md b/.changeset/status-color-roles.md
index 07b29898f2..0d51439653 100644
--- a/.changeset/status-color-roles.md
+++ b/.changeset/status-color-roles.md
@@ -11,7 +11,7 @@
'@astryxdesign/theme-y2k': patch
---
-[feat] Status colours now have a role for each surface, and Info is a new status. For each of info, success, warning, and error: `--color-<status>` is the strong fill and `--color-on-<status>` is content on it, at 4.5:1 or more; `--color-<status>-muted` is the pale fill, with `--color-on-<status>-muted` content; and `--color-text-<status>` is readable status text on the page and cards, with `--color-icon-<status>` and `--color-border-<status>` (status icons and borders) defaulting to it. `--color-info`, `--color-on-info`, `--color-info-muted`, and the other Info roles are new and independent of the accent. Tailwind gains `bg-info`, `bg-info-muted`, `text-on-<status>`, `text-on-<status>-muted`, and `text-status-<status>` (the status text role). Introduced in [#7657](https://github.com/facebook/astryx/pull/7657).
+[feat] Status colours now have a role for each surface, and Info is a new status. For each of info, success, warning, and error: `--color-<status>` is the strong fill and `--color-on-<status>` is content on it, at 4.5:1 or more; `--color-<status>-muted` is the pale fill, with `--color-on-<status>-muted` content; and `--color-text-<status>` is readable status text on the page and cards, with `--color-icon-<status>` and `--color-border-<status>` (status icons and borders) defaulting to it. `--color-info`, `--color-on-info`, `--color-info-muted`, and the other Info roles are new and independent of the accent. Tailwind gains `bg-info`, `bg-info-muted`, `text-on-<status>`, `text-on-<status>-muted`, and `text-status-<status>` (the status text role). Introduced in #7657; final-state evidence (#8729).
`--color-success`, `--color-warning`, and `--color-error` and `bg-<status>` keep their meaning as the strong fills. Tailwind now projects each status by paint property: `text-`, `decoration-`, `placeholder-`, and `caret-<status>` read the status text role, and `border-`, `divide-`, `outline-`, and `ring-<status>` read the status border role, so status text and lines are readable on the page; `bg-`, `accent-`, `fill-`, `stroke-<status>`, shadow colours, and gradients keep the strong fill. for example, Core's light `text-warning` is now `#753F07` instead of `#E9AF08`, and `text-success` is `#09441F` instead of `#0D8626`. To keep the fill colour on text, use `text-[var(--color-warning)]`.
diff --git a/.github/scripts/ci-test-routing.test.mjs b/.github/scripts/ci-test-routing.test.mjs
index 014c557f98..1d45e1e10a 100644
--- a/.github/scripts/ci-test-routing.test.mjs
+++ b/.github/scripts/ci-test-routing.test.mjs
@@ -341,7 +341,7 @@ describe.each(Object.entries(WORKFLOWS))(
);
describe('ci.yml pr-a11y browser specs', () => {
- const steps = load('ci.yml').jobs['pr-a11y'].steps;
+ const steps = load('ci.yml').jobs['pr-a11y-specs'].steps;
const run = steps.find(
step => step.name === 'Run browser accessibility specs',
);
@@ -419,7 +419,8 @@ describe('ci.yml RTL package sharding', () => {
for (const name of [
'build-storybook',
'pr-a11y-shard',
- 'pr-a11y',
+ 'pr-a11y-guards',
+ 'pr-a11y-specs',
'a11y-contracts-shard',
'pr-rtl-shard',
]) {
@@ -439,7 +440,11 @@ describe('ci.yml RTL package sharding', () => {
expect(runLines(workflow.jobs['build-storybook'])).toContain(
'astryx-build-sha.txt',
);
- expect(runLines(workflow.jobs['pr-a11y'])).toContain('git rev-parse HEAD');
+ for (const name of ['pr-a11y-guards', 'pr-a11y-specs']) {
+ expect(runLines(workflow.jobs[name]), name).toContain(
+ 'git rev-parse HEAD',
+ );
+ }
expect(runLines(shard)).toContain('git rev-parse HEAD');
const evidence = read(
@@ -456,10 +461,10 @@ describe('ci.yml RTL package sharding', () => {
});
it('keeps PR accessibility scoped while RTL retains its canonical resolver', () => {
- expect(runLines(workflow.jobs['pr-a11y'])).toContain(
+ expect(runLines(workflow.jobs['pr-a11y-guards'])).toContain(
'.github/scripts/a11y-pr-scope.mjs',
);
- expect(runLines(workflow.jobs['pr-a11y'])).toContain(
+ expect(runLines(workflow.jobs['pr-a11y-guards'])).toContain(
'SCOPE_ARGS=(--components "$COMPONENTS")',
);
expect(runLines(shard)).toContain('.github/scripts/rtl-shard-scope.mjs');
diff --git a/.github/scripts/release-check-workflow.test.mjs b/.github/scripts/release-check-workflow.test.mjs
index baf1a36fbe..ae6e965ad9 100644
--- a/.github/scripts/release-check-workflow.test.mjs
+++ b/.github/scripts/release-check-workflow.test.mjs
@@ -31,6 +31,8 @@ const releaseJobs = [
'pr-visual',
'pr-a11y-shard',
'pr-a11y-audit',
+ 'pr-a11y-guards',
+ 'pr-a11y-specs',
'pr-a11y',
'a11y-contracts-shard',
'a11y-contracts',
@@ -230,7 +232,8 @@ describe('explicit release routing', () => {
it.each([
'pr-a11y-shard',
- 'pr-a11y',
+ 'pr-a11y-guards',
+ 'pr-a11y-specs',
'a11y-contracts-shard',
'visual-scout',
'pr-visual',
@@ -241,6 +244,46 @@ describe('explicit release routing', () => {
expect(runs(jobs[name], {needs})).toBe(false);
});
+ it('passes pr-a11y only when both accessibility owners succeed', () => {
+ const join = jobs['pr-a11y'];
+ const owner = step('pr-a11y', 'Require every accessibility owner');
+ expect(join.if).toContain('always()');
+ expect(owner.env).toEqual({
+ GUARDS_RESULT: '${{ needs.pr-a11y-guards.result }}',
+ SPECS_RESULT: '${{ needs.pr-a11y-specs.result }}',
+ });
+ const result = shell(owner.run, {
+ GUARDS_RESULT: 'success',
+ SPECS_RESULT: 'success',
+ });
+ expect(result.status, result.stderr).toBe(0);
+ });
+
+ it.each([
+ ['failure', 'success'],
+ ['cancelled', 'success'],
+ ['skipped', 'success'],
+ ['success', 'failure'],
+ ['success', 'cancelled'],
+ ['success', 'skipped'],
+ ])('blocks pr-a11y when its owners are %s/%s', (guards, specs) => {
+ const join = jobs['pr-a11y'];
+ const needs = dependencies(join);
+ needs['pr-a11y-guards'].result = guards;
+ needs['pr-a11y-specs'].result = specs;
+ expect(
+ runs(join, {
+ needs,
+ cancelled: guards === 'cancelled' || specs === 'cancelled',
+ }),
+ ).toBe(true);
+ const result = shell(
+ step('pr-a11y', 'Require every accessibility owner').run,
+ {GUARDS_RESULT: guards, SPECS_RESULT: specs},
+ );
+ expect(result.status).not.toBe(0);
+ });
+
it('keeps dispatch concurrency separate and non-cancelling', () => {
expect(workflow.concurrency.group).toContain('|| github.run_id');
expect(workflow.concurrency['cancel-in-progress']).toBe(
@@ -583,7 +626,7 @@ describe('full release scope without PR metadata or maintenance writes', () => {
it('runs the canonical accessibility command without a component filter for full scope', () => {
const audit = step('pr-a11y-audit', 'Run accessibility audit');
- expect(runs(step('pr-a11y', 'Run accessibility audit'))).toBe(false);
+ expect(runs(step('pr-a11y-guards', 'Run accessibility audit'))).toBe(false);
expect(step('pr-a11y-audit', 'Require every audit shard').run).toContain(
'"$SHARD_RESULT" != success',
);
@@ -628,7 +671,7 @@ describe('full release scope without PR metadata or maintenance writes', () => {
}),
);
const result = shell(
- step('pr-a11y', 'Run accessibility audit').run.replaceAll(
+ step('pr-a11y-guards', 'Run accessibility audit').run.replaceAll(
'${{ github.event_name }}',
'pull_request',
),
@@ -654,7 +697,7 @@ describe('full release scope without PR metadata or maintenance writes', () => {
it('does not silently audit everything when PR scope resolution fails', () => {
const result = shell(
- step('pr-a11y', 'Run accessibility audit').run.replaceAll(
+ step('pr-a11y-guards', 'Run accessibility audit').run.replaceAll(
'${{ github.event_name }}',
'pull_request',
),
@@ -752,18 +795,18 @@ describe('full release scope without PR metadata or maintenance writes', () => {
);
expect(step('a11y-contracts', name).with['delete-merged']).toBe(true);
}
- for (const name of [
- 'Run modal close visibility guard',
- 'Run theme var reachability guard',
- 'Run story play guard',
- 'Run browser accessibility specs',
+ for (const [job, name] of [
+ ['pr-a11y-guards', 'Run modal close visibility guard'],
+ ['pr-a11y-guards', 'Run theme var reachability guard'],
+ ['pr-a11y-guards', 'Run story play guard'],
+ ['pr-a11y-specs', 'Run browser accessibility specs'],
]) {
expect(
- runs(step('pr-a11y', name), {event: 'pull_request', operation: ''}),
+ runs(step(job, name), {event: 'pull_request', operation: ''}),
name,
).toBe(true);
- expect(runs(step('pr-a11y', name)), name).toBe(true);
- expect(step('pr-a11y', name)['continue-on-error']).toBeUndefined();
+ expect(runs(step(job, name)), name).toBe(true);
+ expect(step(job, name)['continue-on-error']).toBeUndefined();
}
});
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 6d1cc11980..949449da37 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -1510,7 +1510,8 @@ jobs:
path: a11y-report.json
retention-days: 1
- pr-a11y:
+ pr-a11y-guards:
+ name: pr-a11y (audit and guards)
needs: [build-storybook, check-components]
if: (github.event_name == 'pull_request' || (github.event_name == 'workflow_dispatch' && inputs.operation == 'release-check')) && needs.check-components.outputs.has_components == 'true'
runs-on: 2-core-ubuntu-arm
@@ -1612,16 +1613,53 @@ jobs:
- name: Run story play guard
run: node .github/scripts/story-play-guard.js --storybook-dir apps/storybook/dist
- # Browser accessibility specs. The runner runs every spec
- # playwright.config.ts matches whose own `@pr-a11y` routing lines select
- # it for this pull request (its component folder or named component is in
- # scope, a scope token matches, a "[Component Audit] <Name>:" title names
- # it, or it runs always), in one Playwright run with its own --output
- # directory. A new spec needs no step here. The runner and the routing
- # lines come from the merge commit these steps come from, so an older PR
- # head is routed by current policy; the specs themselves run at the head.
- # Release checks run only the always-on specs here: every spec runs in
- # a11y-contracts.
+ # Browser accessibility specs get their own budget. The scoped axe sweep and
+ # the always-on Chromium guards consume most of a pull request's 15-minute
+ # job budget before these specs start; running beside them keeps both owners
+ # inside the budget without weakening the stable pr-a11y join.
+ pr-a11y-specs:
+ name: pr-a11y (browser specs)
+ needs: [build-storybook, check-components]
+ if: (github.event_name == 'pull_request' || (github.event_name == 'workflow_dispatch' && inputs.operation == 'release-check')) && needs.check-components.outputs.has_components == 'true'
+ runs-on: 2-core-ubuntu-arm
+ timeout-minutes: ${{ github.event_name == 'workflow_dispatch' && 360 || 15 }}
+ permissions:
+ contents: read
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v7
+ with:
+ ref: ${{ github.event.pull_request.head.sha || github.sha }}
+
+ - name: Verify evidence checkout
+ if: github.event_name == 'pull_request'
+ env:
+ EXPECTED_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
+ run: test "$(git rev-parse HEAD)" = "$EXPECTED_HEAD_SHA"
+
+ - name: Setup Node and pnpm
+ uses: ./.github/actions/setup
+ with:
+ install: 'false'
+
+ - name: Download analysis artifact
+ uses: actions/download-artifact@v8
+ with:
+ name: pr-analysis
+
+ - name: Download Storybook artifact
+ uses: actions/download-artifact@v8
+ with:
+ name: storybook-${{ needs.build-storybook.outputs.short_hash }}
+ path: apps/storybook/dist
+
+ - name: Install Playwright
+ run: pnpm install --frozen-lockfile && npx playwright install chromium
+
+ # The runner runs every spec playwright.config.ts matches whose own
+ # `@pr-a11y` routing lines select it for this pull request. The runner and
+ # routing lines come from the merge commit these steps come from, so an
+ # older PR head is routed by current policy while specs run at that head.
- name: Run browser accessibility specs
if: ${{ !cancelled() }}
env:
@@ -1635,9 +1673,6 @@ jobs:
git show "$WORKFLOW_SHA:.github/scripts/a11y-pr-contracts.mjs" > "$runner"
node "$runner"
- # One artifact for every spec's evidence: the selection and JSON report,
- # Playwright's own output, and the receipts specs write under
- # test-results/ or a top-level *-audit-evidence/ folder.
- name: Upload browser accessibility evidence
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v7
@@ -1651,6 +1686,25 @@ jobs:
retention-days: 30
if-no-files-found: ignore
+ # Stable required context joining the scoped audit/guards and browser specs.
+ pr-a11y:
+ needs: [check-components, pr-a11y-guards, pr-a11y-specs]
+ if: ${{ always() && (github.event_name == 'pull_request' || (github.event_name == 'workflow_dispatch' && inputs.operation == 'release-check')) && needs.check-components.outputs.has_components == 'true' }}
+ runs-on: ubuntu-slim
+ timeout-minutes: 5
+ permissions:
+ contents: read
+ steps:
+ - name: Require every accessibility owner
+ env:
+ GUARDS_RESULT: ${{ needs.pr-a11y-guards.result }}
+ SPECS_RESULT: ${{ needs.pr-a11y-specs.result }}
+ run: |
+ if [ "$GUARDS_RESULT" != success ] || [ "$SPECS_RESULT" != success ]; then
+ echo "Accessibility owners did not all succeed: guards=$GUARDS_RESULT specs=$SPECS_RESULT"
+ exit 1
+ fi
+
# Release-only accessibility contracts run beside pr-a11y instead of after
# its full axe sweep, so the release check waits for the longer of the two
# rather than their sum. release-check requires this job as it requires
@@ -2645,6 +2699,8 @@ jobs:
typecheck,
build-sandbox,
build,
+ pr-a11y-guards,
+ pr-a11y-specs,
pr-a11y,
interaction-scope,
pr-interaction,