REQ-056(영구 슬롯 스키마)+REQ-057(상태머신 재정의+인스턴스 lock) 토대 배치. - planning: delivery plan/Design Gate(R-cascade)/milestones/risks - design: R-cascade 실측(idle·closed/entry_count/전역 lock/trading_date 소비처) + 접근안 A/B/C → 안 B(점진/additive-first) 확정: * additive 스키마(instance_key·retired_at, entry_count/trading_date 유지→BAT-δ drop) * inactive 표준 + idle/closed 별칭(closed→idle 제거) * advisory lock 인스턴스 스코프화 * 부분 UNIQUE(instance_key, portfolio_id) WHERE portfolio_id NOT NULL * instance_key NOT NULL DEFAULT 'default' - batches/index BAT-027(standard, planning) 등록 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2.5 KiB
2.5 KiB
BAT-027: 자산 영구 슬롯 토대 — 스키마 + 상태머신 재정의 (dcy-020 BAT-α)
- Status: planning
- Profile: standard
- Source Discovery: dcy-020
- Included REQ: REQ-056 (영구 슬롯 스키마+마이그레이션), REQ-057 (상태머신 재정의 + 인스턴스 스코프 advisory lock)
Summary
- dcy-020(자산 중심 영구 슬롯 모델)의 첫 구현 배치(BAT-α). 익명 풀 슬롯 도메인을 자산 1:1 영구 슬롯의 데이터 모델 + 상태머신 토대로 재작성한다. 외부 전략 계약 변경(BAT-γ)·라이브 cutover(BAT-δ)는 포함하지 않는다.
- 핵심:
Slot모델/EXPECTED_SLOT_FIELDS재정의(portfolio_id 영구키·instance_key·retired_at,entry_count/슬롯trading_date제거), 멱등 마이그레이션 009(UNIQUE(instance_key, portfolio_id)), 상태머신inactive↔pending_buy↔holding↔pending_sell(+error) 으로 재정의(closed→idle복구 제거), advisory lock 인스턴스 스코프화.
Scope
- In Scope:
Slot모델·EXPECTED_SLOT_FIELDS영구 슬롯 재정의 (REQ-056)- 마이그레이션 009 (instance_key·retired_at·UNIQUE 복합, entry_count/trading_date 제거) + persistence flat 매핑 (REQ-056)
- 상태머신 재정의(inactive 합침·closed→idle 제거) + holding 로컬 정본 + 인스턴스 스코프 advisory lock (REQ-057)
data-model.md슬롯 스키마/상태 부분 갱신 (REQ-065 부분)- 상태/계약 단위테스트 재작성
- Out of Scope:
- universe reconcile lifecycle (REQ-058 → BAT-β)
- admission/capacity·intent 계약 (REQ-059/061 → BAT-β/γ)
- 수량/불일치 해소 (REQ-062 → BAT-γ)
- 라이브 cutover (REQ-064 → BAT-δ)
- 운영자 slots 단일 뷰 (REQ-063 → 후속)
Documents
- Planning: planning.md
- Design: design.md
- Implementation: implementation.md
- Verification: verification.md
Notes
- Source discovery 단일(dcy-020). 본 배치는 dcy-020 의 토대 배치로, 후속 BAT-β(reconcile·admission)/BAT-γ(intent·수량)/BAT-δ(cutover)의 선행.
- 핵심 리스크(R-cascade):
Slot모델·상태머신 변경은 intents.py·safety_sell·snapshot_handlers·execution 등 다수 소비처로 연쇄된다. design.md 에서 cascade 격리 전략(소비처 동시 수정 범위)을 확정한 뒤 구현한다 — design 체크포인트 필수. - 라이브 데이터는 본 배치에서 건드리지 않는다(스키마는 신규 마이그레이션으로 정의만; 기존 행 전환은 REQ-064/BAT-δ).