# Phase 2: 보안 기반 (Layer 3 전제 조건) 구현

## 태스크 ID: task-903.1
## 한정위임: 구현 → 검증까지 전부 진행

## 배경
자동화 오케스트레이터 통합 구현 계획서(task-901.1)의 Phase 2.
auto_orch.py 동작 전 필수 보안 인프라 확보.

## 필독 자료
- 구현 계획서: `/home/jay/workspace/memory/specs/automation-impl-plan.md` (Phase 2 섹션)
- 자동화 에이전트 설계서: `/home/jay/workspace/memory/specs/automation-agent-spec.md`
- 체크리스트: `/home/jay/workspace/memory/specs/automation-impl-checklist.md`

## 이미 완료된 작업
- ⚠️ `utils/injection_guard.py` 하드블록 패치는 task-900.1에서 완료됨 (InjectionBlockedError + check_content())
- 이 작업에서는 나머지 3개 모듈만 구현

## 산출물 (계획서 Phase 2 중 미완료분)
1. `orchestrator/pipeline_validator.py` — YAML 스키마 검증 + DAG 검증 + 시크릿 스캔 (~80 LOC)
2. `orchestrator/token_ledger.py` — 일일 토큰 한도 + 파이프라인별 예산 (~60 LOC)
3. `orchestrator/event_bus.py` — 원자적 .done 이벤트 소비 (~50 LOC)
4. `orchestrator/__init__.py` — 패키지 초기화

## 검증 기준
- pipeline_validator: 순환 DAG 감지, 시크릿 패턴 차단, 필수 필드 검증
- token_ledger: DAILY_HARD_LIMIT 초과 시 거부
- event_bus: TOCTOU 경합 테스트 (2프로세스 동시 소비 → 1개만 성공)
- pyright 0 에러, pytest 전건 통과

## 파일 경계 (다른 팀과 충돌 방지)
- 이 작업에서 수정 가능: `orchestrator/` 디렉토리 (신규 생성)
- 수정 금지: `scripts/` (1팀 담당), `dashboard/` (5팀 담당), `utils/injection_guard.py` (이미 완료)

## 작업 후 처리
- 보고서: `memory/reports/task-903.1.md`
- task-timer end: `python3 /home/jay/workspace/memory/task-timer.py end task-903.1`
- .done: `touch /home/jay/workspace/memory/events/task-903.1.done`