chore(features): 참조 기능과 예제 화면을 지우고 레지스트리를 다시 승인한다

소유자 결정(2026-11-07, design-docs repo-structure/README.md 3.4절)으로
템플릿 샘플을 지운다. 샘플이 맡던 시험 대상은 앞 커밋들이 옮겼다.

참조 기능과 예제 화면, 두 context, 그 시험, e2e 3개, 수동 접근성 기록
7개, 런타임 프로필 키, test:reference-feature(명령, 산출물, 게이트
참조), 커버리지 정책 행을 지웠다. removable-template-features 목록은
비우고 장치는 남겼다: test:sample-removal은 인자가 없으면 목록을
하나씩 지우고, 비면 SKIP을 출력하고 보고서에 건너뛴 사례를 남긴다.
기능 스위치 시험과 홈 시작 링크 스위치 시험은 시험 전용 fixture 기능으로
옮겼다. browser soak은 생성 기능을 넣은 빌드에서 돈다. 문서의 샘플
경로를 고쳤다. 날짜가 붙은 설계·리뷰 기록의 본문은 그대로 두었다.
레지스트리 기준선(update:registry-baseline, OWNER DongHyeonka), CI 계약
기준선과 workflow, 초기 JS 기록(194,354B, 17파일, 첫 기능 6,327B, 기능
539B, context 4B)을 다시 받았다.

위험: 레지스트리 행 삭제는 breaking이다. 샘플을 고쳐 쓰는 다운스트림은
수정/삭제 충돌을 만난다. 성능 lab의 기능 라우트 측정은 템플릿에
공개 기능 라우트가 없어 measured:false다. TEMPLATE_FIXTURE 출처는
플랫폼 코드에 남았다.

