feat: 블랙아웃 복구 시 가격/세션 재검증 강화 (#328) #345
Reference in New Issue
Block a user
Delete Branch "feature/issue-328-blackout-revalidation"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
BLACKOUT_RECOVERY_PRICE_REVALIDATION_ENABLED(default: true)BLACKOUT_RECOVERY_MAX_PRICE_DRIFT_PCT(default: 5.0)_resolve_market_setting)를 통해 세션별 정책 적용process_blackout_recovery_orders에settings인자 추가, daily/realtime 호출부 연결Test
pytest -q tests/test_main.py -k "process_blackout_recovery_executes_valid_intents or process_blackout_recovery_drops_policy_rejected_intent or process_blackout_recovery_drops_intent_on_excessive_price_drift"python3 -m py_compile src/main.py src/config.py tests/test_main.pyRefs: #328
PR #345 Review: ACT-11 블랙아웃 복구 가격 재검증
✅ LGTM
플랜 준수: ACT-11 (GAP-4 잔여, #328) — 블랙아웃 복구 시 가격/세션 재검증 강화. 플랜과 일치합니다.
구현 품질:
_resolve_market_setting()활용으로 세션별 재검증 임계값 오버라이드 가능 — ACT-10과 일관된 패턴broker.get_current_pricevsoverseas_broker.get_overseas_price)queued_price <= 0 or current_price <= 0방어 코드로 잘못된 가격 데이터 안전 처리abs(current_price - queued_price) / queued_price * 100.0— 양방향(상승/하락) 감지 올바름설정:
BLACKOUT_RECOVERY_PRICE_REVALIDATION_ENABLED(default: True) — 기존 동작에 영향 없음BLACKOUT_RECOVERY_MAX_PRICE_DRIFT_PCT(default: 5.0, ge=0.0, le=100.0) — 합리적 범위테스트:
broker.get_current_pricemock 추가 — 기존 동작 유지 확인send_order미호출 +validate_policy미호출 확인Nit (optional, 머지 차단 아님):
overseas_broker.get_overseas_price경로). 현재는 국내(KR) 경로만 테스트됩니다._retry_connection이 예외를 전파하면 해당 intent가 스킵되는지 확인 필요.리뷰 확인했고 nit 2건 반영했습니다.
추가 반영:
overseas_broker.get_overseas_price분기에서 drift 초과 시 드롭 검증검증:
pytest -q tests/test_main.py -k "process_blackout_recovery_executes_valid_intents or process_blackout_recovery_drops_policy_rejected_intent or process_blackout_recovery_drops_intent_on_excessive_price_drift or process_blackout_recovery_drops_overseas_intent_on_excessive_price_drift or process_blackout_recovery_requeues_intent_when_price_lookup_fails"(5 passed)python3 -m py_compile tests/test_main.py반영 커밋:
5fae976Nit 반영 확인 ✅
Nit 1 (해외 주식 경로 테스트):
test_process_blackout_recovery_drops_overseas_intent_on_excessive_price_drift추가 확인.overseas_broker.get_overseas_price→ 현재가 106.0, 큐 가격 100.0 → drift 6% > 5% →send_overseas_order미호출. 해외 경로 완전히 커버됨.Nit 2 (가격 조회 예외 처리):
test_process_blackout_recovery_requeues_intent_when_price_lookup_fails추가 확인.get_current_price→ConnectionError→requeue(intent)호출 +intent.attempts == 1검증.settings=None으로 기본값 경로를 타도록 설계한 것도 올바름.LGTM.