feat(slot): slot entry_count + closed-slot reallocation (dcy-019, BAT-025) + REL-005

dcy-019/issue #18: slot 자원을 진입 횟수 기준으로 고르게 재사용하고 idle 소진 시
closed 슬롯을 직접 재할당한다. 거버넌스는 전부 change-req(신규 REQ 없음).

- 도메인(REQ-002): Slot.entry_count(기본 0) + EXPECTED_SLOT_FIELDS, 상태 머신
  closed→pending_buy 신규 전이(base 8→9, ALLOWED_TRANSITIONS 14→15),
  _apply_transition_fields closed→pending_buy clean-slate + →pending_buy 시 +1
- 영속화(REQ-006): 멱등 마이그레이션 008(entry_count), flat 매핑,
  find_allocatable_slot(idle∪closed, entry_count→updated_at→slot_id) + in-memory 동등
- admission(REQ-007): _admit_buy find_idle_slot→find_allocatable_slot + from_state=slot.status
- 테스트(REQ-003): 전이 카운트/계약 가드 정합 + test_slot_entry_count.py / test_buy_admission_reallocation.py
- 문서(REQ-009): data-model.md / runtime-flows.md 정합
- 기존 daily_symbol_entries(symbol-scoped) 분리·미변경

BAT-025(release-candidate) delivery + change-req REQ-002/003/006/007/009(CHG-20260609-01).
REL-005(confirmed, app-service): BAT-024+BAT-025 묶음. operator-facing run-the-app
스모크로 enter --forced-close-at(BAT-024)·closed 재할당(BAT-025) 실 데몬 검증
(실 PG 마이그레이션 008 round-trip 포함).

검증: 단위 366 passed / 35 skipped(KIS sandbox 1건 deselect — live .env 환경 의존), ruff clean.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-09 14:49:22 +09:00
co-authored by Claude Opus 4.8
parent 941d324899
commit 6e8e79660c
28 changed files with 912 additions and 26 deletions
@@ -187,3 +187,42 @@
#### Validation Plan
- BAT-018: 코드-문서 diff 대조.
### CHG-20260609-01
- Date: 2026-06-09
- Author: Justin Ko
#### Change Summary
- (change-req, dcy-019/issue #18) baseline 문서 정합: `docs/data-model.md` 에 daily_slot `entry_count` 필드(slot-scoped, daily_symbol_entries 와 구분)·Lifecycle `closed→pending_buy`·State Rules(전이 패밀리 8 base 포함, closed→pending_buy clean-slate) 반영, `docs/runtime-flows.md` 의 buy admission 흐름을 `find_allocatable_slot`(idle∪closed, entry_count 정렬)·closed 직접 재할당으로, transit_slot 흐름에 `→pending_buy 시 entry_count +1` 단계 반영. BAT-025 검증 완료 → Implemented 유지.
#### Intent
- entry_count + closed 재할당 도메인 변경 후 baseline 문서가 실제 흐름/데이터 모델과 일치하도록 유지.
#### Acceptance Criteria Delta
- Updated:
- AC-2: `docs/runtime-flows.md` admission 슬롯 선택 흐름이 idle∪closed 후보 selector·closed→pending_buy 재할당과 일치.
- AC-3: `docs/data-model.md` 에 daily_slot `entry_count` 필드 + lifecycle/transition 규칙이 반영.
#### Impacted Area Delta
- Docs: docs/data-model.md(daily_slot entry_count/lifecycle/state rules), docs/runtime-flows.md(buy admission selector + transit_slot entry_count step)
#### Delivery Trace Delta
- Batches: BAT-025
- Releases: none
#### Revalidation Impact
- Reverification Needed: yes (BAT-025 에서 완료 — 코드-문서 diff 대조)
- Existing Implementation Invalidated: no (문서 추가 정합 — 기존 서술 보존)
- Status Recommendation: Implemented (change-req → BAT-025 재검증)
- Follow-up Action: confirm-req-implemented(BAT-025).
#### Validation Plan
- BAT-025: 코드(state.py/service.py/intents.py/postgresql.py) ↔ 문서(data-model/runtime-flows) diff 대조.