chore: sync the frontend template from 5434760 to ebea300
Carries 21 template commits: the shared IndexedDB connection/transaction
kernel and the four runtimes moved onto it, the adapter barrel boundary and
the architecture rule that enforces it, the feature adapter contribution
model, `feature-http-binding`, the split of several oversized test files,
and the release identity now derived from the package name.
Product identity is unchanged. The three hard-coded `tech-log-frontend/…`
verifier ids are gone because the template derives them from the package
name and this package is `tech-log-frontend`.
Two decisions worth naming. The platform HTTP executor is the template's
verbatim — it now takes the installed contract so a feature's types flow
through the binding — and TechLog's four gateways, which address operations
by id, reach it through one adapter at the composition root instead of being
rewritten here. And the three derived CI baselines were recomputed from the
merged `config/ci/gates.json` rather than taken from either side: 94 command
definitions, 106 references, 141 artifacts, gate shape `629e5898…`. The
method was checked by first reproducing the pre-merge values from the
pre-merge file.
Verified here: types, lint, architecture, adapter inventory, CI contract,
design system, diagnostics, remediation ledger, browser security and build
all pass; 1789 unit, 152 component, 415 TechLog, 102 integration, 19
reference-feature, 17 recipe and 7 contract tests pass. Five gates stay
red and every one was reproduced at b297d65 first: `check:i18n`,
`check:registries`, `test:runtime-schema`, `verify:documentation` and
`test:sample-removal`.
Full decision record, including what was deliberately not carried and the
five open follow-ups, in `docs/operations/template-sync-2026-09-21.md`.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
b297d659f5
commit
afde2b1da1
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,168 @@
|
||||
import { spawnSync } from "node:child_process";
|
||||
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 { loadCiGateContract } from "../../../scripts/contracts/ci-gates.ts";
|
||||
|
||||
const temporaryRoots: string[] = [];
|
||||
|
||||
afterEach(async () => {
|
||||
await Promise.all(
|
||||
temporaryRoots.splice(0).map((root) =>
|
||||
rm(root, { recursive: true, force: true }),
|
||||
),
|
||||
);
|
||||
});
|
||||
|
||||
describe("CI-runner command-generated evidence freshness", () => {
|
||||
it("rejects stale command-generated evidence from a successful no-op producer", async () => {
|
||||
const root = await mkdtemp(path.join(tmpdir(), "ci-gate-stale-evidence-"));
|
||||
temporaryRoots.push(root);
|
||||
await mkdir(path.join(root, "config/ci"), { recursive: true });
|
||||
await mkdir(path.join(root, "artifacts/tests"), { recursive: true });
|
||||
const contract = JSON.parse(
|
||||
JSON.stringify(await loadCiGateContract(process.cwd())),
|
||||
) as Record<string, any>;
|
||||
const command = contract.commands.find(
|
||||
(entry: Record<string, any>) => entry.id === "test-runtime-schema",
|
||||
);
|
||||
command.script = "test:stale-evidence-noop";
|
||||
const evidence = contract.artifacts.find(
|
||||
(entry: Record<string, any>) =>
|
||||
entry.path === "artifacts/tests/runtime-schema.xml",
|
||||
);
|
||||
const packageDocument = JSON.parse(
|
||||
await readFile("package.json", "utf8"),
|
||||
) as { scripts: Record<string, string> };
|
||||
packageDocument.scripts[command.script] = "true";
|
||||
await writeFile(
|
||||
path.join(root, "config/ci/gates.json"),
|
||||
`${JSON.stringify(contract)}\n`,
|
||||
);
|
||||
await writeFile(
|
||||
path.join(root, "package.json"),
|
||||
`${JSON.stringify(packageDocument)}\n`,
|
||||
);
|
||||
await writeFile(
|
||||
path.join(root, evidence.path),
|
||||
'<testsuite name="stale" tests="0" failures="0"/>\n',
|
||||
);
|
||||
|
||||
const result = spawnSync(
|
||||
process.execPath,
|
||||
[path.resolve("scripts/run-ci-gate.ts"), "FE-GATE-004"],
|
||||
{ cwd: root, encoding: "utf8", env: { ...process.env, CI: "false" } },
|
||||
);
|
||||
|
||||
expect(result.status).toBe(1);
|
||||
expect(
|
||||
await readFile(
|
||||
path.join(root, "artifacts/quality/gates/FE-GATE-004.txt"),
|
||||
"utf8",
|
||||
),
|
||||
).toMatch(/not freshly produced/i);
|
||||
});
|
||||
|
||||
it("accepts a fresh deterministic rewrite with identical evidence bytes", async () => {
|
||||
const root = await mkdtemp(
|
||||
path.join(tmpdir(), "ci-gate-identical-rewrite-"),
|
||||
);
|
||||
temporaryRoots.push(root);
|
||||
await mkdir(path.join(root, "config/ci"), { recursive: true });
|
||||
await mkdir(path.join(root, "artifacts/tests"), { recursive: true });
|
||||
const contract = JSON.parse(
|
||||
JSON.stringify(await loadCiGateContract(process.cwd())),
|
||||
) as Record<string, any>;
|
||||
const command = contract.commands.find(
|
||||
(entry: Record<string, any>) => entry.id === "test-runtime-schema",
|
||||
);
|
||||
command.script = "test:identical-evidence-rewrite";
|
||||
const evidence = contract.artifacts.find(
|
||||
(entry: Record<string, any>) =>
|
||||
entry.path === "artifacts/tests/runtime-schema.xml",
|
||||
);
|
||||
const evidenceBytes =
|
||||
'<testsuite name="deterministic" tests="0" failures="0"/>\n';
|
||||
const packageDocument = JSON.parse(
|
||||
await readFile("package.json", "utf8"),
|
||||
) as { scripts: Record<string, string> };
|
||||
packageDocument.scripts[command.script] =
|
||||
`node -e 'require("node:fs").writeFileSync("${evidence.path}", Buffer.from("${Buffer.from(evidenceBytes).toString("base64")}", "base64"))'`;
|
||||
await writeFile(
|
||||
path.join(root, "config/ci/gates.json"),
|
||||
`${JSON.stringify(contract)}\n`,
|
||||
);
|
||||
await writeFile(
|
||||
path.join(root, "package.json"),
|
||||
`${JSON.stringify(packageDocument)}\n`,
|
||||
);
|
||||
await writeFile(path.join(root, evidence.path), evidenceBytes);
|
||||
|
||||
const result = spawnSync(
|
||||
process.execPath,
|
||||
[path.resolve("scripts/run-ci-gate.ts"), "FE-GATE-004"],
|
||||
{ cwd: root, encoding: "utf8", env: { ...process.env, CI: "false" } },
|
||||
);
|
||||
|
||||
expect(result.status).toBe(0);
|
||||
expect(result.stdout).toMatch(/FE-GATE-004 runtime-schema: PASS/);
|
||||
});
|
||||
});
|
||||
|
||||
describe("CI-runner gate output budget", () => {
|
||||
it("caps aggregate gate output at the log schema before later commands can accumulate", async () => {
|
||||
const root = await mkdtemp(path.join(tmpdir(), "ci-gate-output-budget-"));
|
||||
temporaryRoots.push(root);
|
||||
await mkdir(path.join(root, "config/ci"), { recursive: true });
|
||||
const contract = JSON.parse(
|
||||
JSON.stringify(await loadCiGateContract(process.cwd())),
|
||||
) as Record<string, any>;
|
||||
const gate = contract.gates.find(
|
||||
(entry: Record<string, any>) => entry.id === "FE-GATE-001",
|
||||
);
|
||||
const command = contract.commands.find(
|
||||
(entry: Record<string, any>) => entry.id === gate.commandIds[0],
|
||||
);
|
||||
command.script = "test:huge-output";
|
||||
const logArtifact = contract.artifacts.find(
|
||||
(entry: Record<string, any>) => entry.id === gate.logArtifactId,
|
||||
);
|
||||
const logSchema = contract.artifactSchemas.find(
|
||||
(entry: Record<string, any>) => entry.id === logArtifact.schemaId,
|
||||
);
|
||||
logSchema.maxBytes = 8_192;
|
||||
const packageDocument = JSON.parse(
|
||||
await readFile("package.json", "utf8"),
|
||||
) as { scripts: Record<string, string> };
|
||||
packageDocument.scripts["test:huge-output"] =
|
||||
"node -e \"process.stdout.write('x'.repeat(20000))\"";
|
||||
await writeFile(
|
||||
path.join(root, "config/ci/gates.json"),
|
||||
`${JSON.stringify(contract)}\n`,
|
||||
);
|
||||
await writeFile(
|
||||
path.join(root, "package.json"),
|
||||
`${JSON.stringify(packageDocument)}\n`,
|
||||
);
|
||||
const result = spawnSync(
|
||||
process.execPath,
|
||||
[path.resolve("scripts/run-ci-gate.ts"), "FE-GATE-001"],
|
||||
{
|
||||
cwd: root,
|
||||
encoding: "utf8",
|
||||
env: { ...process.env, CI: "false" },
|
||||
timeout: 15_000,
|
||||
},
|
||||
);
|
||||
|
||||
expect(result.status).toBe(1);
|
||||
const log = await readFile(path.join(root, logArtifact.path));
|
||||
expect(log.byteLength).toBeLessThanOrEqual(8_192);
|
||||
expect(log.toString("utf8")).toMatch(
|
||||
/aggregate output|INFRASTRUCTURE_FAILURE/i,
|
||||
);
|
||||
}, 20_000);
|
||||
});
|
||||
@@ -0,0 +1,41 @@
|
||||
import { mkdtemp, readFile, rm } from "node:fs/promises";
|
||||
import { tmpdir } from "node:os";
|
||||
import path from "node:path";
|
||||
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { runProviderProcess } from "../../../scripts/lib/provider-process-runner.ts";
|
||||
|
||||
describe("CI-runner provider process-group lifecycle", () => {
|
||||
it("kills and reaps a stubborn provider process group including its descendant", async () => {
|
||||
const root = await mkdtemp(path.join(tmpdir(), "provider-process-group-"));
|
||||
const descendantPidPath = path.join(root, "descendant.pid");
|
||||
try {
|
||||
const source = [
|
||||
"const { spawn } = require('node:child_process');",
|
||||
"const { writeFileSync } = require('node:fs');",
|
||||
"const child = spawn(process.execPath, ['-e', `process.on('SIGTERM', () => {}); setInterval(() => {}, 1000)`], { stdio: 'ignore' });",
|
||||
"writeFileSync(process.env.DESCENDANT_PID_PATH, String(child.pid));",
|
||||
"process.on('SIGTERM', () => {});",
|
||||
"setInterval(() => {}, 1000);",
|
||||
].join("\n");
|
||||
|
||||
const running = runProviderProcess({
|
||||
executable: process.execPath,
|
||||
arguments: ["-e", source],
|
||||
environment: {
|
||||
PATH: process.env.PATH,
|
||||
DESCENDANT_PID_PATH: descendantPidPath,
|
||||
},
|
||||
timeoutMs: 250,
|
||||
});
|
||||
|
||||
await expect(running).rejects.toThrow(/timed out.*process close/u);
|
||||
const descendantPid = Number(await readFile(descendantPidPath, "utf8"));
|
||||
expect(Number.isSafeInteger(descendantPid) && descendantPid > 0).toBe(true);
|
||||
expect(() => process.kill(descendantPid, 0)).toThrow(/ESRCH|no such process/u);
|
||||
} finally {
|
||||
await rm(root, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user