From f08c93ab2e8d7be2441ebf22b7ddd213a47dcbed Mon Sep 17 00:00:00 2001 From: DongHyeonka Date: Wed, 4 Nov 2026 21:01:33 +0900 Subject: [PATCH] =?UTF-8?q?fix(removal):=20=EB=AC=B8=EC=84=9C=EB=A5=BC=20?= =?UTF-8?q?=EC=9D=BD=EB=8A=94=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20=EC=A0=9C?= =?UTF-8?q?=EC=99=B8=20=EB=AA=A9=EB=A1=9D=EC=9D=84=20=EB=AA=A8=EB=93=A0=20?= =?UTF-8?q?=EC=A0=9C=EA=B1=B0=20=EB=93=9C=EB=A6=B4=EC=9D=B4=20=EA=B0=99?= =?UTF-8?q?=EC=9D=B4=20=EC=93=B4=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 문제 FE-GATE-020의 제거 드릴은 정해진 목록만 fixture에 복사하고, 그 목록에 README.md·CHANGELOG.md·docs/가 없다. 그런데 fixture에서 도는 test:all에는 그 문서를 읽는 테스트 두 개(documentation-readiness, changelog-review-ids)가 들어 있다. sample-removal 드릴만 두 테스트를 지웠고, browser-file-storage·realtime·optional-recipe 드릴은 제거 대상과 무관하게 `test` 검사에서 ENOENT로 항상 실패했다. 세 드릴의 실패는 merge 게이트를 빨갛게 하고 release 단계도 막는다. 고른 방법 - scripts/lib/removal-fixture.ts에 문서 목록 (REMOVAL_FIXTURE_DOCUMENT_TARGETS)과 그 문서를 읽는 테스트 목록 (REMOVAL_FIXTURE_DOCUMENT_TESTS)을 한 번만 둔다. prepareRemovalFixture는 문서를 복사하지 않은 fixture에서 그 테스트를 지운다. 문서를 복사하는 드릴(test:feature-scaffold)에서는 그대로 돈다. - sample-removal 드릴의 자체 제외 두 줄을 지운다. - 버린 대안: 모든 드릴이 문서까지 복사. capability 드릴은 문서가 설명하는 runtime을 지우므로, 문서 테스트가 지운 경로를 실패로 본다. 드릴마다 문서 예외가 필요해진다. 드릴마다 제외를 복사. 지금 고장의 원인(갈라진 목록)을 되풀이한다. - 단위 테스트가 목록을 고정한다: 문서 없이 복사하면 제외, 문서를 복사하면 제외 없음, 제외 대상이 실제로 문서를 읽음, 다섯 드릴이 모두 prepareRemovalFixture를 쓰고 자체 제외 목록을 두지 않음. 위험·한계 - 저장소 루트 문서를 읽는 테스트가 더 생기면 이 목록에 더해야 한다. 더하지 않으면 capability 드릴이 다시 ENOENT로 실패한다(조용히 통과하지는 않는다). - 세 드릴의 실제 실행 결과는 이 커밋 메시지에 적지 않았다(공유 잠금 대기). 검증 - RED: 새 테스트 "is the only exclusion list"가 수정 전 sample 드릴의 자체 목록 때문에 실패. - tests/unit/removal-fixture.test.ts 12건 통과, 바꾼 파일 eslint 통과. Refs: docs/reviews/2026-11-03-maturity-review/02-adapters-browser-files-cache.md 02-06 --- scripts/lib/removal-fixture.ts | 38 ++++++++++++++++++++++++++++ scripts/test-feature-scaffold.ts | 5 ++-- scripts/test-sample-removal.ts | 4 --- tests/unit/removal-fixture.test.ts | 40 ++++++++++++++++++++++++++++++ 4 files changed, 80 insertions(+), 7 deletions(-) diff --git a/scripts/lib/removal-fixture.ts b/scripts/lib/removal-fixture.ts index ed3d2741..efbbf9b3 100644 --- a/scripts/lib/removal-fixture.ts +++ b/scripts/lib/removal-fixture.ts @@ -46,6 +46,41 @@ export const REMOVAL_FIXTURE_COPY_TARGETS = Object.freeze([ * provider suite down with it — twenty-odd failures with one cause. */ +/** + * The repository's documents. A drill that adds or removes a feature copies + * them as well (REMOVAL_FIXTURE_COPY_TARGETS plus these), because the change + * must leave the documents valid (1103/14-04). The capability drills do not: + * the documents describe the capability they delete, and what those drills + * prove is that the code still builds and tests without it. + */ +export const REMOVAL_FIXTURE_DOCUMENT_TARGETS = Object.freeze([ + "README.md", + "CHANGELOG.md", + "docs", +] as const); + +/** + * 1103/02-06. Tests that read REMOVAL_FIXTURE_DOCUMENT_TARGETS. A fixture + * copied without the documents cannot run them: every capability drill + * (FE-GATE-020) failed its `test` check on ENOENT for README.md and + * CHANGELOG.md, whatever the removal did. prepareRemovalFixture deletes them + * from such a fixture, and the repository's own test:unit keeps running them. + * This is the only list; the sample drill used to keep the exclusion to itself. + */ +export const REMOVAL_FIXTURE_DOCUMENT_TESTS = Object.freeze([ + "tests/unit/changelog-review-ids.test.ts", + "tests/unit/documentation-readiness.test.ts", +] as const); + +/** The tests a fixture copied from `copyTargets` cannot run. */ +export function removalFixtureExcludedTests( + copyTargets: readonly string[], +): readonly string[] { + return REMOVAL_FIXTURE_DOCUMENT_TARGETS.every((target) => copyTargets.includes(target)) + ? [] + : REMOVAL_FIXTURE_DOCUMENT_TESTS; +} + /** * Regenerated result trees under `artifacts/`: traces, coverage HTML, recorded * videos and Storybook bundles. They are tens of megabytes and mean nothing to @@ -114,6 +149,9 @@ export async function prepareRemovalFixture( for (const target of copyTargets) { await cp(target, path.join(root, target), { recursive: true }); } + for (const test of removalFixtureExcludedTests(copyTargets)) { + await rm(path.join(root, test), { force: true }); + } await copyReleaseEvidenceTree(process.cwd(), root); runFixtureGit(root, ["init", "--quiet", "--initial-branch=fixture"]); await linkFixtureNodeModules(root); diff --git a/scripts/test-feature-scaffold.ts b/scripts/test-feature-scaffold.ts index 61654558..6348a516 100644 --- a/scripts/test-feature-scaffold.ts +++ b/scripts/test-feature-scaffold.ts @@ -4,6 +4,7 @@ import { createRemovalFixtureRoot, prepareRemovalFixture, REMOVAL_FIXTURE_COPY_TARGETS, + REMOVAL_FIXTURE_DOCUMENT_TARGETS, renderRemovalJunit, requireRemovalFixtureEnvironment, runRemovalFixtureCheck, @@ -32,9 +33,7 @@ try { // verify:documentation and the documentation tests read these. await prepareRemovalFixture(fixtureRoot, [ ...REMOVAL_FIXTURE_COPY_TARGETS, - "README.md", - "CHANGELOG.md", - "docs", + ...REMOVAL_FIXTURE_DOCUMENT_TARGETS, ]); const created = check("create-feature", "create:feature", [FEATURE_ID]); const checks: RemovalCheck[] = [created]; diff --git a/scripts/test-sample-removal.ts b/scripts/test-sample-removal.ts index 81bec4c0..dab5ac93 100644 --- a/scripts/test-sample-removal.ts +++ b/scripts/test-sample-removal.ts @@ -207,10 +207,6 @@ try { "tests/unit/__snapshots__/ci-workflow-generation.test.ts.snap", "tests/unit/removal-fixture.test.ts", "tests/unit/http-scenario-evidence.test.ts", - // They check README.md and CHANGELOG.md, which the fixture does not copy - // (REMOVAL_FIXTURE_COPY_TARGETS); removing a feature does not change them. - "tests/unit/changelog-review-ids.test.ts", - "tests/unit/documentation-readiness.test.ts", ]) { await rm(path.join(fixtureRoot, excludedFixtureTest), { force: true }); } diff --git a/tests/unit/removal-fixture.test.ts b/tests/unit/removal-fixture.test.ts index b117687b..b34457c0 100644 --- a/tests/unit/removal-fixture.test.ts +++ b/tests/unit/removal-fixture.test.ts @@ -8,6 +8,10 @@ import { loadCiGateContract } from "../../scripts/contracts/ci-gates.ts"; import { assertNoRuntimeImports, pruneRemovalFixtureCiContract, + REMOVAL_FIXTURE_COPY_TARGETS, + REMOVAL_FIXTURE_DOCUMENT_TARGETS, + REMOVAL_FIXTURE_DOCUMENT_TESTS, + removalFixtureExcludedTests, removeRuntimeDependentTests, renderRemovalJunit, runtimeImportGraph, @@ -132,6 +136,42 @@ it("rejects pruning that leaves a reduced gate without commands", async () => { })).rejects.toThrow(/commandIds|too small|at least 1/i); }); +// 1103/02-06. Three FE-GATE-020 drills copied the repository without its +// documents and still ran the tests that read them, so each failed its `test` +// check on ENOENT whatever it removed. Only the sample drill excluded them. +describe("document tests in a removal fixture", () => { + it("leaves the document tests out exactly when the documents are not copied", () => { + expect(removalFixtureExcludedTests(REMOVAL_FIXTURE_COPY_TARGETS)) + .toEqual(REMOVAL_FIXTURE_DOCUMENT_TESTS); + expect(removalFixtureExcludedTests([ + ...REMOVAL_FIXTURE_COPY_TARGETS, + ...REMOVAL_FIXTURE_DOCUMENT_TARGETS, + ])).toEqual([]); + }); + + it("names tests that exist and read the documents", async () => { + for (const test of REMOVAL_FIXTURE_DOCUMENT_TESTS) { + await expect(readFile(test, "utf8")).resolves.toMatch(/README\.md|CHANGELOG\.md/u); + } + }); + + it("is the only exclusion list: every drill prepares its fixture through it", async () => { + for (const drill of [ + "scripts/test-sample-removal.ts", + "scripts/test-feature-scaffold.ts", + "scripts/test-browser-file-storage-runtime-removal.ts", + "scripts/test-realtime-runtime-removal.ts", + "scripts/test-optional-recipe-removal.ts", + ]) { + const source = await readFile(drill, "utf8"); + expect(source, drill).toContain("prepareRemovalFixture("); + for (const test of REMOVAL_FIXTURE_DOCUMENT_TESTS) { + expect(source, drill).not.toContain(test); + } + } + }); +}); + describe("release evidence fixture copy", () => { it("keeps the release evidence and leaves the regenerated trees behind", async () => { const { copyReleaseEvidenceTree, RELEASE_EVIDENCE_REGENERATED_TREES } =