An open source design system that's fully customizable and agent ready
TypeScript
ci: every workflow declares when it runs, as an allowlist (AST-030 FR14) (#8884)
Cindy Zhang4045d1614701
diff --git a/.github/scripts/spec-owner-workflow.test.mjs b/.github/scripts/spec-owner-workflow.test.mjsindex aa576739f2..02b6d22567 100644--- a/.github/scripts/spec-owner-workflow.test.mjs+++ b/.github/scripts/spec-owner-workflow.test.mjs@@ -149,7 +149,10 @@ describe('spec-only workflow contract', () => {expect(source, workflow).toContain("if: steps.scope.outputs.spec_only == 'true'",);+ // Steps live under `jobs:`; a trigger's path list above it uses the+ // same indentation and is not a step.const expensiveSteps = source+ .slice(source.indexOf('\njobs:')).split(/\n - /).slice(1).filter(step =>diff --git a/.github/scripts/workflow-paths.test.mjs b/.github/scripts/workflow-paths.test.mjsnew file mode 100644index 0000000000..4da12b13a2--- /dev/null+++ b/.github/scripts/workflow-paths.test.mjs@@ -0,0 +1,56 @@+// Copyright (c) Meta Platforms, Inc. and affiliates.++/**+ * @file Workflows state what makes them run, never what does not+ * (spec:AST-030 FR14). An exclusion list runs on every path nobody thought to+ * exclude; a path filter on a workflow that reports a required context leaves+ * pull requests waiting on a check that never starts.+ */++import fs from 'node:fs';+import path from 'node:path';++import {expect, it} from 'vitest';+import yaml from 'yaml';++const dir = path.resolve(import.meta.dirname, '../workflows');+const workflows = fs+ .readdirSync(dir)+ .filter(name => name.endsWith('.yml'))+ .map(name => [+ name,+ yaml.parse(fs.readFileSync(path.join(dir, name), 'utf8')),+ ]);+// The workflows that report the required contexts (build, test,+// docsite-test, lint, spec-owner-approval, review-required).+const REQUIRED_CONTEXT_WORKFLOWS = [+ 'ci.yml',+ 'lint.yml',+ 'review-signal.yml',+ 'spec-owner-gate.yml',+];+// `**`, `**/*`, `**/**`: a glob that matches every path is no allowlist.+const MATCH_ALL = /^\*\*(\/\*+)*$/;++it('names required-context workflows that exist', () => {+ const names = workflows.map(([name]) => name);+ for (const name of REQUIRED_CONTEXT_WORKFLOWS) expect(names).toContain(name);+});++it.each(workflows)('%s filters by positive paths only', (name, value) => {+ for (const [event, config] of Object.entries(value.on ?? value[true] ?? {})) {+ expect(config?.['paths-ignore'], `${name} ${event}`).toBeUndefined();+ for (const glob of config?.paths ?? []) {+ expect(+ MATCH_ALL.test(glob) || glob.startsWith('!'),+ `${name}: ${glob}`,+ ).toBe(false);+ }+ if (REQUIRED_CONTEXT_WORKFLOWS.includes(name)) {+ expect(+ config?.paths,+ `${name} reports a required context`,+ ).toBeUndefined();+ }+ }+});diff --git a/.github/workflows/cli-smoke-test.yml b/.github/workflows/cli-smoke-test.ymlindex 1b939d0373..c11004c0bb 100644--- a/.github/workflows/cli-smoke-test.yml+++ b/.github/workflows/cli-smoke-test.yml@@ -7,8 +7,26 @@ name: CLI Smoke Teston:pull_request:branches: ['main']- paths-ignore:- - 'apps/docsite/**'+ # Runs only when something the CLI reads or the smoke scripts run can+ # change (spec:AST-030 FR14): every package (the CLI discovers Core, Lab,+ # Charts, Rich Text and the themes from the workspace), the workspace's+ # dependency and TypeScript configuration, the setup action and the smoke+ # scripts themselves. A merge-group entry, which cannot filter by path,+ # keeps running.+ paths:+ - 'packages/**'+ - 'package.json'+ - 'pnpm-lock.yaml'+ - 'pnpm-workspace.yaml'+ - 'tsconfig*.json'+ - '.nvmrc'+ - '.github/actions/setup/**'+ - '.github/scripts/cli-smoke-test.mjs'+ - '.github/scripts/cli-json-smoke-test.mjs'+ - '.github/scripts/api-cli-parity-test.mjs'+ - '.github/scripts/cdn-template-smoke-test.mjs'+ - '.github/scripts/lib/cdn-*.mjs'+ - '.github/workflows/cli-smoke-test.yml'merge_group:permissions: {}diff --git a/.github/workflows/hardening-issue.yml b/.github/workflows/hardening-issue.ymlindex 99e3db10e5..7c020ecb12 100644--- a/.github/workflows/hardening-issue.yml+++ b/.github/workflows/hardening-issue.yml@@ -12,6 +12,9 @@ on:pull_request:types: [closed]branches: [main]+ # Only a Core component directory can add a component (spec:AST-030 FR14).+ paths:+ - 'packages/core/src/**'permissions: {}diff --git a/.github/workflows/internal-registry.yml b/.github/workflows/internal-registry.ymlindex 7a5c60c382..4f4bfd5d9c 100644--- a/.github/workflows/internal-registry.yml+++ b/.github/workflows/internal-registry.yml@@ -5,13 +5,25 @@ name: Internal Registry# Verifies every pinned dependency is available from the registry before it can# break a build. Temporarily advisory: the check still runs and surfaces# annotations, but a failure no longer fails the job (continue-on-error), so it-# warns instead of blocking. Re-enable gating by removing continue-on-error and-# marking the merge_group run ("Internal Registry / dependency-check") as a-# REQUIRED status check; fork PRs are skipped and enforced by that run.+# warns instead of blocking. The pull_request trigger is path-filtered+# (spec:AST-030 FR14), so this check never starts on a pull request that+# touches no dependency file: never make it a required status check as it+# stands. Re-enabling gating means removing continue-on-error and the path+# filter, so the workflow reports on every pull request and skips its work+# inside the job when no dependency changed.on:pull_request:branches: ['main']+ # Runs only when a dependency declaration or the lockfile can change what+ # the registry must serve (spec:AST-030 FR14). A merge-group entry, which+ # cannot filter by path, keeps running.+ paths:+ - 'pnpm-lock.yaml'+ - 'pnpm-workspace.yaml'+ - '**/package.json'+ - '**/package-lock.json'+ - '.github/workflows/internal-registry.yml'merge_group:permissions: {}diff --git a/docs/specs/AST-030/spec.md b/docs/specs/AST-030/spec.mdindex 55468621a9..184f1662fd 100644--- a/docs/specs/AST-030/spec.md+++ b/docs/specs/AST-030/spec.md@@ -37,7 +37,8 @@ affects_consumer_docs: []".github/workflows/**",".github/scripts/change-scope.*",".github/scripts/*routing*.test.mjs",- ".github/scripts/pr-scope-touches.*"+ ".github/scripts/pr-scope-touches.*",+ ".github/scripts/workflow-paths.test.mjs"]}```@@ -247,6 +248,21 @@ they are separately named.condition of FR3–FR4 also runs the full suite. `main`, release branches,merge-group entries and `release-check` dispatches always run the full suite,and release checks keep FR12's full scope.+- **FR14 — Every workflow declares when it runs, as an allowlist.** Each+ workflow in `.github/workflows` states the positive condition that makes it+ relevant, and runs only when that condition holds. A workflow whose push or+ pull-request trigger serves no required context lists the paths that make it+ relevant on that trigger (`paths:`), and those paths name what the workflow+ reads or runs, never everything; a merge-group entry, which cannot filter by+ path, keeps running. A workflow that reports a required context (`build`,+ `test`, `docsite-test`, `lint`, `spec-owner-approval`, `review-required`)+ starts on every pull request and is never path-filtered: the trusted+ classifier's positive surfaces (FR1–FR5) choose the work inside it, and a job+ whose suite does not apply reports success without running it (FR7). A push+ to `main`, a schedule, a manual dispatch, and review, comment, check and+ deployment events are relevance conditions of their own. No workflow uses+ `paths-ignore` or another exclusion list, which would run on any path no one+ thought to exclude.### Platform support@@ -277,6 +293,10 @@ classifier and join contract are complete. New surfaces may add lanes only throuFR10. New coverage joins its current surface owner; visual regression remains inthe shared Storybook PR owner.+Outside the classifier-routed workflows, the Internal Registry dependency check,+the CLI smoke test and the hardening-issue opener run only when the paths they+read change (FR14).+## Verification| Contract | Verification | Representative states | Mutation or failure expectation |@@ -290,6 +310,7 @@ the shared Storybook PR owner.| FR11 | surface owner, internal-job, and required-join contract tests | Build package browser behavior; CLI; theme-family broad fallback; mixed Core+CLI | a second owner is routed for one surface, an internal job masquerades as a lane, an owned failure misses its join, or an unrelated owner runs || FR12 | Storybook visual-plan, canonical workflow, and repository-owner guard tests | PR scope; full-plan maintenance; report-only publication; deployment/a11y/RTL/vibe artifacts | another workflow captures or compares pixels, a renamed or aliased owner escapes the guard, or legitimate non-visual artifacts are rejected || FR13 | classifier, workflow contract, component-analysis and RTL-scope tests | component change; shared module; Changeset beside code; infrastructure path; incomplete list; no build | an infrastructure path is scoped, a file-system guard test is skipped, a reverse dependent leaves visual/RTL or enters PR accessibility, or a full-suite event is narrowed |+| FR14 | `workflow-paths.test.mjs` over every workflow | path allowlist; required-context workflow | a `paths-ignore`, a match-all or exclusion glob, or a path filter on a workflow that reports a required context fails |## Decision log@@ -430,6 +451,22 @@ request runs the visual, accessibility and RTL owners only with theRejected: a full run triggered by approval, a label or a draft-to-ready change,which tests the pull request's head rather than the merged result.+### DEC-8 — A workflow states what makes it run, never what does not++**Reference:** `spec:AST-030/DEC-8`+**Decider:** `cixzhang`, `2026-10-28`++Every workflow names the positive condition that makes it relevant: the paths it+reads or runs, the classifier surfaces inside a required context, or the event+it answers. An exclusion list (`paths-ignore`) runs on every new directory,+package or root file no one remembered to exclude, so unrelated changes keep+paying for it; an allowlist misses only what its owner did not name. Required+contexts stay unfiltered so a pull request never waits on a check that never+starts.++Rejected: `paths-ignore` lists (they run on whatever is new); path-filtering a+required context (its check would never report).+## Open questionsNone.