Files
trex-core/docs/batches/bat-018_20260608_trading-date-timezone-daily-preallocation/verification.md
T
genichinandClaude Opus 4.8 0b7db66463 feat(runtime): dcy-014 trading_date KST 타임존 분리 + 일일 슬롯 preallocation (BAT-018)
데몬이 시스템 UTC 날짜로 슬롯을 1회만 preallocate 해 trading_date 가 KST 캘린더와
어긋나고 재시작 없이는 다음날 슬롯이 안 생기던 문제(issue #14) 정정.

거버넌스: 전부 change-req (신규 REQ 없음, dcy-014 OQ-3; 스케줄러는 REQ-030 패턴 준용).
- REQ-005: trading_date 를 설정 타임존(기본 Asia/Seoul) 기준 계산(timestamp 는 UTC
  유지). DailyPreallocationScheduler 신규 — TZ 일자당 1회 멱등 fire, 재시작 없이
  다음날 슬롯 자동 생성. setup() 배선 + trex-preallocation 스레드
- REQ-048: TOML trading_timezone/daily_preallocation_time 키 + from_config 전파
- REQ-009: runtime-flows/data-model 정합 + instance.example.toml

OQ-1 기본 00:00(TZ 자정, TOML 설정 가능) / OQ-2 매 캘린더일 생성(거래일 캘린더 후속).
멱등 preallocate 로 중복 tick·다중 인스턴스 중복 생성 0.

검증: 단위 302 passed/32 skipped, 인프라 게이트(PG+RabbitMQ) 334 passed, ruff clean.
신규 test_preallocation_scheduler(고정 clock) + test_instance_config 확장.
BAT-018 release-candidate.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-08 15:39:04 +09:00

2.7 KiB

BAT-018 Verification

  • Status: verified
  • Batch: BAT-018

Acceptance Mapping

REQ-005 (스케줄러 + 부트스트랩, change-req)

AC Evidence
trading_date = 설정 TZ 기준(UTC 아님) tests/application/test_preallocation_scheduler.py::test_trading_date_uses_kst_not_utc_at_midnight_boundary
일자 경계 자동 생성(무재시작) + 멱등 ::test_cross_day_boundary_auto_creates_next_day_idempotently
트리거 시각 게이팅 ::test_trigger_time_gates_next_day_creation
idle 슬롯 생성 ::test_idle_slots_created_for_trading_date
부트스트랩/스레드 배선 회귀 전체 회귀(daemon import/setup)

REQ-048 (TOML 설정, change-req)

AC Evidence
TOML 기본값(KST/00:00) tests/runtime/test_instance_config.py::test_trading_timezone_defaults_to_kst
TOML 값 from_config 전파 ::test_trading_timezone_from_toml_propagates
기존 TOML 키 회귀 기존 test_instance_config 전체

REQ-009 (baseline 문서, change-req)

AC Evidence
runtime-flows/data-model 정합 문서 diff(BAT-018) + instance.example.toml

Evidence

  • Test:
    • 단위 전체 회귀: 302 passed / 32 skipped(신규 스케줄러 6 + config 2 포함; ::test_sandbox_token_and_submit deselect).
    • 인프라 게이트(PG trex_core_test + RabbitMQ): 334 passed.
    • ruff check trex_core tests → All checks passed.
  • Logs: 302 passed, 32 skipped, 1 deselected / 334 passed, 1 deselected ~16.1s.

성공 기준(dcy-014) 대응

  • S-1(설정 TZ "오늘" = DB trading_date, UTC 자정 경계 포함): test_trading_date_uses_kst_not_utc_at_midnight_boundary(15:30Z → KST 6/9).
  • S-2(timestamp UTC 유지): test_timestamps_stay_utc(updated_at utcoffset 0).
  • S-3(무재시작 일자 경계 자동 생성 + 중복 0): test_cross_day_boundary_auto_creates_next_day_idempotently.
  • S-4(TOML 타임존 설정 반영): test_configurable_timezone_changes_trading_date(UTC TZ → 6/8) + test_trading_timezone_from_toml_propagates.

Carried-Over / 비차단

  • 기본 타임존 Asia/Seoul 확정·TOML 키 명명(DATA): 구현에서 trading_timezone/daily_preallocation_time 로 확정. 운영 배포 안내는 instance.example.toml 에 문서화.
  • 실 다중 인스턴스 동시 일일 preallocation 무중복(NFR-2): 멱등 preallocate 로 보장, 실 환경 동시 기동 e2e 는 운영 검증 비차단.
  • 거래일 캘린더(주말/공휴일): OQ-2 결정으로 매 캘린더일 생성, 후속 분리.

Result

  • Ready for Release: true
  • Blocking Issues:
    • 없음. 부트스트랩 TZ 전환·일일 preallocation·TOML 설정 모두 단위 green(334 passed 회귀). LIVE sandbox 토큰 deselect 는 .env 환경 의존(본 batch 무관).