Skip to content

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

TypeScript

ci: one docsite-test job builds the docsite once and runs the data tests and browser contracts on it (#8891)

Cindy Zhang7758c68fa306
diff --git a/.github/scripts/ci-docsite-browser.test.mjs b/.github/scripts/ci-docsite-browser.test.mjs
index eda887e356..dd8e0c6915 100644
--- a/.github/scripts/ci-docsite-browser.test.mjs
+++ b/.github/scripts/ci-docsite-browser.test.mjs
@@ -2,114 +2,154 @@
/**
* @file ci-docsite-browser.test.mjs
- * @input The docsite jobs in the PR CI workflow
- * @output Fail-closed coverage for AST-030's existing docsite-test owner
- * @position Workflow contract: browser failures cannot leave docsite-test green.
+ * @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.
+ * @position Workflow contract over .github/workflows/ci.yml
*/
import fs from 'node:fs';
+import os from 'node:os';
import path from 'node:path';
-import {spawnSync} from 'node:child_process';
+import {spawn, spawnSync} from 'node:child_process';
import {describe, expect, it} from 'vitest';
import yaml from 'yaml';
-import {PR_REPORT_GATE, gated, ungated} from './ci-pr-gate.mjs';
+import {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 browser = jobs['docsite-browser'];
-const data = jobs['docsite-data'];
-const guard = owner.steps.find(
- step => step.name === 'Require successful docsite browser contract',
-);
-const dataGuard = owner.steps.find(
- step => step.name === 'Require successful docsite data generation and tests',
-);
+const step = name => owner.steps.find(candidate => candidate.name === name);
const ACTIVE =
"steps.scope.outputs.spec_only != 'true' && steps.scope.outputs.tooling_only != 'true'";
-describe('docsite browser required-check projection', () => {
- it('joins the existing required context and uses the same surface route', () => {
- expect(owner.needs).toEqual(['docsite-browser', 'docsite-data']);
+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();
+ expect(owner.needs).toBeUndefined();
+ 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(
gated(
- "${{ github.event_name != 'workflow_dispatch' && !startsWith(github.base_ref, 'release/v') && always() && !cancelled() }}",
+ "${{ github.event_name != 'workflow_dispatch' && !startsWith(github.base_ref, 'release/v') }}",
PR_REPORT_GATE,
),
);
- // Each owner decides its own scope and gates every later step on it.
- for (const job of [browser, data]) {
- expect(job.needs).toBeUndefined();
- expect(ungated(job.if)).toBe("github.event_name != 'workflow_dispatch'");
- const scopeAt = job.steps.findIndex(step => step.id === 'scope');
- expect(scopeAt).toBe(1);
- // Exact conditions: an extra skip on any step (for example a
- // docsite-only one) fails here. Only the evidence upload also runs
- // after a failed step.
- for (const step of job.steps.slice(scopeAt + 1)) {
- const expected = step.name?.startsWith('Upload ')
- ? `always() && ${ACTIVE}`
- : ACTIVE;
- expect(step.if, step.name ?? step.uses).toBe(expected);
- }
+ expect(owner.steps[0].name).toBe(
+ 'Require a branch in this repository or the ci:run label',
+ );
+ expect(owner.steps.findIndex(s => s.id === 'scope')).toBe(2);
+
+ const builds = owner.steps.filter(s =>
+ /pnpm -F @astryxdesign\/docsite build/.test(s.run ?? ''),
+ );
+ expect(builds).toHaveLength(1);
+ for (const name of [
+ 'Install Playwright',
+ 'Build docsite workspace dependencies',
+ 'Build the docsite',
+ 'test-docsite (start the data tests)',
+ 'test-docsite-e2e (browser contracts)',
+ 'Verify the hidden production registry gate',
+ ]) {
+ expect(step(name).if, name).toBe(ACTIVE);
+ expect(step(name)['continue-on-error'], name).toBeUndefined();
}
- expect(guard.if).toBe(ACTIVE);
- expect(dataGuard.if).toBe(ACTIVE);
+ 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(
- data.steps.find(step => step.name === 'Generate and test docsite data')
- .if,
- ).toBe(ACTIVE);
- expect(guard.env).toEqual({
- DOCSITE_BROWSER_RESULT: '${{ needs.docsite-browser.result }}',
- });
- expect(dataGuard.env).toEqual({
- DOCSITE_DATA_RESULT: '${{ needs.docsite-data.result }}',
- });
- expect(owner['continue-on-error']).toBeUndefined();
- expect(browser['continue-on-error']).toBeUndefined();
- expect(data['continue-on-error']).toBeUndefined();
- expect(guard['continue-on-error']).toBeUndefined();
- expect(dataGuard['continue-on-error']).toBeUndefined();
- const run = browser.steps.find(
- step => step.name === 'Run docsite browser contracts',
+ step('test-docsite (data test results)')['continue-on-error'],
+ ).toBeUndefined();
+ expect(step('test-docsite (data test results)').if).toBe(
+ "${{ !cancelled() && steps.data.outcome == 'success' }}",
+ );
+ });
+
+ 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.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},
);
- expect(run.run).toBe('pnpm test:docsite-browser');
- expect(run['continue-on-error']).toBeUndefined();
+ 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},
+ );
+ let code = null;
+ const exited = new Promise(resolve =>
+ child.on('exit', status => {
+ code = status;
+ resolve();
+ }),
+ );
+ // 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('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 = browser.steps.find(
- step => step.name === 'Upload docsite browser evidence',
+ 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.
+ expect(upload.if).toBe(
+ `always() && steps.scope.outcome == 'success' && ${ACTIVE}`,
);
- expect(upload.if).toBe(`always() && ${ACTIVE}`);
expect(upload.with['if-no-files-found']).toBe('error');
expect(path.resolve(root, upload.with.path)).toBe(
path.resolve(path.dirname(configPath), outputDir),
);
});
-
- it.each(['success', 'failure', 'cancelled', 'skipped', ''])(
- 'fails closed for browser result %j',
- result => {
- const check = spawnSync('sh', ['-e', '-c', guard.run], {
- env: {...process.env, DOCSITE_BROWSER_RESULT: result},
- });
- expect(check.status === 0).toBe(result === 'success');
- },
- );
-
- it.each(['success', 'failure', 'cancelled', 'skipped', ''])(
- 'fails closed for docsite data result %j',
- result => {
- const check = spawnSync('sh', ['-e', '-c', dataGuard.run], {
- env: {...process.env, DOCSITE_DATA_RESULT: result},
- });
- expect(check.status === 0).toBe(result === 'success');
- },
- );
});
diff --git a/.github/scripts/ci-tooling-routing.test.mjs b/.github/scripts/ci-tooling-routing.test.mjs
index 8d3bf69bba..a2cad768b6 100644
--- a/.github/scripts/ci-tooling-routing.test.mjs
+++ b/.github/scripts/ci-tooling-routing.test.mjs
@@ -161,11 +161,12 @@ describe('Node-tooling CI routing', () => {
step(ci.jobs['docsite-test'], 'Skip docsite work for Node tooling').if,
).toContain(TOOLING_TRUE);
for (const name of [
- 'Build core package',
- 'Build canary component packages',
- 'Generate and test docsite data',
+ 'Build docsite workspace dependencies',
+ 'Build the docsite',
+ 'test-docsite (start the data tests)',
+ 'test-docsite-e2e (browser contracts)',
]) {
- expect(step(ci.jobs['docsite-data'], name).if).toContain(TOOLING_FALSE);
+ expect(step(ci.jobs['docsite-test'], name).if).toContain(TOOLING_FALSE);
}
for (const candidate of [
diff --git a/.github/scripts/shadcn-registry-ci.test.mjs b/.github/scripts/shadcn-registry-ci.test.mjs
index 0697159e13..8dddd1a860 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-data.
+ * tests (verify-production-gate.test.mjs) and in docsite-test.
* @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.
@@ -62,9 +62,9 @@ describe('ShadCN registry CI contract', () => {
),
),
).toBe(true);
- // A docsite-only change skips test-node; docsite-data runs the gate too.
+ // A docsite-only change skips test-node; docsite-test runs the gate too.
expect(
- ci.jobs['docsite-data'].steps.find(
+ ci.jobs['docsite-test'].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 7eba6bcc1c..9fab31bd64 100644
--- a/.github/scripts/spec-owner-workflow.test.mjs
+++ b/.github/scripts/spec-owner-workflow.test.mjs
@@ -174,42 +174,31 @@ 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; the heavy generation lives
- // in docsite-data, which the spec-only lane never starts.
- const docsiteJob = block('docsite-test', 'docsite-data');
- const dataJob = block('docsite-data', 'docsite-browser');
+ // docsite-test 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 checkout = docsiteJob.indexOf('- uses: actions/checkout@v7');
const setup = docsiteJob.indexOf('- uses: ./.github/actions/setup');
const validate = docsiteJob.indexOf('- name: Validate spec records');
-
expect(checkout).toBeGreaterThanOrEqual(0);
expect(setup).toBeGreaterThan(checkout);
expect(validate).toBeGreaterThan(setup);
// It validates on the spec-only lane, and whenever its own scope step
// could not decide, so an undecided lane never skips validation.
- expect(docsiteJob.slice(setup, validate)).toContain(
+ expect(docsiteJob.slice(validate, validate + 200)).toContain(
"if: (steps.scope.outputs.spec_only == 'true' || steps.scope.outputs.decided != 'true')",
);
- expect(docsiteJob).not.toContain('- name: Build core package');
- expect(docsiteJob).not.toContain('- name: Generate and test docsite data');
- const setupStep = dataJob.slice(
- dataJob.indexOf('- uses: ./.github/actions/setup'),
- );
- expect(setupStep.slice(0, 200)).toContain(
- "steps.scope.outputs.spec_only != 'true'",
- );
- const build = dataJob.indexOf('- name: Build core package');
- const generate = dataJob.indexOf('- name: Generate and test docsite data');
- expect(build).toBeGreaterThanOrEqual(0);
- expect(generate).toBeGreaterThan(build);
- expect(dataJob.slice(build, generate)).toContain(
- "if: steps.scope.outputs.spec_only != 'true'",
- );
- expect(dataJob.slice(generate)).toContain(
- "if: steps.scope.outputs.spec_only != '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'");
+ }
});
it('skips every Storybook build command for spec-only changes', () => {
@@ -233,7 +222,7 @@ describe('spec-only workflow contract', () => {
it('fails closed when file APIs are truncated or scope classification fails', () => {
const ci = read('.github/workflows/ci.yml');
expect(ci).toContain(
- `if: ${gated("${{ github.event_name != 'workflow_dispatch' && !startsWith(github.base_ref, 'release/v') && always() && !cancelled() }}", PR_REPORT_GATE)}`,
+ `if: ${gated("${{ github.event_name != 'workflow_dispatch' && !startsWith(github.base_ref, 'release/v') }}", PR_REPORT_GATE)}`,
);
const action = read('.github/actions/test-scope/action.yml');
expect(action).toContain(
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 7799bfdebf..6b73db7288 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -344,15 +344,22 @@ jobs:
pnpm build
node scripts/release/verify-published.mjs --version "$VERSION"
- # Required docsite owner: data tests plus the production browser contract.
- # Historical required check name (AST-030 FR7). It joins the two docsite
- # owners, which run side by side: the browser contract (~10 minutes) used to
- # be followed by this job's own generation and tests (~2.5 minutes). The
+ # Required docsite owner (historical check name, AST-030 FR7): one job
+ # builds the packages and the docsite production build once, then runs the
+ # docsite data tests and the browser contracts side by side on that build.
+ # The browser contracts matter because the playground preview runs
+ # user-authored code in a sandboxed iframe whose only tie to the page is a
+ # nonce-attested MessagePort handshake
+ # (apps/docsite/src/app/playground/previewChannel.ts): jsdom can drive that
+ # state machine but cannot prove the integration (the frame's real `load`
+ # event, a replaced document torn down and its successor given the current
+ # code and theme, nothing sent to a document the code navigated to), and
+ # only the production build has the opaque-origin sandbox at all. The
# spec-only lane validates spec records here, where it always has.
docsite-test:
- needs: [docsite-browser, docsite-data]
- if: ${{ (github.event_name != 'pull_request' || !github.event.pull_request.draft) && (github.event_name != 'workflow_dispatch' && !startsWith(github.base_ref, 'release/v') && always() && !cancelled()) }}
- runs-on: ubuntu-24.04-arm
+ if: ${{ (github.event_name != 'pull_request' || !github.event.pull_request.draft) && (github.event_name != 'workflow_dispatch' && !startsWith(github.base_ref, 'release/v')) }}
+ # The Next.js production build uses every core it gets.
+ runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: read
@@ -377,135 +384,30 @@ jobs:
id: scope
uses: ./.test-scope/.github/actions/test-scope
- - name: Require successful docsite browser contract
- if: steps.scope.outputs.spec_only != 'true' && steps.scope.outputs.tooling_only != 'true'
- env:
- DOCSITE_BROWSER_RESULT: ${{ needs.docsite-browser.result }}
- run: test "$DOCSITE_BROWSER_RESULT" = 'success'
-
- - name: Require successful docsite data generation and tests
- if: steps.scope.outputs.spec_only != 'true' && steps.scope.outputs.tooling_only != 'true'
- env:
- DOCSITE_DATA_RESULT: ${{ needs.docsite-data.result }}
- run: test "$DOCSITE_DATA_RESULT" = 'success'
-
- name: Skip docsite work for Node tooling
if: steps.scope.outputs.tooling_only == 'true'
run: echo "Node-tooling PR — docsite generation is not an owned check"
- uses: actions/checkout@v7
- if: (steps.scope.outputs.spec_only == 'true' || steps.scope.outputs.decided != 'true')
+ if: steps.scope.outputs.tooling_only != 'true'
# Spec validation imports the canonical CLI discovery path, so the
# lightweight docs path needs workspace dependencies too.
- uses: ./.github/actions/setup
- if: (steps.scope.outputs.spec_only == 'true' || steps.scope.outputs.decided != 'true')
+ if: steps.scope.outputs.tooling_only != 'true'
- name: Validate spec records
if: (steps.scope.outputs.spec_only == 'true' || steps.scope.outputs.decided != 'true')
run: node scripts/check-knowledge.mjs
- # Docsite data generation and tests. Its outcome feeds docsite-test.
- docsite-data:
- 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')
- runs-on: ubuntu-24.04-arm
- timeout-minutes: 15
- permissions:
- contents: read
- pull-requests: read
- steps:
- # 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: Check out the scope action
- uses: actions/checkout@v7
- with:
- sparse-checkout: .github/actions/test-scope
- path: .test-scope
- persist-credentials: false
-
- - name: Decide this job's scope
- id: scope
- uses: ./.test-scope/.github/actions/test-scope
-
- - uses: actions/checkout@v7
- if: steps.scope.outputs.spec_only != 'true' && steps.scope.outputs.tooling_only != 'true'
- - uses: ./.github/actions/setup
- if: steps.scope.outputs.spec_only != 'true' && steps.scope.outputs.tooling_only != 'true'
-
- # Docsite `generate` runs `astryx theme build`, which imports the compiled
- # @astryxdesign/core/theme entry (dist/theme/index.js). Build core first so that
- # entry exists — otherwise generate fails with "Cannot find module".
- - name: Build core package
- if: steps.scope.outputs.spec_only != 'true' && steps.scope.outputs.tooling_only != 'true'
- run: pnpm -F @astryxdesign/core build
-
- # The generated preview registry imports every configured canary component
- # package. Build those exports so Vitest exercises the same graph as the
- # canary deployment.
- - name: Build canary component packages
- if: steps.scope.outputs.spec_only != 'true' && steps.scope.outputs.tooling_only != 'true'
- run: |
- pnpm -F @astryxdesign/lab build
- pnpm -F @astryxdesign/charts build
- pnpm -F @astryxdesign/richtext build
- pnpm -F @astryxdesign/vega build
-
- - name: Generate and test docsite data
- if: steps.scope.outputs.spec_only != 'true' && steps.scope.outputs.tooling_only != 'true'
- run: pnpm -F @astryxdesign/docsite generate && pnpm -F @astryxdesign/docsite test
-
- # A docsite-only change skips test-node, and the registry generator
- # lives in the docsite.
- - name: Verify the hidden production registry gate
- if: steps.scope.outputs.spec_only != 'true' && steps.scope.outputs.tooling_only != 'true'
- run: node internal/shadcn-registry/verify-production-gate.mjs
-
- # Docsite browser contracts. The playground preview runs user-authored code
- # in a sandboxed iframe whose only tie to the page is a nonce-attested
- # MessagePort handshake (apps/docsite/src/app/playground/previewChannel.ts).
- # jsdom can drive that state machine but cannot prove the integration: that
- # the frame's real `load` event reaches it, that a replaced document is torn
- # down and the current code and theme reach its successor, and that a
- # document previewed code navigated the frame to receives nothing. Only the
- # production build has the opaque-origin sandbox at all, so this job builds
- # the docsite and drives `next start` in Chromium. Its outcome feeds the
- # existing required docsite-test context; it is not another required lane.
- docsite-browser:
- 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')
- # The longest docsite owner; the Next.js production build uses every core
- # it gets.
- runs-on: ubuntu-latest
- timeout-minutes: 15
- permissions:
- contents: read
- pull-requests: read
- steps:
- # 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: Check out the scope action
- uses: actions/checkout@v7
- with:
- sparse-checkout: .github/actions/test-scope
- path: .test-scope
- persist-credentials: false
-
- - name: Decide this job's scope
- id: scope
- uses: ./.test-scope/.github/actions/test-scope
-
- - uses: actions/checkout@v7
- if: steps.scope.outputs.spec_only != 'true' && steps.scope.outputs.tooling_only != 'true'
- - uses: ./.github/actions/setup
- if: steps.scope.outputs.spec_only != 'true' && steps.scope.outputs.tooling_only != 'true'
- name: Install Playwright
if: steps.scope.outputs.spec_only != 'true' && steps.scope.outputs.tooling_only != 'true'
run: npx playwright install chromium
- # The production build 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.
+ # 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'
run: |
@@ -524,16 +426,41 @@ jobs:
-F @astryxdesign/theme-butter \
build
+ # `build` generates the docsite data first, so the data tests below run
+ # on the same generated files the production build used.
- name: Build the docsite
if: steps.scope.outputs.spec_only != 'true' && steps.scope.outputs.tooling_only != 'true'
run: pnpm -F @astryxdesign/docsite build
- - name: Run docsite browser contracts
+ # 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'
+ # 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'
run: pnpm test:docsite-browser
+ - name: test-docsite (data test results)
+ if: ${{ !cancelled() && steps.data.outcome == 'success' }}
+ run: |
+ while [ ! -f docsite-data.exit ]; do sleep 2; done
+ cat docsite-data.log
+ exit "$(cat docsite-data.exit)"
+
+ # A docsite-only change skips test-node, and the registry generator
+ # lives in the docsite.
+ - name: Verify the hidden production registry gate
+ if: steps.scope.outputs.spec_only != 'true' && steps.scope.outputs.tooling_only != 'true'
+ run: node internal/shadcn-registry/verify-production-gate.mjs
+
- name: Upload docsite browser evidence
- if: always() && steps.scope.outputs.spec_only != 'true' && steps.scope.outputs.tooling_only != 'true'
+ if: always() && steps.scope.outcome == 'success' && steps.scope.outputs.spec_only != 'true' && steps.scope.outputs.tooling_only != 'true'
uses: actions/upload-artifact@v7
with:
name: docsite-browser-evidence
@@ -824,7 +751,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-data for a
+ # the registry: with the Node unit tests, and in docsite-test for a
# docsite-only change.
test-registry-e2e:
name: test-registry-e2e (${{ matrix.leg }})
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index e9cbf0b6a2..d160091f39 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -666,9 +666,9 @@ 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 `docsite-browser`
-job feeds the existing required `docsite-test` check and proves that boundary
-in Chromium against a production build: a reloaded
+(`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
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),