docs(batch): draft-batch BAT-030 (dcy-020 BAT-δ cutover) + design 확정
dcy-020 최종 배치. design 확정(사용자 결정): - D1: 전체 rebuild — daily_slot 비우고 universe+브로커 잔고 기준 재생성, 보유 carry-over 정본=브로커 잔고 - D2: 전부 완성 — literal inactive 전면화 + idle/closed 별칭 제거 + entry_count/trading_date 컬럼 drop - D3: 집행 매도 수량 브로커 정본(미러 fallback 없음, 0이면 skip+divergence) - D4: 실 cutover 는 운영자(REL 단계, 리허설 후); 본 배치는 스크립트+코드+test DB 리허설 batches/index BAT-030 등록. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
# BAT-030 Planning
|
||||
|
||||
- Status: confirmed
|
||||
- Batch: BAT-030
|
||||
- Profile: standard
|
||||
|
||||
## Included REQ
|
||||
- REQ-064 (Migration, Approved): 풀→영구 자산 슬롯 cutover + 롤백.
|
||||
- REQ-062 (Integration, Approved 잔여): 청산 수량 브로커 정본(M2(b), execution dispatch).
|
||||
- REQ-056/057 (잔여): entry_count/trading_date 컬럼 drop, literal inactive + 별칭 제거.
|
||||
- REQ-065 (Documentation): baseline 마감.
|
||||
|
||||
## Delivery Plan (전환 순서 — 안전 우선)
|
||||
1. **literal inactive 전면화**: `state.py` IDLE/CLOSED 별칭 제거(또는 deprecate), 코드가 `inactive` 산출. `execution.py` PENDING_SELL→`INACTIVE`·PENDING_BUY→`INACTIVE`. postgresql/cli/ops_checks 의 'idle'/'closed' → 'inactive'. CHECK 제약 마이그레이션(010: 'inactive' 허용 + 기존 idle/closed→inactive UPDATE).
|
||||
2. **M2(b) 집행 매도 수량 브로커 정본**: dispatch 매도 `int(slot.qty)` → `broker.get_balance()` 해당 symbol hldg_qty. 미러 stale 무관 정확.
|
||||
3. **컬럼 drop**: `entry_count`·슬롯 `trading_date`(또는 opened_at 재의미) drop 마이그레이션 + 모델/EXPECTED_SLOT_FIELDS/persistence 정합. (legacy preallocation 경로도 제거.)
|
||||
4. **cutover 마이그레이션(REQ-064)**: 기존 보유(holding, portfolio_id 보유) 행은 그대로 자산 슬롯; vestigial idle 풀 행(portfolio_id NULL) 정리; instance_key 태깅(009 default 'default'); UNIQUE 부분→전체 승격 검토.
|
||||
5. **default 전환**: 운영 인스턴스 TOML 에 `max_active_slots` 설정(자산 중심 활성) — 운영자 배포 단계.
|
||||
6. **baseline 마감(REQ-065)** + run-the-app 자산 중심 e2e(test DB).
|
||||
|
||||
## Dependencies
|
||||
- Internal: BAT-027/028/029(스키마·상태머신·reconcile·admission·divergence). 전 단계 green.
|
||||
- External: 전략 모듈 slot_id 계약 전환(BAT-029 dual-accept 로 무중단; portfolio_id 매수 폐기 시 전략 전환 필요).
|
||||
|
||||
## Design Gate
|
||||
- Design Required Before Implementation: yes
|
||||
- Reason: (a) **라이브 데이터 cutover** — 보유 포지션 무손실·롤백·in-flight(pending) 처리·운영자 입회 절차를 설계에서 확정. (b) literal inactive 전환은 BAT-027 별칭의 역-cascade(코드+CHECK 마이그레이션+다수 테스트). (c) 집행 dispatch 매도 수량 변경은 라이브 주문 동작. (d) 컬럼 drop 은 비가역 — 순서·롤백 필수. → design.md 확정 후 구현 전 체크포인트.
|
||||
|
||||
## Milestones
|
||||
1. M1 — literal inactive + CHECK 마이그레이션(010) + 별칭 제거 + 테스트
|
||||
2. M2 — 집행 매도 수량 브로커 정본
|
||||
3. M3 — entry_count/trading_date drop 마이그레이션 + 정합
|
||||
4. M4 — cutover 마이그레이션(REQ-064) + 리허설(test DB)
|
||||
5. M5 — baseline 마감 + run-the-app 자산 중심 e2e
|
||||
|
||||
## Risks
|
||||
- R-live (High): 라이브 cutover 로 보유 포지션 손실/집행 중단. 대응: 보유 행 보존(이미 portfolio_id 보유)·거래 세션 외 실행·롤백 스크립트·운영자 입회·리허설(test DB) 선행.
|
||||
- R-irreversible (High): 컬럼 drop 비가역. 대응: drop 전 백업, 단계적(코드 미참조화 → drop), 롤백은 직전 리비전+컬럼 복원.
|
||||
- R-cascade (Medium): literal inactive 역전환의 테스트/코드 cascade. 대응: BAT-027 별칭 지점 일괄 전환 + 회귀 green 게이트.
|
||||
- R-exec (Medium): 집행 매도 qty 변경 회귀. 대응: 단위+리허설, 미러 fallback 없이 broker 권위.
|
||||
|
||||
## Notes
|
||||
- 실 cutover 는 운영자 실행(본 배치는 마이그레이션·코드·리허설 제공). confirm-release 전 cutover 리허설 + run-the-app evidence 필수.
|
||||
- green 기준: 단위 전체 회귀(literal inactive·drop 무파손) + cutover 리허설(보유 보존·롤백) + 자산 중심 e2e.
|
||||
Reference in New Issue
Block a user