Files
trex-core/docs/batches/bat-025_20260609_slot-entry-count-and-closed-reallocation/index.md
T
genichinandClaude Sonnet 4.6 fb05a73130 feat(rel-006): dcy-022/023 + BAT-032~034 — 실행 정책·qty 검증·allocated_capital 제거 통합
BAT-032 (dcy-022): timeout_sec/slippage_pct 실행 정책, 미체결 자동 취소,
보호 지정가, `trex-core cancel` 백스톱. 마이그레이션 012.
BAT-033: `trex-core enter --qty` 필수 검증 — 미지정 시 RPC 전 즉시 오류.
BAT-034 (dcy-023): allocated_capital 죽은 필드 전 경로 제거 (domain·intent·
persistence·snapshot·CLI). 마이그레이션 013(비가역 DROP). 외부 발신자
unknown key 무시 수신 의미론 적용.
REL-006 confirmed: BAT-026~034 통합 릴리즈, pre-release smoke 증거 포함.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-11 07:42:03 +09:00

3.3 KiB
Raw Blame History

BAT-025: slot-scoped entry_count + closed 슬롯 직접 재할당 (dcy-019)

  • Status: released
  • Profile: standard
  • Source Discovery: dcy-019
  • Included REQ: REQ-002 (CHG-20260609-01), REQ-003 (CHG-20260609-01), REQ-006 (CHG-20260609-01), REQ-007 (CHG-20260609-01), REQ-009 (CHG-20260609-01)

Summary

  • dcy-019(slot 진입 횟수 필드 + idle∪closed 후보 중 최저 진입 우선 선택 + closed 직접 재할당, issue #18)을 단일 standard batch 로 delivery 한다. 거버넌스는 dcy-019 OQ-1/2/3 결정대로 전부 change-req, 신규 REQ 없음.
  • 핵심: daily_slot/Slot 에 slot-scoped entry_count(기본 0) 필드 + 멱등 마이그레이션 008(REQ-002/006), 상태 머신 closed→pending_buy 신규 전이(8→9 base, ALLOWED_TRANSITIONS 14→15)(REQ-002), buy admission 의 후보를 idle∪closed 로 확장하고 entry_count→updated_at→slot_id 결정적 정렬로 선택하는 find_allocatable_slot selector(REQ-006) + _admit_buy 일반화(REQ-007), →pending_buy(idle→/closed→) 시 entry_count +1 및 closed→pending_buy clean-slate 점유 초기화(REQ-002). 기존 daily_symbol_entries(symbol-scoped 재진입 카운터)와 분리·미변경.

Scope

  • In Scope:
    • Slot.entry_count(기본 0) + EXPECTED_SLOT_FIELDS + 멱등 마이그레이션 008 + persistence flat 매핑 (REQ-002/006)
    • 상태 머신 closed→pending_buy 신규 전이 + _apply_transition_fields clean-slate + entry_count +1 (REQ-002)
    • find_allocatable_slot(idle∪closed, entry_count→updated_at→slot_id) selector + in-memory 동등 (REQ-006)
    • _admit_buy find_idle_slot→find_allocatable_slot + from_state=slot.status (REQ-007)
    • 테스트 계약 정합(전이 카운트·필드셋·신규 단위) (REQ-003)
    • data-model/runtime-flows baseline 정합 (REQ-009)
  • Out of Scope:
    • daily_symbol_entries(symbol-scoped 재진입 카운터) 제거/변경 — 별도 REQ-002 change-req 트랙(후속)
    • 운영자 CLI/스냅샷에 slot entry_count 노출 (dcy-019 §5 제외)
    • 슬롯별 PnL 집계, 전략 모듈에 선택 정책 노출, preallocation 총량/스케줄 변경
    • snapshot available_slots(=idle_count) capacity 의미 변경 (dcy-019 범위 밖 — 보수적 under-report 유지)

Documents

Notes

  • Source discovery 단일(dcy-019). OQ-1 (a) daily_slot 단독 / OQ-2 entry_count→updated_at→slot_id / OQ-3 closed→pending_buy 직접 전이·→pending_buy 시 +1 Answered.
  • additive·하위호환(NFR-3): 마이그레이션 008 기본 0, closed 후보 부재 시 기존 idle-only 동작 보존(회귀 green).
  • 동시성(NFR-1): selector find 쿼리는 기존 find_idle_slot 와 동일하게 FOR UPDATE 미사용 — claim 경합은 transit_slot advisory lock + SlotStateMismatchError 재시도 루프로 직렬화(중복 카운트 없음).
  • 신규 slot entry_count 와 daily_symbol_entries.entry_count 는 키·목적이 다른 별개 카운터(R-1) — data-model 에 구분 기록.
  • PG 게이트 마이그레이션/드리프트 테스트는 라이브 runtime DSN 미사용(pg_clean truncate 파괴적) — test DSN 환경에서 자동 검증.