---
task_id: task-2434
type: plan
scope: task
created: 2026-05-03
updated: 2026-05-04
status: completed
---

# 계획서: task-2434

**task**: task-2434
**목표**: "가드 없는 merge 금지" 시스템 규칙을 강제할 최소 안전장치 3개(`task_scope.py`, `pre_push_guard.py`, `qc_report_guard.py`) + 통합 CLI(`guard.sh`)를 빌드·테스트·실작동 검증한다.
**승인**: 회장 2026-05-03 "가드 없는 merge는 금지 — 이번 결정은 단순 일정 변경이 아니라 시스템 규칙을 세우는 것이다."
**근거**: `/home/jay/workspace/memory/tasks/task-2434.md`, task-2429 PR #98 자동 revert 사고, task-2431 보고서 OVERALL PASS vs JSON WARN 불일치 사고.

---

## 목표

다음 4개 구성요소를 빌드 · 회귀테스트 · 실작동 시뮬레이션까지 완료한다.

1. `scripts/task_scope.py` — `git diff --name-only base..HEAD` 기반 changed_paths 분류 + scope_matrix 산출
2. `scripts/pre_push_guard.py` — push 직전 4가지 검사 (working tree clean / ahead-behind / scope 일치 / 보고서-qc JSON 일치)
3. `scripts/qc_report_guard.py` — `events/<task>.qc-result` JSON ↔ `reports/<task>.md` 상태 표현 일치 검사
4. `scripts/guard.sh` — Phase 1 명령(scope/pre-push/qc-check) + Phase 2/3 자리표시(NotImplementedError)

## 범위

### 포함
- 신규 파일 4개 (가드 3개 + guard.sh)
- 회귀 테스트 3개 파일 (총 16+ 시나리오)
- 실 작동 시뮬레이션 3종 (정상 PASS / 사고 A / 사고 B / 사고 C)
- 회장 4대 규칙(빌드 · 배포 · 실작동 · confirm) 충족

### 제외 (다음 페이즈 이후)
- `post_merge_probe.py` 개선 (Phase 2)
- `merge_queue` 도입 (Phase 2)
- `auto_revert.py`, `auto_merge.py` 변경 (Phase 3)
- worktree + task branch 자동화 (Phase 3)
- task-2433 재위임은 본 task 머지 후 별도 진행 (회장 명시 후속 시퀀스)

## 위임 계획

- Phase A/B/C 구현(가드 3개 + guard.sh): **토르(백엔드)** — Sonnet — 스크립트 4개 신규 작성 + 유닛 테스트 fixture 협업
- Phase A/B/C 회귀 테스트(16+ 시나리오): **헤임달(테스터)** — Sonnet — 3개 테스트 파일 작성 (토르 구현 직후 병렬)
- Phase E 실 작동 시뮬레이션(사고 A/B/C 차단 확인): **오딘(팀장)** — 통합 검증 단계, dummy task 시뮬레이션 직접 실행
- 디자인 작업: 없음 (시스템 인프라)

## 검증 기준

- 빌드: `python3 -m py_compile scripts/task_scope.py scripts/pre_push_guard.py scripts/qc_report_guard.py` → rc=0
- 배포: `chmod +x scripts/guard.sh && ./scripts/guard.sh scope --help` → 사용법 출력
- 회귀: `python3 -m pytest tests/scripts/test_task_scope.py tests/scripts/test_pre_push_guard.py tests/scripts/test_qc_report_guard.py -v` → 16+ PASS
- 실 작동 시뮬레이션 A: dummy task의 working tree에 task 무관 modified가 있을 때 `pre_push_guard` rc=1
- 실 작동 시뮬레이션 B: dummy task의 qc-result=WARN + 보고서=OVERALL PASS일 때 `qc_report_guard` rc=1
- 실 작동 시뮬레이션 C: extension PR에 server/ 변경이 섞이면 `task_scope` 결과로 `pre_push_guard` rc=1
- 메타 규칙: 본 task 자체가 push될 때 가드 3개 통과해야 함
