Files
trex-core/docs/batches/bat-048_20260621_fill-price-backfill-guard-logging-alert-spike/index.md
T
genichinandClaude Opus 4.8 f1b649cf2a feat(execution): 체결가 0/None 시 지정가 백필 가드 + WARN 로깅 (dcy-032/BAT-048)
REQ-095(슬롯 평단·원장 price 지정가 백필, 0 오염 방지) + REQ-096(백필/미해결 WARN 로깅) 구현.
지정가 부재 시 skip+강WARN. application 단일화(_resolve_fill_price), wire/LedgerTrade 스키마 불변.
575 passed/0 fail, opus QC PASS. REQ-097 알람=스파이크 산출물만(impl 후속).

- _resolve_fill_price 헬퍼 추가: avg_price 검증, limit_price 백필, 미해결 WARN
- _on_filled/_on_partial_cancel 통합: 백필 적용, 슬롯/원장 일관성
- _record_ledger 시그니처: resolved_price 파라미터 (backward compat)
- test_execution_fill_price_backfill.py: 21 시나리오 (avg=None/0, limit=있음/없음 등)
- docs: dcy-032, req-095/096/097, bat-048 설계/검증

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VHtM5Ws1HKCKQ4JGi6GRb5
2026-06-21 13:34:31 +09:00

3.3 KiB

BAT-048: 체결가 0/None 백필 가드 + WARN 로깅 + 알람 능력 스파이크 (dcy-032)

  • Status: verified (confirm-batch-verification 팀장 2026-06-21 — REQ-095/096 Implemented, 575 passed/47 skipped/0 fail 독립 재실행 + ruff clean, opus QC PASS-WITH-NOTES→NOTE-1/2 정정완료, 통합 3건 미실행 결정 기록[영속/전송 diff 0·KIS avg=None 결정적 재현 불가])
  • Profile: standard
  • Source Discovery: dcy-032
  • Included REQ: REQ-095 (구현 완료), REQ-096 (구현 완료), REQ-097 (스파이크 산출물 완료 — 알람 impl 이월)
  • Excluded REQ: 없음

Summary

  • dcy-032 발견: KIS 체결조회에서 체결수량은 반환되나 평균체결가(avg)가 None/0일 때, 슬롯 평단(slot.avg_price)과 원장 cost basis(_record_ledger price)가 동시에 0으로 무경고·영구 오염된다. 완전체결 시 clear_dispatch로 재폴링이 없어 0이 영속된다.
  • 세 REQ가 단일 인과 사슬(체결가 누락 → 무결성 가드 → 가시성 → 알람 검토)을 형성하므로 같은 batch로 묶는다. REQ-095/096은 구현·테스트가 동일 코드 경로(execution.py:_on_filled, _on_partial_cancel, _record_ledger)에 있어 분리 구현의 이점이 없다. REQ-097은 같은 batch design 산출물로 제출되어 사장님 결정의 근거가 된다.

Scope

  • In Scope:
    • trex_core/application/execution.py — _on_filled/_on_partial_cancel의 fill_price 백필 분기(REQ-095) + WARN 로그(REQ-096)
    • trex_core/application/execution.py — _record_ledger의 price 백필 분기(REQ-095) + 백필/0가격 통과 WARN(REQ-096)
    • 알람 채널 후보 A/B/C 분석 문서(REQ-097) — design 산출물
    • tests/application/test_execution.py — avg_price=None, avg_price=0, happy path, WARN 로그 발생 AC 커버
    • docs/runtime-flows.md — 체결 처리 흐름에 백필 분기 추가 (implementation 후 갱신)
    • docs/operations.md — 백필 WARN 발생 시 운영자 점검 절차 추가 (implementation 후 갱신)
  • Out of Scope:
    • trex_core/adapters/broker/kis.py 수정 — 백필 결정 지점을 application으로 단일화하므로 adapter 변경 없음 (design 확정 결과)
    • slots RPC / AMQP wire 계약 변경 — NFR-1 명시적 금지
    • 과거 0 기록 원장/슬롯의 소급 정정
    • 알람 실제 구현 — design review 후 사장님 결정 사안(REQ-097 OQ-1)

Documents

  • Planning: planning.md
  • Design: design.md
  • Implementation: trex_core/application/execution.py, tests/application/test_execution_fill_price_backfill.py
  • Verification: verification.md

Notes

  • R-1(Medium, Discovery R-1): 지정가 백필도 추정치. 실제 체결가 ≠ 지정가일 수 있음. 완화: WARN+추적 가능 플래그, 런북 명시.
  • R-2(Medium, Discovery R-2): 백필 결정 지점(adapter vs application) 선택에 따라 paper/dcy-021 재구성 경로 일관성이 달라짐. design에서 단일 지점 확정 필수 — 팀장 승인 게이트.
  • R-3(Low, Discovery R-3): 알람 구현 포함 시 범위 확대 → M2 일정 압박. design review에서 사장님 결정.
  • wire 계약 안전: 후보 B(AMQP 이벤트 알람) 분석에서 wire 계약 변경 필요성이 발생하면 즉시 팀장 보고·중단(CLAUDE.md 교차 영향 사안 정책).