Merge lane K: CI, guardrails and release fixes

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
DongHyeonka
2026-09-25 23:42:40 +09:00
co-authored by Claude Opus 5.5
88 changed files with 2049 additions and 746 deletions
@@ -86,16 +86,14 @@ jobs:
if: \${{ startsWith(gitea.ref, 'refs/tags/v') || (gitea.event_name == 'workflow_dispatch' && (inputs.stage == 'release' || inputs.stage == 'production' || inputs.stage == 'field')) }}
runs-on: ubuntu-latest
timeout-minutes: 45
env:
HOSTING_BASE_URL: "\${{ vars.HOSTING_BASE_URL }}"
strategy:
fail-fast: false
matrix:
include:
- { gate: FE-GATE-012, name: bundle, browser: false }
- { gate: FE-GATE-014, name: config-compatibility, browser: false }
- { gate: FE-GATE-019, name: hosting-header, browser: false }
- { gate: FE-GATE-026, name: lab-performance, browser: true }
- { gate: FE-GATE-028, name: manual-accessibility-review, browser: false }
steps:
- uses: https://github.com/actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5
with:
@@ -377,11 +375,13 @@ jobs:
if: \${{ gitea.event_name == 'workflow_dispatch' && (inputs.stage == 'production' || inputs.stage == 'field') }}
runs-on: ubuntu-latest
timeout-minutes: 45
env:
HOSTING_BASE_URL: "\${{ vars.HOSTING_BASE_URL }}"
strategy:
fail-fast: false
matrix:
include:
- { gate: FE-GATE-016, name: rollback-drill }
- { gate: FE-GATE-019, name: hosting-header }
- { gate: FE-GATE-021, name: runbook-boot-config }
- { gate: FE-GATE-022, name: runbook-chunk-mismatch }
- { gate: FE-GATE-023, name: runbook-api-degradation }
+68
View File
@@ -0,0 +1,68 @@
import { readFile } from "node:fs/promises";
import { describe, expect, it } from "vitest";
import { architectureDependencyReportArtifactSchema } from "../../scripts/contracts/release-artifacts.ts";
// 12-05 (D-11). dependency-cruiser cannot parse TypeScript 7, so it checked
// zero modules and passed while its report claimed a result. The import graph
// in check-architecture.ts is the only checker; the report carries only it.
const staticImportGraph = {
analyzer: "babel-parser-node-resolver",
modules: [],
dependencies: [],
unresolved: [],
parseFailures: [],
cycles: [],
violations: [],
summary: {
modules: 0,
typescriptModules: 0,
dependencies: 0,
localDependencies: 0,
unresolved: 0,
parseFailures: 0,
cycles: 0,
errors: 0,
typeScriptOnlyPolicyPassed: true,
nonTypeScriptExecutableSources: 0,
},
fixtureChecks: { passed: true, checks: [], failures: [] },
typeScriptOnlySourcePolicy: {
checkedRoots: ["src"],
exceptionsAllowed: false,
violations: [],
passed: true,
},
};
describe("architecture dependency report", () => {
it("carries the import graph only", () => {
expect(architectureDependencyReportArtifactSchema.parse({ staticImportGraph })).toEqual({
staticImportGraph,
});
});
it("rejects a dependency-cruiser section", () => {
const cruiserSummary = {
violations: [],
error: 0,
warn: 0,
info: 0,
ignore: 0,
totalCruised: 0,
totalDependenciesCruised: 0,
};
expect(
architectureDependencyReportArtifactSchema.safeParse({
modules: [],
summary: cruiserSummary,
staticImportGraph,
}).success,
).toBe(false);
});
it("does not run dependency-cruiser", async () => {
expect(await readFile("scripts/check-architecture.ts", "utf8")).not.toMatch(/depcruise/u);
});
});
@@ -0,0 +1,35 @@
import { readFile } from "node:fs/promises";
import { describe, expect, it } from "vitest";
import { formatArchitectureViolation } from "../../scripts/lib/architecture-violation-message.ts";
// 12-11. A violation used to print only the rule name and the file pair; the
// reason and the way out were in .dependency-cruiser.json.
describe("architecture violation message", () => {
it("names the import and says why and where to go", () => {
expect(
formatArchitectureViolation(
{
rule: "concrete-adapters-compose-only-in-bootstrap",
source: "src/presentation/pages/probe.tsx",
target: "src/adapters/http/index.ts",
},
["../../adapters/http/index.ts"],
"Only src/bootstrap constructs concrete adapters.",
),
).toBe(
"Architecture violation [concrete-adapters-compose-only-in-bootstrap]: " +
"src/presentation/pages/probe.tsx -> src/adapters/http/index.ts " +
'(import "../../adapters/http/index.ts")\n' +
" why: Only src/bootstrap constructs concrete adapters.\n",
);
});
it("gives every rule a reason to print", async () => {
const config = JSON.parse(await readFile(".dependency-cruiser.json", "utf8")) as {
forbidden: { name: string; comment?: string }[];
};
expect(config.forbidden.filter(({ comment }) => !comment?.trim()).map(({ name }) => name)).toEqual([]);
});
});
+48
View File
@@ -0,0 +1,48 @@
import { describe, expect, it } from "vitest";
import { promotionEvidenceTime } from "../../scripts/lib/exact-promotion-bundle.ts";
import { evaluatePromotionEvidence } from "../../scripts/lib/provider-evidence.ts";
import { syntheticSignedPromotionBundle } from "./security-followup-fixture.ts";
// 13-04. Provider evidence lives two hours at most, so a promoted release could
// not be re-verified the next day, which the rollback runbook requires. The
// archived mode checks freshness at the recorded promotion time instead.
const promotedAt = Date.parse("2026-08-02T01:00:00.000Z");
const threeHoursLater = promotedAt + 3 * 60 * 60 * 1_000;
function evidenceAt(freshness: "current" | "archived", now: number) {
const fixture = syntheticSignedPromotionBundle();
const provider = JSON.parse(fixture.files["provider-verification.json"].toString("utf8"));
return evaluatePromotionEvidence({
expected: {
run: provider.run,
source: provider.source,
candidate: provider.candidate,
vulnerabilityInvocationNonce: provider.providerEvidence.vulnerabilityInvocationNonce,
provenanceInvocationNonce: provider.providerEvidence.provenanceInvocationNonce,
secretScanAttestation: provider.providerEvidence.secretScanAttestation,
},
localStatus: "PASS",
vulnerabilityReport: JSON.parse(fixture.files["vulnerability-report.json"].toString("utf8")),
provenanceAttestation: JSON.parse(fixture.files["provenance-attestation.json"].toString("utf8")),
vulnerabilityTrust: fixture.verification.vulnerabilityTrust,
provenanceTrust: fixture.verification.provenanceTrust,
nowEpochMs: () => promotionEvidenceTime(freshness, provider.verifiedAt, now),
});
}
describe("archived promotion re-verification", () => {
it("accepts evidence three hours after promotion in archived mode only", () => {
expect(evidenceAt("archived", threeHoursLater).status).toBe("PASS");
expect(evidenceAt("current", threeHoursLater)).toMatchObject({
status: "FAIL_UNVERIFIED",
failures: expect.arrayContaining(["vulnerability report is expired"]),
});
});
it("refuses a promotion time recorded in the future", () => {
expect(() =>
promotionEvidenceTime("archived", "2026-08-02T05:00:00.000Z", promotedAt),
).toThrow(/verifiedAt is in the future/u);
});
});
+40 -4
View File
@@ -189,15 +189,15 @@ describe("CI gate contract", () => {
const index = indexCiGateContract(contract);
expect(contract.schemaVersion).toBe(2);
expect(contract.gates.map(({ id }) => id)).toEqual(
Array.from({ length: 27 }, (_, index) =>
Array.from({ length: 28 }, (_, index) =>
`FE-GATE-${String(index + 1).padStart(3, "0")}`,
),
).filter((gateId) => gateId !== "FE-GATE-016"),
);
expect(contract.jobs).toHaveLength(9);
expect(contract.commands).toHaveLength(93);
expect(contract.commands).toHaveLength(95);
expect(contract.gates.reduce((total, gate) => total + gate.commandIds.length, 0)).toBe(105);
expect(contract.commands.filter(({ expect }) => expect === "fail")).toHaveLength(31);
expect(contract.gates.reduce((total, gate) => total + gate.evidenceArtifactIds.length, 0)).toBe(88);
expect(contract.gates.reduce((total, gate) => total + gate.evidenceArtifactIds.length, 0)).toBe(87);
expect(contract.artifacts).toHaveLength(109);
expect(contract.stages).toHaveLength(5);
expect(contract.retention.classes).toHaveLength(5);
@@ -205,6 +205,42 @@ describe("CI gate contract", () => {
expect(index.gates.get("FE-GATE-020")?.name).toBe("removability");
});
it("runs the signed manual accessibility review at release, not merge (08-06)", async () => {
const contract = await loadCiGateContract(process.cwd());
const index = indexCiGateContract(contract);
const scriptsOf = (gateId: string) =>
(index.gates.get(gateId)?.commandIds ?? []).map((id) => {
const command = index.commands.get(id);
return [command?.script, ...(command?.args ?? [])].join(" ");
});
const stageOf = (gateId: string) =>
contract.stages.find(({ gateIds }) => gateIds.includes(gateId))?.id;
expect(scriptsOf("FE-GATE-009")).toEqual(["test:a11y", "review:a11y-manual -- --format-only"]);
expect(scriptsOf("FE-GATE-028")).toEqual(["review:a11y-manual"]);
expect(stageOf("FE-GATE-009")).toBe("merge");
expect(stageOf("FE-GATE-028")).toBe("release");
});
it("runs the CPU-independent scale PR tier in a merge gate (11-03)", async () => {
const contract = await loadCiGateContract(process.cwd());
const index = indexCiGateContract(contract);
const scripts = index.gates.get("FE-GATE-005")?.commandIds.map((id) => index.commands.get(id)?.script);
expect(scripts).toContain("check:scale:pr");
expect(contract.stages.find(({ id }) => id === "merge")?.gateIds).toContain("FE-GATE-005");
});
it("probes live hosting headers after promotion, not before the release is built (13-05)", async () => {
const contract = await loadCiGateContract(process.cwd());
expect(contract.stages.find(({ id }) => id === "production")?.gateIds).toContain("FE-GATE-019");
expect(contract.stages.find(({ id }) => id === "release")?.gateIds).not.toContain("FE-GATE-019");
const productionGate = contract.jobs.find(({ id }) => id === "production_gate");
expect(productionGate?.gateIds).toContain("FE-GATE-019");
expect(productionGate?.environment).toContainEqual({
name: "HOSTING_BASE_URL",
value: "${{ vars.HOSTING_BASE_URL }}",
});
});
it("keeps the action registry recursively immutable and resolves only known actions", () => {
expect(Object.isFrozen(CI_ACTION_REGISTRY)).toBe(true);
expect(Object.values(CI_ACTION_REGISTRY).every((action) => Object.isFrozen(action))).toBe(true);
+38
View File
@@ -0,0 +1,38 @@
import { chmod, mkdir, mkdtemp, rm, stat, writeFile } from "node:fs/promises";
import { tmpdir } from "node:os";
import path from "node:path";
import { afterEach, describe, expect, it } from "vitest";
import { makeDistFilesPublic } from "../../scripts/lib/dist-permissions.ts";
// 13-02. The validated JSON writer publishes with mode 0600, so dist/config.json
// and dist/release-manifest.json reached the release archive unreadable to a web
// server running as another user, and every boot failed with 403.
const roots: string[] = [];
afterEach(async () => {
await Promise.all(roots.splice(0).map((root) => rm(root, { recursive: true, force: true })));
});
describe("dist file permissions", () => {
it("makes every dist file readable by other users and keeps other bits", async () => {
const root = await mkdtemp(path.join(tmpdir(), "dist-permissions-"));
roots.push(root);
await mkdir(path.join(root, ".vite"), { recursive: true });
const files = {
"config.json": 0o600,
".vite/manifest.json": 0o600,
"index.html": 0o664,
} as const;
for (const [file, mode] of Object.entries(files)) {
await writeFile(path.join(root, file), "{}");
await chmod(path.join(root, file), mode);
}
await makeDistFilesPublic(root);
expect((await stat(path.join(root, "config.json"))).mode & 0o777).toBe(0o644);
expect((await stat(path.join(root, ".vite/manifest.json"))).mode & 0o777).toBe(0o644);
expect((await stat(path.join(root, "index.html"))).mode & 0o777).toBe(0o664);
});
});
+23
View File
@@ -3,6 +3,8 @@ import { describe, expect, it } from "vitest";
import {
checkPublicServiceWorkers,
classifyLiveHostingBaseUrl,
hostingVerdict,
servedEntryScript,
} from "../../scripts/lib/hosting-probe.ts";
describe("public service worker in dist", () => {
@@ -64,3 +66,24 @@ describe("live hosting evidence target", () => {
});
});
});
// 13-05 (D-14). The declared-header fixture proves nothing about hosting, so it
// is UNVERIFIED, and a live probe checks the release actually served.
describe("hosting header verdict", () => {
it("passes only a live probe of the deployed release", () => {
expect(hostingVerdict("live", true)).toBe("PASS");
expect(hostingVerdict("fixture", true)).toBe("UNVERIFIED");
expect(hostingVerdict("fixture", false)).toBe("FAIL");
expect(hostingVerdict("invalid-live", false)).toBe("FAIL");
expect(hostingVerdict("live", false)).toBe("FAIL");
});
it("probes the entry script named by the served index.html", () => {
expect(
servedEntryScript(
'<head><link rel="modulepreload" href="/assets/a-1.js"><script type="module" crossorigin src="/app/assets/index-Dpjd89Th.js"></script></head>',
),
).toBe("/app/assets/index-Dpjd89Th.js");
expect(servedEntryScript("<html><body>maintenance</body></html>")).toBeNull();
});
});
+38
View File
@@ -1,8 +1,11 @@
import { describe, expect, it } from "vitest";
import { readFileSync } from "node:fs";
import {
MANUAL_A11Y_ROUTE_IDS,
validateManualA11yEvidence,
validateManualA11yRecordFormat,
} from "../../scripts/lib/manual-a11y-evidence.ts";
import { ROUTE_REGISTRY } from "../../src/features/installed-feature-contracts.ts";
@@ -64,4 +67,39 @@ describe("manual accessibility evidence", () => {
passed: false,
});
});
// 08-06: the merge stage checks only that each record keeps the template's
// shape; the signed review itself is a release-stage gate (FE-GATE-028).
describe("record format", () => {
const pending = reviewed
.replace("Status: reviewed", "Status: pending-manual-review")
.replace("Release ID: release-1", "Release ID:")
.replace("Reviewer: reviewer@example.test", "Reviewer:")
.replace("Reviewed at: 2026-07-25T12:00:00Z", "Reviewed at:")
.replace("Signature: review-record-1", "Signature:")
.replace("Attestation: accepted", "Attestation: pending")
.replace("M1 Keyboard: pass", "M1 Keyboard: pending");
it("accepts a pending template and a signed record", () => {
expect(validateManualA11yRecordFormat(pending, "APP_HOME")).toEqual([]);
expect(validateManualA11yRecordFormat(reviewed, "APP_HOME")).toEqual([]);
});
it("accepts every checked-in route record", () => {
for (const routeId of MANUAL_A11Y_ROUTE_IDS) {
const record = readFileSync(`artifacts/tests/a11y-manual/${routeId}.md`, "utf8");
expect(validateManualA11yRecordFormat(record, routeId), routeId).toEqual([]);
}
});
it.each([
["a missing field", pending.replace("Signature:\n", ""), "APP_HOME", "Signature"],
["an unknown status", pending.replace("Status: pending-manual-review", "Status: done"), "APP_HOME", "Status"],
["an unknown verdict", pending.replace("M1 Keyboard: pending", "M1 Keyboard: ok"), "APP_HOME", "M1 Keyboard"],
["another route's record", pending, "NOT_FOUND", "Route ID"],
["a reviewed record that is not complete", reviewed.replace("Signature: review-record-1", "Signature:"), "APP_HOME", "Signature"],
])("rejects %s", (_name, record, routeId, field) => {
expect(validateManualA11yRecordFormat(record, routeId)).toContain(field);
});
});
});
+1 -1
View File
@@ -25,7 +25,7 @@ describe("promotion readiness formula", () => {
it.each([
["FE-GATE-001", "MERGE_READY"],
["FE-GATE-012", "RELEASE_READY"],
["FE-GATE-016", "PROD_PROMOTION_READY"],
["FE-GATE-021", "PROD_PROMOTION_READY"],
["FE-GATE-018", "FIELD_SLO_READY"],
["FE-GATE-017", "DOCUMENTATION_READY"],
] as const)("fails closed when %s fails", (failedGate, readiness) => {
+3 -3
View File
@@ -63,7 +63,7 @@ const buildManifest = {
describe("release artifact contracts", () => {
it("verifies confined build outputs and the raw module inventory bytes", async () => {
const moduleInventoryBytes = Buffer.from(
'{"schemaVersion":1,"chunks":[]}\n',
'{"schemaVersion":1,"chunks":[],"packages":[]}\n',
);
const files = new Map<string, Buffer>([
["/repo/dist/.vite/manifest.json", Buffer.from("{}\n")],
@@ -158,7 +158,7 @@ describe("release artifact contracts", () => {
it("rejects a nested symlink that resolves inside the repository but outside dist", async () => {
const moduleInventoryBytes = Buffer.from(
'{"schemaVersion":1,"chunks":[]}\n',
'{"schemaVersion":1,"chunks":[],"packages":[]}\n',
);
const mismatches = await verifyBuildManifestOutputs(
{
@@ -183,7 +183,7 @@ describe("release artifact contracts", () => {
it("allows a legal dist child whose name begins with two dots", async () => {
const moduleInventoryBytes = Buffer.from(
'{"schemaVersion":1,"chunks":[]}\n',
'{"schemaVersion":1,"chunks":[],"packages":[]}\n',
);
const files = new Map<string, Buffer>([
["/repo/dist/.vite/manifest.json", Buffer.from("{}\n")],
+14 -64
View File
@@ -281,32 +281,32 @@ describe("release coherence", () => {
}
});
it("falls back to public rollback artifacts only when primary dist is absent", async () => {
// 13-03: the rollback drill checks the built release only. Reading the
// public/ placeholders when dist was absent let it pass without any build.
it("reads only the built dist pair and never falls back to public placeholders", async () => {
const exactV2 = await releaseV2With(contractPackages);
const tamperedPrimary = await releaseV2With(contractPackages.slice(0, 1));
const validPublic = {
"public/release-manifest.json": exactV2,
"public/config.json": runtimeV2,
};
const unavailablePrimary = [
new SyntaxError("invalid primary JSON"),
Object.assign(new Error("unreadable primary"), { code: "EACCES" }),
{ ...exactV2, unexpected: "tampered" },
];
for (const primaryFailure of unavailablePrimary) {
for (const primary of [
{},
{ "dist/config.json": runtimeV2 },
{ "dist/release-manifest.json": exactV2 },
{ "dist/release-manifest.json": new SyntaxError("invalid primary JSON"), "dist/config.json": runtimeV2 },
{ "dist/release-manifest.json": { ...exactV2, unexpected: "tampered" }, "dist/config.json": runtimeV2 },
]) {
const reads: string[] = [];
await expect(
verifyRollbackReleaseCoherence({
readArtifact: artifactReader({
"dist/release-manifest.json": primaryFailure,
"dist/config.json": runtimeV2,
...validPublic,
}),
readArtifact: artifactReader({ ...primary, ...validPublic }, reads),
contractPackages,
}),
).rejects.toBeDefined();
expect(reads.some((read) => read.startsWith("public/"))).toBe(false);
}
const tamperedPrimary = await releaseV2With(contractPackages.slice(0, 1));
await expect(
verifyRollbackReleaseCoherence({
readArtifact: artifactReader({
@@ -317,55 +317,5 @@ describe("release coherence", () => {
contractPackages,
}),
).resolves.toMatchObject({ coherence: { compatible: false } });
const releaseOnlyMissingReads: string[] = [];
await expect(
verifyRollbackReleaseCoherence({
readArtifact: artifactReader(
{
"dist/config.json": runtimeV2,
...validPublic,
},
releaseOnlyMissingReads,
),
contractPackages,
}),
).rejects.toThrow("primary rollback artifact pair");
expect(releaseOnlyMissingReads).toEqual([
"dist/release-manifest.json",
"dist/config.json",
]);
const runtimeOnlyMissingReads: string[] = [];
await expect(
verifyRollbackReleaseCoherence({
readArtifact: artifactReader(
{
"dist/release-manifest.json": exactV2,
...validPublic,
},
runtimeOnlyMissingReads,
),
contractPackages,
}),
).rejects.toThrow("primary rollback artifact pair");
expect(runtimeOnlyMissingReads).toEqual([
"dist/release-manifest.json",
"dist/config.json",
]);
const missingPairReads: string[] = [];
await expect(
verifyRollbackReleaseCoherence({
readArtifact: artifactReader(validPublic, missingPairReads),
contractPackages,
}),
).resolves.toMatchObject({ coherence: { compatible: true } });
expect(missingPairReads).toEqual([
"dist/release-manifest.json",
"dist/config.json",
"public/release-manifest.json",
"public/config.json",
]);
});
});
+129
View File
@@ -0,0 +1,129 @@
import { mkdir, mkdtemp, readFile, rm, writeFile } from "node:fs/promises";
import { tmpdir } from "node:os";
import path from "node:path";
import { afterEach, describe, expect, it } from "vitest";
import { runRunbookDrill } from "../../scripts/drill-runbook.ts";
import { computeContractSetDigest } from "../../src/contracts/contract-set-canonical.ts";
import type { InstalledContractPackageIdentity } from "../../src/contracts/external-contract-runtime.ts";
// 11-01 / 13-03 (D-14). A drill reports PASS only for what it observed on the
// local build. Boot, live traffic, smoke and the provider switch are not
// observable here, so a drill with provider scope ends UNVERIFIED, never PASS.
const contractPackages = [
{
packageId: "@example/accounts",
version: "1.2.3",
digest: `sha256:${"1".repeat(64)}`,
runtimeProtocolVersion: 1,
sourceRevision: "a".repeat(40),
},
] as const satisfies readonly InstalledContractPackageIdentity[];
const RUNBOOK_IDS = ["FE-RB-001", "FE-RB-002", "FE-RB-003", "FE-RB-004", "FE-RB-005"] as const;
const roots: string[] = [];
afterEach(async () => {
await Promise.all(roots.splice(0).map((root) => rm(root, { recursive: true, force: true })));
});
async function builtDist(options: Readonly<{ withoutJs?: boolean; withoutDist?: boolean }> = {}) {
const root = await mkdtemp(path.join(tmpdir(), "runbook-drill-"));
roots.push(root);
if (options.withoutDist) return root;
const write = async (file: string, content: string) => {
await mkdir(path.dirname(path.join(root, file)), { recursive: true });
await writeFile(path.join(root, file), content);
};
await write("dist/index.html", "<!doctype html><script type=module src=/assets/index-a.js></script>");
await write(
"dist/.vite/manifest.json",
JSON.stringify({
"index.html": { file: "assets/index-a.js", isEntry: true, css: ["assets/index-a.css"], imports: ["_shared-b.js"] },
"_shared-b.js": { file: "assets/shared-b.js" },
"src/pages/lazy.tsx": { file: "assets/lazy-c.js", isDynamicEntry: true },
}),
);
await write("dist/assets/index-a.css", "body{}");
if (!options.withoutJs) {
for (const file of ["assets/index-a.js", "assets/shared-b.js", "assets/lazy-c.js"]) {
await write(`dist/${file}`, "export {};");
}
}
await write(
"dist/release-manifest.json",
JSON.stringify({
schemaVersion: 2,
appVersion: "1.0.0",
buildId: "build-a",
commitSha: "abc1234",
configSchemaVersion: "2.0",
assetManifestHash: "assets-a",
releaseId: "release-a",
builtAt: "2026-08-01T00:00:00.000Z",
routeChunks: {},
contractSet: {
setAlgorithm: "CA_CONTRACT_SET_V1",
setDigest: await computeContractSetDigest(contractPackages),
packages: [...contractPackages],
},
}),
);
await write(
"dist/config.json",
JSON.stringify({
APP_ENV: "local",
API_BASE_URL: "http://localhost:8080/",
REQUEST_TIMEOUT_MS: 10_000,
MAX_RETRY_ATTEMPTS: 2,
TELEMETRY_ENABLED: false,
AUTH_MODE: "external",
CONFIG_SCHEMA_VERSION: "2.0",
RELEASE_MANIFEST_URL: "/release-manifest.json",
BUILD_ID: "build-a",
RELEASE_ID: "release-a",
CAPABILITY_OVERRIDES: {
REALTIME: "DEFAULT",
WEB_WORKER: "DEFAULT",
SERVICE_WORKER: "DEFAULT",
OFFLINE_COMMANDS: "DEFAULT",
},
FEATURE_OVERRIDES: {},
}),
);
return root;
}
describe("runbook drill verdicts", () => {
it.each(RUNBOOK_IDS)("%s on a complete local build is UNVERIFIED, not PASS", async (runbookId) => {
const record = await runRunbookDrill(runbookId, { releaseRoot: await builtDist(), contractPackages });
expect(record.result).toBe("UNVERIFIED");
expect(record.recoveryAssertions.some(({ result }) => result === "FAIL")).toBe(false);
});
it.each(["FE-RB-002", "FE-RB-005"] as const)(
"%s fails when the build lost its JavaScript assets",
async (runbookId) => {
const record = await runRunbookDrill(runbookId, {
releaseRoot: await builtDist({ withoutJs: true }),
contractPackages,
});
expect(record.result).toBe("FAIL");
},
);
it("FE-RB-005 fails without a build instead of reading public/ placeholders", async () => {
await expect(
runRunbookDrill("FE-RB-005", { releaseRoot: await builtDist({ withoutDist: true }), contractPackages }),
).rejects.toThrow(/dist\/release-manifest\.json/u);
});
it("keeps no constant recovery verdict in the drill source", async () => {
const source = await readFile("scripts/drill-runbook.ts", "utf8");
expect(source).not.toMatch(/assertion\([^;]*,\s*true\s*\)/u);
expect(source).not.toMatch(/Asserted:\s*true\b/u);
expect(source).not.toMatch(/injectedMountFailure\s*=\s*true/u);
});
});
+12
View File
@@ -46,12 +46,24 @@ describe("ungated test files", () => {
"tests/scripts/verify-extreme-scale.test.ts",
"tests/scale/browser-soak.contract.test.ts",
"tests/e2e/app-shell.spec.ts",
// 11-03: the CPU-independent scale PR tier runs in FE-GATE-005.
"tests/scale/growth-regression.test.ts",
"tests/scale/traffic/amplification-metrics.test.ts",
])("gates %s", async (file) => {
const inputs = await repositoryInputs();
expect(ungatedTestFailures({ ...inputs, testFiles: [file] })).toEqual([]);
expect(inputs.exclusions.some(({ path }) => path === file)).toBe(false);
});
it("reads the Vitest paths of a scale tier the gate command runs (11-03)", () => {
expect(
gatedTestPaths({ gate: "node scripts/scale/run-scale-profile.ts pr" }, ["gate"], () => ""),
).toEqual(expect.arrayContaining(["tests/scale/growth-regression.test.ts", "tests/scale/traffic"]));
expect(
gatedTestPaths({ gate: "node scripts/scale/run-scale-profile.ts pr" }, ["gate"], () => ""),
).not.toContain("tests/scale/session");
});
it("rejects a new test directory that no gate runs", async () => {
const inputs = await repositoryInputs();
expect(
+31
View File
@@ -0,0 +1,31 @@
import { readFileSync, realpathSync } from "node:fs";
import path from "node:path";
import { describe, expect, it } from "vitest";
import { bundledPackages, normalizeModuleId } from "../../scripts/lib/vite-module-inventory.ts";
// 13-12. The inventory recorded dependency modules as `external:<file name>`,
// so nothing listed which package versions ship in the public bundle.
describe("vite module inventory", () => {
const root = process.cwd();
const zodCore = realpathSync(path.join(root, "node_modules/zod/v4/core/core.js"));
const zodVersion = (
JSON.parse(readFileSync(path.join(root, "node_modules/zod/package.json"), "utf8")) as { version: string }
).version;
it("names a dependency module by package and version", () => {
expect(normalizeModuleId(zodCore, root)).toBe(`npm:zod@${zodVersion}/v4/core/core.js`);
expect(normalizeModuleId(path.join(root, "src/bootstrap/main.tsx"), root)).toBe("src/bootstrap/main.tsx");
expect(normalizeModuleId("\0vite/preload-helper.js", root)).toBe("vite/preload-helper.js");
});
it("lists each bundled package once", () => {
expect(
bundledPackages([
{ fileName: "a.js", modules: ["npm:zod@4.4.3/v4/core/core.js", "src/a.ts"] },
{ fileName: "b.js", modules: ["npm:@tanstack/query-core@5.0.0/build/a.js", "npm:zod@4.4.3/index.js"] },
]),
).toEqual(["@tanstack/query-core@5.0.0", "zod@4.4.3"]);
});
});