Skip to content

ci: the interaction harness and the lint plugin narrow only the Vitest lanes - #10065

Open
cixzhang wants to merge 3 commits into
mainfrom
ci/vitest-scope-tooling-paths
Open

cixzhang wants to merge 3 commits into
mainfrom
ci/vitest-scope-tooling-paths

Conversation

@cixzhang

@cixzhang cixzhang commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Maintainer impact

A pull request that changes the interaction harness or the repository's lint plugin runs every Vitest test, because the classifier calls those files shared infrastructure. In the UI lane that's a median of about 24 runner-minutes per full run on the pull requests this change narrows. A scoped run still costs at least about 12, because its four legs still check out, set up and run their share of the source-reading guards.

  • How often: on 11/3 and 11/4, 28 of the 132 merged pull requests that ran the full Vitest suite had shared paths only in these two groups, beside Changesets. For 15, the interaction harness was the only one.
  • What their Vitest reach is: both groups are ES modules. Their Vitest reach is the tests that import them, plus the source-reading guards: every test that loads ESLint is one.

Intended invariant

A change whose only shared paths are the interaction harness or the lint plugin narrows only the Vitest owner: the UI and Node lanes run the tests whose module graph reaches the change, plus every test that reads repository sources. Every other owner runs as for shared infrastructure:

  • all interaction proofs;
  • the docsite browser contracts;
  • the builds;
  • the component audits;
  • the repository-wide lint.

A change with any other shared path still runs every Vitest test.

Node scripts stay on every Vitest test:

  • package scripts run generators whose output component tests read (the i18n runtime);
  • Vitest's --changed does not follow require;
  • the scoping tools live there.

Change

  • .github/scripts/change-scope.cjs:
    • isVitestGraphInfraPath covers internal/interaction-harness/ and internal/eslint-plugin-astryx/.
    • New output: vitestFullSuite is false when every shared path in the change is one of them; fullSuite is unchanged. The CLI writes vitest_full_suite.
  • The test-scope action passes vitest_full_suite through. Its "everything" default is true, and a base classifier that predates it reports nothing, which runs every test.
  • ci.yml: the two Vitest steps ("Run this shard of the UI tests", "… Node tests") scope by vitest_full_suite. Every other SCOPED/full_suite reader is unchanged.
  • AST-030 FR13: one sentence names the two groups and what they run, and the verification row names the new cases. DEC-6 names the exception.

Evidence

  • New classifier cases (change-scope.test.mjs):
    • each group beside code keeps fullSuite and narrows vitestFullSuite;
    • every other shared path, alone or beside a harness file, keeps every Vitest test, including scripts/generate-i18n-runtime.mjs, .github/scripts/run-labels.cjs, .github/scripts/fs-guard-tests.mjs and admitted Node tooling;
    • an incomplete list runs everything;
    • the CLI writes vitest_full_suite.
  • Workflow contract (ci-test-routing.test.mjs): only the two Vitest steps read vitest_full_suite. spec-owner-workflow.test.mjs's pinned classifier output includes it.
  • On main's classifier, the new classifier cases fail.
  • change-scope, ci-test-routing, test-scope-action, spec-owner-workflow and visual-scope tests pass (256), and pnpm check:knowledge passes.
  • Product/runtime behavior verified unchanged: CI only.
  • CI impact (AST-030 FR19):
    • Per run: on such a pull request's full run, test-ui (standard ubuntu-latest runners) drops from a median of about 24 to at least about 12 runner-minutes (the cheapest of 48 recent scoped test-ui runs cost 11.9). test-node changes little: its scoped run still runs every source-reading guard, which holds nearly all of the Node project's test time.
    • Runner pool: about 14 such pull requests a day, at about 2.5 full runs each, save at most about 450 runner-minutes a day, about 0.3 fewer concurrent jobs on average.
    • Time to green: unchanged. On this pull request's own run the docsite browser contracts, which still run in full for these changes, finished after the last Vitest leg.
    • Coverage: every other owner is unchanged; a missed Vitest test would surface in main's hourly full unit run (FR21).

Writing rubric results

