Files
clean-architecture-frontend…/tests/unit/deletable-history-documents.test.ts
T
donghyeon.kang 568f332892
frontend-quality-gates / FE-GATE-001 / manifest-lockfile (pull_request) Successful in 1m20s
frontend-quality-gates / FE-GATE-002 / lint (pull_request) Successful in 1m13s
frontend-quality-gates / FE-GATE-003 / typecheck (pull_request) Successful in 1m2s
frontend-quality-gates / FE-GATE-004 / runtime-schema (pull_request) Successful in 1m4s
frontend-quality-gates / FE-GATE-005 / unit (pull_request) Failing after 2m13s
frontend-quality-gates / FE-GATE-006 / component (pull_request) Successful in 1m12s
frontend-quality-gates / FE-GATE-007 / integration (pull_request) Successful in 1m17s
frontend-quality-gates / FE-GATE-010 / architecture (pull_request) Successful in 1m38s
frontend-quality-gates / FE-GATE-011 / build (pull_request) Successful in 57s
frontend-quality-gates / FE-GATE-012 / bundle (pull_request) Successful in 53s
frontend-quality-gates / FE-GATE-013 / security (pull_request) Failing after 36s
frontend-quality-gates / FE-GATE-020 / removability (pull_request) Failing after 12m49s
frontend-quality-gates / FE-GATE-008 / e2e (pull_request) Successful in 9m9s
frontend-quality-gates / FE-GATE-009 / accessibility (pull_request) Failing after 6m43s
frontend-quality-gates / FE-GATE-017 / diagram-review (pull_request) Skipped
frontend-quality-gates / FE-GATE-014 / config-compatibility (pull_request) Skipped
frontend-quality-gates / FE-GATE-028 / manual-accessibility-review (pull_request) Skipped
frontend-quality-gates / FE-GATE-026 / lab-performance (pull_request) Skipped
frontend-quality-gates / FE-GATE-015 / immutable-release-candidate (pull_request) Skipped
frontend-quality-gates / external-vulnerability-provider (pull_request) Skipped
frontend-quality-gates / external-provenance-provider (pull_request) Skipped
frontend-quality-gates / promote-verified-immutable-candidate (pull_request) Skipped
frontend-quality-gates / deploy-promoted-release (pull_request) Skipped
frontend-quality-gates / FE-GATE-019 / hosting-header (pull_request) Skipped
frontend-quality-gates / FE-GATE-021 / runbook-boot-config (pull_request) Skipped
frontend-quality-gates / FE-GATE-022 / runbook-chunk-mismatch (pull_request) Skipped
frontend-quality-gates / FE-GATE-023 / runbook-api-degradation (pull_request) Skipped
frontend-quality-gates / FE-GATE-024 / runbook-telemetry (pull_request) Skipped
frontend-quality-gates / FE-GATE-025 / runbook-release-rollback (pull_request) Skipped
frontend-quality-gates / FE-GATE-018 / field-web-vitals (pull_request) Skipped
chore(merge): 하네스 PR #13이 들어간 main을 받는다
main(d1b9c087)에 하네스 PR #13이 들어가 루트에 `AGENTS.md`, `.claude/`,
`.gitattributes`가 생겼다. 이 브랜치는 그 셋을 루트 등록부에 optional로
미리 적어 두었다.

충돌 둘을 풀었다.
- `scripts/lib/removal-fixture.ts`: main은 문서 복사 목록에 `AGENTS.md`를
  더했고 이 브랜치는 그 목록을 등록부의 `fixture-documents` 집합으로
  바꿨다. 등록부의 `AGENTS.md` 항목에 그 집합을 적었다.
- `tests/unit/template-feature-removal-documents.test.ts`: main은 문서
  목록에 `AGENTS.md`와 옛 a11y 기록 폴더를 더했다. a11y 기록은 이
  브랜치에서 `docs/`로 옮겼으므로 `AGENTS.md`만 남겼다.

