안 B(점진/additive-first)의 1단계. 라이브 영향·cascade 없이 자산 영구 슬롯 토대의 스키마/모델 필드만 additive 추가. - Slot.instance_key(기본 "default")·retired_at 추가 + EXPECTED_SLOT_FIELDS 정합 - 마이그레이션 009: instance_key NOT NULL DEFAULT 'default', retired_at, 부분 UNIQUE(instance_key, portfolio_id) WHERE portfolio_id IS NOT NULL (멱등) - postgresql _SLOT_COLUMNS/_row_to_slot/update_slot 매핑(row[19]/[20]) - entry_count/trading_date 컬럼은 유지(drop 은 cutover BAT-δ) 검증: 전체 375 passed / 35 skipped, ruff clean (additive — cascade 무파손). M2(상태머신 inactive 별칭+인스턴스 lock)/M3(소비처 cascade)는 후속. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1.7 KiB
1.7 KiB
BAT-027 Implementation
- Status: in-progress (M1 완료, M2/M3 대기)
- Batch: BAT-027
구현 요약
- 안 B(점진/additive-first). M1(REQ-056 additive 모델+마이그레이션+persistence) 완료. M2/M3(상태머신 inactive 별칭 + 인스턴스 스코프 lock + 소비처 cascade)는 다음 단계.
변경 내역
M1 — REQ-056 additive (완료)
trex_core/domain/slot/models.py:Slot에instance_key: str = "default"·retired_at: Optional[datetime] = None추가,EXPECTED_SLOT_FIELDS+instance_key/+retired_at. (entry_count/trading_date 는 안 B로 유지 — drop 은 BAT-δ)trex_core/adapters/persistence/sql/009_add_slot_instance_key_and_retired_at.sql(신규): instance_key NOT NULL DEFAULT 'default', retired_at, 부분 UNIQUE(instance_key, portfolio_id) WHERE portfolio_id IS NOT NULL. additive·멱등.trex_core/adapters/persistence/postgresql.py:_SLOT_COLUMNS+instance_key/retired_at(row[19]/[20]),_row_to_slot매핑,update_slotSET. pre_allocate INSERT 는 DEFAULT 의존(변경 없음).
M2 — REQ-057 상태머신+인스턴스 lock (대기)
- state.py inactive 표준 + idle/closed 별칭(closed→idle 제거), advisory lock 인스턴스 스코프(2-int).
M3 — 소비처 cascade 정합 (대기)
- execution/intents/cli/ops_checks/service 등 idle·closed·전역 lock 참조 정합.
테스트
- M1: 도메인 슬롯 단위 79 + 전체 375 passed / 35 skipped, ruff clean(additive 무파손). PG 마이그레이션 009 round-trip 은 verification 단계에서 test DSN 검증.
검증 실행
- M1:
TREX_BROKER=paper pytest -q→ 375 passed / 35 skipped / 1 deselected.ruff check trex_coreAll passed.