frontend-quality-gates / merge / static checks (pull_request) Canceled after 0s
frontend-quality-gates / merge / tests (pull_request) Canceled after 0s
frontend-quality-gates / merge / browser tests (pull_request) Canceled after 0s
frontend-quality-gates / FE-GATE-014 / config-compatibility (pull_request) Canceled after 0s
frontend-quality-gates / FE-GATE-026 / lab-performance (pull_request) Canceled after 0s
frontend-quality-gates / FE-GATE-028 / manual-accessibility-review (pull_request) Canceled after 0s
frontend-quality-gates / FE-GATE-015 / immutable-release-candidate (pull_request) Canceled after 0s
frontend-quality-gates / external-vulnerability-provider (pull_request) Canceled after 0s
frontend-quality-gates / external-provenance-provider (pull_request) Canceled after 0s
frontend-quality-gates / promote-verified-immutable-candidate (pull_request) Canceled after 0s
frontend-quality-gates / deploy-promoted-release (pull_request) Canceled after 0s
frontend-quality-gates / FE-GATE-019 / hosting-header (pull_request) Canceled after 0s
frontend-quality-gates / FE-GATE-021 / runbook-boot-config (pull_request) Canceled after 0s
frontend-quality-gates / FE-GATE-022 / runbook-chunk-mismatch (pull_request) Canceled after 0s
frontend-quality-gates / FE-GATE-023 / runbook-api-degradation (pull_request) Canceled after 0s
frontend-quality-gates / FE-GATE-024 / runbook-telemetry (pull_request) Canceled after 0s
frontend-quality-gates / FE-GATE-025 / runbook-release-rollback (pull_request) Canceled after 0s
frontend-quality-gates / FE-GATE-018 / field-web-vitals (pull_request) Canceled after 0s
frontend-quality-gates / FE-GATE-017 / diagram-review (pull_request) Canceled after 0s
frontend-quality-gates / main / self-tests and removal drills (pull_request) Canceled after 0s
문제: `check:ci:gating`(FE-GATE-029)은 `*.test.*`와 `*.spec.*`를 모두 모은 뒤
게이트 명령이 닿는 경로 접두어만 본다. 그래서 `tests/unit/x.spec.ts`는
「게이트 안」으로 세지만 vitest.config.ts는 `*.test.{ts,tsx}`만 모아 아무
게이트도 그 파일을 돌리지 않는다.
고른 방법: 경로마다 그 경로를 돌리는 runner를 함께 적는다
(`gatedTestTargets`: Vitest 경로와 Playwright `testDir`). Vitest 경로는
`*.test.*`만, Playwright `testDir`는 기본 testMatch처럼 `*.spec.*`와
`*.test.*`를 게이트 안으로 본다. 판정(`ungatedTestFailures`)은 이 목록을
받고, 문자열만 주면 Vitest 경로로 본다. `gatedTestPaths`(경로만)는 다른
호출자를 위해 그대로 둔다.
위험·한계: Playwright 설정이 testMatch를 좁혀도 그 testDir의 두 꼴을 모두
게이트 안으로 본다(예전과 같다).
검증(desktop): 새 시험이 판정 규칙을 빼는 변이에서 실패(RED), 고친 뒤
ungated-tests·ungated-scripts·test-all-paths·removal-drill-test-paths 29개
통과, 실제 `check:ci:gating` PASS, `tests/unit/probe.spec.ts`를 두면 그
파일 이름으로 rc=1, eslint·check:types rc=0. 로그
/tmp/claude-gates/w2fe2-ung3/.
Refs: 0929/12-06
79 lines
2.9 KiB
TypeScript
79 lines
2.9 KiB
TypeScript
import { readFileSync } from "node:fs";
|
|
import { readFile } from "node:fs/promises";
|
|
|
|
import { loadCiGateContract } from "./contracts/ci-gates.ts";
|
|
import { loadProductCiOverlay } from "./contracts/product-ci-overlay.ts";
|
|
import {
|
|
gatedTestPaths,
|
|
gatedTestTargets,
|
|
listTestFiles,
|
|
parseUngatedTestExclusions,
|
|
ungatedTestFailures,
|
|
UNGATED_TESTS_PATH,
|
|
} from "./lib/ungated-tests.ts";
|
|
import {
|
|
parseUngatedScriptExclusions,
|
|
ungatedScriptFailures,
|
|
UNGATED_SCRIPTS_PATH,
|
|
} from "./lib/ungated-scripts.ts";
|
|
|
|
/**
|
|
* 12-04. Every test file and every verification package script is reached by
|
|
* a gate command of any stage, or config/ci/ungated-tests.json and
|
|
* config/ci/ungated-scripts.json say why not. It checks how the gates are
|
|
* wired, not the change, so it runs in the main stage (FE-GATE-029) after a
|
|
* merge (design-docs repo-structure/03-ci.md F2); check:ci keeps the contract
|
|
* and workflow checks on every pull request.
|
|
*/
|
|
|
|
const contract = await loadCiGateContract(process.cwd());
|
|
// 1103/12-07. The product's merge gates are entry scripts of CI as well.
|
|
const { mergeGates: productGates } = await loadProductCiOverlay(process.cwd());
|
|
const productGateScripts = productGates.map(({ script }) => script);
|
|
const packageScripts =
|
|
(JSON.parse(await readFile("package.json", "utf8")) as { scripts?: Record<string, string> }).scripts ?? {};
|
|
const failures: string[] = [];
|
|
|
|
// 12-04: every test file runs in a gate, or config/ci/ungated-tests.json says why not.
|
|
try {
|
|
failures.push(
|
|
...ungatedTestFailures({
|
|
testFiles: await listTestFiles(process.cwd()),
|
|
gatedPaths: gatedTestTargets(
|
|
packageScripts,
|
|
[...contract.commands.map(({ script }) => script), ...productGateScripts],
|
|
(file) => readFileSync(file, "utf8"),
|
|
),
|
|
exclusions: parseUngatedTestExclusions(
|
|
JSON.parse(await readFile(UNGATED_TESTS_PATH, "utf8")),
|
|
),
|
|
}),
|
|
);
|
|
} catch (error) {
|
|
failures.push(`ungated test check could not run: ${error instanceof Error ? error.message : String(error)}`);
|
|
}
|
|
|
|
// 12-04: every verification package script is reached by a gate, or
|
|
// config/ci/ungated-scripts.json says why not.
|
|
try {
|
|
const entryScripts = [...contract.commands.map(({ script }) => script), ...productGateScripts];
|
|
failures.push(
|
|
...ungatedScriptFailures({
|
|
scripts: packageScripts,
|
|
entryScripts,
|
|
gatedTestPaths: gatedTestPaths(packageScripts, entryScripts, (file) => readFileSync(file, "utf8")),
|
|
exclusions: parseUngatedScriptExclusions(
|
|
JSON.parse(await readFile(UNGATED_SCRIPTS_PATH, "utf8")),
|
|
),
|
|
}),
|
|
);
|
|
} catch (error) {
|
|
failures.push(`ungated script check could not run: ${error instanceof Error ? error.message : String(error)}`);
|
|
}
|
|
|
|
if (failures.length > 0) {
|
|
process.stderr.write(`CI gating failed:\n${failures.join("\n")}\n`);
|
|
process.exit(1);
|
|
}
|
|
process.stdout.write("CI gating: every test file and verification script is gated or excluded with a reason PASS\n");
|