Files
trex-core/docs/srs/Documentation/req-009_daemon-api-baseline-alignment.md
T
genichinandClaude Opus 4.8 6e8e79660c 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>
2026-06-09 14:49:22 +09:00

7.1 KiB
Raw Blame History

req-009: 데몬/API/영속화 baseline 문서 정합

  • Status: Implemented
  • Type: Documentation
  • Priority: Medium
  • Owner: project maintainers

Intent

  • 데몬화·HTTP API·영속화 레이어가 추가된 뒤 baseline 문서를 실제 구조/흐름/계약과 일치시켜 cross-cutting 참조의 정확성을 유지한다.

Requirement

  • docs/interface-contract.md 에 HTTP API 계약(/v1 엔드포인트 6종)을 추가하고, docs/runtime-flows.md 에 데몬 lifecycle·intent 요청 흐름을 추가하며, docs/project-structure.md(API/persistence/런타임 레이어)와 docs/data-model.md(intent_log + 영속화 테이블)를 갱신한다.

Acceptance Criteria

  1. Given API 구현 완료, When docs/interface-contract.md 확인, Then /v1 엔드포인트 6종의 입력/출력/에러 계약이 실제 구현과 일치한다.
  2. Given 데몬/영속화 구현 완료, When docs/runtime-flows.md·docs/project-structure.md 확인, Then 데몬 흐름과 레이어 구조(domain/application/adapters)가 실제와 일치한다.
  3. Given intent_log + 영속화 테이블, When docs/data-model.md 확인, Then 신규 엔티티/테이블이 반영된다.

Impacted Area

  • Docs: docs/interface-contract.md, docs/runtime-flows.md, docs/project-structure.md, docs/data-model.md
  • Modules: 없음(문서 전용)
  • Tests: 없음

Notes

  • dcy-002 FR-6. REQ-005~008 구현 완료 후 수행해야 의미가 있다(순서 의존).
  • 출처: dcy-002 FR-6.

Change Log

CHG-20260603-01

  • Date: 2026-06-03
  • Author: Justin Ko

Change Summary

  • dcy-002 FR-6 로부터 최초 생성(Proposed).

Intent

  • 데몬/API/영속화 baseline 정합 요구사항을 backlog 로 정규화.

Acceptance Criteria Delta

  • Added:
    • interface-contract, runtime-flows/project-structure, data-model 정합 3개 기준
  • Updated:
    • 없음
  • Removed:
    • 없음

Impacted Area Delta

  • Docs:
    • docs/interface-contract.md, docs/runtime-flows.md, docs/project-structure.md, docs/data-model.md
  • Modules:
    • 없음
  • Tests:
    • 없음

Delivery Trace Delta

  • Batches:
    • none
  • Releases:
    • none

Revalidation Impact

  • Reverification Needed: no
  • Existing Implementation Invalidated: no
  • Status Recommendation: keep-current
  • Follow-up Action: REQ-005~008 구현 후 batch verification 단계에서 수행

Validation Plan

  • baseline 문서와 실제 구현(엔드포인트/레이어/테이블) 대조로 검증.

CHG-20260603-02

  • Date: 2026-06-03
  • Author: Justin Ko

Change Summary

  • Status Proposed → Approved (confirm-req).

Intent

  • 승인 게이트(필수 필드·구체 AC·blocker 없음) 충족, source dcy-002(confirmed, handoff 승인)와 모순 없음 확인.

Acceptance Criteria Delta

  • Added:
    • 없음
  • Updated:
    • 없음
  • Removed:
    • 없음

Impacted Area Delta

  • Docs:
    • docs/srs/index.md (Register 상태 Approved)
  • Modules:
    • 없음
  • Tests:
    • 없음

Delivery Trace Delta

  • Batches:
    • none (batch 편성 전)
  • Releases:
    • none

Revalidation Impact

  • Reverification Needed: no
  • Existing Implementation Invalidated: no
  • Status Recommendation: keep-current
  • Follow-up Action: REQ-005~008 구현 후 batch 편성

Validation Plan

  • 승인 후 batch planning 에서 본 REQ 의 Acceptance Criteria 를 검증 기준으로 사용.

CHG-20260603-03

  • Date: 2026-06-03
  • Author: Justin Ko

Change Summary

  • Status Approved → Implemented (confirm-req-implemented, 근거 batch BAT-002 release-candidate).

Intent

  • BAT-002 verification.md 의 acceptance mapping + evidence(pytest 74 pass / PG 통합 / 데몬 E2E)로 모든 AC 충족 → 구현 완료 동기화.

Acceptance Criteria Delta

  • Added:
    • 없음
  • Updated:
    • 없음
  • Removed:
    • 없음

Impacted Area Delta

  • Docs:
    • docs/srs/index.md (Register Implemented)
  • Modules:
    • 없음
  • Tests:
    • 없음

Delivery Trace Delta

  • Batches:
    • BAT-002 (release-candidate)
  • Releases:
    • none

Revalidation Impact

  • Reverification Needed: no
  • Existing Implementation Invalidated: no
  • Status Recommendation: keep-current
  • Follow-up Action: draft-release 로 release 편성

Validation Plan

  • BAT-002 verification evidence 재참조로 충분.

CHG-20260608-01

  • Date: 2026-06-08
  • Author: Justin Ko

Change Summary

  • (change-req, dcy-014) baseline 문서를 trading_date 타임존 분리·일일 preallocation 흐름에 맞춰 정합: docs/runtime-flows.md(데몬 lifecycle TOML 키·8 스레드·일일 슬롯 preallocation Flow 신규), docs/data-model.md(trading_date=설정 TZ 기준 / timestamp=UTC 구분). BAT-018 정합 완료 → Implemented 유지.

Intent

  • 코드(preallocation_scheduler/daemon/config) 변경과 baseline 문서를 일치(S-1~S-4)시켜 운영자 참조 정합 유지.

Acceptance Criteria Delta

  • Updated:
    • runtime-flows 데몬 lifecycle/일일 preallocation, data-model trading_date TZ vs UTC timestamp 기술 정합.

Impacted Area Delta

  • Docs: docs/runtime-flows.md, docs/data-model.md

Delivery Trace Delta

  • Batches: BAT-018
  • Releases: none

Revalidation Impact

  • Reverification Needed: no (문서 정합)
  • Existing Implementation Invalidated: no
  • Status Recommendation: Implemented (change-req → BAT-018 정합)
  • Follow-up Action: confirm-req-implemented(BAT-018).

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 대조.