Skip to content

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

TypeScript

ci: build the docsite once, run its browser contracts on that build, keep docsite-test as the required join (#9877)

Cindy Zhangef3db957a4e3
diff --git a/.github/interaction-durations.json b/.github/playwright-leg-durations.json
similarity index 91%
rename from .github/interaction-durations.json
rename to .github/playwright-leg-durations.json
index df7172816b..629aadd1ee 100644
--- a/.github/interaction-durations.json
+++ b/.github/playwright-leg-durations.json
@@ -1,5 +1,5 @@
{
- "chromium": {
+ "interaction-chromium": {
"internal/interaction-harness/src/harness.interaction.browser.spec.ts": 118.3,
"internal/interaction-harness/src/storybook.interaction.browser.spec.ts": 1.6,
"packages/core/src/AlertDialog/__tests__/AlertDialog.interaction.browser.spec.ts": 20.3,
@@ -28,7 +28,7 @@
"packages/core/src/motion/__tests__/animatedLayoutAdopters.interaction.browser.spec.ts": 24.5,
"packages/core/src/motion/__tests__/animator.interaction.browser.spec.ts": 16.6
},
- "webkit": {
+ "interaction-webkit": {
"internal/interaction-harness/src/harness.interaction.browser.spec.ts": 168.8,
"internal/interaction-harness/src/storybook.interaction.browser.spec.ts": 8.8,
"packages/core/src/gestures/__tests__/browser/gestures.interaction.browser.spec.ts": 51.6,
@@ -36,5 +36,13 @@
"packages/core/src/hooks/__tests__/usePager.interaction.browser.spec.ts": 35.5,
"packages/core/src/motion/__tests__/animatedLayout.interaction.browser.spec.ts": 41.8,
"packages/core/src/motion/__tests__/animator.interaction.browser.spec.ts": 24.5
+ },
+ "docsite": {
+ "blog-heading-links.spec.ts": 22.7,
+ "blog-live-examples.spec.ts": 26,
+ "header-offset.spec.ts": 6,
+ "internal-docs-prompt.spec.ts": 98,
+ "mobile-navigation.spec.ts": 8,
+ "playground-preview-isolation.spec.ts": 113.8
}
}
diff --git a/.github/scripts/ci-admission.test.mjs b/.github/scripts/ci-admission.test.mjs
index 1cad69ef33..2c9c716970 100644
--- a/.github/scripts/ci-admission.test.mjs
+++ b/.github/scripts/ci-admission.test.mjs
@@ -183,11 +183,21 @@ describe('where runs wait', () => {
)
continue;
if (NO_WORK_ALONE.includes(id)) continue;
+ // Runs only after a job that stops behind a full admission succeeded.
+ if (
+ needsOf(job).some(
+ need =>
+ condition.includes(`needs.${need}.result == 'success'`) &&
+ String(ci.jobs[need]?.if ?? '').includes(FULL_GUARD),
+ )
+ )
+ continue;
expect(needsOf(job), id).toContain('admission');
expect(condition, id).toContain(FULL_GUARD);
guarded.push(id);
}
expect(guarded.sort()).toEqual([
+ 'docsite-build',
'pr-component-a11y-contracts',
'pr-interaction',
'pr-interaction-webkit',
diff --git a/.github/scripts/ci-docsite-browser.test.mjs b/.github/scripts/ci-docsite-browser.test.mjs
index 77598a2acc..24042a91c5 100644
--- a/.github/scripts/ci-docsite-browser.test.mjs
+++ b/.github/scripts/ci-docsite-browser.test.mjs
@@ -2,177 +2,339 @@
/**
* @file ci-docsite-browser.test.mjs
- * @input The docsite-test job in the PR CI workflow
- * @output Fail-closed coverage for AST-030's docsite-test owner: one job
- * builds the docsite once, and a data-test or browser-contract failure
- * cannot leave the required context green.
+ * @input The docsite-build, docsite-browser and docsite-test jobs in the PR CI
+ * workflow
+ * @output Fail-closed coverage for AST-030's docsite owner: one job builds the
+ * docsite once and runs the data tests on it; the browser contracts run on
+ * that same build, never a rebuild; the required docsite-test context passes
+ * only when both did, or when the scope found no browser contract to run.
* @position Workflow contract over .github/workflows/ci.yml
*/
import fs from 'node:fs';
-import os from 'node:os';
+import {createRequire} from 'node:module';
import path from 'node:path';
-import {spawn, spawnSync} from 'node:child_process';
+import {spawnSync} from 'node:child_process';
import {describe, expect, it} from 'vitest';
import yaml from 'yaml';
-import {PR_REPORT_GATE, gated} from './ci-pr-gate.mjs';
+import {PR_CI_GATE, PR_REPORT_GATE, gated} from './ci-pr-gate.mjs';
const root = path.resolve(import.meta.dirname, '../..');
const {jobs} = yaml.parse(
fs.readFileSync(path.join(root, '.github/workflows/ci.yml'), 'utf8'),
);
-const owner = jobs['docsite-test'];
-const step = name => owner.steps.find(candidate => candidate.name === name);
+const build = jobs['docsite-build'];
+const browser = jobs['docsite-browser'];
+const join = jobs['docsite-test'];
+const step = (job, name) =>
+ job.steps.find(candidate => candidate.name === name);
// A Lab-only change skips the docsite work too (spec:AST-030 FR26).
const ACTIVE =
"steps.scope.outputs.spec_only != 'true' && steps.scope.outputs.tooling_only != 'true' && steps.scope.outputs.lab_only != 'true'";
+const BROWSER_PATHS = new RegExp(
+ build.steps.find(s => s.id === 'scope').with.paths,
+);
-describe('docsite-test', () => {
- it('is one job that builds the docsite once and runs both suites on it', () => {
- expect(jobs['docsite-data']).toBeUndefined();
- expect(jobs['docsite-browser']).toBeUndefined();
- // Only CI's run admission, which never skips (ci-admission.test.mjs).
- // room tells it when CI is full (ci-admission.test.mjs); heavy-ci whether
- // an agent push deferred it (spec:AST-030 FR20).
- expect(owner.needs).toEqual(['room', 'admission', 'heavy-ci']);
- expect(owner['continue-on-error']).toBeUndefined();
- // A required context keeps only the draft skip in its condition; an
- // outside contributor's run stops at the first step with the reason.
- expect(owner.if).toBe(
+describe('docsite-build', () => {
+ it('builds the docsite once and runs the data tests and the registry gate on it', () => {
+ expect(build.needs).toEqual(['room', 'admission', 'heavy-ci']);
+ expect(build.if).toBe(
gated(
- "${{ github.event_name != 'workflow_dispatch' && !startsWith(github.base_ref, 'release/v') && !cancelled() }}",
- PR_REPORT_GATE,
+ "${{ github.event_name != 'workflow_dispatch' && !startsWith(github.base_ref, 'release/v') && !cancelled() && needs.heavy-ci.outputs.deferred != 'true' && needs.room.outputs.full != 'true' && needs.admission.outputs.full != 'true' }}",
+ PR_CI_GATE,
),
);
- expect(owner.steps[0].name).toBe(
- 'Require a branch in this repository or the ci:run label',
- );
- // After the FR17 gate and the CI-is-full stop (ci-admission.test.mjs).
- expect(owner.steps[1].name).toBe('Stop when CI is full');
- // Then an agent push's deferral (spec:AST-030 FR20), then the scope.
- expect(owner.steps[2].name).toBe('Heavy CI deferred');
- expect(owner.steps.findIndex(s => s.id === 'scope')).toBe(4);
-
- const builds = owner.steps.filter(s =>
- /pnpm -F @astryxdesign\/docsite build/.test(s.run ?? ''),
+ expect(build.steps.findIndex(s => s.id === 'scope')).toBe(1);
+ const builds = Object.values(jobs).flatMap(job =>
+ (job.steps ?? []).filter(s =>
+ /pnpm -F @astryxdesign\/docsite build/.test(s.run ?? ''),
+ ),
);
- expect(builds).toHaveLength(1);
+ expect(builds).toEqual([step(build, 'Build the docsite')]);
for (const name of [
- 'Install Playwright',
'Build docsite workspace dependencies',
'Build the docsite',
- 'test-docsite (start the data tests)',
- 'test-docsite-e2e (browser contracts)',
+ 'test-docsite (data tests)',
'Verify the hidden production registry gate',
]) {
- expect(step(name).if, name).toBe(ACTIVE);
- expect(step(name)['continue-on-error'], name).toBeUndefined();
+ expect(step(build, name).if, name).toBe(ACTIVE);
+ expect(step(build, name)['continue-on-error'], name).toBeUndefined();
}
- expect(step('test-docsite-e2e (browser contracts)').run).toBe(
- 'pnpm test:docsite-browser',
- );
- // The result step reports whenever the data tests started, even after a
- // browser-contract failure, and its failure fails the job.
- expect(step('test-docsite (start the data tests)').id).toBe('data');
- expect(
- step('test-docsite (data test results)')['continue-on-error'],
- ).toBeUndefined();
- expect(step('test-docsite (data test results)').if).toBe(
- "${{ !cancelled() && steps.data.outcome == 'success' }}",
+ expect(step(build, 'test-docsite (data tests)').run).toBe(
+ 'pnpm -F @astryxdesign/docsite test',
);
});
it('builds and tests the docs prompt with placeholder origins only', () => {
- // One job-level value reaches the build and the browser contracts alike.
- expect(owner.env).toEqual({
- NEXT_PUBLIC_INTERNAL_DOCS_ORIGIN: 'https://docs.example.test',
- NEXT_PUBLIC_DOCS_ACCESS_CHECK_ORIGIN: 'https://probe.example.test',
- });
- for (const s of owner.steps) {
- expect(s.env?.NEXT_PUBLIC_INTERNAL_DOCS_ORIGIN, s.name).toBeUndefined();
- expect(
- s.env?.NEXT_PUBLIC_DOCS_ACCESS_CHECK_ORIGIN,
- s.name,
- ).toBeUndefined();
+ for (const job of [build, browser]) {
+ expect(job.env).toEqual({
+ NEXT_PUBLIC_INTERNAL_DOCS_ORIGIN: 'https://docs.example.test',
+ NEXT_PUBLIC_DOCS_ACCESS_CHECK_ORIGIN: 'https://probe.example.test',
+ });
+ for (const s of job.steps) {
+ expect(s.env?.NEXT_PUBLIC_INTERNAL_DOCS_ORIGIN, s.name).toBeUndefined();
+ expect(
+ s.env?.NEXT_PUBLIC_DOCS_ACCESS_CHECK_ORIGIN,
+ s.name,
+ ).toBeUndefined();
+ }
}
});
- it.each([0, 1])(
- 'the start step records exit %i from the data tests under bash -e',
- async code => {
- const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'docsite-data-'));
- fs.writeFileSync(path.join(dir, 'pnpm'), `#!/bin/sh\nexit ${code}\n`, {
- mode: 0o755,
- });
- const started = spawnSync(
- 'bash',
- ['-e', '-c', step('test-docsite (start the data tests)').run],
- {cwd: dir, env: {...process.env, PATH: `${dir}:${process.env.PATH}`}},
- );
- expect(started.status).toBe(0);
- const exitFile = path.join(dir, 'docsite-data.exit');
- for (let i = 0; i < 100 && !fs.existsSync(exitFile); i++) {
- await new Promise(resolve => setTimeout(resolve, 50));
- }
- const recorded = fs.readFileSync(exitFile, 'utf8').trim();
- fs.rmSync(dir, {recursive: true, force: true});
- expect(recorded).toBe(String(code));
- },
+ it('skips the browser contracts only for component tests, stories, spec records and changesets that are not shared infrastructure', () => {
+ const decide = step(build, 'Decide whether the browser contracts apply');
+ expect(decide.run).toBe(
+ `echo "applies=\${{ (${ACTIVE}) && (steps.scope.outputs.touches == 'true' || steps.scope.outputs.full_suite == 'true') }}" >> "$GITHUB_OUTPUT"`,
+ );
+ expect(build.outputs.browser).toBe('${{ steps.browser.outputs.applies }}');
+ for (const file of [
+ 'apps/docsite/src/app/page.tsx',
+ 'apps/docsite/e2e/header-offset.spec.ts',
+ 'apps/docsite/src/content/blog/post.md',
+ 'packages/core/src/Button/Button.tsx',
+ 'packages/core/src/Button/Button.doc.mjs',
+ 'packages/core/README.md',
+ 'packages/themes/neutral/src/theme.ts',
+ 'pnpm-lock.yaml',
+ '.github/workflows/ci.yml',
+ ])
+ expect(BROWSER_PATHS.test(file), file).toBe(true);
+ for (const file of [
+ 'packages/core/src/Button/__tests__/Button.test.tsx',
+ 'packages/core/src/Button/Button.test.tsx',
+ 'packages/core/src/Slider/__tests__/Slider.interaction.browser.spec.ts',
+ 'apps/storybook/stories/Button.stories.tsx',
+ 'packages/core/src/Button/Button.stories.tsx',
+ 'docs/specs/AST-030/spec.md',
+ '.changeset/quiet-cats.md',
+ 'internal/a11y-spec/src/button.ts',
+ 'internal/interaction-harness/src/harness.ts',
+ ])
+ expect(BROWSER_PATHS.test(file), file).toBe(false);
+ });
+
+ it('uploads the build it made, stamped with its commit, for the browser contracts', () => {
+ const stamp = step(build, 'Stamp the build with its commit');
+ const upload = step(build, 'Upload the docsite build');
+ const order = [
+ step(build, 'Build the docsite'),
+ step(build, 'Decide whether the browser contracts apply'),
+ stamp,
+ upload,
+ ].map(s => build.steps.indexOf(s));
+ expect(order).toEqual([...order].sort((a, b) => a - b));
+ for (const s of [stamp, upload])
+ expect(s.if).toBe("steps.browser.outputs.applies == 'true'");
+ expect(stamp.run.split('\n')[0]).toBe(
+ 'git rev-parse HEAD > apps/docsite/.next/BUILD_COMMIT',
+ );
+ expect(upload.with.name).toBe('docsite-build');
+ expect(upload.with.path.trim().split('\n')).toEqual([
+ 'apps/docsite/.next/',
+ '!apps/docsite/.next/cache/',
+ '!apps/docsite/.next/trace',
+ '!apps/docsite/.next/trace-build',
+ '!apps/docsite/.next/diagnostics/',
+ '!apps/docsite/.next/types/',
+ '!apps/docsite/.next/**/*.map',
+ '!apps/docsite/.next/**/*.nft.json',
+ 'apps/docsite/src/generated/',
+ 'apps/docsite/src/themes/astryx.js',
+ 'apps/docsite/src/themes/astryx.css',
+ 'apps/docsite/public/playground-types.json',
+ 'apps/docsite/public/monaco/',
+ 'apps/docsite/public/vendor/',
+ 'apps/docsite/public/shadcn/',
+ ]);
+ expect(upload.with['if-no-files-found']).toBe('error');
+ expect(upload.with.overwrite).toBe(true);
+ expect(upload.with['retention-days']).toBe(1);
+ expect(upload.with['compression-level']).toBe(6);
+ });
+});
+
+describe('shared infrastructure runs the browser contracts', () => {
+ const {classifyChanges} = createRequire(import.meta.url)(
+ './change-scope.cjs',
);
+ const applies = filenames => {
+ const touches = filenames.some(file => BROWSER_PATHS.test(file));
+ return (
+ touches ||
+ classifyChanges(filenames.map(filename => ({filename}))).fullSuite
+ );
+ };
- it.each([
- [0, true],
- [1, false],
- ])('the data-test result step passes only on exit %i', (code, passes) => {
- const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'docsite-data-'));
- fs.writeFileSync(path.join(dir, 'docsite-data.log'), 'log\n');
- fs.writeFileSync(path.join(dir, 'docsite-data.exit'), `${code}\n`);
- const result = spawnSync(
- 'bash',
- ['-e', '-c', step('test-docsite (data test results)').run],
- {cwd: dir},
+ it('runs them for a harness, a11y-spec, Storybook config or shared test change, each alone', () => {
+ for (const file of [
+ 'internal/interaction-harness/src/busy.ts',
+ 'internal/a11y-spec/src/button.ts',
+ 'apps/storybook/.storybook/preview.tsx',
+ '.github/scripts/ci-admission.test.mjs',
+ ])
+ expect(applies([file]), file).toBe(true);
+ });
+
+ it('skips them for component tests, stories, spec records and changesets alone', () => {
+ expect(
+ applies([
+ 'packages/core/src/Button/__tests__/Button.test.tsx',
+ 'apps/storybook/stories/Button.stories.tsx',
+ 'docs/specs/AST-030/spec.md',
+ '.changeset/quiet-cats.md',
+ ]),
+ ).toBe(false);
+ });
+});
+
+describe('docsite-browser', () => {
+ it('runs only on a build that succeeded and found contracts to run', () => {
+ expect(browser.needs).toEqual(['docsite-build']);
+ expect(browser.if).toBe(
+ gated(
+ "${{ !cancelled() && needs.docsite-build.result == 'success' && needs.docsite-build.outputs.browser == 'true' }}",
+ PR_CI_GATE,
+ ),
+ );
+ expect(browser.strategy).toEqual({'fail-fast': false, matrix: {leg: [1]}});
+ expect(browser.name).toBe(
+ 'docsite-browser (${{ matrix.leg }}/${{ strategy.job-total }})',
);
- fs.rmSync(dir, {recursive: true, force: true});
- expect(result.status === 0).toBe(passes);
});
- it('the data-test result step waits for the data tests to finish', async () => {
- const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'docsite-data-'));
- fs.writeFileSync(path.join(dir, 'docsite-data.log'), 'log\n');
- const child = spawn(
- 'bash',
- ['-e', '-c', step('test-docsite (data test results)').run],
- {cwd: dir},
+ it('serves the downloaded build of the same commit, never a build of its own', () => {
+ const download = step(browser, 'Download the docsite build');
+ const check = step(browser, 'Require the build of this commit');
+ const plan = step(browser, "Plan this leg's browser contracts");
+ const run = step(browser, 'test-docsite-e2e (browser contracts)');
+ const order = [download, check, plan, run].map(s =>
+ browser.steps.indexOf(s),
+ );
+ expect(order).toEqual([...order].sort((a, b) => a - b));
+ expect(download.uses).toMatch(/^actions\/download-artifact@/);
+ expect(download.with).toEqual({
+ name: 'docsite-build',
+ path: 'apps/docsite',
+ });
+ expect(check.run).toContain('built=$(cat apps/docsite/.next/BUILD_COMMIT)');
+ expect(check.run).toContain('test "$built" = "$here"');
+ // The checkout is the commit the build job checked out: no ref.
+ expect(browser.steps[0]).toEqual({uses: 'actions/checkout@v7'});
+ expect(
+ browser.steps.some(s => /docsite build|next build/.test(s.run ?? '')),
+ ).toBe(false);
+ expect(plan.run).toContain('node .github/scripts/playwright-legs.mjs plan');
+ expect(plan.run).toContain(
+ '--key docsite --config apps/docsite/playwright.config.ts',
+ );
+ expect(plan.run).toContain(
+ '--leg ${{ matrix.leg }} --of ${{ strategy.job-total }}',
);
- let code = null;
- const exited = new Promise(resolve =>
- child.on('exit', status => {
- code = status;
- resolve();
- }),
+ expect(run.if).toBe("steps.plan.outputs.files != '0'");
+ expect(run.run).toBe(
+ 'pnpm test:docsite-browser --test-list "$RUNNER_TEMP/docsite-leg.txt"',
);
- // Still waiting while the data tests have not recorded an exit code.
- await new Promise(resolve => setTimeout(resolve, 3000));
- expect(code).toBeNull();
- fs.writeFileSync(path.join(dir, 'docsite-data.exit'), '1\n');
- await exited;
- fs.rmSync(dir, {recursive: true, force: true});
- expect(code).toBe(1);
- }, 15_000);
+ });
+
+ it('the commit check fails on another commit\u2019s build', () => {
+ const check = step(browser, 'Require the build of this commit').run;
+ const dir = fs.mkdtempSync(path.join(root, 'node_modules/.cache-docsite-'));
+ try {
+ fs.mkdirSync(path.join(dir, 'apps/docsite/.next'), {recursive: true});
+ const runIn = commit => {
+ fs.writeFileSync(
+ path.join(dir, 'apps/docsite/.next/BUILD_COMMIT'),
+ `${commit}\n`,
+ );
+ fs.writeFileSync(path.join(dir, 'git'), '#!/bin/sh\necho aaaa\n', {
+ mode: 0o755,
+ });
+ return spawnSync('bash', ['-e', '-c', check], {
+ cwd: dir,
+ env: {...process.env, PATH: `${dir}:${process.env.PATH}`},
+ }).status;
+ };
+ expect(runIn('aaaa')).toBe(0);
+ expect(runIn('bbbb')).not.toBe(0);
+ } finally {
+ fs.rmSync(dir, {recursive: true, force: true});
+ }
+ });
it('uploads the explicit browser output directory and fails if evidence is missing', () => {
const configPath = path.join(root, 'apps/docsite/playwright.config.ts');
const config = fs.readFileSync(configPath, 'utf8');
const outputDir = config.match(/outputDir:\s*'([^']+)'/)?.[1];
expect(outputDir).toBe('../../test-results/docsite');
- const upload = step('Upload docsite browser evidence');
- // A held fork run (the ci:run step failed, so scope never ran) uploads
- // nothing, instead of failing a second time on missing evidence.
+ const upload = step(browser, 'Upload docsite browser evidence');
expect(upload.if).toBe(
- `always() && steps.scope.outcome == 'success' && ${ACTIVE}`,
+ "always() && steps.plan.outcome == 'success' && steps.plan.outputs.files != '0'",
);
+ expect(upload.with.name).toBe('docsite-browser-evidence-${{ matrix.leg }}');
expect(upload.with['if-no-files-found']).toBe('error');
expect(path.resolve(root, upload.with.path)).toBe(
path.resolve(path.dirname(configPath), outputDir),
);
});
});
+
+describe('docsite-test, the required join', () => {
+ it('reports for every pull request, behind only the draft skip', () => {
+ expect(join.needs).toEqual([
+ 'room',
+ 'admission',
+ 'heavy-ci',
+ 'docsite-build',
+ 'docsite-browser',
+ ]);
+ expect(join.if).toBe(
+ gated(
+ "${{ github.event_name != 'workflow_dispatch' && !startsWith(github.base_ref, 'release/v') && !cancelled() }}",
+ PR_REPORT_GATE,
+ ),
+ );
+ expect(join.steps.slice(0, 3).map(s => s.name)).toEqual([
+ 'Require a branch in this repository or the ci:run label',
+ 'Stop when CI is full',
+ 'Heavy CI deferred',
+ ]);
+ expect(join['runs-on']).toBe('ubuntu-slim');
+ });
+
+ const decide = step(
+ join,
+ 'Require the docsite build and its browser contracts',
+ );
+ const passes = (build, browserApplies, browserResult) =>
+ spawnSync('bash', ['-e', '-c', decide.run], {
+ env: {
+ PATH: process.env.PATH,
+ BUILD_RESULT: build,
+ BROWSER: browserApplies,
+ BROWSER_RESULT: browserResult,
+ },
+ }).status === 0;
+
+ it('reads the build, whether contracts apply, and the browser legs\u2019 whole result', () => {
+ expect(decide.env).toEqual({
+ BUILD_RESULT: '${{ needs.docsite-build.result }}',
+ BROWSER: '${{ needs.docsite-build.outputs.browser }}',
+ BROWSER_RESULT: '${{ needs.docsite-browser.result }}',
+ });
+ });
+
+ it('passes on a passed build with passed contracts, or with none to run', () => {
+ expect(passes('success', 'true', 'success')).toBe(true);
+ expect(passes('success', 'false', 'skipped')).toBe(true);
+ });
+
+ it('fails on a failed, cancelled or skipped leg, a failed build, or an unknown scope', () => {
+ for (const result of ['failure', 'cancelled', 'skipped', ''])
+ expect(passes('success', 'true', result), `browser ${result}`).toBe(
+ false,
+ );
+ for (const result of ['failure', 'cancelled', 'skipped', ''])
+ expect(passes(result, 'false', 'skipped'), `build ${result}`).toBe(false);
+ expect(passes('success', '', 'skipped')).toBe(false);
+ expect(passes('success', 'false', 'cancelled')).toBe(false);
+ });
+});
diff --git a/.github/scripts/ci-duration-guard.test.mjs b/.github/scripts/ci-duration-guard.test.mjs
index 5b30b13456..c47eec636e 100644
--- a/.github/scripts/ci-duration-guard.test.mjs
+++ b/.github/scripts/ci-duration-guard.test.mjs
@@ -27,7 +27,7 @@ const BUDGET = 15;
const EXEMPT = new Set(['test-native-swift']);
// Jobs that only join results finish in seconds and need no limit of their
// own; every job that installs, builds, or tests has one.
-const JOINS = new Set(['test', 'build', 'pr-rtl']);
+const JOINS = new Set(['test', 'build', 'docsite-test', 'pr-rtl']);
/** The limit a pull-request run gets from a job's `timeout-minutes`. */
function pullRequestLimit(value) {
diff --git a/.github/scripts/ci-lab-only-routing.test.mjs b/.github/scripts/ci-lab-only-routing.test.mjs
index 9623d9711b..cabd667188 100644
--- a/.github/scripts/ci-lab-only-routing.test.mjs
+++ b/.github/scripts/ci-lab-only-routing.test.mjs
@@ -57,9 +57,9 @@ describe('Lab-only lane (spec:AST-030 FR26)', () => {
});
it('reports success with a Lab-only notice on every required context', () => {
- // docsite-test and test read their own scope; build reads it from the
- // Storybook build, which runs on a Lab-only change.
- for (const name of ['docsite-test', 'test']) {
+ // test reads its own scope; build reads it from the Storybook build and
+ // docsite-test from the docsite build, which both run on a Lab-only change.
+ for (const name of ['test']) {
const notice = step(name, NOTICE);
expect(notice?.if, name).toBe(LAB_TRUE);
expect(notice.run, name).toContain(
@@ -70,6 +70,12 @@ describe('Lab-only lane (spec:AST-030 FR26)', () => {
expect(step('build', NOTICE).if).toBe(
"needs.build-storybook.outputs.lab_only == 'true'",
);
+ expect(step('docsite-test', NOTICE).if).toBe(
+ "needs.docsite-build.outputs.lab_only == 'true'",
+ );
+ expect(ci.jobs['docsite-build'].outputs.lab_only).toBe(
+ '${{ steps.scope.outputs.lab_only }}',
+ );
expect(ci.jobs['build-storybook'].outputs.lab_only).toBe(
'${{ steps.scope.outputs.lab_only }}',
);
@@ -80,12 +86,15 @@ describe('Lab-only lane (spec:AST-030 FR26)', () => {
});
it('keeps every owner the required joins wait on green while skipping its work', () => {
- for (const name of ['docsite-test', 'test-build', 'typecheck']) {
+ for (const name of ['docsite-build', 'test-build', 'typecheck']) {
expect(step(name, NOTICE)?.if, name).toBe(LAB_TRUE);
expect(String(ci.jobs[name].if), name).not.toContain('lab_only');
for (const work of workAfterScope(name)) {
if (work.name === 'Validate spec records') continue;
if (work.name === 'Skip docsite work for Node tooling') continue;
+ // Decides from the scope, Lab-only included, and does no work.
+ if (work.name === 'Decide whether the browser contracts apply')
+ continue;
if (/^Skip /.test(work.name ?? '')) continue;
// A step gated on an earlier work step's outcome follows that step.
if (
diff --git a/.github/scripts/ci-test-routing.test.mjs b/.github/scripts/ci-test-routing.test.mjs
index 9f1b28022c..1c862a2112 100644
--- a/.github/scripts/ci-test-routing.test.mjs
+++ b/.github/scripts/ci-test-routing.test.mjs
@@ -1044,8 +1044,8 @@ describe('heavy lanes outside their component scope (spec:AST-030 FR9)', () => {
}
});
- it('validates spec records whenever docsite-test cannot decide its scope', () => {
- const validate = workflow.jobs['docsite-test'].steps.find(
+ it('validates spec records whenever docsite-build cannot decide its scope', () => {
+ const validate = workflow.jobs['docsite-build'].steps.find(
step => step.name === 'Validate spec records',
);
expect(validate.if).toBe(
diff --git a/.github/scripts/ci-tooling-routing.test.mjs b/.github/scripts/ci-tooling-routing.test.mjs
index 64ef335dee..aac0e08b92 100644
--- a/.github/scripts/ci-tooling-routing.test.mjs
+++ b/.github/scripts/ci-tooling-routing.test.mjs
@@ -409,16 +409,23 @@ describe('Node-tooling CI routing', () => {
it('keeps required build and docsite contexts green without their heavy work', () => {
expect(
- step(ci.jobs['docsite-test'], 'Skip docsite work for Node tooling').if,
+ step(ci.jobs['docsite-build'], 'Skip docsite work for Node tooling').if,
).toContain(TOOLING_TRUE);
for (const name of [
'Build docsite workspace dependencies',
'Build the docsite',
- 'test-docsite (start the data tests)',
- 'test-docsite-e2e (browser contracts)',
+ 'test-docsite (data tests)',
]) {
- expect(step(ci.jobs['docsite-test'], name).if).toContain(TOOLING_FALSE);
+ expect(step(ci.jobs['docsite-build'], name).if).toContain(TOOLING_FALSE);
}
+ // The browser contracts run only when the build found them in scope,
+ // which a tooling-only change never is.
+ expect(
+ step(
+ ci.jobs['docsite-build'],
+ 'Decide whether the browser contracts apply',
+ ).run,
+ ).toContain(TOOLING_FALSE);
for (const candidate of [
...ci.jobs['build-storybook'].steps,
diff --git a/.github/scripts/interaction-legs.mjs b/.github/scripts/playwright-legs.mjs
similarity index 60%
rename from .github/scripts/interaction-legs.mjs
rename to .github/scripts/playwright-legs.mjs
index ce8d7f38c6..311c3decbc 100644
--- a/.github/scripts/interaction-legs.mjs
+++ b/.github/scripts/playwright-legs.mjs
@@ -2,17 +2,19 @@
// Copyright (c) Meta Platforms, Inc. and affiliates.
/**
- * @file interaction-legs.mjs
- * @description Splits the interaction proofs of one Playwright project into
- * legs of about equal running time, by spec file, from the per-file times a
- * CI run recorded (spec:AST-030 FR13).
- * @input `plan`: the project, this leg and the leg count, and any Playwright
- * path filters; `.github/interaction-durations.json`. `record`: CI job logs
- * of the list reporter.
+ * @file playwright-legs.mjs
+ * @description Splits the spec files of one Playwright suite into legs of
+ * about equal running time, from the per-file times a CI run recorded
+ * (spec:AST-030 FR13).
+ * @input `plan`: the suite's times key, its config and project, this leg and
+ * the leg count, and any Playwright path filters;
+ * `.github/playwright-leg-durations.json`. `record`: CI job logs of the list
+ * reporter.
* @output `plan`: this leg's spec files, one per line, for Playwright's
* `--test-list`, and `files=<count>` for `$GITHUB_OUTPUT`. `record`: the
- * durations file, rewritten for the project.
- * @position The pr-interaction and pr-interaction-webkit legs in ci.yml.
+ * durations file, rewritten for the suite.
+ * @position The pr-interaction, pr-interaction-webkit and docsite-browser
+ * legs in ci.yml.
*/
import {execFileSync} from 'node:child_process';
@@ -23,11 +25,13 @@ import {fileURLToPath} from 'node:url';
import {costOf, splitByDuration} from '../../scripts/lib/duration-split.mjs';
import {listedFiles} from './a11y-pr-contracts.mjs';
-// CI runs this file from the workflow's own commit, outside the checkout, in
-// the checkout's root.
+// CI may run this file from the workflow's own commit, outside the checkout,
+// in the checkout's root.
const ROOT = process.cwd();
-export const DURATIONS = path.join(ROOT, '.github/interaction-durations.json');
-const CONFIG = 'playwright.interaction.config.ts';
+export const DURATIONS = path.join(
+ ROOT,
+ '.github/playwright-leg-durations.json',
+);
/**
* Splits `files` into `legs` lists of about equal estimated time, with the
@@ -46,7 +50,9 @@ export function planLegs(files, durations, legs) {
}));
}
-const TEST_LINE = /^(\S+Z)\s+\S+\s+\d+\s+\[([\w-]+)\] › ([^:]+):\d+:\d+ › /;
+// A suite with one unnamed project prints no `[project]`.
+const TEST_LINE =
+ /^(\S+Z)\s+\S+\s+\d+\s+(?:\[([\w-]+)\] › )?([^:\s]+):\d+:\d+ › /;
const RUNNING = /Running \d+ tests? using/;
/** Milliseconds of a log line's timestamp; GitHub writes seven fraction digits. */
@@ -57,8 +63,11 @@ function stamp(line) {
/**
* Seconds per spec file from a CI job log of the list reporter: each test's
* time is the gap from the line before it, so a file's time includes its setup.
+ * `project` picks one project's lines (none for an unnamed project), and
+ * `strip` turns the printed path into the one Playwright lists (relative to
+ * the config's test directory).
*/
-export function recordLog(text, project) {
+export function recordLog(text, project, strip = '') {
const seconds = {};
let previous = null;
for (const line of text.split('\n')) {
@@ -68,9 +77,13 @@ export function recordLog(text, project) {
continue;
}
const match = TEST_LINE.exec(line);
- if (!match || previous == null || match[2] !== project) continue;
+ if (!match || previous == null || match[2] !== (project ?? undefined))
+ continue;
const time = stamp(match[1]);
- seconds[match[3]] = (seconds[match[3]] ?? 0) + (time - previous) / 1000;
+ const file = match[3].startsWith(strip)
+ ? match[3].slice(strip.length)
+ : match[3];
+ seconds[file] = (seconds[file] ?? 0) + (time - previous) / 1000;
previous = time;
}
return seconds;
@@ -85,8 +98,8 @@ function option(args, name) {
return index === -1 ? undefined : args[index + 1];
}
-/** The spec files Playwright lists for a project with these extra arguments. */
-function list(project, out, extra) {
+/** The spec files Playwright lists for a suite with these extra arguments. */
+function list({config, project}, out, extra) {
// The report goes to a file: a spec's own logging can share stdout.
const reportFile = `${out}.list.json`;
execFileSync(
@@ -96,9 +109,8 @@ function list(project, out, extra) {
'playwright',
'test',
'--config',
- CONFIG,
- '--project',
- project,
+ config,
+ ...(project ? ['--project', project] : []),
'--list',
'--reporter=json',
...extra,
@@ -121,37 +133,44 @@ function plan(args) {
const split = args.indexOf('--');
const own = split === -1 ? args : args.slice(0, split);
const filters = split === -1 ? [] : args.slice(split + 1);
- const project = option(own, '--project');
+ const key = option(own, '--key');
+ const suite = {
+ config: option(own, '--config'),
+ project: option(own, '--project'),
+ };
const leg = Number(option(own, '--leg'));
const legs = Number(option(own, '--of'));
const out = option(own, '--out');
const durations = option(own, '--durations') ?? DURATIONS;
- if (!project || !out || !Number.isInteger(leg) || leg < 1 || leg > legs) {
+ if (
+ !key ||
+ !suite.config ||
+ !out ||
+ !Number.isInteger(leg) ||
+ leg < 1 ||
+ leg > legs
+ ) {
throw new Error(
- 'usage: plan --project <name> --leg <i> --of <n> --out <file> [--durations <file>] [-- <filters...>]',
+ 'usage: plan --key <times key> --config <file> [--project <name>] --leg <i> --of <n> --out <file> [--durations <file>] [-- <filters...>]',
);
}
- const files = list(project, out, filters);
+ const files = list(suite, out, filters);
if (files.length === 0)
- throw new Error(`Playwright listed no ${project} interaction spec files`);
- const legsPlan = planLegs(
- files,
- readDurations(durations)[project] ?? {},
- legs,
- );
+ throw new Error(`Playwright listed no ${key} spec files`);
+ const legsPlan = planLegs(files, readDurations(durations)[key] ?? {}, legs);
const mine = legsPlan[leg - 1];
fs.writeFileSync(out, mine.files.map(file => `${file}\n`).join(''));
// Playwright runs nothing, and passes, for a test list that matches no
// spec, so the leg checks that its list selects exactly its files.
if (mine.files.length > 0) {
- const selected = list(project, out, ['--test-list', out]);
+ const selected = list(suite, out, ['--test-list', out]);
if (selected.join('\n') !== mine.files.join('\n'))
throw new Error(
- `The ${project} leg's test list selects ${selected.length} spec files, not its ${mine.files.length}`,
+ `The ${key} leg's test list selects ${selected.length} spec files, not its ${mine.files.length}`,
);
}
console.log(
- `${project} leg ${leg}/${legs}: ${mine.files.length} of ${files.length} spec files, about ${Math.round(mine.seconds)} s`,
+ `${key} leg ${leg}/${legs}: ${mine.files.length} of ${files.length} spec files, about ${Math.round(mine.seconds)} s`,
);
for (const [i, each] of legsPlan.entries())
console.log(
@@ -166,31 +185,36 @@ function plan(args) {
}
function record(args) {
+ const key = option(args, '--key');
const project = option(args, '--project');
+ const strip = option(args, '--strip') ?? '';
+ const valued = new Set(['--key', '--project', '--strip']);
const logs = args.filter(
- (arg, i) => !arg.startsWith('--') && args[i - 1] !== '--project',
+ (arg, i) => !arg.startsWith('--') && !valued.has(args[i - 1]),
);
- if (!project || logs.length === 0)
- throw new Error('usage: record --project <name> <job log...>');
+ if (!key || logs.length === 0)
+ throw new Error(
+ 'usage: record --key <times key> [--project <name>] [--strip <path prefix>] <job log...>',
+ );
const seconds = {};
for (const log of logs) {
for (const [file, value] of Object.entries(
- recordLog(fs.readFileSync(log, 'utf8'), project),
+ recordLog(fs.readFileSync(log, 'utf8'), project, strip),
)) {
seconds[file] = (seconds[file] ?? 0) + value;
}
}
if (Object.keys(seconds).length === 0)
- throw new Error(`no ${project} test lines in the logs`);
+ throw new Error(`no ${key} test lines in the logs`);
const durations = readDurations();
- durations[project] = Object.fromEntries(
+ durations[key] = Object.fromEntries(
Object.entries(seconds)
.sort(([a], [b]) => (a < b ? -1 : 1))
.map(([file, value]) => [file, Math.round(value * 10) / 10]),
);
fs.writeFileSync(DURATIONS, `${JSON.stringify(durations, null, 2)}\n`);
console.log(
- `${project}: ${Object.keys(seconds).length} spec files recorded into ${path.relative(ROOT, DURATIONS)}`,
+ `${key}: ${Object.keys(seconds).length} spec files recorded into ${path.relative(ROOT, DURATIONS)}`,
);
}
@@ -202,7 +226,7 @@ if (
try {
if (command === 'plan') plan(args);
else if (command === 'record') record(args);
- else throw new Error('usage: interaction-legs.mjs plan|record ...');
+ else throw new Error('usage: playwright-legs.mjs plan|record ...');
} catch (error) {
console.error(error.message);
process.exitCode = 1;
diff --git a/.github/scripts/interaction-legs.test.mjs b/.github/scripts/playwright-legs.test.mjs
similarity index 84%
rename from .github/scripts/interaction-legs.test.mjs
rename to .github/scripts/playwright-legs.test.mjs
index 8ca6a9e2b9..51e9246e10 100644
--- a/.github/scripts/interaction-legs.test.mjs
+++ b/.github/scripts/playwright-legs.test.mjs
@@ -8,7 +8,7 @@ import {fileURLToPath} from 'node:url';
import {describe, expect, it} from 'vitest';
import yaml from 'yaml';
-import {planLegs, recordLog} from './interaction-legs.mjs';
+import {planLegs, recordLog} from './playwright-legs.mjs';
const root = path.resolve(
path.dirname(fileURLToPath(import.meta.url)),
@@ -19,7 +19,7 @@ const ci = yaml.parse(
);
const durations = JSON.parse(
fs.readFileSync(
- path.join(root, '.github/interaction-durations.json'),
+ path.join(root, '.github/playwright-leg-durations.json'),
'utf8',
),
);
@@ -78,7 +78,7 @@ describe('planLegs', () => {
describe('the list reader and recordLog', () => {
it('reads the list report with the reader the accessibility contracts use', () => {
const source = fs.readFileSync(
- path.join(root, '.github/scripts/interaction-legs.mjs'),
+ path.join(root, '.github/scripts/playwright-legs.mjs'),
'utf8',
);
expect(source).toContain(
@@ -101,6 +101,25 @@ describe('the list reader and recordLog', () => {
});
expect(recordLog('no run here', 'chromium')).toEqual({});
});
+
+ it('reads a suite with one unnamed project, with its printed path made relative to its test directory', () => {
+ const log = [
+ '2026-11-03T20:04:07.000Z Running 2 tests using 1 worker',
+ '2026-11-03T20:04:15.000Z ✓ 1 apps/docsite/e2e/a.spec.ts:37:5 › first (4.1s)',
+ '2026-11-03T20:04:25.000Z ✓ 2 apps/docsite/e2e/b.spec.ts:65:7 › second (10.2s)',
+ ].join('\n');
+ expect(recordLog(log, undefined, 'apps/docsite/e2e/')).toEqual({
+ 'a.spec.ts': 8,
+ 'b.spec.ts': 10,
+ });
+ // A named project's lines never count for an unnamed one.
+ expect(
+ recordLog(
+ '2026-11-03T20:04:07.000Z Running 1 test using 1 worker\n2026-11-03T20:04:15.000Z ✓ 1 [chromium] › a.spec.ts:3:5 › t',
+ undefined,
+ ),
+ ).toEqual({});
+ });
});
describe('the interaction proof legs in ci.yml', () => {
@@ -159,19 +178,19 @@ describe('the interaction proof legs in ci.yml', () => {
expect(job.steps.indexOf(keep)).toBeLessThan(checkout);
expect(keep.if).toBe("steps.scope.outputs.applies == 'true'");
for (const [file, dir] of [
- ['.github/scripts/interaction-legs.mjs', '.github/scripts/'],
+ ['.github/scripts/playwright-legs.mjs', '.github/scripts/'],
['.github/scripts/a11y-pr-contracts.mjs', '.github/scripts/'],
['scripts/lib/duration-split.mjs', 'scripts/lib/'],
- ['.github/interaction-durations.json', '.github/'],
+ ['.github/playwright-leg-durations.json', '.github/'],
])
expect(keep.run).toContain(
`cp .test-scope/${file} "$RUNNER_TEMP/interaction-legs/${dir}"`,
);
expect(plan.run).toContain(
- `node "$RUNNER_TEMP/interaction-legs/.github/scripts/interaction-legs.mjs" plan --project ${lane.project}`,
+ `--key interaction-${lane.project} --config playwright.interaction.config.ts --project ${lane.project}`,
);
expect(plan.run).toContain(
- '--durations "$RUNNER_TEMP/interaction-legs/.github/interaction-durations.json"',
+ '--durations "$RUNNER_TEMP/interaction-legs/.github/playwright-leg-durations.json"',
);
expect(plan.run).not.toMatch(/git (fetch|show)/);
expect(plan.run).toContain(
@@ -202,10 +221,10 @@ describe('the interaction proof legs in ci.yml', () => {
const scope = ci.jobs[id].steps.find(each => each.id === 'scope');
const pattern = new RegExp(scope.with.paths);
for (const file of [
- '.github/scripts/interaction-legs.mjs',
+ '.github/scripts/playwright-legs.mjs',
'.github/scripts/a11y-pr-contracts.mjs',
'scripts/lib/duration-split.mjs',
- '.github/interaction-durations.json',
+ '.github/playwright-leg-durations.json',
])
expect(pattern.test(file), `${id} ${file}`).toBe(true);
}
@@ -291,9 +310,17 @@ describe('the interaction proof legs in ci.yml', () => {
}
});
+ it('records the docsite browser contracts too, one leg inside the same budget', () => {
+ const times = durations.docsite;
+ expect(Object.keys(times).length).toBeGreaterThan(0);
+ const legs = ci.jobs['docsite-browser'].strategy.matrix.leg.length;
+ for (const leg of planLegs(Object.keys(times), times, legs))
+ expect(leg.seconds).toBeLessThanOrEqual(6 * 60);
+ });
+
it('records a time for each project the legs plan, each under the legs\u2019 per-runner budget', () => {
for (const lane of lanes) {
- const times = durations[lane.project];
+ const times = durations[`interaction-${lane.project}`];
expect(Object.keys(times).length, lane.project).toBeGreaterThan(0);
const plan = planLegs(Object.keys(times), times, lane.legs.length);
// About six minutes a leg under load; the recorded run was a loaded one.
@@ -304,7 +331,7 @@ describe('the interaction proof legs in ci.yml', () => {
it('plans from a copy outside the checkout, run in its root, with the times it is given', () => {
const out = path.join(
- fs.mkdtempSync(path.join(root, 'node_modules/.cache-interaction-legs-')),
+ fs.mkdtempSync(path.join(root, 'node_modules/.cache-playwright-legs-')),
'leg.txt',
);
try {
@@ -330,24 +357,30 @@ describe('the interaction proof legs in ci.yml', () => {
// it imports, laid out as in the tree, outside the checkout.
const copies = path.join(path.dirname(out), 'legs');
for (const file of [
- '.github/scripts/interaction-legs.mjs',
+ '.github/scripts/playwright-legs.mjs',
'.github/scripts/a11y-pr-contracts.mjs',
'scripts/lib/duration-split.mjs',
]) {
fs.mkdirSync(path.dirname(path.join(copies, file)), {recursive: true});
fs.copyFileSync(path.join(root, file), path.join(copies, file));
}
- const copy = path.join(copies, '.github/scripts/interaction-legs.mjs');
+ const copy = path.join(copies, '.github/scripts/playwright-legs.mjs');
const times = path.join(path.dirname(out), 'durations.json');
fs.writeFileSync(
times,
- JSON.stringify({chromium: {'x.spec.ts': 1, 'y.spec.ts': 100}}),
+ JSON.stringify({
+ 'interaction-chromium': {'x.spec.ts': 1, 'y.spec.ts': 100},
+ }),
);
execFileSync(
process.execPath,
[
copy,
'plan',
+ '--key',
+ 'interaction-chromium',
+ '--config',
+ 'playwright.interaction.config.ts',
'--project',
'chromium',
'--leg',
@@ -379,6 +412,10 @@ describe('the interaction proof legs in ci.yml', () => {
[
copy,
'plan',
+ '--key',
+ 'interaction-chromium',
+ '--config',
+ 'playwright.interaction.config.ts',
'--project',
'chromium',
'--leg',
@@ -405,8 +442,12 @@ describe('the interaction proof legs in ci.yml', () => {
execFileSync(
process.execPath,
[
- path.join(root, '.github/scripts/interaction-legs.mjs'),
+ path.join(root, '.github/scripts/playwright-legs.mjs'),
'plan',
+ '--key',
+ 'interaction-chromium',
+ '--config',
+ 'playwright.interaction.config.ts',
'--project',
'chromium',
'--leg',
diff --git a/.github/scripts/shadcn-registry-ci.test.mjs b/.github/scripts/shadcn-registry-ci.test.mjs
index 0107dd284f..aa43d2df96 100644
--- a/.github/scripts/shadcn-registry-ci.test.mjs
+++ b/.github/scripts/shadcn-registry-ci.test.mjs
@@ -5,7 +5,7 @@
* @description Pins the full-catalog ShadCN compatibility check
* (test-registry-e2e), which runs for release-check until the production
* registry launches; its network-free production gate runs with the unit
- * tests (verify-production-gate.test.mjs) and in docsite-test.
+ * tests (verify-production-gate.test.mjs) and in docsite-build.
* @input The PR CI workflow, docsite manifest, and catalog verifier source.
* @output Mutation-sensitive assertions for generation, release gating, stock
* client installation, compilation, and the historical required join.
@@ -63,9 +63,9 @@ describe('ShadCN registry CI contract', () => {
),
),
).toBe(true);
- // A docsite-only change skips test-node; docsite-test runs the gate too.
+ // A docsite-only change skips test-node; docsite-build runs the gate too.
expect(
- ci.jobs['docsite-test'].steps.find(
+ ci.jobs['docsite-build'].steps.find(
candidate =>
candidate.name === 'Verify the hidden production registry gate',
).run,
diff --git a/.github/scripts/spec-owner-workflow.test.mjs b/.github/scripts/spec-owner-workflow.test.mjs
index 9d5d228ee1..e4e56155ba 100644
--- a/.github/scripts/spec-owner-workflow.test.mjs
+++ b/.github/scripts/spec-owner-workflow.test.mjs
@@ -135,7 +135,7 @@ describe('spec-only workflow contract', () => {
"needs.build-storybook.result != 'skipped'",
);
- const docsite = jobBlock('docsite-test');
+ const docsite = jobBlock('docsite-build');
expect(docsite).toContain("steps.scope.outputs.spec_only == 'true'");
expect(docsite).toContain('node scripts/check-knowledge.mjs');
@@ -175,9 +175,9 @@ describe('spec-only workflow contract', () => {
expect(from, start).toBeGreaterThanOrEqual(0);
return ci.slice(from, ci.indexOf(`\n ${end}:`, from));
};
- // docsite-test validates spec records itself and gates its docsite build
+ // docsite-build validates spec records itself and gates its docsite build
// and tests off for the spec-only lane.
- const docsiteJob = block('docsite-test', 'test-ui');
+ const docsiteJob = block('docsite-build', 'docsite-browser');
const checkout = docsiteJob.indexOf('- uses: actions/checkout@v7');
const setup = docsiteJob.indexOf('- uses: ./.github/actions/setup');
@@ -191,14 +191,17 @@ describe('spec-only workflow contract', () => {
"if: (steps.scope.outputs.spec_only == 'true' || steps.scope.outputs.decided != 'true')",
);
- const heavy = docsiteJob.slice(
- docsiteJob.indexOf('- name: Install Playwright'),
- docsiteJob.indexOf('- name: test-docsite (data test results)'),
- );
- const heavySteps = heavy.split('\n - name: ');
- expect(heavySteps.length).toBe(5);
- for (const step of heavySteps) {
- expect(step).toContain("if: steps.scope.outputs.spec_only != 'true'");
+ for (const name of [
+ 'Build docsite workspace dependencies',
+ 'Build the docsite',
+ 'test-docsite (data tests)',
+ 'Verify the hidden production registry gate',
+ ]) {
+ const at = docsiteJob.indexOf(`- name: ${name}`);
+ expect(at, name).toBeGreaterThan(validate);
+ expect(docsiteJob.slice(at, at + 300), name).toContain(
+ "if: steps.scope.outputs.spec_only != 'true'",
+ );
}
});
@@ -410,10 +413,10 @@ describe('test-deps scope (Internal Registry)', () => {
});
});
-describe('docsite-test spec validation', () => {
+describe('docsite-build spec validation', () => {
it('validates spec records whenever its own scope is spec-only or undecided', () => {
const ci = read('.github/workflows/ci.yml');
- const job = ci.slice(ci.indexOf('\n docsite-test:\n'));
+ const job = ci.slice(ci.indexOf('\n docsite-build:\n'));
const validate = job.slice(job.indexOf('- name: Validate spec records'));
expect(validate.split('\n')[1].trim()).toBe(
"if: (steps.scope.outputs.spec_only == 'true' || steps.scope.outputs.decided != 'true')",
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 8c6392737c..e380b429b2 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -557,9 +557,9 @@ jobs:
echo "::notice title=Heavy CI deferred::Heavy CI deferred: runs when marked ready and before merge. Mark the pull request ready, reopen it, or re-run all jobs of this run to run everything."
echo "Heavy CI deferred: runs when marked ready and before merge." >> "$GITHUB_STEP_SUMMARY"
- docsite-test:
+ docsite-build:
needs: [room, admission, heavy-ci]
- if: ${{ (github.event_name != 'pull_request' || !github.event.pull_request.draft) && (github.event_name != 'workflow_dispatch' && !startsWith(github.base_ref, 'release/v') && !cancelled()) }}
+ if: ${{ (github.event_name != 'pull_request' || !github.event.pull_request.draft && (github.event.pull_request.head.repo.full_name == github.repository || contains(github.event.pull_request.labels.*.name, 'ci:run'))) && (github.event_name != 'workflow_dispatch' && !startsWith(github.base_ref, 'release/v') && !cancelled() && needs.heavy-ci.outputs.deferred != 'true' && needs.room.outputs.full != 'true' && needs.admission.outputs.full != 'true') }}
# The Next.js production build uses every core it gets.
runs-on: ubuntu-latest
timeout-minutes: 15
@@ -572,29 +572,22 @@ jobs:
env:
NEXT_PUBLIC_INTERNAL_DOCS_ORIGIN: https://docs.example.test
NEXT_PUBLIC_DOCS_ACCESS_CHECK_ORIGIN: https://probe.example.test
+ outputs:
+ lab_only: ${{ steps.scope.outputs.lab_only }}
+ # The browser contracts apply: the docsite was built, and the change is
+ # shared infrastructure or more than component tests, stories, spec
+ # records and changesets.
+ browser: ${{ steps.browser.outputs.applies }}
steps:
- - name: Require a branch in this repository or the ci:run label
- if: ${{ github.event_name == 'pull_request' && !(github.event.pull_request.head.repo.full_name == github.repository || contains(github.event.pull_request.labels.*.name, 'ci:run')) }}
- run: |
- echo "::error::Waiting for a maintainer's ci:run label: an outside contributor's pull request runs CI once a maintainer adds it (spec:AST-030 FR17)."
- exit 1
# This job decides its own scope (no separate scope job): the step
# reads the PR's file list and the base's trusted classifier, and
- # everything is in scope when it cannot decide.
- - name: Stop when CI is full
- if: needs.room.outputs.full == 'true' || needs.admission.outputs.full == 'true'
- run: |
- echo "::error title=CI is full::CI is full: re-run all jobs or push later. The run found no room under the CI ceiling."
- exit 1
-
- # An agent lane's push defers the heavy suites (spec:AST-030 FR20): the
- # required check fails with the reason, never passes as skipped.
- - name: Heavy CI deferred
- if: needs.heavy-ci.outputs.deferred == 'true'
- run: |
- echo "::error::Heavy CI deferred: runs when marked ready and before merge (spec:AST-030 FR20)."
- exit 1
-
+ # everything is in scope when it cannot decide. `touches` is false only
+ # when every changed file outside the docsite app is a test, a story
+ # (or Storybook file), a spec record, a changeset, or an a11y-spec or
+ # interaction-harness file. The browser contracts still run when the
+ # classifier calls the change shared infrastructure (`full_suite`: the
+ # harnesses, Storybook config, a shared test), as for every owner
+ # (spec:AST-030 FR13).
- name: Check out the scope action
uses: actions/checkout@v7
with:
@@ -605,6 +598,8 @@ jobs:
- name: Decide this job's scope
id: scope
uses: ./.test-scope/.github/actions/test-scope
+ with:
+ paths: '^(?:apps/docsite/|(?!(?:.*/)?__tests__/|.*\.(?:test|spec)\.[cm]?[jt]sx?$|apps/storybook/|.*\.stories\.[jt]sx?$|docs/specs/|\.changeset/|internal/a11y-spec/|internal/interaction-harness/))'
- name: 'Lab-only: Lab tests + Storybook build'
if: steps.scope.outputs.lab_only == 'true'
@@ -627,14 +622,6 @@ jobs:
if: (steps.scope.outputs.spec_only == 'true' || steps.scope.outputs.decided != 'true')
run: node scripts/check-knowledge.mjs
- - name: Install Playwright
- if: steps.scope.outputs.spec_only != 'true' && steps.scope.outputs.tooling_only != 'true' && steps.scope.outputs.lab_only != 'true'
- run: npx playwright install chromium
-
- # The production build (and the data generation inside it) imports every
- # theme package's built entry and the canary component packages, on top
- # of core. Core builds first; the rest depend on it and not on each
- # other, so they build side by side.
- name: Build docsite workspace dependencies
if: steps.scope.outputs.spec_only != 'true' && steps.scope.outputs.tooling_only != 'true' && steps.scope.outputs.lab_only != 'true'
run: |
@@ -659,26 +646,60 @@ jobs:
if: steps.scope.outputs.spec_only != 'true' && steps.scope.outputs.tooling_only != 'true' && steps.scope.outputs.lab_only != 'true'
run: pnpm -F @astryxdesign/docsite build
- # test-docsite (the data tests) runs in the background while
- # test-docsite-e2e (the browser contracts) drives the same build; the
- # e2e step stays its own step so it can move to another tier alone.
- - name: test-docsite (start the data tests)
- id: data
- if: steps.scope.outputs.spec_only != 'true' && steps.scope.outputs.tooling_only != 'true' && steps.scope.outputs.lab_only != 'true'
- # errexit off inside: a failing test run must still record its exit
- # code, written whole so the result step never reads half a file.
- run: (set +e; pnpm -F @astryxdesign/docsite test > docsite-data.log 2>&1; echo $? > docsite-data.exit.tmp; mv docsite-data.exit.tmp docsite-data.exit) &
-
- - name: test-docsite-e2e (browser contracts)
- if: steps.scope.outputs.spec_only != 'true' && steps.scope.outputs.tooling_only != 'true' && steps.scope.outputs.lab_only != 'true'
- run: pnpm test:docsite-browser
+ - name: Decide whether the browser contracts apply
+ id: browser
+ run: echo "applies=${{ (steps.scope.outputs.spec_only != 'true' && steps.scope.outputs.tooling_only != 'true' && steps.scope.outputs.lab_only != 'true') && (steps.scope.outputs.touches == 'true' || steps.scope.outputs.full_suite == 'true') }}" >> "$GITHUB_OUTPUT"
- - name: test-docsite (data test results)
- if: ${{ !cancelled() && steps.data.outcome == 'success' }}
+ # docsite-browser serves this build, never one of its own. The commit
+ # stamp lets it check that the build is of the commit it checked out.
+ - name: Stamp the build with its commit
+ if: steps.browser.outputs.applies == 'true'
run: |
- while [ ! -f docsite-data.exit ]; do sleep 2; done
- cat docsite-data.log
- exit "$(cat docsite-data.exit)"
+ git rev-parse HEAD > apps/docsite/.next/BUILD_COMMIT
+ # The sizes behind the upload, largest first, and what it leaves out.
+ du -sh apps/docsite/.next/* apps/docsite/.next/server/* apps/docsite/src/generated apps/docsite/public/monaco apps/docsite/public/vendor 2>/dev/null | sort -rh | head -15
+ for kind in '*.map' '*.nft.json'; do
+ echo "left out, $kind: $(find apps/docsite/.next -path apps/docsite/.next/cache -prune -o -name "$kind" -type f -print0 | du -ch --files0-from=- 2>/dev/null | tail -1)"
+ done
+
+ # Everything `next start` reads that the build generated and the
+ # repository ignores: the server and static output, the generated data
+ # and theme, the ShadCN registry and the playground's vendored assets.
+ # Not the compile
+ # cache, the build traces, source maps or file traces (*.nft.json, for
+ # a standalone deployment), which serving never reads.
+ - name: Upload the docsite build
+ if: steps.browser.outputs.applies == 'true'
+ uses: actions/upload-artifact@v7
+ with:
+ name: docsite-build
+ path: |
+ apps/docsite/.next/
+ !apps/docsite/.next/cache/
+ !apps/docsite/.next/trace
+ !apps/docsite/.next/trace-build
+ !apps/docsite/.next/diagnostics/
+ !apps/docsite/.next/types/
+ !apps/docsite/.next/**/*.map
+ !apps/docsite/.next/**/*.nft.json
+ apps/docsite/src/generated/
+ apps/docsite/src/themes/astryx.js
+ apps/docsite/src/themes/astryx.css
+ apps/docsite/public/playground-types.json
+ apps/docsite/public/monaco/
+ apps/docsite/public/vendor/
+ apps/docsite/public/shadcn/
+ include-hidden-files: true
+ if-no-files-found: error
+ overwrite: true
+ retention-days: 1
+ # HTML, RSC payloads and JavaScript compress well; the default level
+ # takes most of that at a fraction of the highest level's time.
+ compression-level: 6
+
+ - name: test-docsite (data tests)
+ if: steps.scope.outputs.spec_only != 'true' && steps.scope.outputs.tooling_only != 'true' && steps.scope.outputs.lab_only != 'true'
+ run: pnpm -F @astryxdesign/docsite test
# A docsite-only change skips test-node, and the registry generator
# lives in the docsite.
@@ -686,15 +707,117 @@ jobs:
if: steps.scope.outputs.spec_only != 'true' && steps.scope.outputs.tooling_only != 'true' && steps.scope.outputs.lab_only != 'true'
run: node internal/shadcn-registry/verify-production-gate.mjs
+ # The docsite browser contracts, against the build docsite-build uploaded:
+ # the same commit, never rebuilt. A planner-driven matrix (one leg today;
+ # playwright-legs.mjs splits the spec files by recorded time, so a second
+ # leg is a one-line change).
+ docsite-browser:
+ name: docsite-browser (${{ matrix.leg }}/${{ strategy.job-total }})
+ needs: [docsite-build]
+ if: ${{ (github.event_name != 'pull_request' || !github.event.pull_request.draft && (github.event.pull_request.head.repo.full_name == github.repository || contains(github.event.pull_request.labels.*.name, 'ci:run'))) && (!cancelled() && needs.docsite-build.result == 'success' && needs.docsite-build.outputs.browser == 'true') }}
+ strategy:
+ fail-fast: false
+ matrix:
+ leg: [1]
+ runs-on: ubuntu-latest
+ timeout-minutes: 15
+ permissions:
+ contents: read
+ env:
+ NEXT_PUBLIC_INTERNAL_DOCS_ORIGIN: https://docs.example.test
+ NEXT_PUBLIC_DOCS_ACCESS_CHECK_ORIGIN: https://probe.example.test
+ steps:
+ - uses: actions/checkout@v7
+
+ - uses: ./.github/actions/setup
+
+ - name: Install Playwright
+ run: npx playwright install chromium
+
+ - name: Download the docsite build
+ uses: actions/download-artifact@v8
+ with:
+ name: docsite-build
+ path: apps/docsite
+
+ - name: Require the build of this commit
+ run: |
+ built=$(cat apps/docsite/.next/BUILD_COMMIT)
+ here=$(git rev-parse HEAD)
+ echo "build: $built; checkout: $here"
+ test "$built" = "$here"
+
+ - name: Plan this leg's browser contracts
+ id: plan
+ run: |
+ node .github/scripts/playwright-legs.mjs plan \
+ --key docsite --config apps/docsite/playwright.config.ts \
+ --leg ${{ matrix.leg }} --of ${{ strategy.job-total }} \
+ --out "$RUNNER_TEMP/docsite-leg.txt"
+
+ - name: test-docsite-e2e (browser contracts)
+ if: steps.plan.outputs.files != '0'
+ run: pnpm test:docsite-browser --test-list "$RUNNER_TEMP/docsite-leg.txt"
+
+ # Only a leg whose contracts ran has evidence; one that stopped before
+ # them reports that failure alone.
- name: Upload docsite browser evidence
- if: always() && steps.scope.outcome == 'success' && steps.scope.outputs.spec_only != 'true' && steps.scope.outputs.tooling_only != 'true' && steps.scope.outputs.lab_only != 'true'
+ if: always() && steps.plan.outcome == 'success' && steps.plan.outputs.files != '0'
uses: actions/upload-artifact@v7
with:
- name: docsite-browser-evidence
+ name: docsite-browser-evidence-${{ matrix.leg }}
path: test-results/docsite/
if-no-files-found: error
retention-days: 7
+ # The required docsite context (spec:AST-030 FR7): passes only when the
+ # build passed and every browser leg passed, or the build's scope found no
+ # browser contract to run. A skipped or cancelled leg otherwise fails it.
+ docsite-test:
+ needs: [room, admission, heavy-ci, docsite-build, docsite-browser]
+ if: ${{ (github.event_name != 'pull_request' || !github.event.pull_request.draft) && (github.event_name != 'workflow_dispatch' && !startsWith(github.base_ref, 'release/v') && !cancelled()) }}
+ runs-on: ubuntu-slim
+ permissions: {}
+ steps:
+ - name: Require a branch in this repository or the ci:run label
+ if: ${{ github.event_name == 'pull_request' && !(github.event.pull_request.head.repo.full_name == github.repository || contains(github.event.pull_request.labels.*.name, 'ci:run')) }}
+ run: |
+ echo "::error::Waiting for a maintainer's ci:run label: an outside contributor's pull request runs CI once a maintainer adds it (spec:AST-030 FR17)."
+ exit 1
+
+ - name: Stop when CI is full
+ if: needs.room.outputs.full == 'true' || needs.admission.outputs.full == 'true'
+ run: |
+ echo "::error title=CI is full::CI is full: re-run all jobs or push later. The run found no room under the CI ceiling."
+ exit 1
+
+ # An agent lane's push defers the heavy suites (spec:AST-030 FR20): the
+ # required check fails with the reason, never passes as skipped.
+ - name: Heavy CI deferred
+ if: needs.heavy-ci.outputs.deferred == 'true'
+ run: |
+ echo "::error::Heavy CI deferred: runs when marked ready and before merge (spec:AST-030 FR20)."
+ exit 1
+
+ - name: 'Lab-only: Lab tests + Storybook build'
+ if: needs.docsite-build.outputs.lab_only == 'true'
+ run: |
+ echo "::notice title=Lab-only::Lab-only: Lab tests + Storybook build. This job's work is not required for a change only to the Lab package (spec:AST-030 FR26)."
+
+ - name: Require the docsite build and its browser contracts
+ env:
+ BUILD_RESULT: ${{ needs.docsite-build.result }}
+ BROWSER: ${{ needs.docsite-build.outputs.browser }}
+ BROWSER_RESULT: ${{ needs.docsite-browser.result }}
+ run: |
+ echo "docsite-build: $BUILD_RESULT; browser contracts apply: ${BROWSER:-unknown}; docsite-browser: $BROWSER_RESULT"
+ [ "$BUILD_RESULT" = success ] || exit 1
+ if [ "$BROWSER" = true ]; then
+ [ "$BROWSER_RESULT" = success ] || exit 1
+ else
+ [ "$BROWSER" = false ] && [ "$BROWSER_RESULT" = skipped ] || exit 1
+ fi
+
# Tests run as two parallel lanes joined by `test` below.
#
# They used to be one `pnpm test` on a 2-core runner, which ran both Vitest
@@ -1100,7 +1223,7 @@ jobs:
# (spec:AST-026 FR10, draft): every item through the pinned client. It runs
# for an explicit release check until the production registry launches; the
# network-free production gate runs on every pull request that can change
- # the registry: with the Node unit tests, and in docsite-test for a
+ # the registry: with the Node unit tests, and in docsite-build for a
# docsite-only change.
test-registry-e2e:
name: test-registry-e2e (${{ matrix.leg }}, ${{ matrix.mode }})
@@ -2350,7 +2473,7 @@ jobs:
# Frame evidence measures timing: four cores, one Playwright worker.
# One runner ran every proof in about ten minutes and passed the job's
# fifteen once its checkout was slow. Two legs share the spec files by
- # their recorded times (interaction-legs.mjs), so each runs in about five
+ # their recorded times (playwright-legs.mjs), so each runs in about five
# minutes, and a leg with the slowest checkout seen still ends with about
# four minutes to spare. `test` reads the job's result, which is success
# only when every leg passed.
@@ -2386,7 +2509,7 @@ jobs:
id: scope
uses: ./.test-scope/.github/actions/test-scope
with:
- paths: '^(internal/interaction-harness/|internal/a11y-spec/|playwright\.interaction\.config\.ts$|packages/[^/]+/src/|packages/themes/[^/]+/src/|apps/storybook/|\.github/workflows/ci\.yml$|package\.json$|pnpm-lock\.yaml$|\.github/scripts/(interaction-legs|a11y-pr-contracts)\.mjs$|scripts/lib/duration-split\.mjs$|\.github/interaction-durations\.json$|\.github/actions/test-scope/)'
+ paths: '^(internal/interaction-harness/|internal/a11y-spec/|playwright\.interaction\.config\.ts$|packages/[^/]+/src/|packages/themes/[^/]+/src/|apps/storybook/|\.github/workflows/ci\.yml$|package\.json$|pnpm-lock\.yaml$|\.github/scripts/(playwright-legs|a11y-pr-contracts)\.mjs$|scripts/lib/duration-split\.mjs$|\.github/playwright-leg-durations\.json$|\.github/actions/test-scope/)'
outside-pull-request: skip
requires-head-file: playwright.interaction.config.ts
@@ -2408,10 +2531,10 @@ jobs:
if: steps.scope.outputs.applies == 'true'
run: |
mkdir -p "$RUNNER_TEMP/interaction-legs/.github/scripts" "$RUNNER_TEMP/interaction-legs/scripts/lib"
- cp .test-scope/.github/scripts/interaction-legs.mjs "$RUNNER_TEMP/interaction-legs/.github/scripts/"
+ cp .test-scope/.github/scripts/playwright-legs.mjs "$RUNNER_TEMP/interaction-legs/.github/scripts/"
cp .test-scope/scripts/lib/duration-split.mjs "$RUNNER_TEMP/interaction-legs/scripts/lib/"
cp .test-scope/.github/scripts/a11y-pr-contracts.mjs "$RUNNER_TEMP/interaction-legs/.github/scripts/"
- cp .test-scope/.github/interaction-durations.json "$RUNNER_TEMP/interaction-legs/.github/"
+ cp .test-scope/.github/playwright-leg-durations.json "$RUNNER_TEMP/interaction-legs/.github/"
# The caps step comes from the merge commit, not the pull request's
# head: a head that predates the step does not have it. The head
@@ -2471,9 +2594,10 @@ jobs:
id: plan
if: steps.scope.outputs.applies == 'true'
run: |
- node "$RUNNER_TEMP/interaction-legs/.github/scripts/interaction-legs.mjs" plan --project chromium \
+ node "$RUNNER_TEMP/interaction-legs/.github/scripts/playwright-legs.mjs" plan \
+ --key interaction-chromium --config playwright.interaction.config.ts --project chromium \
--leg ${{ matrix.leg }} --of ${{ strategy.job-total }} \
- --durations "$RUNNER_TEMP/interaction-legs/.github/interaction-durations.json" \
+ --durations "$RUNNER_TEMP/interaction-legs/.github/playwright-leg-durations.json" \
--out "$RUNNER_TEMP/interaction-leg.txt"
- name: Run interaction proofs
@@ -2545,7 +2669,7 @@ jobs:
id: scope
uses: ./.test-scope/.github/actions/test-scope
with:
- paths: '^(packages/core/src/gestures/|packages/core/src/motion/|packages/core/src/internal/touch|packages/core/src/utils/(press|touch|primaryClick|isApplePlatform|flatTree|inputStream|clickGuard|selectionLock|coarsePointer|sharedResizeObserver|scrollView)|packages/core/src/privateAttributes/(hapticSwitch|reducedMotion)\.stylex\.ts$|packages/core/src/Layer/inputHold\.ts$|packages/core/src/hooks/(useMenuPress|menuPress|useLongPress|usePressFeedback|isRtlElement|useIsomorphicLayoutEffect|useAttachment|usePager|__tests__/(usePager|pagerBundle))|internal/interaction-harness/|internal/a11y-spec/|playwright\.interaction\.config\.ts$|packages/themes/[^/]+/src/|apps/storybook/|\.github/workflows/ci\.yml$|package\.json$|pnpm-lock\.yaml$|\.github/scripts/(interaction-legs|a11y-pr-contracts)\.mjs$|scripts/lib/duration-split\.mjs$|\.github/interaction-durations\.json$|\.github/actions/test-scope/)'
+ paths: '^(packages/core/src/gestures/|packages/core/src/motion/|packages/core/src/internal/touch|packages/core/src/utils/(press|touch|primaryClick|isApplePlatform|flatTree|inputStream|clickGuard|selectionLock|coarsePointer|sharedResizeObserver|scrollView)|packages/core/src/privateAttributes/(hapticSwitch|reducedMotion)\.stylex\.ts$|packages/core/src/Layer/inputHold\.ts$|packages/core/src/hooks/(useMenuPress|menuPress|useLongPress|usePressFeedback|isRtlElement|useIsomorphicLayoutEffect|useAttachment|usePager|__tests__/(usePager|pagerBundle))|internal/interaction-harness/|internal/a11y-spec/|playwright\.interaction\.config\.ts$|packages/themes/[^/]+/src/|apps/storybook/|\.github/workflows/ci\.yml$|package\.json$|pnpm-lock\.yaml$|\.github/scripts/(playwright-legs|a11y-pr-contracts)\.mjs$|scripts/lib/duration-split\.mjs$|\.github/playwright-leg-durations\.json$|\.github/actions/test-scope/)'
outside-pull-request: skip
requires-head-file: playwright.interaction.config.ts
@@ -2567,10 +2691,10 @@ jobs:
if: steps.scope.outputs.applies == 'true'
run: |
mkdir -p "$RUNNER_TEMP/interaction-legs/.github/scripts" "$RUNNER_TEMP/interaction-legs/scripts/lib"
- cp .test-scope/.github/scripts/interaction-legs.mjs "$RUNNER_TEMP/interaction-legs/.github/scripts/"
+ cp .test-scope/.github/scripts/playwright-legs.mjs "$RUNNER_TEMP/interaction-legs/.github/scripts/"
cp .test-scope/scripts/lib/duration-split.mjs "$RUNNER_TEMP/interaction-legs/scripts/lib/"
cp .test-scope/.github/scripts/a11y-pr-contracts.mjs "$RUNNER_TEMP/interaction-legs/.github/scripts/"
- cp .test-scope/.github/interaction-durations.json "$RUNNER_TEMP/interaction-legs/.github/"
+ cp .test-scope/.github/playwright-leg-durations.json "$RUNNER_TEMP/interaction-legs/.github/"
# The caps step comes from the merge commit, not the pull request's
# head: a head that predates the step does not have it. The head
@@ -2630,9 +2754,10 @@ jobs:
id: plan
if: steps.scope.outputs.applies == 'true'
run: |
- node "$RUNNER_TEMP/interaction-legs/.github/scripts/interaction-legs.mjs" plan --project webkit \
+ node "$RUNNER_TEMP/interaction-legs/.github/scripts/playwright-legs.mjs" plan \
+ --key interaction-webkit --config playwright.interaction.config.ts --project webkit \
--leg ${{ matrix.leg }} --of ${{ strategy.job-total }} \
- --durations "$RUNNER_TEMP/interaction-legs/.github/interaction-durations.json" \
+ --durations "$RUNNER_TEMP/interaction-legs/.github/playwright-leg-durations.json" \
--out "$RUNNER_TEMP/interaction-leg.txt" -- \
packages/core/src/gestures/ \
packages/core/src/motion/__tests__/animatedLayout.interaction \
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 5cfd465f62..e5042d5ed1 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -668,10 +668,10 @@ Chromium and fails on any other cursor.
The docsite playground runs user-authored code in a sandboxed iframe with an
opaque origin, tied to the page only by a nonce-attested MessagePort handshake
-(`apps/docsite/src/app/playground/previewChannel.ts`). The required
-`docsite-test` check's browser-contract step proves that boundary in
-Chromium against a production build: a reloaded
-preview document recovers with the current code and theme, and a document that
+(`apps/docsite/src/app/playground/previewChannel.ts`). The browser
+contracts in the `docsite-browser` job, which the required `docsite-test`
+check joins, prove that boundary in Chromium against a production build: a
+reloaded preview document recovers with the current code and theme, and a document that
previewed code navigated the frame to receives nothing. The sandbox only exists
in production builds (`next dev` cannot serve its assets to an opaque origin),
so the specs need a build first:
diff --git a/scripts/lib/duration-split.test.mjs b/scripts/lib/duration-split.test.mjs
index eda95817c1..e5dcd47c23 100644
--- a/scripts/lib/duration-split.test.mjs
+++ b/scripts/lib/duration-split.test.mjs
@@ -69,13 +69,13 @@ describe('splitting test files by recorded time', () => {
expect(read('.github/scripts/a11y-contract-shard.mjs')).toMatch(
/import \{medianOf\} from '\.\.\/\.\.\/scripts\/lib\/duration-split\.mjs'/,
);
- expect(read('.github/scripts/interaction-legs.mjs')).toMatch(
+ expect(read('.github/scripts/playwright-legs.mjs')).toMatch(
/import \{costOf, splitByDuration\} from '\.\.\/\.\.\/scripts\/lib\/duration-split\.mjs'/,
);
for (const file of [
'scripts/vitest-shard-sequencer.mjs',
'.github/scripts/a11y-contract-shard.mjs',
- '.github/scripts/interaction-legs.mjs',
+ '.github/scripts/playwright-legs.mjs',
])
expect(read(file), file).not.toMatch(/known\[Math\.floor/);
});