# BAT-019 Planning - Status: confirmed - Batch: BAT-019 - Profile: standard ## Included REQ - REQ-044: GET /v1/assets 권한 완화 (require_admin → require_read) - REQ-045: 사용자 가용 데몬 목록 엔드포인트 신규 (GET /v1/daemons) ## Delivery Plan ### REQ-044 순서 1. `app/api/v1_assets.py`의 `list_catalog_assets` 의존성을 `require_read`로 교체. 2. 나머지 쓰기 엔드포인트(POST/PATCH/DELETE)는 `require_admin` 유지. 3. 기존 test_asset_catalog.py의 `test_get_v1_assets_user_token_returns_403`, `test_get_v1_assets_service_token_returns_403` 등 403 기대 테스트를 200/403 신규 기대치로 업데이트. ### REQ-045 순서 1. `app/schemas/v1.py`에 `DaemonResponse`, `DaemonListResponse` 스키마 추가. 2. `app/api/v1_daemons.py` 신규 생성: GET /v1/daemons 라우터. 3. `app/main.py`에 v1_daemons 라우터 include_router 등록. 4. `tests/test_v1_daemons.py` 신규 생성: AC 전체 커버. ### 구현 순서 REQ-044(단순 1줄 변경) → REQ-045(스키마 → 라우터 → 등록 → 테스트) → 테스트 전체 실행 ## Dependencies - Internal: - `app/core/auth.py`: `require_read` 의존성 (이미 존재) - `app/domain/models.py`: `Daemon` 도메인 모델 (이미 존재, line 66) - `app/services/auth_service.py`: `find_candidate_daemons_for_user` (이미 존재, line 161) - `app/repositories/portfolio_repository.py`: `list_daemons_for_user` (이미 프로토콜 선언됨, line 103) - External: - 없음 ## Design Gate - Design Required Before Implementation: yes - Reason: REQ-045 신규 엔드포인트이므로 경로 컨벤션, 응답 래퍼 스키마, env/service 토큰(user_id=None) 처리, active 필터 여부를 design에서 확정해야 안전하게 구현할 수 있다. REQ-044는 단순 교체지만 같은 batch이므로 design에 함께 기록한다. ## Milestones 1. BAT-019 batch 폴더 및 문서 생성 완료 2. Planning 확정 3. Design 확정 (경로·스키마·env토큰 처리) 4. REQ-044 구현 + 테스트 조정 5. REQ-045 구현 + 신규 테스트 6. pytest 전체 통과 7. Verification 완료 ## Risks - REQ-044: 기존 테스트 중 `require_admin` 기대 403 케이스가 다수 있어 신규 200 기대로 업데이트 필요. 누락 시 기존 테스트 깨짐. - REQ-045: `user_id=None`(env/service 토큰) 처리를 design에서 명확히 결정해야 구현이 일관됨. - REQ-045: `AuthService.find_candidate_daemons_for_user`가 `list_daemons_for_user`를 호출하는데, InMemoryRepository 미구현 시 서비스 레이어를 직접 mock해야 함.