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)
77 lines
3.1 KiB
TypeScript
77 lines
3.1 KiB
TypeScript
import { z } from "zod";
|
|
|
|
import { reachablePackageScripts } from "./package-script-graph.ts";
|
|
|
|
/**
|
|
* 12-04. A verification package script protects nothing unless a CI gate runs
|
|
* it. `ungated-tests.ts` covers test files; this covers the scripts. A script
|
|
* of a verification family is gated when a gate command reaches it through
|
|
* the package script graph, or when it only re-runs Vitest paths a gate
|
|
* already runs. Anything else needs a reasoned entry in
|
|
* config/ci/ungated-scripts.json.
|
|
*/
|
|
export const UNGATED_SCRIPTS_PATH = "config/ci/ungated-scripts.json";
|
|
|
|
const VERIFICATION_SCRIPT = /^(?:check|verify|test|drill|review):/u;
|
|
|
|
const ungatedScriptsSchema = z
|
|
.object({
|
|
schemaVersion: z.literal(1),
|
|
entries: z.array(
|
|
z
|
|
.object({
|
|
script: z.string().regex(VERIFICATION_SCRIPT),
|
|
reason: z.string().trim().min(1, "exclusion reason is required"),
|
|
})
|
|
.strict(),
|
|
),
|
|
})
|
|
.strict();
|
|
|
|
export type UngatedScriptExclusion = Readonly<{ script: string; reason: string }>;
|
|
|
|
export function parseUngatedScriptExclusions(value: unknown): readonly UngatedScriptExclusion[] {
|
|
return ungatedScriptsSchema.parse(value).entries;
|
|
}
|
|
|
|
/** Every segment is a Vitest run whose paths all lie inside gated paths. */
|
|
function rerunsGatedTests(command: string, gatedTestPaths: readonly string[]): boolean {
|
|
const gated = (target: string) =>
|
|
gatedTestPaths.some((gatedPath) => target === gatedPath || target.startsWith(`${gatedPath}/`));
|
|
return command.split("&&").every((segment) => {
|
|
const tokens = segment.trim().split(/\s+/u);
|
|
const run = tokens.findIndex(
|
|
(token, index) => token === "run" && /(?:run-vitest\.ts|vitest)$/u.test(tokens[index - 1] ?? ""),
|
|
);
|
|
if (run < 0) return false;
|
|
const paths = tokens.slice(run + 1).filter((token) => !token.startsWith("-"));
|
|
return paths.length > 0 && paths.every((target) => gated(target.replace(/\/$/u, "")));
|
|
});
|
|
}
|
|
|
|
export function ungatedScriptFailures(input: Readonly<{
|
|
scripts: Readonly<Record<string, string>>;
|
|
entryScripts: readonly string[];
|
|
gatedTestPaths: readonly string[];
|
|
exclusions: readonly UngatedScriptExclusion[];
|
|
}>): string[] {
|
|
const reached = new Set(reachablePackageScripts(input.scripts, input.entryScripts));
|
|
const gated = (script: string) =>
|
|
reached.has(script) || rerunsGatedTests(input.scripts[script] ?? "", input.gatedTestPaths);
|
|
const excluded = new Set(input.exclusions.map(({ script }) => script));
|
|
const failures = Object.keys(input.scripts)
|
|
.filter((script) => VERIFICATION_SCRIPT.test(script) && !gated(script) && !excluded.has(script))
|
|
.sort()
|
|
.map((script) =>
|
|
`verification script is not reached by any CI gate command and is not in ${UNGATED_SCRIPTS_PATH}: ${script}`
|
|
);
|
|
// An entry for a script a removal deleted is harmless; one for a script a
|
|
// gate now reaches would hide the next regression, so it has to go.
|
|
for (const { script } of input.exclusions) {
|
|
if (input.scripts[script] !== undefined && gated(script)) {
|
|
failures.push(`ungated script exclusion is stale; a CI gate reaches it: ${script}`);
|
|
}
|
|
}
|
|
return failures;
|
|
}
|