feat(slot): BAT-027 M1 — additive 영구 슬롯 필드(instance_key, retired_at) + 마이그레이션 009 (dcy-020/REQ-056)
안 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>
This commit is contained in:
@@ -46,6 +46,13 @@ class Slot:
|
||||
entry_count: int = 0
|
||||
created_at: Optional[datetime] = None
|
||||
updated_at: Optional[datetime] = None
|
||||
# dcy-020 / REQ-056 (BAT-027): asset-centric permanent slot foundation (안 B).
|
||||
# instance_key scopes slots per daemon instance in a shared DB
|
||||
# (UNIQUE(instance_key, portfolio_id)); advisory lock is also instance-scoped.
|
||||
# retired_at marks a soft-retired / universe-detached slot (OQ-2). Both added
|
||||
# additively here; entry_count/trading_date removal is deferred to cutover (BAT-δ).
|
||||
instance_key: str = "default"
|
||||
retired_at: Optional[datetime] = None
|
||||
|
||||
|
||||
# Canonical column contract for `Slot` (dcy-001 OQ-2 / FR-5).
|
||||
@@ -72,6 +79,8 @@ EXPECTED_SLOT_FIELDS: frozenset[str] = frozenset({
|
||||
"entry_count", # dcy-019 / REQ-002 (BAT-025)
|
||||
"created_at",
|
||||
"updated_at",
|
||||
"instance_key", # dcy-020 / REQ-056 (BAT-027)
|
||||
"retired_at", # dcy-020 / REQ-056 (BAT-027)
|
||||
})
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user