feat: stop-loss reentry cooldown guard (#319) #341
Reference in New Issue
Block a user
Delete Branch "feature/issue-319-stoploss-reentry-cooldown"
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
STOPLOSS_REENTRY_COOLDOWN_MINUTESsettingValidation
Ticket Maturity Update (2026-02-28)
Coverage Matrix:
Review: PR #341 — feat: stop-loss reentry cooldown guard (#319)
플랜 일치: ✅ ACT-02 정확히 일치
코드 품질: ✅ 양호
Field(default=120, ge=1, le=1440)— 1분~24시간 범위 제한_STOPLOSS_REENTRY_COOLDOWN_UNTIL— 프로세스 수명 동안 유지, 재시작 시 초기화 (의도된 동작)market.code:stock_code— 시장별 분리trade_pnl < 0일 때만 — 익절에는 미적용 (ACT-02 수용 기준 충족)테스트: ❌ 없음 — BLOCKING
우려사항
_STOPLOSS_REENTRY_COOLDOWN_UNTIL)가 테스트 간 상태 누출 가능 — 테스트에서 cleanup fixture 필요결론: Changes Requested — 테스트 추가 필수
리뷰 요청 반영 완료했습니다.
추가 반영:
_STOPLOSS_REENTRY_COOLDOWN_UNTIL.clear()추가검증:
pytest -q tests/test_main.py -k "stoploss_reentry_cooldown or sell_updates_original_buy_decision_outcome"Re-review: PR #341 — feat: stop-loss reentry cooldown guard (#319)
이전 리뷰 지적사항 반영 확인
쿨다운 시간 내 매수 거부 테스트: ✅ 추가됨
test_stoploss_reentry_cooldown_blocks_buy_when_active: 쿨다운 300초 남은 상태에서 BUY 차단 확인쿨다운 경과 후 정상 진입 테스트: ✅ 추가됨
test_stoploss_reentry_cooldown_allows_buy_after_expiry: 만료 10초 전 타임스탬프로 BUY 허용 확인익절 시 쿨다운 미적용 테스트: ✅ 추가됨
test_sell_updates_original_buy_decision_outcome끝에 쿨다운 미설정 확인 (assert "KR:005930" not in _STOPLOSS_REENTRY_COOLDOWN_UNTIL)테스트 간 상태 누출 방지: ✅ 해결
_reset_kill_switch_statefixture에_STOPLOSS_REENTRY_COOLDOWN_UNTIL.clear()추가 (setup + teardown 양쪽)코드 품질
결론: LGTM ✅
8b5fcfb7c1to5f53b02da8컨플릭트 해결 완료했습니다.
조치:
feature/v3-session-policy-stream최신 기준으로 rebasesrc/config.py,src/main.py병합US_MIN_PRICE필터 로직 유지STOPLOSS_REENTRY_COOLDOWN로직 유지git push --force-with-lease검증:
pytest -q tests/test_main.py -k "stoploss_reentry_cooldown or us_min_price_filter_boundary or us_min_price_filter_not_applied_to_kr_market or sell_updates_original_buy_decision_outcome"