Skip to content

Commit 8010e83

Browse files
committed
build(check): run every locally runnable catalog gate in pnpm check
`pnpm check --full` ran a hand-written `check:tooling` chain plus fallow and the unit suite, so it skipped gates the catalog marks localRunnable (di-seams, agent-guidance, affected-selector, mutation and coverage models, wire and replay compatibility, provider integration, fixture cache and fallback, maestro conformance) and the apple-runner Vitest project. `--full` now runs the catalog's localRunnable checks with `unit` in place of `vitest-related`, `test:unit` includes apple-runner, and the superseded `check:tooling` script is removed. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016qAu53rMak1bXMuR5U2gF4
1 parent 89d63c5 commit 8010e83

9 files changed

Lines changed: 59 additions & 32 deletions

File tree

‎CONTRIBUTING.md‎

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -217,12 +217,13 @@ pnpm check:affected --run --head "$(git rev-parse HEAD)"
217217
Only a passed receipt with `exactCommit: true` proves validation at that commit. Without `--head`,
218218
the run also includes staged, unstaged, and untracked files; treat that result as local feedback.
219219
Unknown, workflow, lockfile, and selector-owning changes fail open to the full local set. For broad
220-
refactors or when explicitly requested, run `pnpm check`: formatting, lint, typechecking, layering,
221-
dependency-graph parity, production exports, MCP metadata, docs prose and links, the build, bundle
222-
ownership, the package check, Fallow, unit tests, and local smoke tests. Both commands share one host
223-
lock and need macOS or Linux; on Windows, use the affected plan and direct focused checks. GitHub CI
224-
stays authoritative for coverage, provider integration, history-backed compatibility, specialized
225-
toolchains, and live device lanes.
220+
refactors or when explicitly requested, run `pnpm check`: every gate the catalog in
221+
`scripts/check-affected/checks.ts` marks `localRunnable`, which is the set a fail-open
222+
`check:affected` run selects. That covers formatting, lint, typechecking, layering, the guard and
223+
model self-tests, the build, the package check, Fallow, the unit suite (including the `apple-runner`
224+
project), provider integration, history-backed compatibility, and local smoke tests. Both commands
225+
share one host lock and need macOS or Linux; on Windows, use the affected plan and direct focused
226+
checks. GitHub CI stays authoritative for coverage, specialized toolchains, and live device lanes.
226227

227228
Lint limits `*.test.{ts,tsx,mjs}` files throughout the repository and production `.ts`, `.tsx`,
228229
and `.mjs` files under `src/` and package `src/` to 1,000 lines, including comments and blank lines.

‎docs/agents/testing.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ For JSON, run `pnpm --silent check:affected --json`.
2424
With `--run --json`, stdout contains the receipt and stderr contains progress.
2525
When head is `HEAD`, planning and execution include working-tree changes.
2626

27-
`pnpm check` runs `check:tooling`, `check:fallow`, and `check:unit`.
28-
It does not run every catalog check.
27+
`pnpm check` runs every `localRunnable` catalog check.
28+
It runs `unit` in place of `vitest-related`.
2929

3030
Only a passed receipt with `exactCommit: true` proves validation at the named commit.
3131
A dirty-tree pass is local feedback.

‎package.json‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,6 @@
184184
"check:quick": "pnpm lint && pnpm typecheck",
185185
"sync:mcp-metadata": "node scripts/sync-mcp-metadata.mjs",
186186
"check:mcp-metadata": "node scripts/sync-mcp-metadata.mjs --check",
187-
"check:tooling": "pnpm format:check && pnpm lint && pnpm typecheck && pnpm check:layering && pnpm depgraph:test && pnpm check:gate-manifest:test && pnpm check:gate-manifest && pnpm check:production-exports && pnpm check:native-dupes:test && pnpm check:native-dupes && pnpm check:tmpdir-leaks:test && pnpm check:xctest-selection && pnpm check:packaged-runner-swift && pnpm check:mcp-metadata && pnpm check:doc-prose && pnpm check:doc-links && pnpm build && pnpm check:bundle-owner-files && pnpm check:package",
188187
"check:unit": "pnpm test:unit && pnpm check:tmpdir-leaks && pnpm test:smoke",
189188
"check": "node --experimental-strip-types scripts/check-affected/run.ts --run --full",
190189
"prepack": "npm_config_dry_run=false pnpm release:prepare",
@@ -201,7 +200,7 @@
201200
"test-app:maestro:ios": "pnpm test-app:maestro --platform ios",
202201
"test-app:maestro:android": "pnpm test-app:maestro --platform android",
203202
"test": "pnpm test:unit",
204-
"test:unit": "vitest run --project unit-core --project fuzz-worker",
203+
"test:unit": "vitest run --project unit-core --project apple-runner --project fuzz-worker",
205204
"test:maestro-compat": "vitest run --project unit-core packages/maestro src/compat/__tests__/replay-input.test.ts",
206205
"test:coverage": "vitest run --coverage --allowOnly=false --project=!fuzz-worker && pnpm test:fuzz-worker",
207206
"test:coverage:ci": "vitest run --coverage --allowOnly=false --project=!fuzz-worker && pnpm test:fuzz-worker",

