Files
clean-architecture-frontend…/tests/unit/changelog-review-ids.test.ts
T
DongHyeonka b834b8d7ec docs(changelog): 리뷰 README 절과 영역 문서 ID의 꼴을 머리에 적고 테스트한다
문제
CHANGELOG 머리는 리뷰 ID를 `MMDD/NN-MM`과 `F-N`으로만 정한다. 본문에는
`1101 README 14.3`, `1103 07 영역 P-07-06`, `백엔드 리뷰 1101/02-01`,
"리뷰 조치 X2"가 섞여 있다. 마지막은 라운드가 없어 어느 리뷰인지 찾을 수
없다. changelog-review-ids 테스트는 `NN-MM`·`F-N`만 본다(1101/14-02 잔여).

고른 방법
- 머리에 세 꼴을 적었다: `MMDD README N.N`(다시 돌린 항목은 뒤에 `X2`),
  `MMDD NN 영역 P-NN-NN`, `백엔드 리뷰 MMDD/NN-MM`. 지금 본문의 참조는 이
  꼴이다.
- "리뷰 조치 X2"를 `1103 README 14.6 X2`로 고쳤다(2fef27d 등의 Refs가 그
  절을 가리킨다).
- 테스트 "cites README sections and other review references with their
  round": 괄호 안 토큰 중 README 절·X 번호·P-ID·백엔드 리뷰를 담은 것이 이
  꼴과 다르면 실패한다.
- 버린 대안: README 절도 `MMDD/README-14.3` 같은 한 꼴로 바꾸기. 본문 9곳과
  커밋 Refs의 쓰임을 함께 바꿔야 해서 얻는 것보다 바꿀 것이 많다.

위험·한계
- 괄호 밖에 적은 참조는 보지 않는다(기존 테스트와 같다).

검증
- desktop batch에서 확인: node scripts/run-vitest.ts run
  tests/unit/changelog-review-ids.test.ts
  RED: 부모 CHANGELOG에서 새 테스트가 ["리뷰 조치 X2"]로 실패한다.

Refs: 1101/14-02
2026-11-06 02:59:02 +09:00

51 lines
2.1 KiB
TypeScript

import { readFile } from "node:fs/promises";
import { describe, expect, it } from "vitest";
/**
* 1101/14-02. Every review round numbers its findings `NN-MM`, so `(14-02)`
* names a different defect in each round. The CHANGELOG is how a copied
* project finds the reason for a change, so each ID there carries its round:
* `MMDD/NN-MM`, the month and day of the round's review folder (`F-N` is that
* round's FOLLOW-UP list). The review folders are deletable history, so this
* reads only the CHANGELOG.
*/
async function parenthesizedTokens(): Promise<string[]> {
const changelog = await readFile("CHANGELOG.md", "utf8");
return [...changelog.matchAll(/\(([^()]*)\)/gu)].flatMap((match) =>
(match[1] ?? "").split(",").map((token) => token.trim()),
);
}
describe("review IDs in CHANGELOG.md (1101/14-02)", () => {
it("names the review round of every finding ID", async () => {
const tokens = await parenthesizedTokens();
const ids = tokens.filter((token) =>
/^(?:\d{4}\/)?(?:\d{2}-\d{2}(?:~\d{2}-\d{2})?|F-\d+)$/u.test(token),
);
expect(ids.length).toBeGreaterThan(0);
expect(ids.filter((id) => !/^\d{4}\//u.test(id))).toEqual([]);
});
// The other references the CHANGELOG cites, in the shapes its header
// defines: a section of a round's README (`1101 README 14.3`, a re-run item
// after it: `1103 README 14.6 X2`), an ID an area document numbers itself
// (`1103 07 영역 P-07-06`) and the paired backend's review
// (`백엔드 리뷰 1101/02-01`). A reference without its round, such as
// "리뷰 조치 X2", named no review a reader could find.
it("cites README sections and other review references with their round", async () => {
const references = (await parenthesizedTokens()).filter((token) =>
/README \d|\bX\d|P-\d{2}-\d{2}|백엔드 리뷰/u.test(token),
);
expect(references.length).toBeGreaterThan(0);
expect(
references.filter(
(token) =>
!/^(?:\d{4} README \d+(?:\.\d+)*(?: X\d+)?|\d{4} \d{2} 영역 P-\d{2}-\d{2}|백엔드 리뷰 \d{4}\/\d{2}-\d{2})$/u.test(
token,
),
),
).toEqual([]);
});
});