fix(removal): CI 스크립트가 없는 기능 제거도 CI 기준선 사유를 만든다
문제 test:sample-removal -- --feature=<id>는 참조 기능이 아닌 기능에 ciScripts: []를 쓴다. pruneRemovalFixtureCiContract가 그 빈 집합으로 기준선 사유를 "removal fixture pruned "(끝 공백)로 만들고, 바로 뒤 기준선 검사가 "leading/trailing whitespace is forbidden"으로 거부한다. 그래서 create:feature로 만든 모든 기능의 제거 드릴이 3초 만에 무관한 오류로 끝나고 게이트 검사는 하나도 돌지 않는다. 고른 방법 - 지운 스크립트가 없으면 사유를 "removal fixture pruned no CI scripts"로 쓴다. - 이 길을 merge 게이트가 돌게 하는 것(test:feature-scaffold가 생성 기능에 --feature 드릴을 한 번 돌림)은 같은 발견의 둘째 절반이라 드릴 범위를 고치는 다음 커밋에서 한다. 위험·한계 - 이 커밋만으로는 제품 기능 제거 드릴 전체를 실행해 보지 않았다. 검증 - RED: 새 테스트 "re-baselines a removal that prunes no CI script" 실패 (reason 'removal fixture pruned '). - 수정 뒤 tests/unit/removal-fixture.test.ts 9건 통과. Refs: docs/reviews/2026-11-03-maturity-review/16-structure-patterns.md 16-02
This commit is contained in:
@@ -465,8 +465,14 @@ export async function pruneRemovalFixtureCiContract(options: Readonly<{
|
||||
]);
|
||||
// D-13: the reduced contract is a new baseline, recorded the way a project
|
||||
// that removes the capability records it; canonical check:ci then applies.
|
||||
// 1103/16-02. A product feature owns no CI script; an empty list used to
|
||||
// leave a trailing blank that the baseline schema refuses.
|
||||
await updateCiContractBaseline(options.root, {
|
||||
owner: "removal-fixture",
|
||||
reason: `removal fixture pruned ${[...options.removedScripts].join(", ")}`,
|
||||
reason: `removal fixture pruned ${
|
||||
options.removedScripts.size === 0
|
||||
? "no CI scripts"
|
||||
: [...options.removedScripts].join(", ")
|
||||
}`,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -92,6 +92,25 @@ it("prunes removed command and evidence references and re-baselines the contract
|
||||
expect(packageDocument.scripts["check:ci"]).not.toMatch(/reduced/u);
|
||||
});
|
||||
|
||||
// 1103/16-02. A product feature owns no CI script, so its removal prunes
|
||||
// nothing. The baseline reason then ended in a blank ("removal fixture pruned
|
||||
// ") and the baseline schema refused it before any gate ran.
|
||||
it("re-baselines a removal that prunes no CI script", async () => {
|
||||
const root = await copyCiContract("removal-fixture-no-scripts-");
|
||||
|
||||
await pruneRemovalFixtureCiContract({
|
||||
root,
|
||||
removedScripts: new Set(),
|
||||
removedEvidencePathFragments: [],
|
||||
});
|
||||
|
||||
const baseline = JSON.parse(
|
||||
await readFile(path.join(root, "config/ci/contract-baseline.json"), "utf8"),
|
||||
) as Record<string, unknown>;
|
||||
expect(baseline["reason"]).toBe("removal fixture pruned no CI scripts");
|
||||
await expect(loadCiGateContract(root)).resolves.toBeDefined();
|
||||
});
|
||||
|
||||
it("rejects a contract that no longer matches its committed baseline", async () => {
|
||||
const root = await copyCiContract("removal-fixture-baseline-drift-");
|
||||
const baselinePath = path.join(root, "config/ci/contract-baseline.json");
|
||||
|
||||
Reference in New Issue
Block a user