From 444535920f6d79135ec69d5fa2a6c117fcc5a356 Mon Sep 17 00:00:00 2001 From: DongHyeonka Date: Fri, 20 Nov 2026 07:23:36 +0900 Subject: [PATCH 1/2] =?UTF-8?q?fix(checkers):=20=EC=A0=9C=EA=B1=B0=20?= =?UTF-8?q?=EC=82=AC=EB=B3=B8=20=EC=A4=80=EB=B9=84=EA=B0=80=20=EC=97=86?= =?UTF-8?q?=EB=8A=94=20=EC=84=A0=ED=83=9D=20=ED=95=AD=EB=AA=A9=EC=9D=80=20?= =?UTF-8?q?=EA=B1=B4=EB=84=88=EB=9B=B0=EA=B3=A0=20=EC=97=86=EB=8A=94=20?= =?UTF-8?q?=ED=95=84=EC=88=98=20=ED=95=AD=EB=AA=A9=EC=9D=80=20=EB=93=B1?= =?UTF-8?q?=EB=A1=9D=EB=B6=80=EB=A1=9C=20=EB=8C=84=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 문제: 제거 drill의 사본 준비(`scripts/lib/removal-fixture.ts` `prepareRemovalFixture`)는 등록부(`config/repository-layout.json`)의 `fixture-copy` 경로(문서 drill은 `fixture-documents`도)를 `cp`로 복사한다. checkout에 없는 경로가 하나라도 있으면 cp의 ENOENT 스택으로 끝나 drill이 시작도 못 한다. 등록부가 `optional`(「drill이나 제품 사본에 없을 수 있다, 고를 때 없으면 건너뛴다」)로 적은 `recipes`가 없어도 그랬다. 고른 방법: - 복사 전에 경로마다 `lstat`한다. ENOENT면 첫 경로 조각으로 등록부 항목을 찾는다(루트 항목은 슬래시가 없고 `setPaths`는 그 항목 아래라서 첫 조각이 항목이다). - `optional` 항목이면 건너뛴다. - 아니면 실패 줄을 모은다. 루트 항목은 「entry <항목> is not optional, … restore it or remove the entry」, 안쪽 경로는 「entry <항목> selects it in setPaths …, remove it from that entry's setPaths」다. 등록부가 고르지 않는 경로는 「no … entry selects it」로 댄다. - 모은 줄이 있으면 사본 폴더를 비우기 전에 한 번에 던진다. - ENOENT가 아닌 오류(경로 중간이 파일이라 ENOTDIR 등)는 그대로 던진다. 등록부가 설명할 수 있는 오류가 아니라서다. - 문서 시험을 지울지는 실제로 복사한 목록으로 판정한다 (`removalFixtureExcludedTests(present)`). - 새 시험은 건너뛸 항목을 등록부에서 고른다(추적하고 `fixture-copy`가 고르는 첫 `optional` 항목, 지금은 `recipes`). 루트 이름을 손으로 쓴 목록이면 R2 검사(`tests/unit/repository-layout.test.ts`)가 잡는다. - 매뉴얼 03 R1에 추적하는 항목의 `optional` 뜻과 사본 준비 동작을 더한다. 버린 것: - 손으로 복사하는 다른 곳처럼 없는 경로를 모두 건너뛰기: drill이 필수 설정 없이 돌아 다른 자리에서 엉뚱하게 실패한다. - 첫 없는 경로에서 바로 던지기: 여러 개를 지운 제품이 하나씩 고쳐 가며 다시 돌아야 한다. - 시험 목록을 `MADE_UP_REPOSITORY_LISTS`에 이유와 함께 적어 R2를 넘기기: 등록부에서 고르면 예외 없이 되고 등록부가 바뀌어도 따라간다. 위험·한계: 모든 경로가 있으면 동작은 전과 같다. 문서 시험 판정을 `present`로 바꾼 것은 지금 등록부로는 닿지 않는다(문서 항목이 모두 필수라 없으면 먼저 멈춘다). 그래서 그것을 지키는 시험은 없다. 검증(desktop `scripts/verify.sh`, 깨끗한 worktree): - RED: 기준 5f9309a1(1292fd84와 removal-fixture·등록부가 같다) + 새 시험 → 「선택 항목을 건너뜀」·「필수 경로를 등록부로 댐」 둘이 cp의 `ENOENT: … lstat 'recipes'`로 실패. ENOTDIR 시험은 기준에서도 통과 (지키는 시험). - 리뷰 반영분 RED: 반영 전 트리 + 새 시험 → 새 문구 단언만 실패. - 변이 7건, 각자 겨눈 시험이 실패: optional 건너뛰기를 끔, 모든 lstat 오류를 없음으로 봄, 첫 줄만 보고, 요청 목록을 그대로 복사, setPaths 확인을 지움, 검사를 rm 뒤로, mkdir 뒤로 옮김(뒤 둘은 표시 파일 단언이 잡는다). - GREEN: `tests/unit/removal-fixture.test.ts` + `tests/unit/repository-layout.test.ts` 3회 연속 26 통과. `lint`· `check:types` rc=0. 시험 timeout은 merge 실행의 FE-GATE-005 test:unit에서 잰 최장 594ms(부하 4, test:coverage는 더 짧음). - merge 단계와 main 단계 게이트는 PR 본문에 적는다. Refs: fe-ci-next (3a) --- docs/manual/03-outside-feature-folder.md | 2 +- scripts/lib/removal-fixture.ts | 57 ++++++++++- tests/unit/removal-fixture.test.ts | 115 +++++++++++++++++++++++ 3 files changed, 170 insertions(+), 4 deletions(-) diff --git a/docs/manual/03-outside-feature-folder.md b/docs/manual/03-outside-feature-folder.md index 0d64202d..1d926905 100644 --- a/docs/manual/03-outside-feature-folder.md +++ b/docs/manual/03-outside-feature-folder.md @@ -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`을 목록 전체로 도는지 | diff --git a/scripts/lib/removal-fixture.ts b/scripts/lib/removal-fixture.ts index 7cff1aee..b83a7052 100644 --- a/scripts/lib/removal-fixture.ts +++ b/scripts/lib/removal-fixture.ts @@ -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 { + 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 { + 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); diff --git a/tests/unit/removal-fixture.test.ts b/tests/unit/removal-fixture.test.ts index b144809f..c3bd9f6e 100644 --- a/tests/unit/removal-fixture.test.ts +++ b/tests/unit/removal-fixture.test.ts @@ -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) { + 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)); +}); -- 2.54.0 From f102e022007ac1a4154bc0919be43e182e29e78d Mon Sep 17 00:00:00 2001 From: DongHyeonka Date: Fri, 20 Nov 2026 09:38:31 +0900 Subject: [PATCH 2/2] =?UTF-8?q?docs(changelog):=20=EC=A0=9C=EA=B1=B0=20?= =?UTF-8?q?=EC=82=AC=EB=B3=B8=20=EC=A4=80=EB=B9=84=EA=B0=80=20=EC=97=86?= =?UTF-8?q?=EB=8A=94=20=EC=84=A0=ED=83=9D=20=ED=95=AD=EB=AA=A9=EC=9D=84=20?= =?UTF-8?q?=EA=B1=B4=EB=84=88=EB=9B=B0=EB=8A=94=20=EA=B2=83=EC=9D=84=20?= =?UTF-8?q?=EC=A0=81=EB=8A=94=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 문제: `44453592`가 제거 drill의 사본 준비 동작을 바꿨는데 변경 이력에 없다. 복사한 프로젝트가 가져갈지 고를 수 없다. 고른 방법: 첫 미출시 절 표의 끝에 한 줄을 더한다. 바뀐 동작(없는 `optional` 항목은 건너뜀, 없는 필수 경로는 등록부 항목과 고칠 곳을 대고 멈춤)과 매뉴얼 03 R1의 새 문장을 적고, 해시는 `44453592`다. 위험·한계: 문서 한 줄이다. 검증: `git merge-base --is-ancestor 44453592 HEAD` 통과. 노트북 `scripts/verify.sh docs`와 desktop `verify:documentation`은 PR 본문에 적는다. Refs: fe-ci-next (3a) --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9a355b8b..23b4d6a1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -57,6 +57,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` → 하네스와 작업 매뉴얼 -- 2.54.0