검증(desktop): check:types, lint, check:architecture, check:registries,
check:ci, verify:documentation, test:unit, test:component,
test:contract, test:integration, test:recipes, test:coverage(Risk
coverage PASS 378/378, 문턱 68개), test:e2e 183, test:a11y, test:visual,
test:storybook, test:browser-capabilities, test:feature-scaffold PASS(76
checks), test:sample-removal SKIP, build, check:bundle.
This commit is contained in:
DongHyeonka
2026-11-08 14:07:58 +09:00
parent b2042de9be
commit e3c8db48ae
126 changed files with 630 additions and 7607 deletions
+93 -67
View File
@@ -8,8 +8,10 @@ import {
} from "node:fs/promises";
import { spawnSync } from "node:child_process";
import path from "node:path";
import { fileURLToPath } from "node:url";
import { ROUTE_FEATURE_OWNER } from "../src/features/installed-feature-contracts.ts";
import { loadCiGateContract } from "./contracts/ci-gates.ts";
import { createFileSystemDeclarationSource } from "./generate-product-feature-index.ts";
import { productFeatureResidue } from "./lib/feature-residue.ts";
import { isProductionModulePath } from "./lib/risk-coverage.ts";
@@ -32,42 +34,92 @@ import {
import { REMOVABLE_TEMPLATE_FEATURES } from "./lib/removable-template-features.ts";
/**
* 09-07 (D-10). Removes one installed feature, `--feature=<id>` (default: the
* reference sample), from a copy of the repository and proves the rest still
* typechecks, tests, covers and builds. Every feature loses its directory, its
* tests/features directory, its context when no other feature is left in it,
* its runtime-profile override and its central policy rows. The sample also
* owns the extra paths and scripts listed in SAMPLE_EXTRAS.
* 09-07 (D-10). Removes one installed feature, `--feature=<id>`, from a copy
* of the repository and proves the rest still typechecks, tests, covers and
* builds. Every feature loses its directory, its tests/features directory,
* its context when no other feature is left in it, its runtime-profile
* override and its central policy rows. A sample that
* scripts/lib/removable-template-features.ts lists also loses its extra paths
* and package scripts, with the CI evidence only those scripts produce, and
* the copy then gets a feature from create:feature and runs the gates again.
*
* Without `--feature` (FE-GATE-020) each listed sample is removed in turn.
* The template lists none since its samples were deleted (2026-11-07): the
* run then reports the drill as skipped, not passed, and test:feature-scaffold
* removes a generated feature through `--feature`.
*/
const featureId =
process.argv.find((argument) => argument.startsWith("--feature="))
?.slice("--feature=".length) ?? "reference-feature";
const SAMPLE_REPORT = "artifacts/tests/sample-removal.xml";
const requestedFeature = process.argv
.find((argument) => argument.startsWith("--feature="))
?.slice("--feature=".length);
if (requestedFeature === undefined) {
const checks: RemovalCheck[] = REMOVABLE_TEMPLATE_FEATURES.map((sample) => {
const status = spawnSync(
process.execPath,
[fileURLToPath(import.meta.url), `--feature=${sample.featureId}`],
{ stdio: "inherit" },
).status;
return status === 0
? { name: sample.featureId, passed: true }
: {
name: sample.featureId,
passed: false,
failure: `test:sample-removal -- --feature=${sample.featureId} exited ${status ?? "on a signal"}`,
};
});
await mkdir("artifacts/tests", { recursive: true });
if (checks.length === 0) {
await writeFile(
SAMPLE_REPORT,
`<?xml version="1.0" encoding="UTF-8"?>\n` +
`<testsuite name="sample-removal" tests="1" failures="0" skipped="1">` +
`<testcase name="listed-samples"><skipped message="scripts/lib/removable-template-features.ts lists no sample" /></testcase>` +
`</testsuite>\n`,
);
process.stdout.write(
"sample removal: SKIP (scripts/lib/removable-template-features.ts lists no sample; " +
"test:feature-scaffold removes a generated feature with --feature)\n",
);
} else {
await writeFile(SAMPLE_REPORT, renderRemovalJunit("sample-removal", checks));
if (checks.some((check) => !check.passed)) process.exitCode = 1;
}
process.exit();
}
const featureId: string = requestedFeature;
type FeatureExtras = Readonly<{
paths: readonly string[];
ciScripts: readonly string[];
evidencePathFragments: readonly string[];
residue: RegExp;
}>;
// The sample's own files and scripts outside its folders are declared with
// the other removable template features, which verify:documentation reads too.
const REFERENCE_SAMPLE = REMOVABLE_TEMPLATE_FEATURES.find(
(feature) => feature.featureId === "reference-feature",
);
if (REFERENCE_SAMPLE === undefined) {
throw new Error("scripts/lib/removable-template-features.ts does not declare reference-feature");
/** The CI evidence that only `scripts` produce: it goes with them. */
async function evidenceOnlyFrom(scripts: readonly string[]): Promise<string[]> {
if (scripts.length === 0) return [];
const contract = await loadCiGateContract(process.cwd());
const commandIds = new Set(
contract.commands.filter(({ script }) => scripts.includes(script)).map(({ id }) => id),
);
return contract.artifacts.flatMap((artifact) =>
artifact.production === "command-generated" &&
artifact.producerCommandIds.length > 0 &&
artifact.producerCommandIds.every((commandId) => commandIds.has(commandId))
? [artifact.path]
: [],
);
}
const SAMPLE_EXTRAS: Readonly<Record<string, FeatureExtras>> = Object.freeze({
"reference-feature": Object.freeze({
paths: REFERENCE_SAMPLE.extraPaths,
ciScripts: REFERENCE_SAMPLE.scripts,
evidencePathFragments: [
"reference-feature.xml",
],
residue: /REFERENCE_RESOURCE|reference-feature|reference-resource/i,
}),
// The sample's own files and scripts outside its folders, which
// verify:documentation reads too.
const listedSample = REMOVABLE_TEMPLATE_FEATURES.find(
(feature) => feature.featureId === featureId,
);
const extras: FeatureExtras = Object.freeze({
paths: listedSample?.extraPaths ?? [],
ciScripts: listedSample?.scripts ?? [],
evidencePathFragments: await evidenceOnlyFrom(listedSample?.scripts ?? []),
});
function escapeRegExp(value: string): string {
@@ -106,15 +158,6 @@ async function locateFeature(id: string) {
}
const located = await locateFeature(featureId);
const extras: FeatureExtras = SAMPLE_EXTRAS[featureId] ?? Object.freeze({
paths: [],
ciScripts: [],
evidencePathFragments: [],
residue: new RegExp(
`${escapeRegExp(featureId)}|${escapeRegExp(located.directory)}`,
"i",
),
});
// Captured from this repository before the copy loses them.
const featureRouteIds = Object.entries(ROUTE_FEATURE_OWNER)
.filter(([, owner]) => owner === featureId)
@@ -124,7 +167,7 @@ const fixtureRoot = await createRemovalFixtureRoot(`${featureId}-removal`);
const pnpmCli = requireRemovalFixtureEnvironment("npm_execpath");
const featureSource = `src/features/${located.directory}`;
const featureTests = `tests/features/${located.directory}`;
const isSample = featureId in SAMPLE_EXTRAS;
const isSample = listedSample !== undefined;
/**
* Platform tests that must survive the sample feature's removal. Asserting they
* are still present is what stops the removal fixture from "passing" by having
@@ -281,12 +324,6 @@ try {
const retainedCriticalModules = coveragePolicy.criticalModules.filter(
(modulePolicy) => !modulePolicy.path?.startsWith(`${featureSource}/`),
);
if (
isSample &&
retainedCriticalModules.length === coveragePolicy.criticalModules.length
) {
throw new Error("Reference feature coverage policy is not registered");
}
coveragePolicy.criticalModules = retainedCriticalModules;
coveragePolicy.highRiskPaths = coveragePolicy.highRiskPaths.filter(
(modulePath) => !modulePath.startsWith(`${featureSource}/`),
@@ -299,7 +336,7 @@ try {
);
coveragePolicy.repositoryBaseline -= removedProductionModuleCount;
if (coveragePolicy.repositoryBaseline <= 0) {
throw new Error("Reference feature removal produced an invalid coverage baseline");
throw new Error(`${featureId} removal produced an invalid coverage baseline`);
}
await writeFile(
coveragePolicyFile,
@@ -400,7 +437,7 @@ try {
// JavaScript of the features installed now, and test:unit compares a build
// with it. A product re-records it when it adds a feature; removing that
// feature changes it again, so the fixture re-records it as the product
// would. The sample removal deletes the measurement with the sample.
// would.
const measurement = path.join(fixtureRoot, "scripts/scale/measure-feature-shape-growth.ts");
if (await access(measurement).then(() => true, () => false)) {
const measured = spawnSync(
@@ -414,22 +451,13 @@ try {
}
await regenerateRemovalFixtureWorkflow(fixtureRoot);
const residue: string[] = [];
if (isSample) {
for (const root of ["src", "tests"]) {
for (const file of await filesBelow(path.join(fixtureRoot, root))) {
const relative = path.relative(fixtureRoot, file);
const content = await readFile(file, "utf8");
if (extras.residue.test(`${relative}\n${content}`)) {
residue.push(relative);
}
}
}
} else {
// 1105/16-04. Template tests use example feature IDs as data; only what
// still points at the removed feature counts (scripts/lib/feature-residue.ts).
residue.push(...(await productFeatureResidue(fixtureRoot, featureId, located.directory)));
}
// 1105/16-04. Template tests use example feature IDs as data; only what
// still points at the removed feature counts (scripts/lib/feature-residue.ts).
const residue = await productFeatureResidue(fixtureRoot, featureId, located.directory);
const builtResiduePattern = new RegExp(
`${escapeRegExp(featureId)}|${escapeRegExp(located.directory)}`,
"i",
);
const missingCommonTests: string[] = [];
for (const testPath of commonTestPaths) {
@@ -471,7 +499,7 @@ try {
for (const file of await filesBelow(path.join(fixtureRoot, "dist"))) {
if (!/\.(?:js|css|html|json)$/.test(file)) continue;
const content = await readFile(file, "utf8");
if (extras.residue.test(content)) {
if (builtResiduePattern.test(content)) {
builtResidue.push(path.relative(fixtureRoot, file));
}
}
@@ -493,9 +521,9 @@ try {
outcome("built-fixture-id-residue", builtResidue, "built residue"),
);
// U7 (decision 4). The same copy, now without the sample, gets one feature
// from create:feature and runs the same gates again: the command and the
// feature it writes need nothing from the sample.
// U7 (decision 4). The same copy, now without the listed sample, gets one
// feature from create:feature and runs the same gates again: the command
// and the feature it writes need nothing from the sample.
if (isSample) {
// 1103/09-06. With the write slice (NEVER), which needs nothing from
// the sample either.
@@ -513,9 +541,7 @@ try {
const failed = checks.filter((entry) => !entry.passed);
await mkdir("artifacts/tests", { recursive: true });
await writeFile(
isSample
? "artifacts/tests/sample-removal.xml"
: `artifacts/tests/feature-removal-${featureId}.xml`,
`artifacts/tests/feature-removal-${featureId}.xml`,
renderRemovalJunit(`${featureId}-removal`, checks),
);
if (failed.length > 0) {