Files
clean-architecture-frontend…/scripts/lib/promotion-readiness.ts
DongHyeonka 94f8434f85 ci(gates): FE-GATE-020을 merge 단계에서 main 단계로 옮긴다
문제:
프론트 PR 실행 p50이 17.7분으로 15분 목표를 넘고, 기능·scaffold 제거 드릴
FE-GATE-020이 PR 대부분(34건 중 25건)에서 돌아 약 6분을 차지한다.
CI-X-0002 (다) 결정에 따라 FE-GATE-020을 merge 단계에서 main 단계로 옮긴다.

고른 방법과 버린 대안:
- config/ci/gates.json, scripts/contracts/ci-gates.ts(expectedJobOwnership),
  scripts/lib/promotion-readiness.ts(MERGE_READY·MAIN_READY)에서 FE-GATE-020을
  merge/merge_test에서 main/main_gate(FE-GATE-029 다음, FE-GATE-030 앞)로
  옮기고 workflow와 스냅샷을 재생성한다.
- scripts/lib/feature-scaffold-drill.ts는 되돌림 시 재귀를 막으려 자기 스크립트
  (test:sample-removal·test:feature-scaffold)를 제외 목록에 남기되 merge 밖
  stale 거절에서만 면제한다. 고른 드릴 명령 29개는 기존과 같다.
- config/ci/pr-gate-selection.json의 accessibility-records·scaffold 줄에서
  FE-GATE-020을 빼고, scaffold 줄은 되돌림과 계약 시험을 위해 남긴다.
- 버린 대안: FE-GATE-020 전용 드릴 입력 목록(효과 미미·거짓 초록 위험),
  제외 목록에서 자기 스크립트 삭제(되돌림 시 재귀·미사용 상수 발생).

위험·한계:
- 기능·scaffold 드릴 회귀가 PR이 아니라 병합 뒤 main 빨강으로 드러나며,
  release·tag run과 RELEASE_READY도 FE-GATE-020을 요구하지 않는다.
- .claude/skills/fe-structure/SKILL.md:53은 .claude/ 수정 금지 가드로 바꾸지
  않았으며, 같은 안내는 docs/work/reference/gates.md에 반영했다.
- 생성기·드릴·src/features·src/contexts 규칙을 바꾸는 PR은
  scripts/verify.sh gate FE-GATE-020을 직접 돌린다.

검증:
- C1 RED (트리 38592b2283d7): ci-workflow-generation rc=1, promotion-readiness rc=1
- C2 RED (트리 06a01260818a): feature-scaffold-drill rc=1 (outside the merge stage)
- laptop-gate check:types, lint, verify:documentation, 단위 시험 7파일(538 passed) rc=0
- scripts/verify.sh docs rc=0, scripts/verify.sh hooks rc=0 (112 tests)

Refs: CI-FE-0005
2026-12-04 07:45:06 +09:00

79 lines
2.9 KiB
TypeScript

export const PROMOTION_FORMULA = Object.freeze({
MERGE_READY: Object.freeze([
"FE-GATE-001",
"FE-GATE-002",
"FE-GATE-003",
"FE-GATE-004",
"FE-GATE-005",
"FE-GATE-006",
"FE-GATE-007",
"FE-GATE-008",
"FE-GATE-009",
"FE-GATE-010",
"FE-GATE-011",
// 15-01. Bundle budget: a PR that exceeds it is not merge-ready.
"FE-GATE-012",
"FE-GATE-013",
]),
RELEASE_READY: Object.freeze([
"FE-GATE-014",
"FE-GATE-015",
"FE-GATE-026",
// FE-GATE-027. A candidate is only release-ready once it has been admitted
// to a named environment; coherence alone never proved it belonged there.
"FE-GATE-027",
// FE-GATE-028 (08-06). The signed human accessibility review belongs to a
// release candidate, so it gates release; merge checks the record format.
"FE-GATE-028",
]),
PROD_PROMOTION_READY: Object.freeze([
// FE-GATE-019 (13-05, D-14). Live hosting headers of the deployed promoted
// release; the declared-header fixture alone is UNVERIFIED, not PASS.
"FE-GATE-019",
// FE-GATE-016 is retired (D-14): it repeated FE-GATE-025's FE-RB-005 drill.
"FE-GATE-021",
"FE-GATE-022",
"FE-GATE-023",
"FE-GATE-024",
"FE-GATE-025",
]),
FIELD_SLO_READY: Object.freeze(["FE-GATE-018"]),
DOCUMENTATION_READY: Object.freeze(["FE-GATE-017"]),
// F2 (design-docs repo-structure/03-ci.md 7.3). The checkers' negative
// fixtures and the gating coverage check run after a merge to main. They
// test the checkers, not the change, so they hold no promotion.
// FE-GATE-030 (owner decision 2026-11-12 p): the optional runtime removal
// drills moved here from FE-GATE-020. FE-GATE-020 (CI-X-0002 (다) /
// CI-FE-0005) moved here too so PR runs skip the ~6-minute scaffold drill.
// A failure turns main red, and the next pull request fixes it before merge.
MAIN_READY: Object.freeze(["FE-GATE-029", "FE-GATE-020", "FE-GATE-030"]),
});
export type GateResult = "PASS" | "FAIL" | "UNVERIFIED";
export function evaluatePromotionReadiness(
gateResults: Readonly<Record<string, GateResult>>,
) {
const allPass = (gateIds: readonly string[]) =>
gateIds.every((gateId) => gateResults[gateId] === "PASS");
const mergeReady = allPass(PROMOTION_FORMULA.MERGE_READY);
const releaseReady =
mergeReady && allPass(PROMOTION_FORMULA.RELEASE_READY);
const productionReady =
releaseReady && allPass(PROMOTION_FORMULA.PROD_PROMOTION_READY);
const fieldReady =
productionReady && allPass(PROMOTION_FORMULA.FIELD_SLO_READY);
const documentationReady = allPass(PROMOTION_FORMULA.DOCUMENTATION_READY);
const mainReady = allPass(PROMOTION_FORMULA.MAIN_READY);
return Object.freeze({
MERGE_READY: mergeReady,
RELEASE_READY: releaseReady,
PROD_PROMOTION_READY: productionReady,
FIELD_SLO_READY: fieldReady,
DOCUMENTATION_READY: documentationReady,
MAIN_READY: mainReady,
});
}