‎scripts/check-affected/checks.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -222,11 +222,11 @@ export function getCheckSpec(id: CheckId): CheckSpec {
222222

223223
// Resolve the runnable command for a check. Script-backed checks are validated
224224
// against package.json so a renamed/removed script fails loudly instead of
225-
// silently skipping a gate. `fallow` threads the same --base the audit uses.
225+
// silently skipping a gate. `fallow` threads the same --base the audit uses, when there is one.
226226
export function resolveCommand(
227227
spec: CheckSpec,
228228
scripts: Readonly<Record<string, string>>,
229-
base: string,
229+
base: string | undefined,
230230
related: RelatedRunScope = { changedFiles: [], unitSuiteRuns: false },
231231
): string[] {
232232
if (spec.kind.type === 'vitest-related') {
@@ -251,7 +251,7 @@ export function resolveCommand(
251251
);
252252
}
253253
const command = ['pnpm', 'run', script];
254-
if (spec.id === 'fallow') command.push('--base', base);
254+
if (spec.id === 'fallow' && base !== undefined) command.push('--base', base);
255255
return command;
256256
}
257257

‎scripts/check-affected/run-cli.test.ts‎

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,16 @@ import type { ExecutionReceipt } from './execution.ts';
99
const root = path.resolve(import.meta.dirname, '../..');
1010
const runner = path.join(import.meta.dirname, 'run.ts');
1111

12-
function fixture() {
12+
function fixture(failingScript?: string) {
1313
const cwd = fs.mkdtempSync(path.join(os.tmpdir(), 'validation-cli-'));
1414
const git = (...args: string[]) => runCmdSync('git', args, { cwd }).stdout.trim();
1515
git('init', '-q');
1616
git('config', 'user.email', '[email protected]');
1717
git('config', 'user.name', 'Test');
1818
const { scripts } = JSON.parse(fs.readFileSync(path.join(root, 'package.json'), 'utf8'));
1919
const pkg = { name: 'validation-fixture', private: true, scripts };
20-
pkg.scripts['check:agent-guidance'] = 'node -e "process.exit(7)"';
21-
for (const script of ['check:tooling', 'check:fallow', 'check:unit'])
22-
pkg.scripts[script] = 'node -e "process.exit(0)"';
20+
for (const script of Object.keys(pkg.scripts)) pkg.scripts[script] = 'node -e "process.exit(0)"';
21+
if (failingScript) pkg.scripts[failingScript] = 'node -e "process.exit(7)"';
2322
fs.writeFileSync(path.join(cwd, 'package.json'), JSON.stringify(pkg));
2423
fs.writeFileSync(
2524
path.join(cwd, 'pnpm-workspace.yaml'),
@@ -58,7 +57,7 @@ test(
5857
'CLI JSON contains execution plan and preserves the failing command exit code',
5958
{ skip: process.platform === 'win32' },
6059
() => {
61-
const { cwd, base } = fixture();
60+
const { cwd, base } = fixture('check:agent-guidance');
6261
try {
6362
const result = invoke(cwd, ['--base', base]);
6463
assert.equal(result.exitCode, 7, result.stderr);
@@ -82,7 +81,13 @@ test(
8281
try {
8382
const full = invoke(cwd, ['--full']);
8483
assert.equal(full.exitCode, 0, full.stderr);
85-
assert.equal(full.receipt.results[0]?.id, 'check:tooling');
84+
const ran = full.receipt.results
85+
.filter((result) => result.status === 'passed')
86+
.map((result) => result.id);
87+
assert.ok(ran.includes('di-seams'), ran.join(', '));
88+
assert.ok(ran.includes('unit'), ran.join(', '));
89+
assert.ok(!ran.includes('vitest-related'), ran.join(', '));
90+
assert.ok(!full.receipt.results.some((result) => result.id === 'android-helpers'));
8691
fs.writeFileSync(path.join(cwd, 'pnpm-lock.yaml'), 'lockfileVersion: 9');
8792
const stale = invoke(cwd, ['--full']);
8893
assert.equal(stale.exitCode, 1);

‎scripts/check-affected/run.test.ts‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,14 +163,20 @@ async function runPassing(changedFiles: string[]): Promise<string[][]> {
163163

164164
const RELATED = ['pnpm', 'exec', 'vitest', 'related', '--run', '--passWithNoTests'];
165165

166-
// check:unit runs every unit-core and fuzz-worker test, so the related run must not repeat them.
166+
// check:unit runs every test of UNIT_TEST_PROJECTS, so the related run must not repeat them.
167167
test('a production source change leaves the unit projects to the unit suite it runs', async () => {
168168
const changedFiles = ['packages/selectors/src/index.ts', 'packages/selectors/src/index.test.ts'];
169169
const executed = await runPassing(changedFiles);
170170
assert.ok(executed.some((command) => command.includes('check:unit')));
171171
assert.deepEqual(
172172
executed.find((command) => command.includes('related')),
173-
[...RELATED, '--project=!unit-core', '--project=!fuzz-worker', ...changedFiles],
173+
[
174+
...RELATED,
175+
'--project=!unit-core',
176+
'--project=!apple-runner',
177+
'--project=!fuzz-worker',
178+
...changedFiles,
179+
],
174180
);
175181
});
176182

@@ -218,7 +224,7 @@ test('runChecks skips CI checks, runs every local check of a fail-open plan, and
218224
// check:unit runs in this plan too, so the related run leaves the unit projects to it.
219225
assert.deepEqual(
220226
related[0]?.filter((arg) => arg.startsWith('--project')),
221-
['--project=!unit-core', '--project=!fuzz-worker'],
227+
['--project=!unit-core', '--project=!apple-runner', '--project=!fuzz-worker'],
222228
);
223229
assert.ok(
224230
!related[0]?.includes('--coverage'),

‎scripts/check-affected/run.ts‎

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,20 @@ function printPlanHuman(plan: CheckPlan, args: Args): void {
176176
}
177177
}
178178

179+
// `--full` runs every locally runnable catalog check. `unit` runs the whole unit suite, so the
180+
// related run that only narrows it has nothing to add.
181+
function fullPlan(): CheckPlan {
182+
return {
183+
failOpen: true,
184+
checks: CHECK_CATALOG.filter((spec) => spec.localRunnable && spec.id !== 'vitest-related').map(
185+
(spec) => spec.id,
186+
),
187+
reasons: [],
188+
failOpenReasons: [],
189+
docsOnlyPaths: [],
190+
};
191+
}
192+
179193
// How a resolved command is executed. Injectable so the entrypoint's `--run`
180194
// propagation (order, skip of GitHub-authoritative checks, stop-on-failure) is
181195
// testable without spawning real processes.
@@ -184,7 +198,7 @@ export type CommandExecutor = (command: string[], cwd: string, id: string) => Pr
184198
export async function runChecks(
185199
plan: CheckPlan,
186200
pkg: PackageJson,
187-
args: Args,
201+
args: { readonly base: string | undefined },
188202
options: {
189203
cwd?: string;
190204
skip?: ValidationContext['skip'];
@@ -290,13 +304,11 @@ async function main(argv = process.argv.slice(2)): Promise<number> {
290304
return 1;
291305
}
292306
if (args.full) {
293-
const scripts = ['check:tooling', 'check:fallow', 'check:unit'];
294-
receipt.results = scripts.map((id) => ({ id, status: 'not-run' }));
295-
for (const script of scripts) {
296-
const code = await execute(['pnpm', 'run', script], repoRoot, script);
297-
if (code !== 0) return code;
298-
}
299-
return 0;
307+
const plan = fullPlan();
308+
receipt.plan = plan;
309+
receipt.results = plan.checks.map((id) => ({ id, status: 'not-run' }));
310+
// A full run has no diff, so fallow takes its own merge-base instead of a --base.
311+
return await runChecks(plan, currentPackage, { base: undefined }, { execute, skip });
300312
}
301313
const { changedFiles, plan } = prepare(receipt.refs.resolvedBase, currentPackage);
302314
receipt.changedFiles = changedFiles;

‎scripts/lib/vitest-projects.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
* `--project` flags; scripts/lib/vitest-projects.test.ts fails when the two differ. This module
44
* stays dependency-free: importing vitest.config.ts consumes its validation-report variable.
55
*/
6-
export const UNIT_TEST_PROJECTS = ['unit-core', 'fuzz-worker'] as const;
6+
export const UNIT_TEST_PROJECTS = ['unit-core', 'apple-runner', 'fuzz-worker'] as const;

‎test/repo-guards/npm-package-scripts.test.ts‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import fs from 'node:fs';
33
import path from 'node:path';
44
import { fileURLToPath } from 'node:url';
55
import { test } from 'vitest';
6+
import { getCheckSpec } from '../../scripts/check-affected/checks.ts';
67

78
const repoRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../..');
89
const packageJson = JSON.parse(fs.readFileSync(path.join(repoRoot, 'package.json'), 'utf8')) as {
@@ -91,7 +92,10 @@ test('the package gate disables the detached update notifier for its smoke probe
9192
// be stopped. Publishing runs it; nothing else guarantees the tarball is ever verified.
9293
test('publishing cannot skip the package gate', () => {
9394
assert.match(script('package:npm'), /pnpm check:package$/);
94-
assert.match(script('check:tooling'), /pnpm check:package$/);
95+
// `pnpm check` runs every locally runnable catalog gate, so the package gate must stay one.
96+
assert.match(script('check'), /scripts\/check-affected\/run\.ts --run --full$/);
97+
assert.deepEqual(getCheckSpec('package').kind, { type: 'script', script: 'check:package' });
98+
assert.equal(getCheckSpec('package').localRunnable, true);
9599
// The minimum-Node job runs the script directly — the repo's pinned pnpm needs a newer Node than
96100
// the floor that job covers — so it must still name the same entry point the script does.
97101
assert.match(script('check:package'), /scripts\/check-package\.ts$/);

0 commit comments

Comments
 (0)