fix(removal): 새 드릴 가드 테스트가 제거 fixture 안에서도 성립한다
문제
capability 제거 드릴의 fixture도 test:unit을 돈다. 앞 커밋들이 더한 가드
테스트 두 개가 그 안에서 실패했다.
- removal-fixture.test.ts: 문서 테스트 파일과 드릴 스크립트를 이름으로 읽는데,
fixture는 문서 테스트를 지우고(02-06) 드릴은 자기 스크립트를 지운다.
browser-file-storage·realtime 드릴이 이 두 건으로 `test` 검사에서 실패했다.
- feature-scaffold-drill: 제거 드릴이 자기 capability 명령을 계약에서 빼면,
scaffold 드릴 제외 목록의 그 스크립트가 "merge 단계에 없음"으로 실패한다.
고른 방법
- 문서 테스트는 "문서가 있는 곳에만 있다"를 단언한다(저장소: 둘 다 있음,
capability fixture: 둘 다 없음).
- 드릴 목록은 scripts/test-*.ts 중 removal-fixture.ts를 import하는 파일로 찾고,
sample·scaffold 드릴이 그 안에 있는지 확인한다.
- 제외 목록이 낡았다는 판정은 계약에 있으나 merge 단계 밖인 명령에만 한다.
계약에서 아예 빠진 명령(제거 드릴이 정리한 capability)은 낡은 것이 아니다.
위험·한계
- 계약에서 지운 스크립트의 제외 항목이 저장소에 남아도 이 검사는 알리지
않는다. 남아도 아무 명령을 숨기지 않는다.
검증
- 수정 전 snapshot(0edc3fc)에서 test:browser-file-storage-removal,
test:realtime-removal 모두 이 두 테스트로 exit 1(ENOENT).
- 수정 뒤 removal-fixture·feature-scaffold-drill 18건 통과, eslint·tsc 통과.
Refs: docs/reviews/2026-11-03-maturity-review/02-adapters-browser-files-cache.md 02-06
Refs: docs/reviews/2026-11-03-maturity-review/12-guardrails-ci.md 12-02
This commit is contained in:
@@ -88,12 +88,16 @@ export function scaffoldDrillCommands(
|
||||
}));
|
||||
}
|
||||
}
|
||||
// An exclusion the merge stage no longer runs would hide nothing today and
|
||||
// silently drop the command if it came back under the same name.
|
||||
const stale = Object.keys(excluded).filter((script) => !mergeScripts.has(script));
|
||||
// An exclusion for a command that moved out of the merge stage would hide
|
||||
// nothing today and silently drop it if it came back. A command the contract
|
||||
// no longer has at all (a removal drill pruned its capability) is not stale.
|
||||
const contractScripts = new Set(contract.commands.map(({ script }) => script));
|
||||
const stale = Object.keys(excluded).filter(
|
||||
(script) => contractScripts.has(script) && !mergeScripts.has(script),
|
||||
);
|
||||
if (stale.length > 0) {
|
||||
throw new TypeError(
|
||||
`the scaffold drill excludes scripts the merge stage does not run: ${stale.join(", ")}`,
|
||||
`the scaffold drill excludes scripts the contract runs outside the merge stage: ${stale.join(", ")}`,
|
||||
);
|
||||
}
|
||||
return Object.freeze(selected);
|
||||
|
||||
Reference in New Issue
Block a user