REQ-011 change-req(CHG-20260612-01)→구현→confirm-req-implemented(CHG-20260612-02)
전체 delivery. paper 한정 결정성 버그(프로덕션 무관).
- seq_store.py 신규: SeqStore 포트 + RedisSeqStore(원자 INCR, 재시작 단조·영속)
+ InMemorySeqStore(폴백/테스트). REQ-016 token_cache 패턴 재사용.
- paper.py: optional seq_store 주입. 미주입 시 기존 in-memory 동작 byte-for-byte 유지.
- config.py/daemon.py: TREX_PAPER_REDIS_URL → RedisSeqStore wiring
(key=trex:broker:paper:{instance_key}:order-seq).
- 런타임 Redis 오류는 전파(silent in-memory 폴백 금지 — 버그 재현 방지).
- tests: 재시작 단조성/correlation_id 비충돌/in-memory 폴백/fake redis INCR (5).
434 passed (+5), ruff clean.
REQ-011 Approved→Implemented, BAT-039 release-candidate. issue #4 close.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2.5 KiB
2.5 KiB
BAT-039 Verification
- Status: confirmed
- Batch: BAT-039
Acceptance Mapping
-
REQ-011 AC-1 (submit accepted, 동기 단축 없음):
- 변경 범위 밖(발번 경로만 수정, 비동기 계약 불변). Evidence: 기존 paper 테스트 전체 회귀 —
pytest tests/434 passed.
- 변경 범위 밖(발번 경로만 수정, 비동기 계약 불변). Evidence: 기존 paper 테스트 전체 회귀 —
-
REQ-011 AC-2 (결정적 fill 시나리오 — 즉시/N틱/부분/거부):
- 변경 범위 밖. Evidence: 기존 paper 더블 시나리오 테스트 회귀 없음(434 passed).
-
REQ-011 AC-3 (도메인 순수성 — broker 의존 0, BrokerPort 구현 adapters 한정):
seq_store.py는 adapters/broker 레이어에 위치, 도메인 미참조. Evidence: 도메인 import 스윕 회귀 없음(전체 회귀 green).
-
REQ-011 AC-4 (seq store 재시작 단조 + correlation_id 비충돌 + 미주입 폴백):
- Evidence:
test_shared_seq_store_is_monotonic_across_restart: 같은 store 공유 두 broker(재시작 모사) →PAPER-000001→PAPER-000002단조 PASSED.test_post_restart_sell_does_not_collide_with_prior_buy: 매수→재시작→매도 correlation_id 비충돌 PASSED.test_without_store_restart_reproduces_collision: (버그 문서화) store 없을 때 두 broker 모두PAPER-000001→ correlation_id 동일(원장 dedup 발생) PASSED — 수정 전 동작 고정.test_in_memory_fallback_starts_at_one: 미주입 시PAPER-000001부터(기존 동작 유지) PASSED.test_redis_seq_store_incr_is_monotonic_and_shared: fake redis INCR 로 재시작 모사 단조·공유 PASSED.
- Evidence:
Evidence
-
Test:
pytest tests/adapters/broker/test_paper_seq_store.py— 5 passed (신규)pytest tests/— 434 passed, 45 skipped (BAT-038 429 → +5, 회귀 0)ruff check trex_core tests— All checks passed
-
Manual / Architecture Impact (none):
- design.md Architecture Impact = none —
docs/project-structure.md,docs/runtime-flows.md동기화 불필요(발번 경로 내부 결정성 보강, 외부 흐름/계약 불변).seq_store.py는 token_cache 와 동급 adapters 파일 추가로 구조 패턴 불변. _build_brokerwiring(TREX_PAPER_REDIS_URL→RedisSeqStore, instance_key 스코프 키) 코드 리뷰 확인.
- design.md Architecture Impact = none —
Result
- Ready for Release: true
- Blocking Issues: 없음
- 라이브 Redis 통합 스모크는 REL 배포 단계 사항. 단위 테스트가 INCR/단조/폴백 계약을 fake redis_module + InMemorySeqStore 로 검증하므로 release-ready 차단 아님. 실 KIS 무관(odno 고유).