refactor(layout): 남은 루트 경로 목록도 등록부 집합에서 고른다
정리 4단계의 R2 검사는 등록부를 쓰는 7곳만 봤다. 그 밖에 루트 이름을 담은 목록이 코드 15파일에 19개 따로 있어, 루트 항목 하나를 옮기면 여전히 여러 곳을 같이 고쳐야 했다. - 등록부에 집합 12개를 더했다. 사본 복사에서 건너뛰는 항목 셋 (checkout·provider·공급망 fixture), fixture 코드 범위, pnpm 매니페스트, Playwright 설정, visual 증거, 문서 입력, 에이전트 하네스, tsconfig 묶음 셋. 각 집합 설명에 읽는 파일을 적었다. - 사본이 건너뛰는 node_modules·dist·.tmp 같은 추적 안 하는 항목은 종류 untracked(optional)로 적는다. 추적 파일이 있으면 시험이 실패한다. - 19개 목록이 모두 집합을 고른다. 집합의 원소는 전과 같아 동작은 바뀌지 않는다. - R2 시험이 추적되는 코드 파일 전체를 본다. 루트 항목(이나 그 안 경로)만 담은 문자열 배열에 추적되는 루트 이름이 둘 이상이면 실패. 인자 목록은 `--` 뒤만 본다. main의 옛 목록 18개를 이 검사가 잡는 것을 확인했다. - 집합마다 selectRepositoryPaths·selectRepositoryEntries로 고르는 코드가 있는지 본다. 문서를 복사하지 않는 제거 drill(FE-GATE-020)은 문서 시험(REMOVAL_FIXTURE_DOCUMENT_TESTS)을 지우는데, 집합 셋 (agent-harness·documentation-inputs·feature-typecheck)은 그 시험만 읽는다. 시험이 이 셋을 적어 두고, 문서 시험이 지워진 사본에서만 셋이 비는 것을 허용한다. 셋이 바뀌면 전체 checkout에서 실패한다. - 파서가 kinds·sets 설명과 코드의 목록이 같은지 본다. - .gitignore 주석이 a11y 기록을 아직 artifacts/ 아래라고 적던 것을 고쳤다(정리 3단계에서 docs/로 옮김). 검증(desktop): test:unit, check:types, check:ci, lint, verify:documentation. repository-layout 시험을 문서 없는 제거 사본과 feature-scaffold 사본에서도 돌렸고, 집합 하나의 읽는 곳을 지우면 두 곳 모두 실패한다.
This commit is contained in:
@@ -4,6 +4,7 @@ import path from "node:path";
|
||||
import { spawnSync } from "node:child_process";
|
||||
|
||||
import { CACHEABLE_ASSET_CONTENT_TYPES } from "../src/contracts/service-worker-static-manifest.ts";
|
||||
import { selectRepositoryPaths } from "./lib/repository-layout.ts";
|
||||
|
||||
/**
|
||||
* GOV-01 / SW-RR-03. Structural gates for facts that a hand-maintained document
|
||||
@@ -99,7 +100,7 @@ async function main(): Promise<void> {
|
||||
// dependencies mid-run. `linkFixtureNodeModules` is the only sanctioned form.
|
||||
const sources = spawnSync(
|
||||
"git",
|
||||
["grep", "-n", "-e", 'symlink(', "--", "scripts", "tests"],
|
||||
["grep", "-n", "-e", 'symlink(', "--", ...selectRepositoryPaths("fixture-code")],
|
||||
{ encoding: "utf8" },
|
||||
);
|
||||
if (sources.status === 0) {
|
||||
@@ -113,7 +114,7 @@ async function main(): Promise<void> {
|
||||
}
|
||||
const linkedFixtures = spawnSync(
|
||||
"git",
|
||||
["grep", "-l", "linkFixtureNodeModules", "--", "scripts", "tests"],
|
||||
["grep", "-l", "linkFixtureNodeModules", "--", ...selectRepositoryPaths("fixture-code")],
|
||||
{ encoding: "utf8" },
|
||||
);
|
||||
if (
|
||||
|
||||
@@ -45,8 +45,10 @@ import {
|
||||
FIXTURE_PNPM_ENVIRONMENT,
|
||||
linkFixtureNodeModules,
|
||||
} from "./lib/fixture-node-modules.ts";
|
||||
import { selectRepositoryPaths } from "./lib/repository-layout.ts";
|
||||
|
||||
const repositoryRoot = process.cwd();
|
||||
const UNCOPIED_ROOTS = selectRepositoryPaths("supply-chain-fixture-skip");
|
||||
const fixtureRoot = await mkdtemp(path.join(tmpdir(), "provider-exact-five-fixture-"));
|
||||
try {
|
||||
await cp(repositoryRoot, fixtureRoot, {
|
||||
@@ -55,7 +57,7 @@ try {
|
||||
const relative = path.relative(repositoryRoot, source);
|
||||
if (!relative) return true;
|
||||
const first = relative.split(path.sep)[0];
|
||||
return ![".release", "artifacts", "dist", "node_modules"].includes(first ?? "");
|
||||
return !UNCOPIED_ROOTS.includes(first ?? "");
|
||||
},
|
||||
});
|
||||
await cp(path.join(repositoryRoot, "artifacts"), path.join(fixtureRoot, "artifacts"), {
|
||||
|
||||
@@ -12,6 +12,7 @@ import {
|
||||
type HttpScenarioExpectation,
|
||||
type HttpScenarioReceipt,
|
||||
} from "./lib/http-scenario-evidence.ts";
|
||||
import { selectRepositoryPaths } from "./lib/repository-layout.ts";
|
||||
import { writeValidatedJsonArtifact } from "./lib/validated-json-artifact.ts";
|
||||
import { testEvidenceReportSchema } from "./lib/test-evidence-artifact.ts";
|
||||
|
||||
@@ -381,12 +382,7 @@ if (!fixtureMode && !scenarioOnly) {
|
||||
}
|
||||
}
|
||||
// playwright.dev.config.ts spreads playwright.config.ts.
|
||||
for (const config of [
|
||||
"playwright.config.ts",
|
||||
"playwright.visual.config.ts",
|
||||
"playwright.storybook.config.ts",
|
||||
"playwright.capabilities.config.ts",
|
||||
]) {
|
||||
for (const config of selectRepositoryPaths("playwright-configs")) {
|
||||
if (!(await readFile(config, "utf8")).includes("forbidOnly: true")) {
|
||||
failures.push(`${config}: missing forbidOnly: true, so a committed test.only passes the gate`);
|
||||
}
|
||||
@@ -409,11 +405,7 @@ if (!fixtureMode && !scenarioOnly) {
|
||||
if (facts.visualBaselines < 4) {
|
||||
failures.push("visual baseline requires at least four risk surfaces");
|
||||
}
|
||||
for (const required of [
|
||||
"playwright.storybook.config.ts",
|
||||
"playwright.visual.config.ts",
|
||||
"tests/storybook/workshop.spec.ts",
|
||||
]) {
|
||||
for (const required of selectRepositoryPaths("visual-evidence")) {
|
||||
if ((await filesBelow(required)).length === 0) {
|
||||
failures.push(`test evidence missing ${required}`);
|
||||
}
|
||||
|
||||
@@ -6,7 +6,10 @@ import { readFileSync } from "node:fs";
|
||||
* entry, and every list of root paths is a named set chosen from it (R2).
|
||||
* Seven places used to keep their own literal lists of root paths, each a
|
||||
* different subset, so moving one root item meant editing all seven
|
||||
* (design-docs repo-structure/04-frontend-layout.md §2.4).
|
||||
* (design-docs repo-structure/04-frontend-layout.md §2.4); about twenty more
|
||||
* lists followed on 2026-11-11. An untracked item (node_modules, dist, other
|
||||
* worktrees) has an entry only when a set names it, such as the items a copy
|
||||
* of the checkout skips.
|
||||
*/
|
||||
|
||||
export const REPOSITORY_LAYOUT_SETS = Object.freeze([
|
||||
@@ -17,6 +20,18 @@ export const REPOSITORY_LAYOUT_SETS = Object.freeze([
|
||||
"scale-source",
|
||||
"vite-build",
|
||||
"typescript-only",
|
||||
"checkout-copy-skip",
|
||||
"provider-fixture-skip",
|
||||
"supply-chain-fixture-skip",
|
||||
"fixture-code",
|
||||
"package-manifest",
|
||||
"playwright-configs",
|
||||
"visual-evidence",
|
||||
"documentation-inputs",
|
||||
"agent-harness",
|
||||
"feature-typecheck",
|
||||
"product-typecheck",
|
||||
"app-typecheck",
|
||||
] as const);
|
||||
export type RepositoryLayoutSet = (typeof REPOSITORY_LAYOUT_SETS)[number];
|
||||
|
||||
@@ -27,6 +42,7 @@ export const REPOSITORY_LAYOUT_KINDS = Object.freeze([
|
||||
"document",
|
||||
"history",
|
||||
"output",
|
||||
"untracked",
|
||||
] as const);
|
||||
export type RepositoryLayoutKind = (typeof REPOSITORY_LAYOUT_KINDS)[number];
|
||||
|
||||
@@ -49,6 +65,18 @@ export const REPOSITORY_LAYOUT_FILE = "config/repository-layout.json";
|
||||
export function parseRepositoryLayout(value: unknown): readonly RepositoryLayoutEntry[] {
|
||||
const document = record(value, "layout");
|
||||
if (document["schemaVersion"] !== 1) throw new Error("layout: schemaVersion must be 1");
|
||||
// Each kind and set the code knows is described once in the file, and the file names no other.
|
||||
for (const [field, known] of [
|
||||
["kinds", REPOSITORY_LAYOUT_KINDS],
|
||||
["sets", REPOSITORY_LAYOUT_SETS],
|
||||
] as const) {
|
||||
if (!(field in document)) continue;
|
||||
const described = Object.keys(record(document[field], `layout.${field}`)).sort();
|
||||
const expected = [...known].sort();
|
||||
if (described.join() !== expected.join()) {
|
||||
throw new Error(`layout.${field} must describe exactly ${expected.join(", ")}; it has ${described.join(", ")}`);
|
||||
}
|
||||
}
|
||||
const entries = document["entries"];
|
||||
if (!Array.isArray(entries) || entries.length === 0) {
|
||||
throw new Error("layout: entries must be a non-empty array");
|
||||
@@ -66,6 +94,9 @@ export function parseRepositoryLayout(value: unknown): readonly RepositoryLayout
|
||||
if (!(REPOSITORY_LAYOUT_KINDS as readonly string[]).includes(kind)) {
|
||||
throw new Error(`${at}.kind: unknown kind ${kind}`);
|
||||
}
|
||||
if (kind === "untracked" && entry["optional"] !== true) {
|
||||
throw new Error(`${at}: an untracked item may be absent, so it is optional`);
|
||||
}
|
||||
const sets = (entry["sets"] ?? []) as unknown;
|
||||
if (!Array.isArray(sets)) throw new Error(`${at}.sets must be an array`);
|
||||
const setPaths = record(entry["setPaths"] ?? {}, `${at}.setPaths`);
|
||||
|
||||
Reference in New Issue
Block a user