Files
portfolio-hub/docs/srs/Interface/req-012_portfolio-create-catalog-validation.md
T
genichinandClaude Sonnet 4.6 6add0ade29 feat: REQ-001~018 Implemented 전환, REQ-010 GET /v1/assets admin catalog 재정의, REL-001 draft
- confirm-req-implemented: REQ-001~018 (17건, REQ-013 제외) Approved → Implemented
  - BAT-001(REQ-009/011/014), BAT-002(REQ-010/012/015), BAT-003(REQ-001/002/003/006)
  - BAT-004(REQ-004/005), BAT-005(REQ-007/008), BAT-006(REQ-016/017/018)
  - CHG-20260521-01 entry 각 REQ에 추가; SRS index Recent Change Log 갱신

- REQ-010 CHG-20260521-02: GET /v1/assets admin catalog 전용 재정의
  - 기존 token_type 분기 portfolio 조회 코드 제거, admin permission + list_assets() 호출로 대체
  - AssetCatalogListResponse 스키마 추가 (items/total)
  - REQ-010 Status: Implemented → Approved (재검증 필요)
  - 테스트 343건 전체 통과: service/user token 403, admin token 200 + catalog schema 검증

- migration 보강: portfolios_asset_migration market 컬럼 부재 fallback,
  portfolio_tags 빈 테이블 early-return, service_token index fix autocommit_block 정리

- docs/releases/rel-001: REL-001 draft 추가 (BAT-001~011 포함)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-21 10:17:39 +00:00

4.4 KiB

REQ-012: portfolio 생성 CLI catalog 검증

  • Status: Implemented
  • Type: Interface
  • Priority: High
  • Owner: Justin Ko

Intent

  • user가 pfhub portfolio create CLI로 portfolio를 생성할 때 지정한 asset이 catalog에 active 상태로 존재하는지 검증하여, 미등록 또는 비활성 asset 기반의 portfolio 생성을 방지한다.

Requirement

  • pfhub portfolio create 명령에 --asset-id <uuid> 또는 --symbol <symbol> 옵션을 추가하여 catalog asset을 지정하도록 한다.
  • portfolio 생성 전 지정된 asset_id(또는 symbol로 조회한 asset_id)가 assets catalog에 status='active'로 존재하는지 검증한다.
  • catalog에 없거나 status='inactive'인 asset이면 오류 메시지와 함께 생성을 거부한다.
  • app/services/portfolio_service.py의 create_portfolio에 asset 검증 로직을 추가한다.
  • user portfolio CRUD HTTP API(POST /portfolios 등)는 이 REQ 범위 밖이다(별도 Discovery에서 처리).

Acceptance Criteria

  1. Given active asset이 catalog에 존재, When pfhub portfolio create <name> --asset-id <asset_id> --user <username>, Then portfolio가 생성되고 해당 asset_id로 연결된다.
  2. Given 존재하지 않는 asset_id, When pfhub portfolio create with 미등록 asset_id, Then "asset not found" 오류가 출력되고 portfolio가 생성되지 않는다.
  3. Given status='inactive'인 asset_id, When pfhub portfolio create with 해당 asset_id, Then "asset is inactive" 오류가 출력되고 portfolio가 생성되지 않는다.
  4. Given --symbol <symbol> 옵션 사용, When 해당 symbol이 catalog에 active로 존재, Then symbol로 asset_id를 조회하여 portfolio를 생성한다.

Impacted Area

  • Docs: 없음 (별도 문서 갱신 불필요)
  • Modules:
    • app/cli/commands/portfolio.py — create 명령에 --asset-id / --symbol 옵션 추가
    • app/services/portfolio_service.py — create_portfolio에 catalog 검증 로직 추가
  • Tests:
    • tests/test_asset_catalog.py (신규) — catalog 검증 AC-1~4 검증

Notes

  • REQ-009(assets 테이블), REQ-011(portfolios 재설계) 선행 필요.
  • HTTP API를 통한 portfolio 생성 시 catalog 검증 정책은 동일하게 적용되어야 하나, HTTP mutation API는 Out of Scope(별도 Discovery 처리 예정)이다.
  • Source: dcy-001 FR-4

Change Log

CHG-20260521-01

  • Date: 2026-05-21
  • Author: Justin Ko

Change Summary

  • Status: Approved → Implemented

Intent

  • BAT-002 confirm-batch-verification 완료. pfhub portfolio create --asset-id/--symbol catalog 검증(존재·비활성 거부) 모든 AC 검증 통과.

Acceptance Criteria Delta

  • No change

Impacted Area Delta

  • No change

Delivery Trace Delta

  • Batches:
    • BAT-002
  • Releases:
    • REL-001

Revalidation Impact

  • Reverification Needed: no
  • Existing Implementation Invalidated: no
  • Status Recommendation: implemented
  • Follow-up Action: none

CHG-20260519-02

  • Date: 2026-05-19
  • Author: Justin Ko

Change Summary

  • Status: Proposed → Approved

Intent

  • 승인 게이트 통과: 필수 필드(Status/Type/Priority/Owner/Intent/Requirement/AC/Impacted Area/Change Log) 모두 충족, AC 구체성 확인 완료

Acceptance Criteria Delta

  • No change

Impacted Area Delta

  • No change

Delivery Trace Delta

  • Batches:
    • none (미정)
  • Releases:
    • none (미정)

Revalidation Impact

  • Reverification Needed: no
  • Existing Implementation Invalidated: no
  • Status Recommendation: promote-to-approved
  • Follow-up Action: batch 계획 편입

CHG-20260519-01

  • Date: 2026-05-19
  • Author: Justin Ko

Change Summary

  • 최초 생성 — dcy-001 confirm-discovery 후 draft-req 실행

Intent

  • dcy-001 FR-4를 Interface REQ로 분리; portfolio create CLI catalog 검증 정의

Acceptance Criteria Delta

  • Added:
    • AC-1~4 최초 작성

Impacted Area Delta

  • Docs:
    • 없음
  • Modules:
    • app/cli/commands/portfolio.py, app/services/portfolio_service.py — 최초 지정
  • Tests:
    • tests/test_asset_catalog.py — 최초 지정

Delivery Trace Delta

  • Batches:
    • none (미정)
  • Releases:
    • none (미정)

Revalidation Impact

  • Reverification Needed: no
  • Existing Implementation Invalidated: no
  • Status Recommendation: keep-current
  • Follow-up Action: confirm-req 후 batch 계획 편입; REQ-009, REQ-011 선행 의존성 확인

Validation Plan

  • pytest CliRunner로 AC-1~4 검증