등록부의 `AGENTS.md`·`.claude`·`.gitattributes`는 이제 추적되는 항목이라
optional을 빼고 역할을 실제 내용으로 고쳤다. 추적되는 루트 항목과
등록부 항목이 서로 남는 것 없이 같다.

검증(desktop): 커밋별 5검사와 merge 게이트 14개, verify:documentation.
2026-11-11 20:29:01 +09:00

91 lines
3.5 KiB
TypeScript

import { readdir, readFile, stat } from "node:fs/promises";
import path from "node:path";
import { describe, expect, it } from "vitest";
import { selectRepositoryPaths } from "../../scripts/lib/repository-layout.ts";
/**
* README.md, "Files you can delete after copying", tells a new project that
* the build and the gates read none of the history documents except
* `docs/reviews/adapters/INVENTORY.md`. The removal fixtures rely on the same
* promise: they do not copy `docs/`. A test that opens a review document broke
* all three removal checks (fix of 11-04), so the promise is checked here.
* The root instruction files left the list on 2026-11-07: they are the
* template's contract, which a copy keeps (template-contract-documents.test.ts).
*/
// The history-free set of config/repository-layout.json (R2). The registry
// itself names every root item, history documents included (R1); naming a
// root item is not reading it.
const CODE_PATHS = selectRepositoryPaths("history-free");
const LAYOUT_REGISTRY = "config/repository-layout.json";
// Built from pieces so that this file does not match itself.
const REVIEWS = ["docs", "reviews", ""].join("/");
const KEPT = `${REVIEWS}adapters/INVENTORY.md`;
// The 2026-09-25 round's task folder moved into the history folder on
// 2026-11-07 (docs/README.md §3), so the history pattern covers it. A pattern
// for the old root folder would now only catch a product's own route or
// folder of that name.
const DELETABLE = [
new RegExp(`${REVIEWS}(?!adapters/INVENTORY\\.md)`, "u"),
new RegExp(["docs", "superpowers"].join("/"), "u"),
new RegExp(["docs", "history"].join("/"), "u"),
new RegExp(`\\b${"SPEC"}\\.md\\b`, "u"),
];
/**
* 1101/14-01. A section number without a document name cannot be followed,
* and the scale design it meant used to live only in the history bundle a
* copy deletes. Cite it as `scale-architecture.md §N`
* (docs/architecture/scale-architecture.md, a current contract).
*/
const UNNAMED_SECTION = new RegExp(`\\b${"spec"} ?§`, "iu");
async function codeFiles(directory: string): Promise<string[]> {
const entries = await readdir(directory, { withFileTypes: true }).catch(
() => [],
);
const files = await Promise.all(
entries.map(async (entry) => {
const target = path.join(directory, entry.name);
if (entry.isDirectory())
return entry.name === "node_modules" ? [] : codeFiles(target);
return /\.(?:[cm]?[jt]sx?|json|ya?ml)$/u.test(entry.name) ? [target] : [];
}),
);
return files.flat();
}
async function linesMatching(patterns: readonly RegExp[]): Promise<string[]> {
const files = (
await Promise.all(
CODE_PATHS.map(async (entry) =>
(await stat(entry).catch(() => null))?.isDirectory() ? codeFiles(entry) : [entry],
),
)
).flat();
const matches: string[] = [];
for (const file of files) {
if (file === LAYOUT_REGISTRY) continue;
const lines = (await readFile(file, "utf8").catch(() => "")).split("\n");
lines.forEach((line, index) => {
if (patterns.some((pattern) => pattern.test(line)))
matches.push(`${file}:${index + 1}`);
});
}
return matches;
}
describe("deletable history documents", () => {
it("are read by no code, test, script or configuration", async () => {
expect(await linesMatching(DELETABLE), `only ${KEPT} may be read`).toEqual([]);
});
it("are not cited as an unnamed design section", async () => {
expect(
await linesMatching([UNNAMED_SECTION]),
"name the document: scale-architecture.md §N",
).toEqual([]);
});
});