# task-393.1 완료 보고서: ThreadAuto 텍스트 믹스 도입 (Phase 0)

## 작업 요약
ThreadAuto에 텍스트 전용 포스트를 추가하여 콘텐츠 유형을 다양화.
기존 카드뉴스(이미지) 20개/일 → 카드뉴스 8개 + 텍스트 8개 + 영상 2개 = 18개/일 믹스로 전환.

## 생성/수정 파일 목록

### 수정 파일
- `content/topic_selector.py` — DAILY_MIX_V2 상수 추가, select_daily_topics() V2 반환 형식
- `content/pipeline.py` — content_type 기반 생성기 분기 (text_* → TextContentGenerator)
- `scheduler/publish_worker.py` — content_type 기반 발행 분기 (text_* → post_text)
- `tests/test_topic_selector.py` — DAILY_MIX_V2 + V2 반환 형식 테스트 추가
- `tests/test_publish_worker.py` — content_type 분기 테스트 9개 추가
- `tests/test_pipeline_v2.py` — content_type 분기 테스트 7개 추가

### 신규 파일
- `content/text_prompts.py` — 4종 텍스트 타입별 시스템 프롬프트, AI 냄새 방지 규칙, 오프닝 패턴
- `content/text_generator.py` — TextContentGenerator 클래스 (Claude CLI 호출, 검증, 재시도)
- `tests/test_text_generator.py` — text_generator/text_prompts 테스트 33개

## 주요 변경 사항

### 1. DAILY_MIX_V2 (topic_selector.py)
- 기존 DAILY_MIX (20개) 유지 + DAILY_MIX_V2 (18개) 신규
- V2 반환 형식: `{"category": str, "topic": dict, "content_type": str}`
- content_type 분포: cardnews(8), text_short(3), text_info(2), text_story(1), text_news(2), video(2)

### 2. TextContentGenerator (text_generator.py)
- 4종 텍스트 타입: text_short(280자), text_info(500자), text_story(500자), text_news(500자)
- Claude CLI 호출로 생성, max_length 검증 + AI 냄새 블랙리스트 필터
- 검증 실패 시 최대 3회 재시도

### 3. Pipeline 분기 (pipeline.py)
- content_type.startswith("text_") → TextContentGenerator
- content_type == "video" → ContentGeneratorV2 (기존 모듈, Phase 0 한정)
- else (cardnews) → ContentGeneratorV2 (기존 로직)

### 4. 발행 분기 (publish_worker.py)
- text_* → post.get("text") 사용 + client.post_text()
- video → 기존 이미지 기반 로직
- cardnews → 기존 이미지/캐러셀 로직

### 5. 하위 호환
- content_type 없는 기존 데이터 → 기본값 "cardnews"
- pipeline: topic = item.get("topic", item) 으로 V1 형식도 처리
- api/client.py: post_text() 이미 존재하여 수정 불요

## 테스트 결과
- topic_selector: 52 passed
- text_generator: 33 passed
- publish_worker: 60 passed
- pipeline_v2: 36 passed
- **총 181개 테스트 통과**

### 기존 테스트 회귀
- test_evergreen_topics 2개 FAIL — 기존 상태 오염 (evergreen_topics.json의 used_count가 이전 실행으로 변경됨). 우리 변경과 무관.

## pyright 결과
- `run_pyright.sh` 실행: 0 errors, 0 warnings (프로젝트 루트 기준)
- QC verifier pyright: WARN — 모든 에러가 `reportMissingImports` (worktree 경로에서 실행되어 프로젝트 내부 import를 해석 못함). 기존 파일들도 동일한 패턴.

## QC 검증 결과
- file_check: PASS (보고서/이벤트 생성 후)
- data_integrity: PASS
- test_runner: FAIL (기존 test_evergreen_topics 상태 오염, 우리 변경 무관)
- tdd_check: PASS
- pyright_check: WARN (reportMissingImports, 기존 패턴)
- style_check: PASS (black + isort)

## 버그 유무
- 발견된 버그 없음
- 기존 test_evergreen_topics 실패는 테스트 격리 문제 (pre-existing)

## 머지 판단
- **머지 필요**: Yes
- **브랜치**: task/task-393.1-dev1
- **워크트리 경로**: /home/jay/projects/ThreadAuto/.worktrees/task-393.1-dev1
- **머지 의견**: 181개 테스트 전부 통과, pyright 0 errors, black+isort 포매팅 완료. 기존 카드뉴스 파이프라인 로직 변경 없음 (하위 호환 보장). 기존 test_evergreen_topics 실패는 우리 변경과 무관한 상태 오염. 머지 추천.
