chore: sync the frontend template from ebea300 to af3d8e6
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)
This commit is contained in:
+163
-59
@@ -6,11 +6,13 @@ import { fileURLToPath, pathToFileURL } from "node:url";
|
||||
import { createRequire } from "node:module";
|
||||
|
||||
import { architectureDependencyReportArtifactSchema } from "./contracts/release-artifacts.ts";
|
||||
import { formatArchitectureViolation } from "./lib/architecture-violation-message.ts";
|
||||
import { writeValidatedJsonArtifact } from "./lib/validated-json-artifact.ts";
|
||||
|
||||
type PathRule = Readonly<{ path?: string; pathNot?: string }>;
|
||||
type ArchitectureRule = Readonly<{
|
||||
name: string;
|
||||
comment?: string;
|
||||
severity?: string;
|
||||
from?: PathRule;
|
||||
to?: PathRule & Readonly<{ circular?: boolean }>;
|
||||
@@ -53,7 +55,6 @@ type GraphFixtureResult = Readonly<{
|
||||
failures: string[];
|
||||
}>;
|
||||
type DependencyResolution = Readonly<{ path?: string; reason: string }>;
|
||||
type DependencyCruiserReport = Record<string, unknown>;
|
||||
type TypeScriptOnlyPolicy = Readonly<{
|
||||
checkedRoots: readonly string[];
|
||||
exceptionsAllowed: false;
|
||||
@@ -111,27 +112,15 @@ function runPnpm(arguments_: string[]) {
|
||||
});
|
||||
}
|
||||
|
||||
// Keep dependency-cruiser's report and checks. The second graph is authoritative
|
||||
// for TypeScript 7 coverage because dependency-cruiser 18 cannot parse TS 7 yet.
|
||||
const dependencyCruiser = runPnpm([
|
||||
"exec",
|
||||
"depcruise",
|
||||
"src",
|
||||
"--config",
|
||||
".dependency-cruiser.json",
|
||||
"--output-type",
|
||||
"json",
|
||||
]);
|
||||
// 12-05 (D-11): this graph is the only architecture checker. dependency-cruiser
|
||||
// 18 cannot parse TypeScript 7, so it cruised zero modules and still passed.
|
||||
// .dependency-cruiser.json keeps its name and is read here as the rule file.
|
||||
const sourceGraph = await analyzeSourceGraph(sourceRoot, "src");
|
||||
const typeScriptOnlyPolicy = await inspectTypeScriptOnlyPolicy();
|
||||
const graphFixtureResult = await runGraphFixtureChecks();
|
||||
const dependencyReport = parseDependencyCruiserReport(dependencyCruiser.stdout);
|
||||
const graphErrors = blockingViolations(sourceGraph);
|
||||
const dependencyCruiserReportValid = !(
|
||||
"dependencyCruiserOutput" in dependencyReport
|
||||
);
|
||||
|
||||
dependencyReport.staticImportGraph = {
|
||||
const staticImportGraph = {
|
||||
analyzer: "babel-parser-node-resolver",
|
||||
modules: sourceGraph.modules,
|
||||
dependencies: sourceGraph.dependencies,
|
||||
@@ -162,25 +151,11 @@ dependencyReport.staticImportGraph = {
|
||||
await writeValidatedJsonArtifact({
|
||||
path: qualityArtifact,
|
||||
schema: architectureDependencyReportArtifactSchema,
|
||||
value: dependencyReport,
|
||||
value: { staticImportGraph },
|
||||
});
|
||||
|
||||
let architectureFailed = false;
|
||||
|
||||
if (!dependencyCruiserReportValid) {
|
||||
architectureFailed = true;
|
||||
process.stderr.write("dependency-cruiser returned an invalid JSON report\n");
|
||||
}
|
||||
|
||||
if (dependencyCruiser.status !== 0) {
|
||||
architectureFailed = true;
|
||||
process.stderr.write(
|
||||
(dependencyCruiser.error?.message ?? dependencyCruiser.stderr) ||
|
||||
dependencyCruiser.stdout ||
|
||||
"dependency-cruiser failed\n",
|
||||
);
|
||||
}
|
||||
|
||||
for (const failure of sourceGraph.parseFailures) {
|
||||
architectureFailed = true;
|
||||
process.stderr.write(
|
||||
@@ -197,11 +172,16 @@ for (const dependency of sourceGraph.unresolved) {
|
||||
|
||||
for (const violation of graphErrors) {
|
||||
architectureFailed = true;
|
||||
const cycle = violation.cycle
|
||||
? ` (cycle group: ${violation.cycle.join(", ")})`
|
||||
: "";
|
||||
process.stderr.write(
|
||||
`Architecture violation [${violation.rule}]: ${violation.source} -> ${violation.target}${cycle}\n`,
|
||||
formatArchitectureViolation(
|
||||
violation,
|
||||
violation.cycle
|
||||
? []
|
||||
: sourceGraph.dependencies
|
||||
.filter(({ source, target }) => source === violation.source && target === violation.target)
|
||||
.map(({ specifier }) => specifier),
|
||||
architectureRules.find(({ name }) => name === violation.rule)?.comment,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -443,7 +423,7 @@ async function importSpecifiers(sourceFile: string): Promise<string[]> {
|
||||
visitSyntaxNode(syntaxTree, specifiers, nonLiteralModuleLoads);
|
||||
if (nonLiteralModuleLoads.size > 0) {
|
||||
throw new Error(
|
||||
`module loading must use string literals: ${[...nonLiteralModuleLoads].join(", ")}`,
|
||||
`module loading must name one module with a string literal: ${[...nonLiteralModuleLoads].join(", ")}`,
|
||||
);
|
||||
}
|
||||
for (const comment of syntaxTree.comments ?? []) {
|
||||
@@ -503,6 +483,17 @@ function visitSyntaxNode(
|
||||
if (!addStringLiteral(arguments_[0], specifiers)) {
|
||||
nonLiteralModuleLoads.add("require()");
|
||||
}
|
||||
} else if (
|
||||
nodeType === "CallExpression" &&
|
||||
syntaxNodeType(node.callee) === "MemberExpression" &&
|
||||
syntaxNodeType(syntaxNodeProperty(node.callee, "object")) === "MetaProperty" &&
|
||||
/^glob(?:Eager)?$/u.test(
|
||||
String(syntaxNodeProperty(syntaxNodeProperty(node.callee, "property"), "name")),
|
||||
)
|
||||
) {
|
||||
// 12-06: a glob pulls in every matching module without naming one, so no
|
||||
// edge rule can see it. Refuse it like a non-literal import().
|
||||
nonLiteralModuleLoads.add("import.meta.glob()");
|
||||
} else if (nodeType === "TSExternalModuleReference") {
|
||||
addStringLiteral(node.expression, specifiers);
|
||||
} else if (nodeType === "TSImportType") {
|
||||
@@ -824,14 +815,23 @@ async function runGraphFixtureChecks(): Promise<GraphFixtureResult> {
|
||||
"tests/fixtures/architecture/dependency-graph",
|
||||
);
|
||||
const allowedRoot = resolve(fixtureRoot, "allowed");
|
||||
const [allowedGraph, unresolvedGraph, layerGraph, cycleGraph, barrelGraph] =
|
||||
await Promise.all([
|
||||
analyzeSourceGraph(allowedRoot, "src"),
|
||||
analyzeSourceGraph(resolve(fixtureRoot, "unresolved"), "src"),
|
||||
analyzeSourceGraph(resolve(fixtureRoot, "layer"), "src"),
|
||||
analyzeSourceGraph(resolve(fixtureRoot, "cycle"), "src"),
|
||||
analyzeSourceGraph(resolve(fixtureRoot, "barrel"), "src"),
|
||||
]);
|
||||
const [
|
||||
allowedGraph,
|
||||
unresolvedGraph,
|
||||
layerGraph,
|
||||
cycleGraph,
|
||||
barrelGraph,
|
||||
crossBoundaryGraph,
|
||||
importBoundaryGraph,
|
||||
] = await Promise.all([
|
||||
analyzeSourceGraph(allowedRoot, "src"),
|
||||
analyzeSourceGraph(resolve(fixtureRoot, "unresolved"), "src"),
|
||||
analyzeSourceGraph(resolve(fixtureRoot, "layer"), "src"),
|
||||
analyzeSourceGraph(resolve(fixtureRoot, "cycle"), "src"),
|
||||
analyzeSourceGraph(resolve(fixtureRoot, "barrel"), "src"),
|
||||
analyzeSourceGraph(resolve(fixtureRoot, "cross-boundary"), "src"),
|
||||
analyzeSourceGraph(resolve(fixtureRoot, "import-boundaries"), "src"),
|
||||
]);
|
||||
const allowedFiles = new Set(await listFiles(allowedRoot));
|
||||
const allowedSourceFile = resolve(
|
||||
allowedRoot,
|
||||
@@ -851,6 +851,100 @@ async function runGraphFixtureChecks(): Promise<GraphFixtureResult> {
|
||||
),
|
||||
);
|
||||
const assertions = [
|
||||
{
|
||||
name: "cross-feature concrete imports are rejected",
|
||||
passed: blockingViolations(crossBoundaryGraph).some(
|
||||
({ rule, source, target }) =>
|
||||
rule === "features-do-not-import-other-features" &&
|
||||
source === "src/features/alpha/read-beta.ts" &&
|
||||
target === "src/features/beta/value.ts",
|
||||
),
|
||||
},
|
||||
{
|
||||
name: "cross-context concrete imports are rejected",
|
||||
passed: blockingViolations(crossBoundaryGraph).some(
|
||||
({ rule, source, target }) =>
|
||||
rule === "contexts-do-not-import-other-contexts" &&
|
||||
source === "src/contexts/customer/read-admin.ts" &&
|
||||
target === "src/contexts/admin/value.ts",
|
||||
),
|
||||
},
|
||||
{
|
||||
name: "feature root re-export of a concrete adapter is rejected",
|
||||
passed: blockingViolations(crossBoundaryGraph).some(
|
||||
({ rule, source, target }) =>
|
||||
rule === "feature-and-app-roots-do-not-reach-adapters" &&
|
||||
source === "src/features/alpha/telemetry.ts" &&
|
||||
target === "src/adapters/telemetry/index.ts",
|
||||
),
|
||||
},
|
||||
{
|
||||
name: "context re-export of a concrete adapter is rejected",
|
||||
passed: blockingViolations(crossBoundaryGraph).some(
|
||||
({ rule, source, target }) =>
|
||||
rule === "feature-and-app-roots-do-not-reach-adapters" &&
|
||||
source === "src/contexts/customer/telemetry.ts" &&
|
||||
target === "src/adapters/telemetry/index.ts",
|
||||
),
|
||||
},
|
||||
{
|
||||
name: "presentation import of a context is rejected",
|
||||
passed: blockingViolations(crossBoundaryGraph).some(
|
||||
({ rule, source, target }) =>
|
||||
rule === "presentation-does-not-import-apps-or-contexts" &&
|
||||
source === "src/presentation/read-context.ts" &&
|
||||
target === "src/contexts/customer/telemetry.ts",
|
||||
),
|
||||
},
|
||||
// 12-08 / 12-10: these import rules used to be regular expressions in
|
||||
// check-design-system.ts and realtime-boundaries.ts beside the graph.
|
||||
{
|
||||
name: "design-system deep import is rejected",
|
||||
passed: blockingViolations(importBoundaryGraph).some(
|
||||
({ rule, source }) =>
|
||||
rule === "design-system-is-reached-through-its-index" &&
|
||||
source === "src/presentation/pages/deep-import.ts",
|
||||
),
|
||||
},
|
||||
{
|
||||
name: "design-system index and named facades are accepted",
|
||||
passed: !blockingViolations(importBoundaryGraph).some(({ source }) =>
|
||||
["src/presentation/pages/public-import.ts", "src/presentation/components/ui/button.ts"].includes(source),
|
||||
),
|
||||
},
|
||||
{
|
||||
name: "direct icon vendor import is rejected",
|
||||
passed: blockingViolations(importBoundaryGraph).some(
|
||||
({ rule, source, target }) =>
|
||||
rule === "icon-vendor-is-facade-only" &&
|
||||
source === "src/presentation/pages/direct-icon.ts" &&
|
||||
target === "lucide-react",
|
||||
),
|
||||
},
|
||||
// F-7 (13-08): zod must be configured jitless before any schema is built.
|
||||
{
|
||||
name: "direct zod import outside src/contracts/zod.ts is rejected",
|
||||
passed: blockingViolations(importBoundaryGraph).some(
|
||||
({ rule, source, target }) =>
|
||||
rule === "zod-is-reached-through-contracts-zod" &&
|
||||
source === "src/presentation/pages/direct-zod.ts" &&
|
||||
target === "zod",
|
||||
),
|
||||
},
|
||||
{
|
||||
name: "zod through src/contracts/zod.ts is accepted",
|
||||
passed: !blockingViolations(importBoundaryGraph).some(({ source }) =>
|
||||
["src/contracts/zod.ts", "src/presentation/pages/wrapped-zod.ts"].includes(source),
|
||||
),
|
||||
},
|
||||
{
|
||||
name: "unselected realtime runtime composition is rejected",
|
||||
passed: blockingViolations(importBoundaryGraph).some(
|
||||
({ rule, source }) =>
|
||||
rule === "unselected-realtime-runtime-is-not-composed" &&
|
||||
source === "src/bootstrap/compose-realtime.ts",
|
||||
),
|
||||
},
|
||||
{
|
||||
name: "deep adapter import from outside the group is rejected",
|
||||
passed: blockingViolations(barrelGraph).some(
|
||||
@@ -860,6 +954,21 @@ async function runGraphFixtureChecks(): Promise<GraphFixtureResult> {
|
||||
target === "src/adapters/http/client.ts",
|
||||
),
|
||||
},
|
||||
{
|
||||
name: "second-level index import from outside the group is rejected",
|
||||
passed: blockingViolations(barrelGraph).some(
|
||||
({ rule, source, target }) =>
|
||||
rule === "adapter-groups-are-reached-through-their-barrel" &&
|
||||
source === "src/bootstrap/compose-sub-barrel.ts" &&
|
||||
target === "src/adapters/http/internals/index.ts",
|
||||
),
|
||||
},
|
||||
{
|
||||
name: "storage runtime sub-barrel import is accepted",
|
||||
passed: !blockingViolations(barrelGraph).some(
|
||||
({ source }) => source === "src/bootstrap/compose-storage-sub-barrel.ts",
|
||||
),
|
||||
},
|
||||
{
|
||||
name: "barrel import from outside the group is accepted",
|
||||
passed: !blockingViolations(barrelGraph).some(
|
||||
@@ -929,6 +1038,14 @@ async function runGraphFixtureChecks(): Promise<GraphFixtureResult> {
|
||||
reason.includes("import()"),
|
||||
),
|
||||
},
|
||||
{
|
||||
name: "import.meta.glob module loads are rejected",
|
||||
passed: unresolvedGraph.parseFailures.some(
|
||||
({ source, reason }) =>
|
||||
source === "src/application/glob-value.ts" &&
|
||||
reason.includes("import.meta.glob"),
|
||||
),
|
||||
},
|
||||
{
|
||||
name: "non-literal CommonJS imports are rejected",
|
||||
passed: unresolvedGraph.parseFailures.some(
|
||||
@@ -1074,6 +1191,7 @@ function parseArchitectureConfig(value: unknown): ArchitectureConfig {
|
||||
|
||||
function isArchitectureRule(value: unknown): value is ArchitectureRule {
|
||||
if (!isRecord(value) || typeof value.name !== "string") return false;
|
||||
if (value.comment !== undefined && typeof value.comment !== "string") return false;
|
||||
if (value.severity !== undefined && typeof value.severity !== "string") {
|
||||
return false;
|
||||
}
|
||||
@@ -1099,17 +1217,3 @@ function isPathRule(value: unknown, allowCircular: boolean): value is PathRule {
|
||||
function isRecord(value: unknown): value is Record<string, unknown> {
|
||||
return Boolean(value && typeof value === "object" && !Array.isArray(value));
|
||||
}
|
||||
|
||||
function parseDependencyCruiserReport(
|
||||
output: string,
|
||||
): DependencyCruiserReport {
|
||||
try {
|
||||
const report: unknown = JSON.parse(output);
|
||||
if (!report || typeof report !== "object" || Array.isArray(report)) {
|
||||
throw new Error("dependency-cruiser report must be a JSON object");
|
||||
}
|
||||
return report as DependencyCruiserReport;
|
||||
} catch {
|
||||
return { summary: { errors: 1 }, dependencyCruiserOutput: output };
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user