test(infra): gate protected acceptance tests and ratchet test quality (TDD 2.0 Phase 1)

docs/tdd-red/07-revamp-plan.md Phase 1 — v1.1이 문서로만 선언한 것을 게이트로 옮긴다.

보호 수용 경로 게이트 (check-protected-tests.mjs):
- 06 §5 의 보호 6경로를 base revision 과 비교한다.
- 실패 조건: 테스트/스텝 블록 감소, expect 감소, .only 추가, skip/todo 추가,
  보호 파일 삭제.
- 정당한 스펙 변경은 커밋 본문 `allow-protected-change: <사유>` 또는 --reason 으로만
  통과한다(사람 리뷰 대체 아님). CI quality 잡이 --base HEAD^ 로 실행하며
  체크아웃이 depth 2 로 바뀐다. 얕은 클론에서는 SKIP 사유를 출력한다.

품질 래칫 (check-test-quality.mjs + test-quality-baseline.json):
- 파일별 weak-assertion(toBeDefined/toBeTruthy/toBeFalsy/toBeNull)과
  ambient-time(Date.now/Math.random/performance.now) 수치를 동결하고 증가만 막는다.
- 128 / 203 건을 한 번에 고치지 않고 회귀만 차단한다. --update 는 리뷰 후 실행.

배선: verify:all 에 두 게이트 편입, CI quality 잡 단계 추가,
map/02 §10 · tdd-red/06 §5·§6 · 07 Phase 0-1 상태 갱신.

검증:
- self-test: check-protected-tests 6케이스, check-test-quality 6케이스 통과
- 실제 약화 주입 시 두 게이트가 exit 1 (smoke.spec.ts .only, 약한 단정 추가) 후 원복
- npm run test:hygiene / check:design GREEN, npm test GREEN (2800+605+31+24)
This commit is contained in:
Yun Chan 2026-11-08 21:11:12 +09:00
parent 42583cc96b
commit d3d6f34bfa
9 changed files with 658 additions and 22 deletions

View file

@ -59,6 +59,11 @@
"test:hygiene:test": "node scripts/ci/check-test-hygiene.mjs --self-test",
"test:metrics": "node scripts/ci/test-metrics.mjs",
"test:metrics:write": "node scripts/ci/test-metrics.mjs --write",
"check:protected-tests": "node scripts/ci/check-protected-tests.mjs",
"check:protected-tests:test": "node scripts/ci/check-protected-tests.mjs --self-test",
"test:quality": "node scripts/ci/check-test-quality.mjs",
"test:quality:test": "node scripts/ci/check-test-quality.mjs --self-test",
"test:quality:update": "node scripts/ci/check-test-quality.mjs --update",
"test:acceptance:desktop": "npm run test:e2e --workspace=@d3ro/desktop",
"test:acceptance:web": "npm run test:e2e --workspace=@d3ro/web -- smoke.spec.ts",
"lint": "eslint apps/desktop apps/web apps/admin packages --ext .ts,.tsx --max-warnings=0",
@ -66,7 +71,7 @@
"typecheck:mobile": "npm --prefix apps/mobile-rn run typecheck",
"lint:mobile": "npm --prefix apps/mobile-rn run lint",
"test:mobile": "npm --prefix apps/mobile-rn run test:ci",
"verify:all": "npm run test:hygiene && npm run typecheck && npm run typecheck:mobile && npm run lint && npm run lint:mobile && npm run test && npm run test:mobile && npm run check:design"
"verify:all": "npm run test:hygiene && npm run check:protected-tests && npm run test:quality && npm run typecheck && npm run typecheck:mobile && npm run lint && npm run lint:mobile && npm run test && npm run test:mobile && npm run check:design"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^8.0.0",