문제: 문서를 복사하지 않는 capability 드릴 셋은 `REMOVAL_FIXTURE_DOCUMENT_TESTS` 의 파일을 통째로 지운다. 문서를 읽는 테스트 하나 때문에 `backend-contract-pin.test.ts`가 목록에 들어가, config와 코드만 보는 나머지 14건(pin 커밋, 답 표 사본, 생성기 사실, Envelope 판정 대조)도 그 드릴에서 돌지 않는다. `feature-tracked-files.test.ts`의 생성기 목록 검사 1건도 같다. 목록을 지키는 검사는 파일 글자에 `README.md|CHANGELOG.md|docs/`가 있는지만 봐서, `backend-contract-pin.test.ts`는 주석 한 줄로 통과했다. 고른 방법(리뷰 문서 ⓐ+ⓑ): - 6.1 표를 읽는 테스트를 `backend-contract-pin-document.test.ts`로 옮기고 목록에는 그 파일을 둔다. pin 파일은 목록에서 빠져 모든 드릴에서 돈다. 새 파일은 pin에서 문서 경로만 읽고, 그 경로가 `docs/` 아래인지 확인한다. - `feature-tracked-files.test.ts`의 문서와 무관한 1건을 `feature-tracked-file-rewrites.test.ts`로 옮긴다. 남은 두 건은 모두 문서를 읽어 그 파일은 목록에 남는다(`create-feature.ts`의 참조도 그대로 맞다). - 목록 검사는 Babel로 파일을 파싱해 코드의 문자열·템플릿 리터럴에 문서 경로가 있는지 본다. 주석은 세지 않는다. 주석만 있는 소스를 거절하는지 자체 테스트를 더했다. - 6.1 대조를 가리키던 `external-contract-runtime.ts` 주석과 계약 문서 한 줄을 새 파일 이름으로 고쳤다. 버린 대안: capability 드릴이 계약 문서 하나만 복사하기. 문서 테스트가 늘 때마다 복사 목록이 늘고, 그 드릴이 "문서 없이"를 증명한다는 전제가 흐려진다. 목록 검사만 고치기는 빠지는 범위가 그대로다. 위험·한계: - 목록 검사는 파일 단위다. 파일 안의 모든 테스트가 문서를 읽는지는 기계로 보지 않는다. 목록 주석에 규칙을 적었다. - 검사는 코드에 문서 경로 문자열이 있는지 본다. 그 문자열로 실제로 읽는지는 보지 않는다. - 이 노트북에서는 실행하지 못했다. 검증: desktop batch에서 확인. node scripts/run-vitest.ts run tests/unit/removal-fixture.test.ts tests/unit/backend-contract-pin.test.ts tests/unit/backend-contract-pin-document.test.ts tests/unit/feature-tracked-files.test.ts tests/unit/feature-tracked-file-rewrites.test.ts check:types, lint, verify:documentation, ci:gate FE-GATE-020(capability 드릴 셋의 unit 실행에 pin 14건이 나오는지) Refs: 1106/12-01
57 lines
2.5 KiB
TypeScript
57 lines
2.5 KiB
TypeScript
import { readFile } from "node:fs/promises";
|
|
|
|
import { describe, expect, it } from "vitest";
|
|
|
|
import { FEATURE_TRACKED_FILE_REWRITES } from "../../scripts/create-feature.ts";
|
|
|
|
/**
|
|
* 1105/16-01. Adding a feature changes two tracked template files: the dev
|
|
* server's manifest (`create:feature` rewrites it) and, while the sample is
|
|
* installed, the initial JavaScript record (rewritten by command). The 03
|
|
* manual's section A said the command writes two files outside the feature
|
|
* folder and named neither, the canonical table in starter-experience.md
|
|
* had neither, and nothing said what to do when two feature branches change
|
|
* the same `setDigest` line. The documents name each file with the command
|
|
* that rewrites it, which is also how a merge conflict on it is resolved.
|
|
*
|
|
* 1106/12-01. Every test here reads a document, so the removal drills that
|
|
* copy no documents leave this file out (REMOVAL_FIXTURE_DOCUMENT_TESTS in
|
|
* scripts/lib/removal-fixture.ts). The generator's own list is checked in
|
|
* tests/unit/feature-tracked-file-rewrites.test.ts, which every drill runs.
|
|
*/
|
|
function between(text: string, start: string, end: string): string {
|
|
const from = text.indexOf(start);
|
|
const to = text.indexOf(end, from + start.length);
|
|
if (from < 0 || to < 0) throw new Error(`no section from "${start}" to "${end}"`);
|
|
return text.slice(from, to);
|
|
}
|
|
|
|
describe("tracked files a feature changes (1105/16-01)", () => {
|
|
it("names each file and its rewrite command in the 03 manual's section A", async () => {
|
|
const section = between(
|
|
await readFile("docs/manual/03-outside-feature-folder.md", "utf8"),
|
|
"## A. 생성 명령이 만든다",
|
|
"## B. ",
|
|
);
|
|
for (const file of FEATURE_TRACKED_FILE_REWRITES) {
|
|
expect(section, file.path).toContain(file.path);
|
|
expect(section, file.path).toContain(file.command);
|
|
}
|
|
expect(section).toMatch(/충돌/u);
|
|
});
|
|
|
|
it("names each file and its rewrite command in the canonical table", async () => {
|
|
const table = between(
|
|
await readFile("docs/architecture/starter-experience.md", "utf8"),
|
|
"Files outside the feature directory.",
|
|
"The central catalogs",
|
|
);
|
|
for (const file of FEATURE_TRACKED_FILE_REWRITES) {
|
|
const row = table.split("\n").find((line) => line.startsWith("|") && line.includes(file.path));
|
|
expect(row, file.path).toBeDefined();
|
|
expect(row, file.path).toContain(file.command);
|
|
expect(row, file.path).toMatch(/merge conflict/u);
|
|
}
|
|
});
|
|
});
|