# task-202.1 완료 보고서: QC 검증 범위 수정 — 코딩 작업에만 적용

## 작업 개요
`team_prompts.py`의 QC 검증 섹션이 모든 작업에 포함되던 것을 **코딩 작업에만** 적용되도록 수정

## 배경
제이회장님 지시: "단순 확인, 점검, 리서치 등의 업무에도 qc검증 진행해?? 코딩결과에만 하는거 아닌가???"

## 수정 내용

### 1. team_prompts.py 수정

**`build_prompt()` 함수에 `task_type` 파라미터 추가:**
```python
def build_prompt(
    team_id: str, 
    task_id: str, 
    task_desc: str, 
    level: str = "normal", 
    project_id: Optional[str] = None, 
    chain_id: Optional[str] = None, 
    task_type: str = "coding"  # NEW
) -> str:
```

**QC 섹션 조건부 추가:**
```python
# 코딩 작업에만 QC 섹션 포함
if task_type == "coding":
    prompt += _build_verification_section(level)
```

### 2. dispatch.py 수정

**`build_prompt()` 함수에 `task_type` 파라미터 추가:**
```python
def build_prompt(..., task_type: str = "coding") -> str:
    return _build_team_prompt(..., task_type=task_type)
```

**`dispatch()` 함수에 `task_type` 파라미터 추가:**
```python
def dispatch(..., task_type: str = "coding") -> dict:
```

**CLI에 `--type` 인자 추가:**
```python
parser.add_argument(
    "--type",
    default="coding",
    choices=["coding", "research", "check"],
    help="작업 유형 - coding: QC 검증 포함, research/check: QC 검증 제외 (기본: coding)",
)
```

## 사용법

### 코딩 작업 (QC 포함, 기본값)
```bash
python3 dispatch.py --team dev1-team --task "API 개발"
python3 dispatch.py --team dev1-team --task "API 개발" --type coding
```

### 리서치/분석 작업 (QC 제외)
```bash
python3 dispatch.py --team dev1-team --task "시장 조사" --type research
```

### 점검/확인 작업 (QC 제외)
```bash
python3 dispatch.py --team dev3-team --task "로그 확인" --type check
```

## task_type 종류

| task_type | 설명 | QC 검증 |
|-----------|------|---------|
| `coding` | 코딩/개발 작업 (기본값) | ✅ 포함 |
| `research` | 리서치, 분석 작업 | ❌ 제외 |
| `check` | 점검, 확인, 상태 확인 작업 | ❌ 제외 |

## 테스트 결과

### team_prompts.py 테스트 (58개)
```
tests/test_team_prompts.py ... 58 passed in 0.08s
```

### dispatch.py 테스트 (52개)
```
tests/test_dispatch.py ... 52 passed in 0.16s
```

### 새로 추가된 테스트 (TestTaskTypeQCSkip, 9개)
- `test_coding_type_includes_qc` ✅
- `test_research_type_skips_qc` ✅
- `test_check_type_skips_qc` ✅
- `test_default_type_is_coding` ✅
- `test_glm_team_coding_includes_qc` ✅
- `test_glm_team_research_skips_qc` ✅
- `test_critical_with_research_still_skips_qc` ✅
- `test_security_with_research_still_skips_qc` ✅
- `test_research_type_still_has_critical_marker` ✅

## 수정된 파일

| 파일 | 수정 내용 |
|------|----------|
| `/home/jay/workspace/prompts/team_prompts.py` | `task_type` 파라미터 추가, QC 조건부 포함 |
| `/home/jay/workspace/dispatch.py` | `--type` CLI 인자 추가, `task_type` 전달 |
| `/home/jay/workspace/tests/test_team_prompts.py` | `TestTaskTypeQCSkip` 테스트 9개 추가 |
| `/home/jay/workspace/tests/test_dispatch.py` | `_patched_build()` 함수에 `task_type` 지원 추가 |

## 하위 호환성

- **기본값은 `coding`**: 기존 코드 수정 없이 동일하게 작동
- 기존 테스트 모두 통과 (110개)
- API 변경사항은 선택적 파라미터만 추가

---

## 팀장(라) 검토 노트

- GLM이 `team_prompts.py`, `dispatch.py`, 테스트 파일까지 잘 수정했으나, `tests/test_integration.py`의 `_safe_build` 모의 함수에 `task_type` 파라미터를 추가하지 않아 1개 테스트 실패 발생
- 팀장이 직접 `test_integration.py:83`의 `_safe_build` 시그니처와 내부 로직 수정 후 445개 전체 통과 확인
- 구현 품질 자체는 우수: 기본값 유지로 하위 호환, argparse choices로 CLI 입력 제한, 로직 분리 명확

## 최종 자동 검증 결과 (qc_verify.py)

```json
{
  "task_id": "task-202.1",
  "verified_at": "2026-03-03T23:56:52",
  "overall": "PASS",
  "checks": {
    "api_health": {"status": "SKIP", "details": ["Skipped via --skip flag"]},
    "file_check": {"status": "PASS", "details": ["5/5 checks passed"]},
    "data_integrity": {"status": "PASS", "details": ["status='completed' and .done file both consistent", "timeline: 8분 12초"]},
    "test_runner": {"status": "PASS", "details": ["445 passed in 4.23s"]}
  },
  "summary": "3 PASS, 1 SKIP"
}
```

---

**완료일**: 2026-03-03
**작업자**: Dev3 Team (GLM-5 + 라 팀장 검토)