AST-030 FR13 (one sentence added), its verification row, and DEC-6 (one clause added):

  • present tense;
  • no history, pull requests or research;
  • one rule;
  • both groups named with what they run;
  • the row names the tests and the cases that fail.

Scope

  • No intended public API, product behavior, visual direction, or policy change beyond the FR13 sentence above.
  • Public text and artifacts contain no internal Meta context.

… the Vitest lanes

A change to internal/interaction-harness/, internal/eslint-plugin-astryx/,
scripts/, .github/scripts/ or apps/sandbox/scripts/ is shared
infrastructure, so it ran every Vitest test beside every other owner. Only
Vitest's module graph and the source-reading guards can reach these files,
so the classifier now reports vitest_full_suite=false for them: the UI and
Node lanes run the tests the change reaches plus the guards, and every other
owner (interaction proofs, browser contracts, builds, audits) still runs as
for shared infrastructure. The scripts the Vitest configuration loads and
admitted Node tooling stay on every Vitest test. AST-030 FR13 says so.
@vercel

vercel Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Nov 5, 2026 12:48pm UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 5, 2026
@astracat-bot

astracat-bot Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 5, 2026, 1:00 PM UTC

@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 5, 2026
@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · f8505e5

Storybook · Sandbox · built from this PR's head

Package size: no published package changed; no new dependencies.

API changes: none in this pull request

Committed API report behind this build: cli 9 rows, core 4 rows; run pnpm api:report.

Not run on this PR: add ci:run-visual, ci:run-a11y or ci:run-rtl to run them.

CI impact: +9.1 job-min per update · pool +11% · time to green −7.3 min · standard runners · 6 CI action or script files changed (not measured) ⚠️
Before After Change
Job-minutes per PR update 81.4 90.5 +9.1
Runner pool, runner-minutes a day 31,595 35,125 +3,530 (+11%)
Average concurrent jobs 21.9 24.4 +2.5
Time to green (median → this run) 26.8 min 19.5 min −7.3 min
Runs a day 388 388 0

Changed jobs: test-node changed: standard · test-ui changed: standard

Not measured (the jobs that use these keep their recent minutes above): .github/actions/test-scope/action.yml, .github/scripts/change-scope.cjs, .github/scripts/change-scope.test.mjs, .github/scripts/ci-test-routing.test.mjs, .github/scripts/spec-owner-workflow.test.mjs, .github/scripts/test-scope-action.test.mjs.

Flags: runner-pool usage +11%.

Assumptions: before is each job's average over the last 20 pull-request runs; after keeps that for unchanged jobs and uses this run's minutes for added or changed ones, weighted by how often each changed job ran in those runs; runs a day averages the seven whole days before today; time to green compares this run with the median of those runs that ran the same jobs.


Generated by PR Enrichment workflow | View full report

@cixzhang
cixzhang marked this pull request as ready for review November 5, 2026 09:10
@cixzhang

cixzhang commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

/approve-spec eeaec00

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Nov 5, 2026

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requesting changes: the FR13 direction is approved, but the new output breaks an existing test, and the narrowing covers some files whose effect reaches tests outside Vitest's module graph, so their pull requests could go green while skipping tests they break.

  • spec-owner-workflow.test.mjs (line 95) expects the classifier's exact output, which now ends with vitest_full_suite=false, so test-node (4/4) fails on this head; add that line to the expected string.
  • scripts/generate-i18n-runtime.mjs runs during pnpm install and writes the generated i18n modules that components import, yet a change to it alone selects no UI test, so about 310 component tests that render its output (for example Avatar.test.tsx and Banner.test.tsx) would not run.
  • Vitest's --changed does not follow CommonJS require and fs-guard-tests.mjs counts only createRequire, so a change to .github/scripts/run-labels.cjs runs neither lib/pr-status.test.mjs nor lib/ci-impact.test.mjs, which load it through require.
  • .github/scripts/fs-guard-tests.mjs is narrowed too, so a pull request that changes it uses its own copy to decide which source-reading tests run.
  • The description and commit say only Vitest's module graph and the source-reading tests can reach these files, which the cases above disprove, so please narrow that claim to what the fix makes true.
  • The CI impact line is missing each changed job's runner class, average concurrent jobs and a time-to-green figure, which AST-030 FR19 asks for.

