fix(checkers): 제거 사본 준비가 없는 선택 항목은 건너뛰고 없는 필수 항목은 등록부로 댄다 #73
@@ -150,6 +150,7 @@ Gitea runner에서 merge 단계를 초록으로 만들고, worker를 늘리지
|
||||
| 시험 증거 전체 검사(FE-GATE-008)가 checkout에 없는 Playwright 설정에서 ENOENT 스택으로 죽지 않고, 그 파일과 출처(`config/repository-layout.json`의 `playwright-configs` 항목, 또는 `--playwright-config`)를 대는 실패 줄을 보고서와 로그에 남긴다. 릴리스 증거 토큰을 읽는 `playwright.config.ts`가 없을 때도 같다. 게이트 판정은 그대로 실패다. capability를 지우며 설정 파일만 지우고 등록부 항목을 남기면 이 실패가 난다. 매뉴얼 03 E절이 루트 항목을 지울 때 등록부 항목과 secret-scan `trackedRoots`도 지우라고 적는다 | `scripts/check-test-evidence.ts`, `tests/unit/test-evidence-repository-configs.test.ts`, `docs/manual/03-outside-feature-folder.md` | `439d3271` |
|
||||
| 끊을 곳 없는 긴 RELEASE_ID·build id, 서버의 상관 ID(128자까지)와 item id가 320px 화면을 넘치지 않는다. 지원 참조는 새 `SupportReference` 하나가 그리고(`ui-support-reference`), 홈 런타임 요약·부팅 오류 화면의 값·상세 화면 메타데이터의 값은 `overflow-wrap: anywhere`를 쓴다. 홈은 grid 항목이라 고치기 전 세 엔진에서 594~641px로 넓어졌다. 기능 화면이 지원 참조를 직접 그렸으면 디자인 시스템 배럴의 컴포넌트에 넘긴다. 오류 화면은 `TerminalErrorSurface`·`StatusPage`의 `supportReference`로 넘긴다. `AsyncSurface`의 `supportReference`는 결과를 모르는 저장일 때만 그려지고(`useAppForm().supportReference`), 오류로 끝난 상태는 `failure.requestId`를 스스로 그린다. `SupportReference`는 배럴 밖이다 | `src/presentation/components/support-reference.tsx`, `src/presentation/components/async-surface.tsx`, `src/presentation/templates/page-templates.tsx`, `src/presentation/boundaries/`, `src/presentation/styles/theme/`, `tests/e2e/responsive.spec.ts`, `tests/e2e/generated-feature.spec.ts`, `tests/e2e/support/reflow.ts` | `953e1ca5` |
|
||||
| `scripts/verify.sh`가 RELEASE_ID에 checkout 브랜치 이름을 넣지 않고 CI와 같은 꼴의 고정 ref(`refs/heads/verify-1-1`)를 쓴다. 같은 트리의 FE-GATE-008 결과가 브랜치 이름 길이로 갈렸다 | `scripts/verify.sh`, `scripts/tests/test_verify.py` | `4ab62f81` |
|
||||
| 제거 drill의 사본 준비(`prepareRemovalFixture`)가 checkout에 없는 `optional` 등록부 항목(`recipes`)을 건너뛴다. 없는 필수 경로에서는 cp의 ENOENT 스택 대신, 사본 폴더를 비우기 전에 그 경로와 고르는 등록부 항목, 고칠 곳(경로를 되살리거나 항목을 지우거나 그 항목의 `setPaths`에서 빼기)을 대고 멈춘다. 등록부가 고르지 않는 경로도 이름으로 댄다. 매뉴얼 03 R1이 추적하는 항목도 drill 사본이나 제품 사본에 없을 수 있으면 `optional`로 적으라고 한다 | `scripts/lib/removal-fixture.ts`, `tests/unit/removal-fixture.test.ts`, `docs/manual/03-outside-feature-folder.md` | `44453592` |
|
||||
|
||||
## 미출시 — `8327e221` → 하네스와 작업 매뉴얼
|
||||
|
||||
|
||||
@@ -230,7 +230,7 @@ src/features/product-capabilities.ts (SERVICE_WORKER = ACTIVE)
|
||||
|
||||
| ID | 규칙 | 검사 |
|
||||
| --- | --- | --- |
|
||||
| R1 | 루트 항목은 모두 `config/repository-layout.json`에 있다. 항목마다 종류(source·tool-convention·gate-input·document·history·output), 역할, 읽는 곳을 적는다. 추적하지 않는 항목(`node_modules`, `dist`, 다른 worktree)은 집합이 이름으로 고를 때만 종류 `untracked`, `optional`로 적는다 | `tests/unit/repository-layout.test.ts`(FE-GATE-005). 등록부에 없는 루트 항목이 추적되거나 `untracked` 항목에 추적 파일이 있으면 실패 |
|
||||
| R1 | 루트 항목은 모두 `config/repository-layout.json`에 있다. 항목마다 종류(source·tool-convention·gate-input·document·history·output), 역할, 읽는 곳을 적는다. 추적하지 않는 항목(`node_modules`, `dist`, 다른 worktree)은 집합이 이름으로 고를 때만 종류 `untracked`, `optional`로 적는다. 추적하는 항목도 drill 사본이나 제품 사본에 없을 수 있으면 `optional`로 적는다(`recipes`). 제거 drill의 사본 준비(`prepareRemovalFixture`)는 없는 `optional` 항목을 건너뛴다. 없는 필수 항목은 복사 전에 등록부 항목과 경로를 대고 멈춘다 | `tests/unit/repository-layout.test.ts`(FE-GATE-005). 등록부에 없는 루트 항목이 추적되거나 `untracked` 항목에 추적 파일이 있으면 실패. 사본 준비의 동작은 FE-GATE-005의 단위 시험이 본다 |
|
||||
| R2 | 루트 경로 목록은 등록부의 이름 붙은 집합(`sets`, 하위 경로는 `setPaths`)에서 `selectRepositoryPaths(<집합>)`으로만 고른다. 목록을 코드에 새로 적지 않는다. JSON 정책 파일(`config/security/secret-scan-policy.json`)은 그 집합의 사본을 갖고 시험이 같은지 본다 | 같은 시험. 추적되는 코드 파일 전체에서, 루트 항목이나 그 안 경로만 담은 문자열 배열에 추적되는 루트 이름이 둘 이상이면 실패. 인자 목록은 `--` 뒤의 경로만 본다. 시험이 메모리 안에 만드는 가상 저장소의 목록은 `tests/unit/repository-layout.test.ts`의 `MADE_UP_REPOSITORY_LISTS`에 파일·목록·이유로 적는다. 집합마다 그것을 고르는 코드가 있어야 한다 |
|
||||
| R3 | 추적 파일은 읽는 곳이 있다. `artifacts/`는 출력 전용이라 `.gitkeep`만 추적한다. 사람이 쓴 기록은 `docs/` 아래에 둔다(수동 a11y 기록은 `docs/accessibility/route-reviews/`) | `tests/unit/tracked-artifacts.test.ts`(FE-GATE-005). `config/` 아래 고아 JSON은 리뷰가 본다 |
|
||||
| R4 | 템플릿이나 제품이 넣은 샘플 기능은 `scripts/lib/removable-template-features.ts` 목록에 있고, 복사본에서 지우고 빌드·시험하는 drill로 증명한다. 문서 검사만으로는 안 된다 | `tests/unit/example-feature-rules.test.ts`(FE-GATE-005). FE-GATE-020이 `test:sample-removal`을 목록 전체로 도는지 |
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { spawnSync } from "node:child_process";
|
||||
import {
|
||||
cp,
|
||||
lstat,
|
||||
mkdir,
|
||||
mkdtemp,
|
||||
readFile,
|
||||
@@ -20,7 +21,11 @@ import {
|
||||
linkFixtureNodeModules,
|
||||
} from "./fixture-node-modules.ts";
|
||||
import { generateCiWorkflow } from "../generate-ci-workflow.ts";
|
||||
import { selectRepositoryPaths } from "./repository-layout.ts";
|
||||
import {
|
||||
REPOSITORY_LAYOUT,
|
||||
REPOSITORY_LAYOUT_FILE,
|
||||
selectRepositoryPaths,
|
||||
} from "./repository-layout.ts";
|
||||
|
||||
/**
|
||||
* The fixture-copy set of config/repository-layout.json (R2). It includes the
|
||||
@@ -150,16 +155,62 @@ export function requireRemovalFixtureEnvironment(name: string): string {
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* fe-ci-next (3a). The copy targets `sourceRoot` has. A target of an optional
|
||||
* registry entry (a drill or a product copy may lack it) is left out when
|
||||
* absent. Any other absent target ends the preparation before the fixture is
|
||||
* touched, with the registry entry and field that select it: cp used to end
|
||||
* on its own ENOENT, `recipes` included, and say nothing of the registry.
|
||||
*/
|
||||
async function presentCopyTargets(
|
||||
sourceRoot: string,
|
||||
copyTargets: readonly string[],
|
||||
): Promise<string[]> {
|
||||
const present: string[] = [];
|
||||
const lacking: string[] = [];
|
||||
for (const target of copyTargets) {
|
||||
try {
|
||||
await lstat(path.join(sourceRoot, target));
|
||||
present.push(target);
|
||||
continue;
|
||||
} catch (error) {
|
||||
if ((error as NodeJS.ErrnoException).code !== "ENOENT") throw error;
|
||||
}
|
||||
// Every root item has one entry, and a path a set selects inside one is
|
||||
// under it in the entry's setPaths (repository-layout.ts), so the first
|
||||
// segment names the entry.
|
||||
const entry = REPOSITORY_LAYOUT.find(({ path: item }) => item === target.split("/")[0]);
|
||||
const inSetPaths =
|
||||
entry !== undefined && Object.values(entry.setPaths).some((paths) => paths?.includes(target));
|
||||
if (entry === undefined || (entry.path !== target && !inSetPaths)) {
|
||||
lacking.push(
|
||||
`${target}: the fixture copy names it, but no ${REPOSITORY_LAYOUT_FILE} entry selects it and this checkout has no such path`,
|
||||
);
|
||||
} else if (!entry.optional) {
|
||||
lacking.push(
|
||||
entry.path === target
|
||||
? `${target}: ${REPOSITORY_LAYOUT_FILE} entry ${target} is not optional, but this checkout has no such path; restore it or remove the entry`
|
||||
: `${target}: ${REPOSITORY_LAYOUT_FILE} entry ${entry.path} selects it in setPaths and is not optional, but this checkout has no such path; restore it or remove it from that entry's setPaths`,
|
||||
);
|
||||
}
|
||||
}
|
||||
if (lacking.length > 0) {
|
||||
throw new Error(`removal fixture: this checkout lacks what the fixture copies\n${lacking.join("\n")}`);
|
||||
}
|
||||
return present;
|
||||
}
|
||||
|
||||
export async function prepareRemovalFixture(
|
||||
root: string,
|
||||
copyTargets: readonly string[] = REMOVAL_FIXTURE_COPY_TARGETS,
|
||||
): Promise<void> {
|
||||
const present = await presentCopyTargets(process.cwd(), copyTargets);
|
||||
await rm(root, { recursive: true, force: true });
|
||||
await mkdir(root, { recursive: true });
|
||||
for (const target of copyTargets) {
|
||||
for (const target of present) {
|
||||
await cp(target, path.join(root, target), { recursive: true });
|
||||
}
|
||||
for (const test of removalFixtureExcludedTests(copyTargets)) {
|
||||
for (const test of removalFixtureExcludedTests(present)) {
|
||||
await rm(path.join(root, test), { force: true });
|
||||
}
|
||||
await copyReleaseEvidenceTree(process.cwd(), root);
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import { spawnSync } from "node:child_process";
|
||||
import { existsSync } from "node:fs";
|
||||
import { mkdir, mkdtemp, readdir, readFile, rm, writeFile } from "node:fs/promises";
|
||||
import { tmpdir } from "node:os";
|
||||
import path from "node:path";
|
||||
import { pathToFileURL } from "node:url";
|
||||
|
||||
import { parseAsync } from "@babel/core";
|
||||
import { afterEach, describe, expect, it } from "vitest";
|
||||
@@ -18,6 +20,8 @@ import {
|
||||
renderRemovalJunit,
|
||||
runtimeImportGraph,
|
||||
} from "../../scripts/lib/removal-fixture.ts";
|
||||
import { REPOSITORY_LAYOUT, REPOSITORY_LAYOUT_FILE } from "../../scripts/lib/repository-layout.ts";
|
||||
import { childProcessTimeout } from "../helpers/child-process-timeout.ts";
|
||||
|
||||
const temporaryRoots: string[] = [];
|
||||
|
||||
@@ -301,3 +305,114 @@ describe("removal JUnit report (14-08)", () => {
|
||||
expect(xml.match(/residue:/gu)).toHaveLength(1);
|
||||
});
|
||||
});
|
||||
|
||||
// fe-ci-next (3a). prepareRemovalFixture copied every path it was given with
|
||||
// cp, so a checkout that lacked one ended on cp's ENOENT before the drill
|
||||
// began. That included `recipes`, which the registry marks optional: a drill
|
||||
// or a product copy may lack it, and a selection skips it when absent. Each
|
||||
// run prepares a fixture from a small checkout (the child's working
|
||||
// directory) that has only package.json and an empty node_modules, into a
|
||||
// fixture folder that already exists with a marker file in it, as the one
|
||||
// createRemovalFixtureRoot gives the drills.
|
||||
describe("fixture copy of the registry's paths", () => {
|
||||
/**
|
||||
* Longest desktop run of a test in this block: the last one, in FE-GATE-005's
|
||||
* test:unit of a merge run at load 4 (2026-11-20); their test:coverage runs
|
||||
* there were shorter.
|
||||
*/
|
||||
const PREPARE_MS = 594;
|
||||
const MODULE = pathToFileURL(path.resolve("scripts/lib/removal-fixture.ts")).href;
|
||||
|
||||
async function prepareFrom(targets: readonly string[], arrange?: (checkout: string) => Promise<void>) {
|
||||
const checkout = await mkdtemp(path.join(tmpdir(), "removal-fixture-checkout-"));
|
||||
const parent = await mkdtemp(path.join(tmpdir(), "removal-fixture-root-"));
|
||||
temporaryRoots.push(checkout, parent);
|
||||
await writeFile(path.join(checkout, "package.json"), "{}\n");
|
||||
await mkdir(path.join(checkout, "node_modules"));
|
||||
await arrange?.(checkout);
|
||||
const fixture = path.join(parent, "fixture");
|
||||
await mkdir(fixture);
|
||||
await writeFile(path.join(fixture, "marker"), "made before the preparation\n");
|
||||
const result = spawnSync(
|
||||
process.execPath,
|
||||
[
|
||||
"--input-type=module",
|
||||
"-e",
|
||||
`const { prepareRemovalFixture } = await import(${JSON.stringify(MODULE)});
|
||||
await prepareRemovalFixture(process.env.FIXTURE_ROOT, JSON.parse(process.env.FIXTURE_TARGETS));`,
|
||||
],
|
||||
{
|
||||
cwd: checkout,
|
||||
encoding: "utf8",
|
||||
env: { ...process.env, FIXTURE_ROOT: fixture, FIXTURE_TARGETS: JSON.stringify(targets) },
|
||||
},
|
||||
);
|
||||
return { result, fixture };
|
||||
}
|
||||
|
||||
const optional = (root: string) => REPOSITORY_LAYOUT.find((entry) => entry.path === root)?.optional;
|
||||
// A tracked root item the fixture copy selects and a drill or a product may
|
||||
// lack (recipes when this was written).
|
||||
const lackable =
|
||||
REPOSITORY_LAYOUT.find(
|
||||
(entry) => entry.optional && entry.kind !== "untracked" && entry.sets.includes("fixture-copy"),
|
||||
)?.path ?? "";
|
||||
|
||||
it("skips an optional entry the checkout lacks and prepares the rest", async () => {
|
||||
expect(lackable).not.toBe("");
|
||||
const { result, fixture } = await prepareFrom(["package.json", lackable]);
|
||||
|
||||
expect(result.status, result.stderr).toBe(0);
|
||||
expect(existsSync(path.join(fixture, "package.json"))).toBe(true);
|
||||
expect(existsSync(path.join(fixture, lackable))).toBe(false);
|
||||
expect(existsSync(path.join(fixture, ".git"))).toBe(true);
|
||||
}, childProcessTimeout(PREPARE_MS));
|
||||
|
||||
it("names every other path the checkout lacks with the registry entry that selects it", async () => {
|
||||
expect(lackable).not.toBe("");
|
||||
expect(optional("playwright.capabilities.config.ts")).toBe(false);
|
||||
expect(optional("docs")).toBe(false);
|
||||
expect(optional("not-registered.txt")).toBeUndefined();
|
||||
expect(REPOSITORY_LAYOUT.find((entry) => entry.path === "docs")?.setPaths["fixture-copy"]).toContain(
|
||||
"docs/accessibility/route-reviews",
|
||||
);
|
||||
const { result, fixture } = await prepareFrom([
|
||||
"package.json",
|
||||
lackable,
|
||||
"playwright.capabilities.config.ts",
|
||||
"docs/accessibility/route-reviews",
|
||||
"docs/not-selected",
|
||||
"not-registered.txt",
|
||||
]);
|
||||
|
||||
expect(result.status).not.toBe(0);
|
||||
expect(result.stderr).not.toMatch(/ENOENT/u);
|
||||
expect(result.stderr).toContain(
|
||||
`playwright.capabilities.config.ts: ${REPOSITORY_LAYOUT_FILE} entry playwright.capabilities.config.ts is not optional, but this checkout has no such path; restore it or remove the entry`,
|
||||
);
|
||||
expect(result.stderr).toContain(
|
||||
`docs/accessibility/route-reviews: ${REPOSITORY_LAYOUT_FILE} entry docs selects it in setPaths and is not optional, but this checkout has no such path; restore it or remove it from that entry's setPaths`,
|
||||
);
|
||||
const unselected = (target: string) =>
|
||||
`${target}: the fixture copy names it, but no ${REPOSITORY_LAYOUT_FILE} entry selects it and this checkout has no such path`;
|
||||
expect(result.stderr).toContain(unselected("docs/not-selected"));
|
||||
expect(result.stderr).toContain(unselected("not-registered.txt"));
|
||||
expect(result.stderr).not.toContain(`${lackable}:`);
|
||||
// It ends before the fixture is touched, not after emptying it or halfway
|
||||
// through the copy.
|
||||
expect(existsSync(path.join(fixture, "marker"))).toBe(true);
|
||||
}, childProcessTimeout(PREPARE_MS));
|
||||
|
||||
// Only a missing file is named. Another error (here `docs` is a file, so a
|
||||
// path under it is not a directory entry) is not one the registry explains,
|
||||
// so the preparation still ends on it.
|
||||
it("ends on an error other than a missing file", async () => {
|
||||
const { result } = await prepareFrom(["package.json", "docs/accessibility/route-reviews"], (checkout) =>
|
||||
writeFile(path.join(checkout, "docs"), "not a folder\n"),
|
||||
);
|
||||
|
||||
expect(result.status).not.toBe(0);
|
||||
expect(result.stderr).toMatch(/ENOTDIR/u);
|
||||
expect(result.stderr).not.toContain("this checkout has no such path");
|
||||
}, childProcessTimeout(PREPARE_MS));
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user