chore(review): 1103 계약·레지스트리 조치 브랜치를 합친다

Refs: docs/reviews/2026-11-03-maturity-review/README.md 07-01~07-04 13-04 14-06
This commit is contained in:
DongHyeonka
2026-11-04 21:28:13 +09:00
24 changed files with 1060 additions and 42 deletions
+9
View File
@@ -931,6 +931,15 @@ async function runGraphFixtureChecks(): Promise<GraphFixtureResult> {
target === "zod",
),
},
{
name: "zod subpath 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/subpath-zod.ts" &&
target === "zod/v4",
),
},
{
name: "zod through src/contracts/zod.ts is accepted",
passed: !blockingViolations(importBoundaryGraph).some(({ source }) =>
+45 -3
View File
@@ -116,6 +116,13 @@ const owners = new Map<string, string>();
const snapshots: RegistrySnapshot[] = [];
const rowsByRegistry = new Map<string, RegistryRows>();
const sourcesByRegistry = new Map<string, string>();
/**
* 1103/14-06. Registries whose source did not load. Their failure is already
* reported with its cause, so the checks that read their rows (references,
* the baseline comparison) skip them instead of reporting the same failure
* again as a deleted registry.
*/
const unloadedRegistries = new Set<string>();
const registryExtensions = [".ts", ".tsx", ".mts", ".cts"];
async function resolveRegistrySource(
@@ -144,6 +151,33 @@ async function resolveRegistrySource(
return candidates[0] ?? null;
}
/**
* 1103/14-06. A contract composition failure (`ContractContributionError`)
* says only "not composable"; its cause is the `reason` property.
*/
function loadErrorText(error: Error): string {
const message = error.message.split("\n")[0] ?? "";
const reason: unknown = (error as Error & { reason?: unknown }).reason;
return typeof reason === "string" && reason.length > 0
? `${message} (reason: ${reason})`
: message;
}
function withoutRegistries(
snapshot: Readonly<Record<string, unknown>>,
registryIds: ReadonlySet<string>,
): Readonly<Record<string, unknown>> {
if (registryIds.size === 0 || !Array.isArray(snapshot.registries)) {
return snapshot;
}
return {
...snapshot,
registries: (snapshot.registries as Array<{ registryId?: unknown }>).filter(
(registry) => !registryIds.has(String(registry.registryId)),
),
};
}
type FieldLookup = Readonly<{
found: boolean;
value: unknown;
@@ -371,8 +405,12 @@ for (const specification of governance.registries) {
} catch (error) {
// A source that exists but fails to load names its error, so a broken
// import in a feature contract is not reported as a missing file.
const reason = sourcePath && error instanceof Error ? `: ${error.message.split("\n")[0]}` : "";
if (!rows) failures.push(`missing registry source ${specification.path}${reason}`);
const reason = sourcePath && error instanceof Error ? `: ${loadErrorText(error)}` : "";
if (!rows) {
failures.push(`missing registry source ${specification.path}${reason}`);
unloadedRegistries.add(specification.registryId);
continue;
}
}
const registryRows = projectRegistryRows(specification, rows);
@@ -534,6 +572,7 @@ for (const specification of governance.registries) {
for (const reference of specification.references ?? []) {
const targetRows = rowsByRegistry.get(reference.registryId);
if (!targetRows) {
if (unloadedRegistries.has(reference.registryId)) continue;
failures.push(
`${specification.registryId} references unknown registry ${reference.registryId}`,
);
@@ -672,7 +711,10 @@ if (baselinePath && approvalPath && evidencePath) {
`registry baseline approval digest mismatch: approved=${approvalResult.approvedDigest} actual=${approvalResult.actualDigest}`,
);
}
const registryDiff = diffRegistrySnapshots(baseline, currentSnapshot);
const registryDiff = diffRegistrySnapshots(
withoutRegistries(baseline, unloadedRegistries),
currentSnapshot,
);
compatibility = registryDiff;
const evidence = JSON.parse(
await readFile(evidencePath, "utf8"),