frontend-quality-gates / FE-GATE-017 / diagram-review (pull_request) Skipped
frontend-quality-gates / main / self-tests and removal drills (pull_request) Skipped
frontend-quality-gates / merge / static checks (pull_request) Successful in 1m9s
frontend-quality-gates / merge / tests (pull_request) Successful in 10m55s
frontend-quality-gates / merge / browser tests (pull_request) Successful in 5m11s
frontend-quality-gates / FE-GATE-014 / config-compatibility (pull_request) Skipped
frontend-quality-gates / FE-GATE-028 / manual-accessibility-review (pull_request) Skipped
frontend-quality-gates / FE-GATE-026 / lab-performance (pull_request) Skipped
frontend-quality-gates / FE-GATE-015 / immutable-release-candidate (pull_request) Skipped
frontend-quality-gates / external-vulnerability-provider (pull_request) Skipped
frontend-quality-gates / external-provenance-provider (pull_request) Skipped
frontend-quality-gates / promote-verified-immutable-candidate (pull_request) Skipped
frontend-quality-gates / deploy-promoted-release (pull_request) Skipped
frontend-quality-gates / FE-GATE-019 / hosting-header (pull_request) Skipped
frontend-quality-gates / FE-GATE-021 / runbook-boot-config (pull_request) Skipped
frontend-quality-gates / FE-GATE-022 / runbook-chunk-mismatch (pull_request) Skipped
frontend-quality-gates / FE-GATE-023 / runbook-api-degradation (pull_request) Skipped
frontend-quality-gates / FE-GATE-024 / runbook-telemetry (pull_request) Skipped
frontend-quality-gates / FE-GATE-025 / runbook-release-rollback (pull_request) Skipped
frontend-quality-gates / FE-GATE-018 / field-web-vitals (pull_request) Skipped
This reverts commitb489589403, reversing changes made to9e1cfd5975. 문제: main run 376(b4895894)의 `main / self-tests and removal drills` job에서 FE-GATE-030이 실패한다. browser-file-storage 제거 드릴 사본에서 tests/unit/test-evidence-source-rules.test.ts 6건이 모두 같은 이유로 떨어진다. scripts/check-test-evidence.ts의 missingForbidOnly가 playwright.capabilities.config.ts를 읽다 ENOENT로 죽는다. #55가 forbidOnly 검사를 전체 검사에서 fixture 모드까지 모든 모드로 옮겼다. 드릴은 그 설정 파일을 지우지만 config/repository-layout.json의 playwright-configs 목록에는 그대로 남는다. 이 job은 main 단계에만 있어 PR run에서는 돌지 않았다. 고른 방법: CI 매뉴얼 9.3대로 main을 먼저 초록으로 돌리려고 #55 병합 커밋을 통째로 되돌린다(git revert -m 1b4895894). 되돌린 트리는9e1cfd59트리(9b3237dd)와 같다. 버린 대안: 그 자리에서 고치기(없는 설정을 건너뛰거나, 드릴이 목록에서도 빼기)는 어느 쪽이 맞는지 판단과 검증이 필요해 main 빨강이 길어진다. 고침은 #55를 다시 올리는 PR에서 한다. 위험·한계: #55의 고침 12커밋(검사기 진단과 시험 빈틈)이 main에서 빠진다. 다시 올릴 때 이 드릴(FE-GATE-030, main 단계)을 PR 쪽에서 따로 돌리지 않으면 같은 일이 다시 난다. 검증: desktop 공유 잠금 아래 test:browser-file-storage-removal.b4895894트리(7536337a) 3회 모두 rc=1(64·69·53초). 3회차 로그에서 6건 실패, 6건 모두 run 376과 같은 ENOENT(playwright.capabilities.config.ts).9e1cfd59트리(9b3237dd, 이 커밋의 트리) 1회 rc=0(92초). 로그 desktop /tmp/claude-gates/fe-run376-b489-removal/, fe-run376-9e1c-removal/.
193 lines
6.5 KiB
TypeScript
193 lines
6.5 KiB
TypeScript
import { createHash } from "node:crypto";
|
|
import { mkdir, readFile, rm } from "node:fs/promises";
|
|
import process from "node:process";
|
|
import { z } from "zod";
|
|
|
|
import {
|
|
ROUTE_REGISTRY,
|
|
ROUTE_RUNTIME_CONTRACT,
|
|
} from "../src/features/installed-feature-contracts.ts";
|
|
import {
|
|
buildManifestArtifactSchema,
|
|
jsonSchemaDocumentArtifactSchema,
|
|
moduleInventoryArtifactSchema,
|
|
releaseManifestV2ArtifactSchema,
|
|
runtimeConfigV2ArtifactSchema,
|
|
} from "./contracts/release-artifacts.ts";
|
|
import { buildContractSet } from "./generate-contract-set.ts";
|
|
import {
|
|
assertCiBuildEnvironment,
|
|
buildDate,
|
|
} from "./lib/build-environment.ts";
|
|
import { writeValidatedJsonArtifact } from "./lib/validated-json-artifact.ts";
|
|
import { CANONICAL_VITE_MANIFEST_PATH } from "./lib/build-manifest-outputs.ts";
|
|
import { runOutputPath } from "./lib/run-isolation.ts";
|
|
|
|
assertCiBuildEnvironment(process.env);
|
|
// 1105/12-04. With RUN_OUTPUT_ROOT set, this build's dist and artifacts are
|
|
// under that folder. The manifest still records `dist`, `artifacts/...`:
|
|
// its paths are relative to the folder the build wrote, which is the
|
|
// checkout when the variable is unset.
|
|
const at = (relativePath: string) => runOutputPath(relativePath);
|
|
type ViteManifestEntry = Readonly<{
|
|
file: string;
|
|
name?: string;
|
|
isDynamicEntry?: boolean;
|
|
}>;
|
|
|
|
const packageJson = parsePackageMetadata(
|
|
JSON.parse(await readFile("package.json", "utf8")),
|
|
);
|
|
const packageManagerVersion = packageJson.packageManager.split("@").at(-1);
|
|
const buildId = process.env.VITE_BUILD_ID ?? "local-build";
|
|
const commitSha = process.env.VITE_COMMIT_SHA ?? "local";
|
|
const releaseId = process.env.RELEASE_ID ?? "local-release";
|
|
const runnerImage = process.env.CI_RUNNER_IMAGE ?? `${process.platform}-${process.arch}`;
|
|
const buildTime = buildDate(process.env);
|
|
const builtAt = buildTime.toISOString();
|
|
const viteManifest = await readFile(at(CANONICAL_VITE_MANIFEST_PATH), "utf8");
|
|
const viteManifestObject = parseViteManifest(JSON.parse(viteManifest));
|
|
const moduleInventory = await readFile(
|
|
at("dist/.vite/module-inventory.json"),
|
|
"utf8",
|
|
);
|
|
const moduleInventoryDocument = moduleInventoryArtifactSchema.parse(
|
|
JSON.parse(moduleInventory),
|
|
);
|
|
const moduleInventoryBytes = `${JSON.stringify(moduleInventoryDocument, null, 2)}\n`;
|
|
const assetManifestHash = createHash("sha256")
|
|
.update(viteManifest)
|
|
.digest("hex");
|
|
const moduleInventoryHash = createHash("sha256")
|
|
.update(moduleInventoryBytes)
|
|
.digest("hex");
|
|
const runtimeConfig = runtimeConfigV2ArtifactSchema.parse(
|
|
JSON.parse(await readFile(at("dist/config.json"), "utf8")),
|
|
);
|
|
const routeChunks: Record<string, string> = {};
|
|
const runtimeContracts: Readonly<Record<string, { moduleId: string }>> =
|
|
ROUTE_RUNTIME_CONTRACT;
|
|
for (const definition of Object.values(ROUTE_REGISTRY)) {
|
|
const runtime = runtimeContracts[definition.routeId];
|
|
const asset = Object.values(viteManifestObject).find(
|
|
(entry) => entry.name === runtime?.moduleId && entry.isDynamicEntry,
|
|
);
|
|
if (!runtime || !asset?.file) {
|
|
throw new Error(`Missing built route chunk: ${definition.routeId}`);
|
|
}
|
|
routeChunks[definition.chunkId] = asset.file;
|
|
}
|
|
const runtimeConfigJsonSchema = z.toJSONSchema(runtimeConfigV2ArtifactSchema);
|
|
|
|
runtimeConfig.BUILD_ID = buildId;
|
|
runtimeConfig.RELEASE_ID = releaseId;
|
|
|
|
const manifest = buildManifestArtifactSchema.parse({
|
|
schemaVersion: 1,
|
|
buildId,
|
|
commitSha,
|
|
releaseId,
|
|
moduleInventoryHash,
|
|
generatedAt: builtAt,
|
|
buildContext: {
|
|
nodeVersion: process.version,
|
|
packageManagerVersion,
|
|
runnerImage,
|
|
sourceDateEpoch: process.env.SOURCE_DATE_EPOCH ?? null,
|
|
},
|
|
outputs: {
|
|
directory: "dist",
|
|
viteManifest: CANONICAL_VITE_MANIFEST_PATH,
|
|
moduleInventory: "artifacts/quality/vite-module-inventory.json",
|
|
routeChunks,
|
|
runtimeConfigSchema: "dist/runtime-config.schema.json",
|
|
},
|
|
});
|
|
|
|
// §5.2 / §24.6 RC-3. The writer emits V2 only; the scalar API contract
|
|
// version has no writer source left.
|
|
const releaseManifest = releaseManifestV2ArtifactSchema.parse({
|
|
schemaVersion: 2,
|
|
appVersion: packageJson.version,
|
|
buildId,
|
|
commitSha,
|
|
configSchemaVersion: runtimeConfig.CONFIG_SCHEMA_VERSION,
|
|
assetManifestHash,
|
|
releaseId,
|
|
builtAt,
|
|
routeChunks,
|
|
contractSet: buildContractSet(),
|
|
});
|
|
|
|
await mkdir(at("artifacts/release"), { recursive: true });
|
|
await mkdir(at("artifacts/quality"), { recursive: true });
|
|
await writeValidatedJsonArtifact({
|
|
path: at("artifacts/quality/vite-module-inventory.json"),
|
|
schema: moduleInventoryArtifactSchema,
|
|
value: moduleInventoryDocument,
|
|
});
|
|
await rm(at("dist/.vite/module-inventory.json"));
|
|
await writeValidatedJsonArtifact({
|
|
path: at("dist/config.json"),
|
|
schema: runtimeConfigV2ArtifactSchema,
|
|
value: runtimeConfig,
|
|
});
|
|
await writeValidatedJsonArtifact({
|
|
path: at("dist/release-manifest.json"),
|
|
schema: releaseManifestV2ArtifactSchema,
|
|
value: releaseManifest,
|
|
});
|
|
await writeValidatedJsonArtifact({
|
|
path: at("dist/runtime-config.schema.json"),
|
|
schema: jsonSchemaDocumentArtifactSchema,
|
|
value: runtimeConfigJsonSchema,
|
|
});
|
|
await writeValidatedJsonArtifact({
|
|
path: at("artifacts/release/runtime-config.schema.json"),
|
|
schema: jsonSchemaDocumentArtifactSchema,
|
|
value: runtimeConfigJsonSchema,
|
|
});
|
|
await writeValidatedJsonArtifact({
|
|
path: at("artifacts/release/build-manifest.json"),
|
|
schema: buildManifestArtifactSchema,
|
|
value: manifest,
|
|
});
|
|
|
|
function parsePackageMetadata(value: unknown): Readonly<{
|
|
version: string;
|
|
packageManager: string;
|
|
}> {
|
|
if (
|
|
!isRecord(value) ||
|
|
typeof value.version !== "string" ||
|
|
typeof value.packageManager !== "string"
|
|
) {
|
|
throw new TypeError("package.json release metadata is invalid");
|
|
}
|
|
return { version: value.version, packageManager: value.packageManager };
|
|
}
|
|
|
|
function parseViteManifest(
|
|
value: unknown,
|
|
): Readonly<Record<string, ViteManifestEntry>> {
|
|
if (!isRecord(value)) throw new TypeError("Vite manifest must be an object");
|
|
const entries: Record<string, ViteManifestEntry> = {};
|
|
for (const [key, candidate] of Object.entries(value)) {
|
|
if (!isRecord(candidate) || typeof candidate.file !== "string") {
|
|
throw new TypeError(`Invalid Vite manifest entry: ${key}`);
|
|
}
|
|
entries[key] = {
|
|
file: candidate.file,
|
|
...(typeof candidate.name === "string" ? { name: candidate.name } : {}),
|
|
...(typeof candidate.isDynamicEntry === "boolean"
|
|
? { isDynamicEntry: candidate.isDynamicEntry }
|
|
: {}),
|
|
};
|
|
}
|
|
return entries;
|
|
}
|
|
|
|
function isRecord(value: unknown): value is Record<string, unknown> {
|
|
return Boolean(value && typeof value === "object" && !Array.isArray(value));
|
|
}
|