Carries 359 template commits, tag v0.2.0 plus one documentation commit: the generator-built feature index with its app, bounded-context and feature declarations, the src/platform kernel and scale tooling, the 2026-09-24 src review fixes, and the 2026-09-25 maturity review round with its CHANGELOG [보안]/[계약] rows. 691 of the 824 template paths are applied, 85 of them merged with product changes; 127 are not carried. Product identity is unchanged: name, version 0.1.0, routes, design and the TechLog domain. Three decisions worth naming. TechLog stays composed directly, as the last two syncs recorded; its directory carries a NOT_INSTALLED marker that says so, and every installed-* composer takes the template's projection with TechLog added on top. The reference sample is no longer installed: the template now installs a feature only through feature-module.ts and context-routes.ts, which load the screens this product deleted, so its three operations, six schemas and one topic leave the registries, recorded as registry change evidence. And AppRouter mounts the platform and TechLog routes only; the template's bounded-context route gateway waits for a generator-installed feature. Required fixes: readSubject on the BFF session owner (without it every HTTP Studio session would close as integration-failed), zod through the facade in nine TechLog files, noUnusedLocals, and public/config.json written out to match the local profile. Derived baselines were recomputed after reproducing both sides' values: CI contract 101 commands / 106 references / 141 artifacts, gate shape c9adcf85; registry approval 2dc6c3a3; the runtime config schema baseline equals the schema at8210d48. Verified here: types, lint, architecture, adapter inventory, CI contract, i18n, design system, diagnostics, browser security, dev release manifest, TechLog contract and build pass; 220 component, 155 integration, 15 contract, 418 TechLog, 43 reference-feature, 18 recipe and 46 release-coherence tests pass, and 2381 of 2383 unit tests. Reproduced at8210d48first and unchanged: check:registries (byte-identical), test:runtime-schema, verify:documentation. Brought by the template and escalated rather than suppressed: check:request-fanout on TechLog's cursor pagination, check:remediation-ledger (fails upstream too), the shared-chunk hash test, and the registry-dependent sample removal and second-feature tests. Playwright suites were not run. Full record, the five open questions and the follow-ups in docs/operations/template-sync-2026-09-29.md. (cherry picked from commit b2170cf265dea45dc9cc05d3c61e627e97f31cdb)
114 lines
4.4 KiB
TypeScript
114 lines
4.4 KiB
TypeScript
import { spawnSync } from "node:child_process";
|
|
import { mkdir, readFile, writeFile } from "node:fs/promises";
|
|
import path from "node:path";
|
|
|
|
import { collectTscScale } from "./collect-tsc-diagnostics.ts";
|
|
import { runCompositionScale } from "./run-composition-scale.ts";
|
|
import {
|
|
approveBaseline,
|
|
compareToBaseline,
|
|
currentEnvironment,
|
|
snapshotMetrics,
|
|
type ScaleBaseline,
|
|
} from "./scale-baseline.ts";
|
|
|
|
/**
|
|
* Spec §48–§49. Relative regression gate against the stored, approved scale
|
|
* baseline (`config/scale/benchmark-baseline.json`).
|
|
*
|
|
* node scripts/scale/check-scale-baseline.ts compare, fail on regression
|
|
* SCALE_BASELINE_OWNER=... SCALE_BASELINE_REASON=... \
|
|
* node scripts/scale/check-scale-baseline.ts --update re-measure and re-approve
|
|
*
|
|
* The comparison is written to artifacts/scale/baseline-comparison.json (or
|
|
* `--artifact=`). Updating is an explicit, attributed act; the check never
|
|
* rewrites the baseline.
|
|
*/
|
|
export const BASELINE_PATH = "config/scale/benchmark-baseline.json";
|
|
export const LOCAL_TSC_SIZES = Object.freeze([25, 100, 400]);
|
|
|
|
function typescriptVersion(): string {
|
|
const result = spawnSync(path.resolve("node_modules/.bin/tsc"), ["-v"], { encoding: "utf8" });
|
|
const match = /Version\s+(\S+)/u.exec(result.stdout ?? "");
|
|
if (!match?.[1]) throw new Error("cannot determine TypeScript version");
|
|
return match[1];
|
|
}
|
|
|
|
async function measure() {
|
|
const composition = await runCompositionScale(["S0", "S1", "S2"], { samples: 9, warmup: 2 });
|
|
const compiler = await collectTscScale(LOCAL_TSC_SIZES);
|
|
return snapshotMetrics(composition.results, compiler);
|
|
}
|
|
|
|
async function main(): Promise<void> {
|
|
const update = process.argv.includes("--update");
|
|
const artifact = path.resolve(
|
|
process.argv.find((entry) => entry.startsWith("--artifact="))?.slice("--artifact=".length) ??
|
|
"artifacts/scale/baseline-comparison.json",
|
|
);
|
|
const environment = currentEnvironment(typescriptVersion());
|
|
const metrics = await measure();
|
|
|
|
if (update) {
|
|
const owner = process.env["SCALE_BASELINE_OWNER"];
|
|
const reason = process.env["SCALE_BASELINE_REASON"];
|
|
if (!owner || !reason) {
|
|
process.stderr.write("SCALE_BASELINE_OWNER and SCALE_BASELINE_REASON are required.\n");
|
|
process.exit(1);
|
|
}
|
|
const baseline = approveBaseline(environment, metrics, {
|
|
owner,
|
|
reason,
|
|
approvedAt: new Date().toISOString(),
|
|
});
|
|
await mkdir(path.dirname(BASELINE_PATH), { recursive: true });
|
|
await writeFile(BASELINE_PATH, `${JSON.stringify(baseline, null, 2)}\n`);
|
|
process.stdout.write(`scale baseline approved: ${baseline.approval.metricsDigest}\n`);
|
|
return;
|
|
}
|
|
|
|
let baseline: ScaleBaseline;
|
|
try {
|
|
baseline = JSON.parse(await readFile(BASELINE_PATH, "utf8")) as ScaleBaseline;
|
|
} catch {
|
|
process.stderr.write(`missing or unreadable ${BASELINE_PATH}; run update:scale-baseline\n`);
|
|
process.exit(1);
|
|
}
|
|
const comparison = compareToBaseline(baseline, environment, metrics);
|
|
await mkdir(path.dirname(artifact), { recursive: true });
|
|
await writeFile(
|
|
artifact,
|
|
`${JSON.stringify(
|
|
{ schemaVersion: 1, generatedAt: new Date().toISOString(), environment, baselineApproval: baseline.approval, ...comparison },
|
|
null,
|
|
2,
|
|
)}\n`,
|
|
);
|
|
const { compatibility } = comparison;
|
|
process.stdout.write(
|
|
`compatibility: structural=${compatibility.structural.ok} compiler=${compatibility.compiler.ok} timing=${compatibility.timing.ok}\n`,
|
|
);
|
|
if (!compatibility.timing.ok) {
|
|
process.stdout.write(
|
|
`timing regression NOT compared (incomplete): ${compatibility.timing.reasons.join("; ")}\n`,
|
|
);
|
|
}
|
|
process.stdout.write(
|
|
`axes: absolute ${comparison.absolute.findings.length} (${comparison.absolute.passed ? "ok" : "FAIL"}), ` +
|
|
`growth ${comparison.growth.findings.length} (${comparison.growth.passed ? "ok" : "FAIL"}), ` +
|
|
`relative ${comparison.compiler.length} compiler + ${comparison.timing.length} timing\n`,
|
|
);
|
|
for (const failure of comparison.failures) process.stdout.write(`FAIL ${failure}\n`);
|
|
process.stdout.write(
|
|
`scale baseline gate: ${comparison.status.toUpperCase()} (${path.relative(process.cwd(), artifact)})\n`,
|
|
);
|
|
if (comparison.status === "failed") process.exitCode = 1;
|
|
else if (comparison.status === "incomplete" && process.env["SCALE_ALLOW_INCOMPLETE"] !== "1") {
|
|
process.exitCode = 1;
|
|
}
|
|
}
|
|
|
|
if (import.meta.url === `file://${process.argv[1]}`) {
|
|
await main();
|
|
}
|