An open source design system that's fully customizable and agent ready
TypeScript
ci: a Lab-only pull request runs the Lab tests and the Storybook build (AST-030 FR26) (#9412)
Cindy Zhang53b86f3557c1
diff --git a/.github/actions/test-scope/action.yml b/.github/actions/test-scope/action.ymlindex 53e3dce5c8..d07b17728d 100644--- a/.github/actions/test-scope/action.yml+++ b/.github/actions/test-scope/action.yml@@ -64,6 +64,11 @@ outputs:tooling_only:description: The PR changes only Node tooling.value: ${{ steps.scope.outputs.tooling_only }}+ lab_only:+ description: >-+ The PR changes only the Lab package (and Changesets): it runs the Lab+ tests and the Storybook build, nothing else (spec:AST-030 FR26).+ value: ${{ steps.scope.outputs.lab_only }}full_suite:description: The import graph cannot scope this change; run every test.value: ${{ steps.scope.outputs.full_suite }}@@ -103,8 +108,8 @@ outputs:value: ${{ steps.scope.outputs.head_file_present }}applies:description: >-- The job's work applies: not a specialized lane (spec, docsite or tooling- only), `touches` holds, and any `requires-head-file` is present.+ The job's work applies: not a specialized lane (spec, docsite, tooling or+ Lab only), `touches` holds, and any `requires-head-file` is present.value: ${{ steps.scope.outputs.applies }}runs:@@ -129,6 +134,7 @@ runs:spec_only: 'false',docsite_only: 'false',tooling_only: 'false',+ lab_only: 'false',full_suite: 'true',release_bump: 'false',touches: 'true',@@ -245,7 +251,8 @@ runs:const pattern = new RegExp(process.env.SCOPE_PATHS);touches = String(files.some(f => pattern.test(f.filename) || (f.previous_filename != null && pattern.test(f.previous_filename))));}- const specialized = ['spec_only', 'docsite_only', 'tooling_only'].some(key => classified[key] === 'true');+ // A base whose classifier predates lab_only reports none: false.+ const specialized = ['spec_only', 'docsite_only', 'tooling_only', 'lab_only'].some(key => classified[key] === 'true');let applies = String(!specialized && touches === 'true');// Whether the head has the file the work needs, decided whether or// not `touches` holds; a diff that touches the file keeps it.@@ -264,7 +271,10 @@ runs:if (headFilePresent === 'false') applies = 'false';let componentScope = {};if (audit) {- if (specialized) {+ // A Lab-only change keeps its component audits: the default+ // touched check skips it, but a maintainer's label still runs its+ // suite on Lab's components (spec:AST-030 FR12, FR26).+ if (specialized && classified.lab_only !== 'true') {componentScope = auditNone;} else {const auditFile = path.join(root, 'component-audit');diff --git a/.github/scripts/change-scope.cjs b/.github/scripts/change-scope.cjsindex b353014d2f..26440243d6 100644--- a/.github/scripts/change-scope.cjs+++ b/.github/scripts/change-scope.cjs@@ -28,6 +28,10 @@ const SPEC_RECORD_PATTERNS = [const CHANGESET_PATTERN = /^\.changeset\/(?!README\.md$)[^/]+\.md$/;+// The experimental Lab package: a change only here (and its release notes)+// runs the Lab tests and the Storybook build (spec:AST-030 FR26).+const LAB_ROOT = 'packages/lab/';+const SURFACES = Object.freeze({KNOWLEDGE: 'knowledge',DOCSITE: 'docsite',@@ -199,6 +203,7 @@ function classifyChanges(changes, {expectedCount} = {}) {touchesDesignAssets: false,specChangesetConflict: false,docsiteOnly: false,+ labOnly: false,// No paths to scope from runs everything (spec:AST-030 FR4).fullSuite: true,surfaces: complete ? [] : [SURFACES.SHARED_OR_UNKNOWN],@@ -248,6 +253,15 @@ function classifyChanges(changes, {expectedCount} = {}) {const specOnly = exactSurface(SURFACES.KNOWLEDGE);const docsiteOnly = exactSurface(SURFACES.DOCSITE);const toolingOnly = exactSurface(SURFACES.NODE_TOOLING);+ // Every changed path is in the Lab package, besides Changesets, which no+ // test or build reads (spec:AST-030 FR26).+ const labOnly =+ complete &&+ allPaths.some(filePath => filePath.startsWith(LAB_ROOT)) &&+ allPaths.every(+ filePath =>+ filePath.startsWith(LAB_ROOT) || CHANGESET_PATTERN.test(filePath),+ );// An incomplete list, or any shared infrastructure, runs everything.const fullSuite = !complete || allPaths.some(isSharedInfraPath);return {@@ -257,6 +271,7 @@ function classifyChanges(changes, {expectedCount} = {}) {touchesDesignAssets,specChangesetConflict,docsiteOnly,+ labOnly,fullSuite,surfaces,complete,@@ -268,7 +283,9 @@ function classifyChanges(changes, {expectedCount} = {}) {? 'only docsite files changed': toolingOnly? 'only admitted Node tooling changed'- : 'changes include another surface',+ : labOnly+ ? 'only the Lab package changed'+ : 'changes include another surface',};}@@ -305,7 +322,7 @@ if (require.main === module) {throw new Error('GITHUB_OUTPUT is required with --github-output.');fs.appendFileSync(outputPath,- `spec_only=${result.specOnly}\ndocsite_only=${result.docsiteOnly}\ntooling_only=${result.toolingOnly}\nfull_suite=${result.fullSuite}\n`,+ `spec_only=${result.specOnly}\ndocsite_only=${result.docsiteOnly}\ntooling_only=${result.toolingOnly}\nlab_only=${result.labOnly}\nfull_suite=${result.fullSuite}\n`,);} else {process.stdout.write(`${JSON.stringify(result)}\n`);@@ -313,6 +330,7 @@ if (require.main === module) {}module.exports = {+ LAB_ROOT,NODE_TOOLING_PATHS,SURFACES,classifyChanges,diff --git a/.github/scripts/change-scope.test.mjs b/.github/scripts/change-scope.test.mjsindex c150dd81f8..36e888d2b6 100644--- a/.github/scripts/change-scope.test.mjs+++ b/.github/scripts/change-scope.test.mjs@@ -502,3 +502,92 @@ describe('full-suite scope', () => {expect(classifyChanges([], {expectedCount: 0}).fullSuite).toBe(true);});});++describe('Lab-only change scope (spec:AST-030 FR26)', () => {+ const lab = [+ 'packages/lab/src/Tour/Tour.tsx',+ 'packages/lab/src/Tour/__tests__/Tour.test.tsx',+ 'packages/lab/src/Tour/Tour.doc.mjs',+ ];++ it('is Lab-only when every changed path is in the Lab package', () => {+ const result = classifyChanges(lab.map(filename => ({filename})));+ expect(result).toMatchObject({+ labOnly: true,+ specOnly: false,+ docsiteOnly: false,+ toolingOnly: false,+ });+ expect(result.reason).toBe('only the Lab package changed');+ // Its manifest and build configuration are the Lab package's too.+ expect(+ classifyChanges([{filename: 'packages/lab/package.json'}]).labOnly,+ ).toBe(true);+ });++ it('stays Lab-only beside its release notes, but a Changeset alone is not Lab', () => {+ expect(+ classifyChanges(+ [...lab, '.changeset/tour-steps.md'].map(filename => ({filename})),+ ).labOnly,+ ).toBe(true);+ expect(+ classifyChanges([{filename: '.changeset/tour-steps.md'}]).labOnly,+ ).toBe(false);+ });++ it('runs full CI for any other path beside a Lab change', () => {+ for (const other of [+ 'packages/core/src/Button/Button.tsx',+ 'packages/core/src/internal/touch.ts',+ 'packages/cli/api/search/search.mjs',+ 'scripts/sync-exports.js',+ 'tsconfig.json',+ 'packages/charts/src/index.ts',+ 'apps/storybook/stories/Tour.stories.tsx',+ 'apps/docsite/src/app/page.tsx',+ 'apps/sandbox/src/main.tsx',+ '.github/workflows/ci.yml',+ 'pnpm-lock.yaml',+ 'package.json',+ 'vitest.config.mts',+ 'internal/lab-readiness/audit.mjs',+ 'docs/specs/AST-030/spec.md',+ 'packages/labels/src/index.ts',+ ]) {+ expect(+ classifyChanges([...lab, other].map(filename => ({filename}))).labOnly,+ other,+ ).toBe(false);+ }+ });++ it('checks both sides of a rename into or out of the Lab package', () => {+ const graduated = classifyChanges([+ {+ filename: 'packages/core/src/Tour/Tour.tsx',+ previous_filename: 'packages/lab/src/Tour/Tour.tsx',+ status: 'R100',+ },+ ]);+ expect(graduated.labOnly).toBe(false);+ const parked = classifyChanges([+ {+ filename: 'packages/lab/src/Tour/Tour.tsx',+ previous_filename: 'packages/core/src/Tour/Tour.tsx',+ status: 'R100',+ },+ ]);+ expect(parked.labOnly).toBe(false);+ });++ it('is never Lab-only for an incomplete or empty file list', () => {+ expect(+ classifyChanges(+ lab.map(filename => ({filename})),+ {expectedCount: 4},+ ).labOnly,+ ).toBe(false);+ expect(classifyChanges([]).labOnly).toBe(false);+ });+});diff --git a/.github/scripts/ci-docsite-browser.test.mjs b/.github/scripts/ci-docsite-browser.test.mjsindex c9912cff43..77598a2acc 100644--- a/.github/scripts/ci-docsite-browser.test.mjs+++ b/.github/scripts/ci-docsite-browser.test.mjs@@ -22,8 +22,9 @@ const {jobs} = yaml.parse();const owner = jobs['docsite-test'];const step = name => owner.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.spec_only != 'true' && steps.scope.outputs.tooling_only != 'true' && steps.scope.outputs.lab_only != 'true'";describe('docsite-test', () => {it('is one job that builds the docsite once and runs both suites on it', () => {diff --git a/.github/scripts/ci-heavy-deferral.test.mjs b/.github/scripts/ci-heavy-deferral.test.mjsindex b26f3125db..337ecf6a51 100644--- a/.github/scripts/ci-heavy-deferral.test.mjs+++ b/.github/scripts/ci-heavy-deferral.test.mjs@@ -273,13 +273,16 @@ describe('a deferred push', () => {expect([ci.jobs[id].needs].flat(), id).toContain('heavy-ci');});+ // A Lab-only change runs only fast work, so it defers nothing either+ // (spec:AST-030 FR26).it.each([- ['true', 'false', ''],- ['false', 'true', HEAVY_DEFERRED_MESSAGE],- ['', 'true', HEAVY_DEFERRED_MESSAGE],+ ['true', 'false', 'false', ''],+ ['false', 'true', 'false', ''],+ ['false', 'false', 'true', HEAVY_DEFERRED_MESSAGE],+ ['', '', 'true', HEAVY_DEFERRED_MESSAGE],])(- 'defers unless the change is spec-only (spec_only=%s → deferred=%s)',- (specOnly, deferred, summary) => {+ 'defers unless the change is spec-only or Lab-only (spec_only=%s, lab_only=%s → deferred=%s)',+ (specOnly, labOnly, deferred, summary) => {const step = ci.jobs['heavy-ci'].steps.find(item => item.id === 'decide');const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'heavy-ci-'));try {@@ -294,6 +297,7 @@ describe('a deferred push', () => {env: {...process.env,SPEC_ONLY: specOnly,+ LAB_ONLY: labOnly,GITHUB_OUTPUT: output,GITHUB_STEP_SUMMARY: stepSummary,GITHUB_RUN_ID: '7',diff --git a/.github/scripts/ci-lab-only-routing.test.mjs b/.github/scripts/ci-lab-only-routing.test.mjsnew file mode 100644index 0000000000..6e66c88d21--- /dev/null+++ b/.github/scripts/ci-lab-only-routing.test.mjs@@ -0,0 +1,226 @@+// Copyright (c) Meta Platforms, Inc. and affiliates.++/**+ * @file ci-lab-only-routing.test.mjs+ * @description Pins the Lab-only lane (spec:AST-030 FR26): a pull request that+ * changes only the Lab package runs the Lab package's tests, the Storybook+ * build and the repository-wide guards, and every required context reports+ * success with a Lab-only notice instead of skipping.+ * @input CI and lint workflow YAML, and the trusted scope classifier.+ * @output Mutation-sensitive assertions over each job's Lab-only steps.+ * @position Workflow contract beside ci-tooling-routing.test.mjs.+ */++import fs from 'node:fs';+import {createRequire} from 'node:module';+import path from 'node:path';++import {describe, expect, it} from 'vitest';+import yaml from 'yaml';++const root = path.resolve(import.meta.dirname, '../..');+const read = relative => fs.readFileSync(path.join(root, relative), 'utf8');+const ci = yaml.parse(read('.github/workflows/ci.yml'));+const lint = read('.github/workflows/lint.yml');+const {classifyChanges} = createRequire(import.meta.url)('./change-scope.cjs');++const LAB_TRUE = "steps.scope.outputs.lab_only == 'true'";+const LAB_FALSE = "steps.scope.outputs.lab_only != 'true'";+const NOTICE = 'Lab-only: Lab tests + Storybook build';++const steps = name => ci.jobs[name].steps;+const step = (name, stepName) => steps(name).find(s => s.name === stepName);+const isScopeStep = s => s.id === 'scope' || s.with?.path === '.test-scope';+/** A step that does a job's work, after its gates and its scope step. */+const workAfterScope = name => {+ const all = steps(name);+ const scope = all.findIndex(s => s.id === 'scope');+ expect(scope, name).toBeGreaterThanOrEqual(0);+ return all+ .slice(scope + 1)+ .filter(s => s.name !== NOTICE && (s.run || s.uses));+};++describe('Lab-only lane (spec:AST-030 FR26)', () => {+ it('takes the fast path only for a change confined to the Lab package', () => {+ const files = names => names.map(filename => ({filename}));+ expect(+ classifyChanges(+ files(['packages/lab/src/Tour/Tour.tsx', '.changeset/x.md']),+ ).labOnly,+ ).toBe(true);+ expect(+ classifyChanges(+ files(['packages/lab/src/Tour/Tour.tsx', 'packages/core/src/index.ts']),+ ).labOnly,+ ).toBe(false);+ });++ 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']) {+ const notice = step(name, NOTICE);+ expect(notice?.if, name).toBe(LAB_TRUE);+ expect(notice.run, name).toContain(+ '::notice title=Lab-only::Lab-only: Lab tests + Storybook build',+ );+ expect(notice.run, name).not.toMatch(/exit [1-9]/);+ }+ expect(step('build', NOTICE).if).toBe(+ "needs.build-storybook.outputs.lab_only == 'true'",+ );+ expect(ci.jobs['build-storybook'].outputs.lab_only).toBe(+ '${{ steps.scope.outputs.lab_only }}',+ );+ // No required context is skipped for it: none names the lane at job level.+ for (const name of ['build', 'test', 'docsite-test']) {+ expect(String(ci.jobs[name].if), name).not.toContain('lab_only');+ }+ });++ it('keeps every owner the required joins wait on green while skipping its work', () => {+ for (const name of ['docsite-test', '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;+ if (/^Skip /.test(work.name ?? '')) continue;+ // A step gated on an earlier work step's outcome follows that step.+ if (+ /steps\.(?!scope\.)[\w-]+\.(?:outcome|outputs)/.test(String(work.if))+ )+ continue;+ expect(+ work.if,+ `${name}: ${work.name ?? work.uses ?? work.run}`,+ ).toContain(LAB_FALSE);+ }+ }+ // The test join requires a decided Lab-only scope like the others.+ const join = step('test', 'Require expected test-owner outcomes');+ expect(join.env.LAB_ONLY).toBe('${{ steps.scope.outputs.lab_only }}');+ expect(read('.github/scripts/ci-test-join.mjs')).toContain(+ "['lab_only', process.env.LAB_ONLY]",+ );+ });++ it('runs the Node lane as any scoped pull request does, source-reading guards included', () => {+ // A Lab file that broke a guard would turn every later pull request red.+ for (const s of steps('test-node')) {+ expect(String(s.if ?? ''), s.name ?? s.uses ?? s.run).not.toContain(+ 'lab_only',+ );+ expect(s.run ?? '', s.name).not.toContain('LAB_ONLY');+ }+ });++ it('runs every Lab test and the source-reading guards on the UI legs, with the repository guards', () => {+ const suite = step('test-ui', 'Run this shard of the UI tests');+ expect(suite.env.LAB_ONLY).toBe('${{ steps.scope.outputs.lab_only }}');+ expect(suite.if).not.toContain('lab_only');+ const labBranch = suite.run.split('elif')[0];+ expect(labBranch).toContain('if [ "$LAB_ONLY" = true ]; then');+ expect(labBranch).toContain(+ 'pnpm test:ui --passWithNoTests --shard=${{ matrix.shard }}/${{ strategy.job-total }} packages/lab/\n',+ );+ // The Lab tests, not the module graph's --changed set, then the guards.+ expect(labBranch).not.toContain('pnpm test:ui --changed');+ expect(labBranch).toContain(+ 'node .github/scripts/fs-guard-tests.mjs --changed HEAD^1 > "$RUNNER_TEMP/fs-guards.txt"',+ );+ expect(labBranch).toContain(+ 'pnpm test:ui --passWithNoTests --shard=${{ matrix.shard }}/${{ strategy.job-total }} "${GUARDS[@]}"',+ );+ expect(labBranch.indexOf('packages/lab/')).toBeLessThan(+ labBranch.indexOf('fs-guard-tests'),+ );+ // Checkout, setup and the repository-wide guards still run: a guard break+ // that landed would turn every later pull request red.+ for (const name of [+ 'Check knowledge schema history',+ 'Check copyright headers',+ 'Check package.json exports are in sync',+ 'Verify the published CLI ./api type surface',+ 'Check token docs are in sync',+ 'Check lab readiness manifest is current',+ ]) {+ expect(step('test-ui', name).if, name).not.toContain('lab_only');+ }+ for (const s of steps('test-ui').filter(+ s =>+ s.uses === 'actions/checkout@v7' ||+ s.uses === './.github/actions/setup',+ )) {+ if (isScopeStep(s)) continue;+ expect(String(s.if)).not.toContain('lab_only');+ }+ // The core Markdown benchmark is not a Lab test.+ expect(step('test-ui', 'Run the isolated Markdown benchmark').if).toContain(+ LAB_FALSE,+ );+ });++ it('builds Storybook as on any pull request, then typechecks Lab and its stories', () => {+ // A Lab type error that landed would fail every later pull request's+ // typecheck, so the Lab package and the stories are checked against the+ // packages this job built.+ const typecheck = step(+ 'build-storybook',+ 'Lab-only: typecheck Lab and its stories',+ );+ // Spelled out beside the lane, as every build command in this job is.+ expect(typecheck.if).toBe(+ `steps.scope.outputs.spec_only != 'true' && ${LAB_TRUE}`,+ );+ expect(typecheck.run).toBe(+ 'pnpm -F @astryxdesign/lab -F @astryxdesign/storybook typecheck',+ );+ const all = steps('build-storybook');+ expect(all.indexOf(typecheck)).toBeGreaterThan(+ all.findIndex(s => s.name === 'Build packages and Storybook'),+ );+ for (const s of all.filter(s => s !== typecheck)) {+ expect(String(s.if ?? ''), s.name ?? s.uses ?? s.run).not.toContain(+ 'lab_only',+ );+ }+ });++ it('runs no heavy suite, and defers nothing for an agent push', () => {+ // Interaction proofs and native Swift read `applies`, which a Lab-only+ // change turns false in the scope action itself.+ expect(read('.github/actions/test-scope/action.yml')).toContain(+ "['spec_only', 'docsite_only', 'tooling_only', 'lab_only'].some(key => classified[key] === 'true')",+ );+ expect(String(ci.jobs['pr-touched-components'].if)).toContain(+ "needs.build-storybook.outputs.lab_only != 'true'",+ );+ // The default visual check is a focused check of touched Core+ // components, so a Lab-only change has none. A maintainer's `ci:run-a11y`+ // or `ci:run-rtl` label still audits Lab's components (FR12);+ // `ci:run-visual` runs the stable visual suite, which leaves out+ // canary-only Lab.+ for (const name of ['visual-scout', 'pr-visual']) {+ const specialized = steps(name).find(s => s.env?.SPECIALIZED)?.env+ .SPECIALIZED;+ expect(specialized, name).not.toContain('lab_only');+ }+ expect(read('.github/actions/test-scope/action.yml')).toContain(+ "if (specialized && classified.lab_only !== 'true') {",+ );+ const decide = step(+ 'heavy-ci',+ 'Defer the heavy suites unless the change is spec-only or Lab-only',+ );+ expect(decide.env.LAB_ONLY).toBe('${{ steps.scope.outputs.lab_only }}');+ expect(decide.run).toContain(+ 'if [ "$SPEC_ONLY" = true ] || [ "$LAB_ONLY" = true ]; then',+ );+ });++ it('keeps full lint for a Lab-only change', () => {+ expect(lint).not.toContain('lab_only');+ });+});diff --git a/.github/scripts/ci-test-join.mjs b/.github/scripts/ci-test-join.mjsindex 7f81bea208..2644c0a4ad 100644--- a/.github/scripts/ci-test-join.mjs+++ b/.github/scripts/ci-test-join.mjs@@ -46,6 +46,7 @@ const scopes = [['docsite_only', process.env.DOCSITE_ONLY],['spec_only', process.env.SPEC_ONLY],['tooling_only', process.env.TOOLING_ONLY],+ ['lab_only', process.env.LAB_ONLY],];for (const [name, value] of scopes) {if (value !== 'true' && value !== 'false') {diff --git a/.github/scripts/ci-test-join.test.mjs b/.github/scripts/ci-test-join.test.mjsindex 1ed04e4a84..220fb5bec2 100644--- a/.github/scripts/ci-test-join.test.mjs+++ b/.github/scripts/ci-test-join.test.mjs@@ -12,6 +12,7 @@ const broad = {DOCSITE_ONLY: 'false',SPEC_ONLY: 'false',TOOLING_ONLY: 'false',+ LAB_ONLY: 'false',RELEASE_BUMP: 'false',RELEASE_BUMP_RESULT: 'skipped',TEST_UI_RESULT: 'success',@@ -65,7 +66,7 @@ describe('pull-request test join', () => {}});- it.each(['DOCSITE_ONLY', 'SPEC_ONLY', 'TOOLING_ONLY'])(+ it.each(['DOCSITE_ONLY', 'SPEC_ONLY', 'TOOLING_ONLY', 'LAB_ONLY'])('still requires every owner to report success for %s, since each skips its own work',scope => {expect(run({[scope]: 'true'})).toMatchObject({status: 0});@@ -96,5 +97,8 @@ describe('pull-request test join', () => {it('rejects missing or invalid scope decisions', () => {expect(run({SPEC_ONLY: ''})).toMatchObject({status: 1});expect(run({TOOLING_ONLY: 'unknown'})).toMatchObject({status: 1});+ // A Lab-only decision is required too (spec:AST-030 FR26).+ expect(run({LAB_ONLY: null})).toMatchObject({status: 1});+ expect(run({LAB_ONLY: 'maybe'})).toMatchObject({status: 1});});});diff --git a/.github/scripts/ci-test-routing.test.mjs b/.github/scripts/ci-test-routing.test.mjsindex 9a3e13e2b2..1f6daf4f60 100644--- a/.github/scripts/ci-test-routing.test.mjs+++ b/.github/scripts/ci-test-routing.test.mjs@@ -172,7 +172,17 @@ describe.each(Object.entries(WORKFLOWS))(if (graphScoped) {expect(share.run.trim()).toBe([- 'if [ "$SCOPED" = true ]; then',+ 'if [ "$LAB_ONLY" = true ]; then',+ ' # A change only to the Lab package runs every Lab test across the',+ ' # same legs, and the guards below as any scoped run does',+ ' # (spec:AST-030 FR26).',+ ` pnpm test:ui --passWithNoTests ${SHARD_ARG} packages/lab/`,+ ' node .github/scripts/fs-guard-tests.mjs --changed HEAD^1 > "$RUNNER_TEMP/fs-guards.txt"',+ ' mapfile -t GUARDS < "$RUNNER_TEMP/fs-guards.txt"',+ ' if [ "${#GUARDS[@]}" -gt 0 ]; then',+ ` pnpm test:ui --passWithNoTests ${SHARD_ARG} "\${GUARDS[@]}"`,+ ' fi',+ 'elif [ "$SCOPED" = true ]; then',` pnpm test:ui --changed=HEAD^1 --passWithNoTests ${SHARD_ARG}`,' # Tests no module graph relates to the change run too: guards',' # that read sources, and tests that load a changed package from',@@ -221,8 +231,11 @@ describe.each(Object.entries(WORKFLOWS))(expect(job.steps.indexOf(isolated)).toBeGreaterThan(job.steps.indexOf(share),);+ // The core benchmark is not a Lab test (spec:AST-030 FR26).expect(isolated.if).toBe(- share.if ? `matrix.shard == 1 && ${share.if}` : 'matrix.shard == 1',+ share.if+ ? `matrix.shard == 1 && ${share.if} && steps.scope.outputs.lab_only != 'true'`+ : 'matrix.shard == 1',);});diff --git a/.github/scripts/ci-tooling-routing.test.mjs b/.github/scripts/ci-tooling-routing.test.mjsindex c290cf2a07..ffaac1875a 100644--- a/.github/scripts/ci-tooling-routing.test.mjs+++ b/.github/scripts/ci-tooling-routing.test.mjs@@ -31,6 +31,9 @@ const TOOLING_FALSE = "steps.scope.outputs.tooling_only != 'true'";const TOOLING_TRUE = "steps.scope.outputs.tooling_only == 'true'";const BROAD_ONLY ="steps.scope.outputs.docsite_only != 'true' && steps.scope.outputs.spec_only != 'true' && steps.scope.outputs.tooling_only != 'true'";+// The Build package's contracts skip a Lab-only change too (spec:AST-030+// FR26); the Node lane runs its scoped share and guards.+const BROAD_NOT_LAB = `${BROAD_ONLY} && steps.scope.outputs.lab_only != 'true'`;// The Build package's test directory: an opt-in test there (one that runs only// with an `ASTRYX_*=1` switch) must run in test-build, with its switch set.@@ -351,7 +354,7 @@ describe('Node-tooling CI routing', () => {expect(step(ci.jobs['test-build'], 'Run Build package contracts'),).toMatchObject({- if: BROAD_ONLY,+ if: BROAD_NOT_LAB,run: 'pnpm test:build',});// The Build package's owner keeps its contracts. The list lives once, in@@ -378,7 +381,7 @@ describe('Node-tooling CI routing', () => {'Verify canonical setup compositions','Verify guest fixture contrast',]) {- expect(step(ci.jobs['test-build'], name).if).toBe(BROAD_ONLY);+ expect(step(ci.jobs['test-build'], name).if).toBe(BROAD_NOT_LAB);}// No size-base job: Main keeps the merge base's sizes, and build-storybook// builds the base only when Main kept no record.@@ -425,7 +428,9 @@ describe('Node-tooling CI routing', () => {candidate.id === 'scope' ||candidate.with?.path === '.test-scope' ||candidate.name === 'Skip heavy work for a specialized lane' ||- candidate.name === 'Skip typechecks for a specialized lane'+ candidate.name === 'Skip typechecks for a specialized lane' ||+ candidate.name === 'Lab-only: Lab tests + Storybook build' ||+ candidate.name === 'Lab-only: typecheck Lab and its stories') {continue;}diff --git a/.github/scripts/spec-owner-workflow.test.mjs b/.github/scripts/spec-owner-workflow.test.mjsindex 521a4f385f..9d5d228ee1 100644--- a/.github/scripts/spec-owner-workflow.test.mjs+++ b/.github/scripts/spec-owner-workflow.test.mjs@@ -93,7 +93,7 @@ describe('spec-only workflow contract', () => {);expect(result.status, result.stderr).toBe(0);expect(fs.readFileSync(output, 'utf8')).toBe(- 'spec_only=true\ndocsite_only=false\ntooling_only=false\nfull_suite=false\n',+ 'spec_only=true\ndocsite_only=false\ntooling_only=false\nlab_only=false\nfull_suite=false\n',);fs.rmSync(path.join(classifierDir, 'knowledge-paths.cjs'));diff --git a/.github/scripts/test-scope-action.test.mjs b/.github/scripts/test-scope-action.test.mjsindex 3e86070022..ee90e37556 100644--- a/.github/scripts/test-scope-action.test.mjs+++ b/.github/scripts/test-scope-action.test.mjs@@ -171,6 +171,7 @@ describe('per-job scope step', () => {'has_components','has_rtl_components','has_rtl_harness',+ 'lab_only','release_bump','spec_only','tooling_only',@@ -295,6 +296,53 @@ describe('per-job scope step', () => {expect(outputs).toMatchObject({spec_only: 'true', applies: 'false'});});+ it('does not apply on the Lab-only lane, and reports it (spec:AST-030 FR26)', async () => {+ const {outputs} = await decide({+ files: changed('packages/lab/src/Tour/Tour.tsx', '.changeset/tour.md'),+ inputs: {paths: INTERACTION_PATHS},+ });+ expect(outputs).toMatchObject({+ lab_only: 'true',+ applies: 'false',+ spec_only: 'false',+ });+ const mixed = await decide({+ files: changed(+ 'packages/lab/src/Tour/Tour.tsx',+ 'packages/core/src/Button/Button.tsx',+ ),+ });+ expect(mixed.outputs).toMatchObject({lab_only: 'false', applies: 'true'});+ });++ it('reports no Lab-only lane when the base classifier predates it', async () => {+ const old = fs+ .readFileSync(path.join(root, '.github/scripts/change-scope.cjs'), 'utf8')+ .replace('\\nlab_only=${result.labOnly}', '');+ expect(old).not.toContain('lab_only=');+ const {outputs} = await decide({+ files: changed('packages/lab/src/Tour/Tour.tsx'),+ baseOverrides: {'.github/scripts/change-scope.cjs': old},+ });+ expect(outputs).toMatchObject({+ lab_only: 'false',+ applies: 'true',+ decided: 'true',+ });+ });++ it('reports no Lab-only lane outside a pull request or when undecidable', async () => {+ const push = await decide({+ context: {...pullRequestContext(), eventName: 'workflow_dispatch'},+ });+ expect(push.outputs.lab_only).toBe('false');+ const broken = await decide({+ files: changed('packages/lab/src/Tour/Tour.tsx'),+ missingBase: ['.github/scripts/change-scope.cjs'],+ });+ expect(broken.outputs).toMatchObject({lab_only: 'false', decided: 'false'});+ });+it('fails when the trusted classifier rejects the change', async () => {const {messages} = await decide({files: [@@ -511,6 +559,16 @@ describe('per-job scope step', () => {});});+ it('keeps the component audits for a Lab-only change, so a label still runs its suite (spec:AST-030 FR26)', async () => {+ const {outputs} = await decide({+ files: changed('packages/lab/src/Tour/Tour.tsx'),+ inputs,+ });+ expect(outputs.lab_only).toBe('true');+ expect(outputs.applies).toBe('false');+ expect(outputs.has_components).toBe('true');+ });+it('runs every audit in full when the base lacks the audit classifier', async () => {const {outputs, messages} = await decide({files: changed('packages/core/src/Button/Button.tsx'),diff --git a/.github/scripts/touched-components.test.mjs b/.github/scripts/touched-components.test.mjsindex b67649c4f5..dde0f7c0dc 100644--- a/.github/scripts/touched-components.test.mjs+++ b/.github/scripts/touched-components.test.mjs@@ -490,7 +490,7 @@ describe('pr-touched-components routing', () => {it('runs on every pull request after the Storybook build and pr-visual, on one standard arm runner', () => {expect(job.needs).toEqual(['build-storybook', 'pr-visual']);expect(ungated(job.if)).toBe(- "!cancelled() && github.event_name == 'pull_request' && needs.build-storybook.result == 'success'",+ "!cancelled() && github.event_name == 'pull_request' && needs.build-storybook.result == 'success' && needs.build-storybook.outputs.lab_only != 'true'",);expect(job['runs-on']).toBe('ubuntu-24.04-arm');expect(job['timeout-minutes']).toBeLessThanOrEqual(15);diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex 277db912e3..6bc38433d2 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -522,12 +522,14 @@ jobs:id: scopeuses: ./.test-scope/.github/actions/test-scope- - name: Defer the heavy suites unless the change is spec-only+ - name: Defer the heavy suites unless the change is spec-only or Lab-onlyid: decideenv:SPEC_ONLY: ${{ steps.scope.outputs.spec_only }}+ LAB_ONLY: ${{ steps.scope.outputs.lab_only }}run: |- if [ "$SPEC_ONLY" = true ]; then+ # A Lab-only change runs only fast work, so nothing is deferred (FR26).+ if [ "$SPEC_ONLY" = true ] || [ "$LAB_ONLY" = true ]; thenecho 'deferred=false' >> "$GITHUB_OUTPUT"exit 0fi@@ -584,24 +586,29 @@ jobs:id: scopeuses: ./.test-scope/.github/actions/test-scope+ - name: 'Lab-only: Lab tests + Storybook build'+ if: steps.scope.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: Skip docsite work for Node toolingif: 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.tooling_only != 'true'+ if: steps.scope.outputs.tooling_only != 'true' && steps.scope.outputs.lab_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.tooling_only != 'true'+ if: steps.scope.outputs.tooling_only != 'true' && steps.scope.outputs.lab_only != 'true'- name: Validate spec recordsif: (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'+ 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@@ -609,7 +616,7 @@ jobs:# 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'+ if: steps.scope.outputs.spec_only != 'true' && steps.scope.outputs.tooling_only != 'true' && steps.scope.outputs.lab_only != 'true'run: |pnpm -F @astryxdesign/core buildpnpm --workspace-concurrency=4 \@@ -629,7 +636,7 @@ jobs:# `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'+ 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@@ -637,13 +644,13 @@ jobs:# 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'+ 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'+ 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: test-docsite (data test results)@@ -656,11 +663,11 @@ jobs:# 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'+ 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- name: Upload docsite browser evidence- if: always() && steps.scope.outcome == 'success' && 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' && steps.scope.outputs.lab_only != 'true'uses: actions/upload-artifact@v7with:name: docsite-browser-evidence@@ -726,6 +733,11 @@ jobs:id: scopeuses: ./.test-scope/.github/actions/test-scope+ - name: 'Lab-only: Lab tests + Storybook build'+ if: steps.scope.outputs.lab_only == 'true'+ run: |+ echo "::notice title=Lab-only::Lab-only: Lab tests + Storybook build. This job runs the Lab package's tests, the source-reading guard tests and the repository guards (spec:AST-030 FR26)."+- name: Skip heavy work for a specialized laneif: steps.scope.outputs.docsite_only == 'true' || steps.scope.outputs.spec_only == 'true' || steps.scope.outputs.tooling_only == 'true'run: echo "Specialized PR lane — skipping unrelated test suite"@@ -780,8 +792,19 @@ jobs:- name: Run this shard of the UI testsenv:SCOPED: ${{ github.event_name == 'pull_request' && steps.scope.outputs.full_suite == 'false' }}+ LAB_ONLY: ${{ steps.scope.outputs.lab_only }}run: |- if [ "$SCOPED" = true ]; then+ if [ "$LAB_ONLY" = true ]; then+ # A change only to the Lab package runs every Lab test across the+ # same legs, and the guards below as any scoped run does+ # (spec:AST-030 FR26).+ pnpm test:ui --passWithNoTests --shard=${{ matrix.shard }}/${{ strategy.job-total }} packages/lab/+ node .github/scripts/fs-guard-tests.mjs --changed HEAD^1 > "$RUNNER_TEMP/fs-guards.txt"+ mapfile -t GUARDS < "$RUNNER_TEMP/fs-guards.txt"+ if [ "${#GUARDS[@]}" -gt 0 ]; then+ pnpm test:ui --passWithNoTests --shard=${{ matrix.shard }}/${{ strategy.job-total }} "${GUARDS[@]}"+ fi+ elif [ "$SCOPED" = true ]; thenpnpm test:ui --changed=HEAD^1 --passWithNoTests --shard=${{ matrix.shard }}/${{ strategy.job-total }}# Tests no module graph relates to the change run too: guards# that read sources, and tests that load a changed package from@@ -802,7 +825,7 @@ jobs:# (AST-036); the other shards run on other machines.- name: Run the isolated Markdown benchmarkrun: pnpm test:ui:isolated- if: matrix.shard == 1 && steps.scope.outputs.docsite_only != 'true' && steps.scope.outputs.spec_only != 'true' && steps.scope.outputs.tooling_only != 'true'+ if: matrix.shard == 1 && steps.scope.outputs.docsite_only != 'true' && steps.scope.outputs.spec_only != 'true' && steps.scope.outputs.tooling_only != 'true' && steps.scope.outputs.lab_only != 'true'test-node:name: test-node (${{ matrix.shard }}/${{ strategy.job-total }})@@ -1089,6 +1112,11 @@ jobs:id: scopeuses: ./.test-scope/.github/actions/test-scope+ - name: 'Lab-only: Lab tests + Storybook build'+ if: steps.scope.outputs.lab_only == 'true'+ run: |+ echo "::notice title=Lab-only::Lab-only: Lab tests + Storybook build. The test owners ran the Lab package's tests and the source-reading guard tests (spec:AST-030 FR26)."+# A release-branch pull request is spec-only by classification, but its# join still runs: it requires the release bump's own validation.- uses: actions/checkout@v7@@ -1102,6 +1130,7 @@ jobs:DOCSITE_ONLY: ${{ steps.scope.outputs.docsite_only }}SPEC_ONLY: ${{ steps.scope.outputs.spec_only }}TOOLING_ONLY: ${{ steps.scope.outputs.tooling_only }}+ LAB_ONLY: ${{ steps.scope.outputs.lab_only }}TEST_UI_RESULT: ${{ needs.test-ui.result }}TEST_NODE_RESULT: ${{ needs.test-node.result }}TEST_BUILD_RESULT: ${{ needs.test-build.result }}@@ -1174,6 +1203,7 @@ jobs:outputs:short_hash: ${{ steps.release.outputs.short_hash || steps.urls.outputs.short_hash }}pr_number: ${{ steps.urls.outputs.pr_number }}+ lab_only: ${{ steps.scope.outputs.lab_only }}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@@ -1343,6 +1373,14 @@ jobs:if: steps.scope.outputs.docsite_only != 'true' && steps.scope.outputs.spec_only != 'true' && steps.scope.outputs.tooling_only != 'true'run: node .github/scripts/build-packages-and-storybook.mjs+ # A Lab-only change skips the typecheck job (spec:AST-030 FR26), so the+ # Lab package and the Storybook stories that import it are typechecked+ # here, against the packages this job just built: a type error that+ # landed would fail every later pull request's typecheck.+ - name: 'Lab-only: typecheck Lab and its stories'+ if: steps.scope.outputs.spec_only != 'true' && steps.scope.outputs.lab_only == 'true'+ run: pnpm -F @astryxdesign/lab -F @astryxdesign/storybook typecheck+- name: Verify package exportsif: steps.scope.outputs.docsite_only != 'true' && steps.scope.outputs.spec_only != 'true' && steps.scope.outputs.tooling_only != 'true'run: node scripts/verify-exports.mjs@@ -1595,23 +1633,28 @@ jobs:id: scopeuses: ./.test-scope/.github/actions/test-scope+ - name: 'Lab-only: Lab tests + Storybook build'+ if: steps.scope.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: Skip typechecks for a specialized laneif: steps.scope.outputs.docsite_only == 'true' || steps.scope.outputs.spec_only == 'true' || steps.scope.outputs.tooling_only == 'true'run: echo "Specialized PR lane — skipping typechecks"- name: Checkout- if: steps.scope.outputs.docsite_only != 'true' && steps.scope.outputs.spec_only != 'true' && steps.scope.outputs.tooling_only != 'true'+ if: steps.scope.outputs.docsite_only != 'true' && steps.scope.outputs.spec_only != 'true' && steps.scope.outputs.tooling_only != 'true' && steps.scope.outputs.lab_only != 'true'uses: actions/checkout@v7with:ref: ${{ github.event.pull_request.head.sha || github.sha }}- name: Setup Node and pnpm- if: steps.scope.outputs.docsite_only != 'true' && steps.scope.outputs.spec_only != 'true' && steps.scope.outputs.tooling_only != 'true'+ if: steps.scope.outputs.docsite_only != 'true' && steps.scope.outputs.spec_only != 'true' && steps.scope.outputs.tooling_only != 'true' && steps.scope.outputs.lab_only != 'true'uses: ./.github/actions/setup# The doc, template and CLI typechecks resolve the built package types.- name: Build packages- if: steps.scope.outputs.docsite_only != 'true' && steps.scope.outputs.spec_only != 'true' && steps.scope.outputs.tooling_only != 'true'+ if: steps.scope.outputs.docsite_only != 'true' && steps.scope.outputs.spec_only != 'true' && steps.scope.outputs.tooling_only != 'true' && steps.scope.outputs.lab_only != 'true'run: pnpm build# Every workspace package's own `typecheck` script: its sources and@@ -1620,7 +1663,7 @@ jobs:# A PR head cut before `pnpm typecheck` existed runs the previous list,# loaded from the merge commit these steps come from.- name: Typecheck every package- if: steps.scope.outputs.docsite_only != 'true' && steps.scope.outputs.spec_only != 'true' && steps.scope.outputs.tooling_only != 'true'+ if: steps.scope.outputs.docsite_only != 'true' && steps.scope.outputs.spec_only != 'true' && steps.scope.outputs.tooling_only != 'true' && steps.scope.outputs.lab_only != 'true'env:WORKFLOW_SHA: ${{ github.sha }}run: |@@ -1665,6 +1708,11 @@ jobs: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.build-storybook.outputs.lab_only == 'true'+ run: |+ echo "::notice title=Lab-only::Lab-only: Lab tests + Storybook build. The Storybook build job built the packages and typechecked Lab and its stories (spec:AST-030 FR26)."+- name: Assert parallel builds succeededrun: |echo "build-storybook: ${{ needs.build-storybook.result }}"@@ -2432,42 +2480,47 @@ jobs:id: scopeuses: ./.test-scope/.github/actions/test-scope+ - name: 'Lab-only: Lab tests + Storybook build'+ if: steps.scope.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)."+- uses: actions/checkout@v7- if: steps.scope.outputs.docsite_only != 'true' && steps.scope.outputs.spec_only != 'true' && steps.scope.outputs.tooling_only != 'true'+ if: steps.scope.outputs.docsite_only != 'true' && steps.scope.outputs.spec_only != 'true' && steps.scope.outputs.tooling_only != 'true' && steps.scope.outputs.lab_only != 'true'- name: Per-author heavy-suite caps- if: steps.scope.outputs.docsite_only != 'true' && steps.scope.outputs.spec_only != 'true' && steps.scope.outputs.tooling_only != 'true'+ if: steps.scope.outputs.docsite_only != 'true' && steps.scope.outputs.spec_only != 'true' && steps.scope.outputs.tooling_only != 'true' && steps.scope.outputs.lab_only != 'true'uses: ./.github/actions/heavy-caps# The daily heavy-run cap counts this step (spec:AST-030 FR16).- name: Heavy suite runs- if: steps.scope.outputs.docsite_only != 'true' && steps.scope.outputs.spec_only != 'true' && steps.scope.outputs.tooling_only != 'true'+ if: steps.scope.outputs.docsite_only != 'true' && steps.scope.outputs.spec_only != 'true' && steps.scope.outputs.tooling_only != 'true' && steps.scope.outputs.lab_only != 'true'run: 'true'- uses: ./.github/actions/setup- if: steps.scope.outputs.docsite_only != 'true' && steps.scope.outputs.spec_only != 'true' && steps.scope.outputs.tooling_only != 'true'+ if: steps.scope.outputs.docsite_only != 'true' && steps.scope.outputs.spec_only != 'true' && steps.scope.outputs.tooling_only != 'true' && steps.scope.outputs.lab_only != 'true'- name: Install Playwright- if: steps.scope.outputs.docsite_only != 'true' && steps.scope.outputs.spec_only != 'true' && steps.scope.outputs.tooling_only != 'true'+ if: steps.scope.outputs.docsite_only != 'true' && steps.scope.outputs.spec_only != 'true' && steps.scope.outputs.tooling_only != 'true' && steps.scope.outputs.lab_only != 'true'run: npx playwright install chromium# The Build package's contracts: the packed consumer's dependencies, the# production CSS-layer cascade, and cross-package StyleX markers in a# real browser. `pnpm test:build` owns the list.- name: Run Build package contracts- if: steps.scope.outputs.docsite_only != 'true' && steps.scope.outputs.spec_only != 'true' && steps.scope.outputs.tooling_only != 'true'+ if: steps.scope.outputs.docsite_only != 'true' && steps.scope.outputs.spec_only != 'true' && steps.scope.outputs.tooling_only != 'true' && steps.scope.outputs.lab_only != 'true'run: pnpm test:build# The vibe-tests fixtures share this Playwright-equipped runner: the# canonical setup compositions and the guest fixture contrast need a# production browser render.- name: Verify canonical setup compositions- if: steps.scope.outputs.docsite_only != 'true' && steps.scope.outputs.spec_only != 'true' && steps.scope.outputs.tooling_only != 'true'+ if: steps.scope.outputs.docsite_only != 'true' && steps.scope.outputs.spec_only != 'true' && steps.scope.outputs.tooling_only != 'true' && steps.scope.outputs.lab_only != 'true'env:ASTRYX_CANONICAL_SETUP_BROWSER: '1'run: pnpm vitest run internal/vibe-tests/setup-test/setup-canonical.test.ts --project node --maxWorkers=1- name: Verify guest fixture contrast- if: steps.scope.outputs.docsite_only != 'true' && steps.scope.outputs.spec_only != 'true' && steps.scope.outputs.tooling_only != 'true'+ if: steps.scope.outputs.docsite_only != 'true' && steps.scope.outputs.spec_only != 'true' && steps.scope.outputs.tooling_only != 'true' && steps.scope.outputs.lab_only != 'true'run: pnpm -F @astryxdesign/vibe-tests fixtures:contrast# The full visual plan first loads every Core story to learn which theming@@ -3352,7 +3405,7 @@ jobs:pr-touched-components:name: Touched components (visual, accessibility, RTL)needs: [build-storybook, pr-visual]- 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() && github.event_name == 'pull_request' && needs.build-storybook.result == 'success') }}+ 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() && github.event_name == 'pull_request' && needs.build-storybook.result == 'success' && needs.build-storybook.outputs.lab_only != 'true') }}runs-on: ubuntu-24.04-armtimeout-minutes: 15permissions:diff --git a/docs/specs/AST-030/spec.md b/docs/specs/AST-030/spec.mdindex c47399ac7e..213e535c80 100644--- a/docs/specs/AST-030/spec.md+++ b/docs/specs/AST-030/spec.md@@ -107,7 +107,8 @@ they are separately named.A category does not earn a specialized lane merely by existing in this table.Until every selected surface has an admitted, complete specialized owner route,that surface set uses the broad check set. `shared-or-unknown` always uses the- broad check set.+ broad check set, except a Changeset beside a Lab-only change, which keeps the+ Lab-only route (FR26).- **FR3 — Classification uses trusted base policy.** Pull-request code MUST NOTchoose its own lane. The workflow MUST load the classifier and every classifier@@ -121,7 +122,8 @@ they are separately named.set MUST select the broad lane. No fallback may grant a specialized lane.- **FR5 — Mixed scope keeps every owner.** A change touching multiple classifiedsurfaces MUST run the union of their checks. It MUST NOT run specialized lanes- for untouched surfaces. A set containing `shared-or-unknown`, a fail-closed+ for untouched surfaces. A set containing `shared-or-unknown` (apart from a+ Changeset beside a Lab-only change, FR26), a fail-closedcondition from FR3–FR4, or any selected surface without a complete admittedspecialized owner route MUST use broad CI. A specification beside runtime codedoes not hide the runtime surface.@@ -204,7 +206,9 @@ they are separately named.suite's label at the event:`ci:run-visual`, `ci:run-a11y` or `ci:run-rtl`, in each case last applied bysomeone with write, maintain or admin access, and a lookup that cannot- confirm that runs nothing. A label runs only its own suite. Without a label, a pull request update+ confirm that runs nothing. A label runs only its own suite. A Lab-only pull+ request (FR26) runs no default touched-components check; its labels still+ run their suites. Without a label, a pull request updateruns none of these owners at their opted-in scope, and no required contextdepends on them; it runs one default touched-components check instead:visual, accessibility and RTL for only the components the change touches,@@ -407,7 +411,8 @@ they are separately named.it is ready and before merge.** A push to a ready pull request authored by theshared agent login, into `main`, in its run's first attempt, runs onlytypecheck in the CI workflow (lint keeps its own workflow), unless its trusted- classification is spec-only; the path-filtered workflows (FR14) are+ classification is spec-only or Lab-only (FR26); the path-filtered workflows+ (FR14) areunaffected. Its heavy jobs skip, and the required contexts `test`, `build` and `docsite-test` (FR7)report failure with "Heavy CI deferred: runs when marked ready and beforemerge", never success, so nothing merges on that run; the PR report says the@@ -478,6 +483,28 @@ they are separately named.hourly schedule (FR21), and the release cut's own exact-commit checks areunchanged (DEC-19).+- **FR26 — A Lab-only pull request runs the Lab tests and the Storybook+ build.** A pull request whose every changed path is in the Lab package+ (`packages/lab/`), beside any Changesets, runs the Lab package's tests on the+ UI legs, the source-reading guard tests on the UI and Node legs as any scoped+ pull request runs them (FR13), the Storybook build, a typecheck of the Lab package and the+ Storybook stories against the packages that build made, and the+ repository-wide guards: full lint and the UI lane's copyright,+ package-exports, CLI API type, token-docs, Lab readiness and knowledge-schema+ checks. It runs no docsite build or tests, no full typecheck, no+ Build-package tests, no interaction proofs, no touched-components check,+ and no visual, accessibility or RTL suite unless a maintainer's label runs+ one (FR12), and an agent lane's push defers+ nothing (FR20). The required `build`, `test` and `docsite-test` contexts+ report success with the notice "Lab-only: Lab tests + Storybook build",+ never a skip. A change to any other path is mixed and runs CI as for any+ pull request: Core (its internal modules included), the CLI, scripts, shared+ or root configuration, the lockfile, and Lab stories under+ `apps/storybook/stories/`. So does an incomplete file list or a base whose+ classifier has no Lab-only lane. An outside+ contributor's pull request still needs `ci:run` (FR17), and `main` and the+ release-check cover Lab as before (DEC-21).+### Platform support- Supported feature/engine floor: GitHub pull-request and merge-group workflows@@ -492,7 +519,7 @@ they are separately named.## Current-state impactCurrent CI has singleton fast paths for canonical specification records, the-docsite, and admitted Node tooling. All other changes run broad Node/UI, build,+docsite, admitted Node tooling and the Lab package (FR26). All other changes run broad Node/UI, build,browser, and application checks. This accepted record changes no workflow byitself.@@ -532,11 +559,12 @@ The nightly perf lane is the one scheduled measurement outside them (FR18).| FR17 | `ci-pr-gate.test.mjs` over every `pull_request` workflow and the shared conditions | branch here, fork with and without `ci:run`, another label, draft with the label, ready, push, merge group, dispatch | a job that can start on a pull request without the condition, a label trigger, a required job that skips for a pull request that may not run CI, or a draft or unlabelled fork that runs fails || FR18 | `perf-nightly-workflow.test.mjs`, `perf-trend.test.mjs` and `run-labels.test.mjs` | nightly and dispatch; labelled, unlabelled, draft and unvouched-fork pull requests; write, read and no access; newest label event; failed lookup; 10% boundary; metric floors; seven-day window edges; fewer than three runs; a metric over once, twice in a row, or a different metric before; recorded and pull request runs | a run on an unlabelled pull request, a label honoured from read access, a regression called at exactly 10%, under its floor or on one run alone, a run outside the window in the baseline, a pull request run that records, or a second regression issue fails || FR19 | `ci-impact.test.mjs`, `pr-preview.test.mjs` and the maintenance template | CI change and non-CI change; standard, non-standard and expression runners; added, removed and changed jobs; trigger change | a CI change reports no impact, a move onto a non-standard runner or a pool or time-to-green rise past its threshold goes unflagged, or the section names a price |-| FR20 | `ci-heavy-deferral.test.mjs` over ci.yml, lint.yml and pr-comment.yml | agent push; marked ready; opened; reopened; re-run; another author; release branch; merge-back; spec-only change; a release-check and an opt-in label run, where the decision skips; a failed-jobs re-run of a deferred push | a heavy job runs on a deferred push, a required context passes or skips on one, a ready, reopened or re-run pull request defers, a spec-only change defers, the report hides the deferral, or a job below the decision skips because it skipped |+| FR20 | `ci-heavy-deferral.test.mjs` over ci.yml, lint.yml and pr-comment.yml | agent push; marked ready; opened; reopened; re-run; another author; release branch; merge-back; spec-only change; Lab-only change; a release-check and an opt-in label run, where the decision skips; a failed-jobs re-run of a deferred push | a heavy job runs on a deferred push, a required context passes or skips on one, a ready, reopened or re-run pull request defers, a spec-only or Lab-only change defers, the report hides the deferral, or a job below the decision skips because it skipped || FR21 | `ci-heavy-lanes.test.mjs` dispatch cases, `main-unit-run.test.mjs` over deploy.yml, `release-check-receipt.test.mjs` | push run; dispatched unit run; tip with the scheduler's or a person's release-check, or a person's maintenance capture; unit run cancelled, skipped or timed out; newer recheck or person's run of the tip; a person's validation of an older commit; cut commit with and without a passing unit run | a push runs the unit suites, a push cancels a unit run, a release-check comes without a unit run of its commit, an incomplete run goes unreported or waits a window, or a cut publishes without a passing unit run || FR22 | `main-validation-workflow.test.mjs` over the Main workflow and its commit resolver; `vitest-shard-sequencer.test.mjs` over the recorded Node times | six UI and six Node legs; dispatch without a commit, with a commit in main's history, with a commit outside it and with a malformed one; a re-check from the workflow token and from a person, and one that names `sha`; a `sha` before the size records, and one of only spaces; four and six Node legs over the recorded suite, a file with no recorded time, a project other than `node` | a hold, a leg past the fifteen-minute budget, a commit outside main's history that validates, a person's dispatch or a person's `sha` run that cancels or replaces a validation of main, a `sha` lane that checks out another commit, or a `sha` run named for main's tip, or two of the slowest Node files in one leg, a file run by no leg or by two, or a split that depends on collection order fails || FR23 | `release-check-shape.test.mjs`, `a11y-contract-shard.test.mjs` and the release-check workflow contract | release-check and pull-request legs; a contract file longer than a leg's share, one it cannot name exactly, and a serial one; the recorded suite; a re-check from an admin, a maintainer and a writer, from another branch, with a short SHA and with an older commit; failed-only beside a passed, a running and a missing run | a narrower release-check, a held or over-budget leg, a test selected by no leg or by two, a re-check that a writer can start, that waits for main's running check, or that re-runs jobs of another commit fails || FR24 | `ci-heavy-lanes.test.mjs` cadence cases | release-check 170 and 176 minutes old; the unit lane hourly beside it; weekday 06:37 Pacific inside the window in standard and daylight time; the pre-cut check already started; the tip already checked; a weekend morning; before 06:30 and after 07:30 | a release-check starts inside the 175-minute window, the pre-cut check is skipped or starts twice, or it runs on a weekend |+| FR26 | `ci-lab-only-routing.test.mjs`, `change-scope.test.mjs` and `test-scope-action.test.mjs` Lab-only cases | a Lab-only change, with and without a Changeset; Lab beside core, charts, a Storybook story, the docsite, the Sandbox, a workflow, the lockfile, root configuration, internal tooling or a spec record; a rename into or out of Lab; an incomplete list; a base classifier without the lane; each required context, its owners, the UI legs' Lab tests, the UI and Node guard tests, the repository guards, the Storybook build and Lab typecheck, the heavy suites with and without a label, lint and an agent push | a mixed change takes the Lab-only lane; a required context skips or fails, or passes without its notice; a Lab test, a guard test, a repository guard, the Lab typecheck or the Storybook build does not run; an unlabelled heavy suite, the docsite or the full typecheck runs, or a label's suite cannot audit Lab; lint is skipped |## Decision log@@ -919,6 +947,44 @@ keeps its own hourly schedule (FR21).Rejected: a check only at the cut (main's result would lag a whole day);keeping it hourly (the run is the largest share of main's runner use).+### DEC-21 — A Lab-only change runs only what checks Lab++**Reference:** `spec:AST-030/DEC-21`+**Decider:** `cixzhang`, `2026-11-01`++The Lab package is published only to npm's `canary` dist-tag, never as a+stable release, so no user of a stable release can be affected by a Lab+change, and its changes merge without the spec gates. The+decider's words: "Lab can just merge since its not shipped"; "Lab could+likely skip a lot of CI"; "LAb-only updates at least. Maybe it only runs the+lab tests"; "Theymight need storybook". A Lab-only pull request therefore+runs the Lab tests and the Storybook build, which holds Lab's stories and the+pull request's preview.++The repository-wide guards, the source-reading guard tests and the Lab+typecheck are an addition to those words. The guards and guard tests read the+whole repository on every pull request, and the full typecheck checks Lab's+tests, docs and stories, so a Lab change that broke one would turn every later+pull request red until `main` was repaired. They cost about half of what the+lane would otherwise save.++The docsite and the Sandbox import Lab, and their checks do not run on a+Lab-only pull request; the CLI's tests that load Lab or read its files run+with the guard tests. A Lab change that breaks the docsite or Sandbox build+shows as a failing preview deployment on its own pull request and on `main`'s+production deployment. One that breaks a docsite test fails only the next+pull request's `docsite-test`: `main` runs no docsite tests. A Lab break that+lands also reaches the `canary` dist-tag until the next push to+`main` replaces it. That is the accepted cost: about one pull-request run in a+hundred is Lab-only, and each skips most of a full run's work.++Rejected: keeping full CI for Lab (it spends shipped-surface checks on a+package no stable release includes); Lab tests alone, without the+repository-wide guards (a landed guard break blocks everyone else's pull+requests); counting Lab stories under `apps/storybook/stories/` as Lab-only+(they share the visual surface, and a path cannot tell a Lab story from a core+one without reading pull-request content, FR3).+## Open questionsNone.