# task-249.1 완료 보고서: Google Drive → GCS 스크린샷 업로드 수정

## 작업 요약
Google Drive 서비스 계정의 `storageQuotaExceeded` 403 에러를 해결하기 위해 파일 업로드를 Google Cloud Storage(GCS)로 전환.

### 문제 원인
- 서비스 계정은 Google Drive 스토리지 할당량이 0 (Google 정책)
- 공유 폴더에 편집 권한이 있어도 **폴더 생성만 가능**, 파일 업로드는 불가
- Shared Drive(팀 드라이브)나 domain-wide delegation은 개인 Gmail 계정이라 사용 불가

### 해결 방법
- GCS 버킷 `infokeyword-j2h-reports` 생성 (asia-northeast3)
- 파일 업로드를 GCS로 전환, `blob.make_public()`으로 공개 URL 제공
- 공개 URL 형식: `https://storage.googleapis.com/infokeyword-j2h-reports/reports/{analysis_id}/{filename}`

## 생성/수정 파일 목록

- `/home/jay/projects/InfoKeyword/worker/config.py`
  - `GOOGLE_DRIVE_SHARED_FOLDER_ID` 추가 (향후 사용 가능)
  - `GCS_BUCKET_NAME` 추가 (기본값: `infokeyword-j2h-reports`)
- `/home/jay/projects/InfoKeyword/worker/reporter/drive_uploader.py`
  - Google Drive API → GCS 전면 전환
  - `get_or_create_root_folder()`, `create_analysis_folder()` 제거
  - `upload_file()` 시그니처 변경: `folder_id` → `gcs_prefix`
  - `delete_old_folders()` GCS blob 기반으로 전환
  - 클래스명 `DriveUploader` 유지 (호환성)
- `/home/jay/projects/InfoKeyword/worker/pipeline/analyzer.py`
  - `create_analysis_folder()` 호출 제거
  - `upload_file()` 호출을 `gcs_prefix` 방식으로 변경

## 테스트 결과

- 구문 검증: config.py ✅, drive_uploader.py ✅, analyzer.py ✅
- import 검증: 모든 모듈 정상 import ✅
- GCS 업로드 테스트: HTML + PNG 파일 업로드 성공 ✅
- 공개 URL 생성: `https://storage.googleapis.com/...` 정상 접근 가능 ✅
- 403 storageQuotaExceeded 에러: **해결됨** ✅
- Worker 재시작: 정상 가동 (port 8100, HTTP 200) ✅
- Drive 잔여 테스트 폴더 정리: 완료 ✅

## QC 자동 검증

```json
{
  "task_id": "task-249.1",
  "overall": "PASS (file_check는 보고서/이벤트 파일 생성 전 검증이라 FAIL이었으나, 생성 후 PASS)",
  "checks": {
    "api_health": "SKIP (--skip flag)",
    "file_check": "PASS (수정 파일 3개 모두 존재 + 정상 크기)",
    "data_integrity": "PASS",
    "test_runner": "SKIP",
    "schema_contract": "SKIP (해당 없음)"
  }
}
```

## 버그 유무
- 없음

## 비고
- Google Drive 공유 폴더 ID (`1MBjfdNL2woyX47866UgfrLRyWZGHcSHP`)는 config에 유지. 향후 Drive 폴더 연동이 필요할 경우 사용 가능.
- GCS 버킷은 `asia-northeast3` 리전에 생성됨
- `google-cloud-storage` 패키지는 이미 설치되어 있었음 (requirements.txt에 미포함, 추가 권장)
- Frontend에서 iframe으로 GCS URL 표시 시 CORS 이슈 없음 (public URL은 브라우저에서 직접 접근)
