Files
portfolio-hub/docs/batches/bat-001_20260502_trex-basic-v1-api-contract/index.md
T
genichin ce63c75c9c feat(V1-API): implement TREX-Basic consumer API contract with encryption and persistence
- Add V1 API endpoints: assets, ledger, user-info
- Implement Fernet-based credential payload encryption (req-010)
- Extend health response schema with runtime info (req-004)
- Add service token runtime ID issuance (req-005)
- Implement database schema migration for V1 API (req-009)
- Add comprehensive test coverage for V1 endpoints
- Update SRS with 10 new requirements (REQ-004 through REQ-011)
- Create batch planning, design, and verification for BAT-001
- Integrate review-discovery StagePilot skill
- Update documentation indices and baseline specs
2026-05-02 09:06:15 +00:00

2.8 KiB

BAT-001 Index

  • Status: in-delivery
  • Batch: BAT-001
  • Profile: standard
  • Created: 2026-05-02

Included REQ

REQ 제목 Type Priority
REQ-004 GET /health 응답 스키마 확장 Interface High
REQ-005 service-token 발급 시 runtime_id 동시 생성 Interface High
REQ-006 GET /v1/assets 엔드포인트 구현 Interface High
REQ-007 GET /v1/user_info 엔드포인트 구현 Interface High
REQ-008 POST /v1/assets/{asset_id}/ledger/trades 구현 Interface High
REQ-009 v1 API DB 스키마 migration 추가 Migration High
REQ-010 credential_payload Fernet 암호화 및 startup validation Non-Functional High

Source Discovery

  • dcy-002: trex-basic Consumer-Driven Contract 반영

Scope Summary

  • GET /health 응답 확장 (service, version, checked_at 필드 추가)
  • service-token 발급 시 runtime_id UUID v4 동시 생성 및 auth_tokens 저장
  • GET /v1/assets 엔드포인트 신규 구현 (portfolio → asset 뷰 변환)
  • GET /v1/user_info 엔드포인트 신규 구현 (runtime_id, trading_enabled, brokers[] 복호화 반환)
  • POST /v1/assets/{asset_id}/ledger/trades 엔드포인트 신규 구현 (idempotent 체결 기록)
  • Alembic migration: portfolios.market 컬럼, auth_tokens.runtime_id 컬럼, broker_credentials 테이블, ledger_trades 테이블 추가
  • Fernet 암복호화 유틸리티 신규 구현 및 startup validation

Impacted Area

  • Docs: docs/project-structure.md, docs/runtime-flows.md (design 완료 후 갱신)
  • Modules:
    • app/api/health.py (수정)
    • app/api/auth_routes.py (수정)
    • app/api/v1_assets.py (신규)
    • app/api/v1_user_info.py (신규)
    • app/api/v1_ledger.py (신규)
    • app/main.py (수정: /v1 라우터 등록)
    • app/cli/commands/service_tokens.py (수정)
    • app/core/config.py (수정: CREDENTIAL_ENCRYPTION_KEY 추가)
    • app/core/encryption.py (신규: Fernet 유틸리티)
    • app/domain/models.py (수정: AuthToken.runtime_id, BrokerCredential, LedgerTrade 추가)
    • app/services/auth_service.py (수정)
    • app/services/ (신규 서비스 메서드)
    • app/schemas/ (신규 v1 스키마)
    • app/repositories/postgres.py (수정: 신규 테이블 쿼리)
    • migrations/versions/ (신규 migration 파일)
  • Tests:
    • tests/test_app.py 또는 tests/test_health.py (신규/확장)
    • tests/test_auth.py (확장)
    • tests/test_v1_assets.py (신규)
    • tests/test_v1_user_info.py (신규)
    • tests/test_v1_ledger.py (신규)

Stage Documents

Stage File Status
Planning planning.md draft
Design design.md draft
Implementation implementation.md draft
Verification verification.md draft