Keeping these files on every Vitest test, as VITEST_CONFIG_SCRIPTS already does for the config's imports, with a case for each, would close the gap; the fail-closed default and the workflow wiring otherwise look right.

[Automated review]

Comment thread .github/scripts/change-scope.cjs Outdated
/^\.github\/scripts\//,
/^apps\/sandbox\/scripts\//,
];
const VITEST_CONFIG_SCRIPTS = new Set([

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This exclusion covers only what vitest.config.ts imports. Scripts that prepare runs (scripts/generate-i18n-runtime.mjs writes the generated i18n modules most components import), CommonJS files reached through require (Vitest's --changed does not follow it), and .github/scripts/fs-guard-tests.mjs (the scoped steps run the pull request's copy) also reach tests outside the module graph, so they need to stay on every Vitest test.

fs.appendFileSync(
outputPath,
`spec_only=${result.specOnly}\ndocsite_only=${result.docsiteOnly}\ntooling_only=${result.toolingOnly}\nlab_only=${result.labOnly}\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}\nvitest_full_suite=${result.vitestFullSuite}\n`,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

spec-owner-workflow.test.mjs:95-97 pins this exact output and now fails (test-node (4/4)); add vitest_full_suite=false\n to its expected string.

…t lanes

The Node scripts stay shared for Vitest: package scripts run generators
whose output component tests read (the i18n runtime), Vitest's --changed
does not follow require, and the scoping tools themselves live there. The
interaction harness and the lint plugin are ES modules whose Vitest reach
is their importers plus the source-reading guards (every test that loads
ESLint is one). The pinned classifier output in spec-owner-workflow.test.mjs
now carries vitest_full_suite. AST-030 FR13 names the two groups.
@cixzhang
cixzhang marked this pull request as draft November 5, 2026 09:38
@cixzhang cixzhang changed the title ci: the interaction harness, lint plugin and Node scripts narrow only the Vitest lanes ci: the interaction harness and the lint plugin narrow only the Vitest lanes Nov 5, 2026
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 5, 2026
@cixzhang
cixzhang marked this pull request as ready for review November 5, 2026 09:39
@cixzhang

cixzhang commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

/approve-spec f8505e5

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Nov 5, 2026

@astracat-bot astracat-bot Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requesting changes for one fix in the description: the FR13 amendment carries an engineering owner's approval for this head, and the classifier, the action's fail-closed default and the two Vitest steps conform to it.

  • Miss: The CI impact line counts a scoped test-ui run as about 2 runner-minutes, but each of its four legs still checks out, sets up and runs its share of the UI guard files, and the cheapest of 48 recent scoped test-ui runs cost 11.9 runner-minutes (#9846, a single Changeset that reached no test) against a median 24.7 for full runs of the pull requests this change would narrow, so please restate the per-run line as about 24 to at least 12 runner-minutes and the pool line as at most about 450 runner-minutes a day and 0.3 concurrent jobs, with the Maintainer impact sentence to match.

Non-blocking: AST-030 DEC-6 still says shared infrastructure runs everything; one clause naming the new FR13 exception would keep the record consistent.

The test-node and time-to-green lines now hold.

[Automated review]

@cixzhang
cixzhang marked this pull request as draft November 5, 2026 12:40
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 5, 2026
@cixzhang

cixzhang commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

/approve-spec 12c291d

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Nov 5, 2026
@cixzhang
cixzhang marked this pull request as ready for review November 5, 2026 12:50

@astracat-bot astracat-bot Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved pending CI: CI has not run on this head yet, because the branch conflicts with main and pull-request CI starts only once that is resolved.

The FR13 and DEC-6 amendment carries an engineering owner's approval for this head, and the classifier, the action's fail-closed vitest_full_suite default and the two Vitest steps conform to it; the new classifier cases fail on main's classifier and pass here.

  • The conflict is in docs/specs/AST-030/spec.md, where main re-padded the Verification table whose FR13 row this pull request edits; after the rebase, the new head needs CI and an engineering owner's /approve-spec again.

[Automated review]

This branch was successfully deployed

1 active deployment
Preview — 12c291d9 Deployed Nov 5, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant