ci: run the CPU-independent scale PR tier in FE-GATE-005 (11-03)
No CI job ran any scale tier, and every tier past pr compares timings only on the baseline CPU. The pr tier checks counts, bounds and growth shape; it now includes S2 composition, since S0/S1 stay under the noise floor and let a quadratic accumulation through. The ungated-test check reads tier paths. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
7f889a6d83
commit
45ee231bb0
@@ -3,12 +3,14 @@ import path from "node:path";
|
||||
|
||||
import { z } from "zod";
|
||||
|
||||
import { SCALE_TIERS, type ScaleTier } from "../scale/run-scale-profile.ts";
|
||||
import { reachablePackageScripts } from "./package-script-graph.ts";
|
||||
|
||||
/**
|
||||
* 12-04. A test file protects nothing unless a CI gate runs it. The gated set
|
||||
* is read from the package scripts the CI contract's commands reach: Vitest
|
||||
* path filters (`run-vitest.ts run <paths>`) and Playwright config `testDir`s.
|
||||
* path filters (`run-vitest.ts run <paths>`), the Vitest steps of a scale tier
|
||||
* (`run-scale-profile.ts <tier>`) and Playwright config `testDir`s.
|
||||
* A test outside that set needs a reasoned entry in config/ci/ungated-tests.json.
|
||||
*/
|
||||
export const UNGATED_TESTS_PATH = "config/ci/ungated-tests.json";
|
||||
@@ -53,17 +55,22 @@ export function gatedTestPaths(
|
||||
readConfig: (file: string) => string,
|
||||
): string[] {
|
||||
const paths = new Set<string>();
|
||||
const addVitestPaths = (tokens: readonly string[]) => {
|
||||
const vitestRun = tokens.findIndex(
|
||||
(token, index) => token === "run" && /(?:run-vitest\.ts|vitest)$/u.test(tokens[index - 1] ?? ""),
|
||||
);
|
||||
if (vitestRun < 0) return;
|
||||
for (const token of tokens.slice(vitestRun + 1)) {
|
||||
if (!token.startsWith("-")) paths.add(token.replace(/\/$/u, ""));
|
||||
}
|
||||
};
|
||||
for (const script of reachablePackageScripts(scripts, entryScripts)) {
|
||||
for (const segment of scripts[script]!.split("&&")) {
|
||||
const tokens = segment.trim().split(/\s+/u);
|
||||
const vitestRun = tokens.findIndex(
|
||||
(token, index) => token === "run" && /(?:run-vitest\.ts|vitest)$/u.test(tokens[index - 1] ?? ""),
|
||||
);
|
||||
if (vitestRun >= 0) {
|
||||
for (const token of tokens.slice(vitestRun + 1)) {
|
||||
if (token.startsWith("-")) break;
|
||||
paths.add(token.replace(/\/$/u, ""));
|
||||
}
|
||||
addVitestPaths(tokens);
|
||||
const scaleProfile = tokens.findIndex((token) => /run-scale-profile\.ts$/u.test(token));
|
||||
if (scaleProfile >= 0) {
|
||||
for (const step of SCALE_TIERS[tokens[scaleProfile + 1] as ScaleTier] ?? []) addVitestPaths(step.command);
|
||||
}
|
||||
const playwrightTest = tokens.findIndex(
|
||||
(token, index) => token === "test" && tokens[index - 1] === "playwright",
|
||||
|
||||
Reference in New Issue
Block a user