feat(safety-sell): dcy-010 BAT-014 — 영속 거부 재시도 쿨다운 (REQ-052~054)
dcy-010(safety-sell 영속 거부 재시도 백오프) 전체 SDLC: draft-req → confirm-req → draft-batch(BAT-014 batch-lite) → run-batch-delivery → confirm-req-implemented. 2026-06-07 실 KIS LIVE SL/TP e2e에서 발견한 KIS 주문 spam 위험(영속 거부 시 매도 무한 재제출) 차단. - REQ-052 (Integration): SafetySellService per-slot 인메모리 쿨다운 (_in_cooldown/_attempt_sell/_prune_cooldown) — forced_close·stop-loss·take-profit 트리거에 min_retry_interval_sec(600s) 이내 재시도 skip(가격 poll 포함) + max_retry_warn_count(3) 도달 시 WARNING + holding 이탈 정리. market_close 제외. - REQ-053 (Configuration): SafetySellConfig min_retry_interval_sec/max_retry_warn_count + TREX_SAFETY_SELL_MIN_RETRY_INTERVAL/MAX_RETRY_WARN_COUNT env (additive) - REQ-054 (Documentation): runtime-flows 쿨다운 flow + 가격체크 tr_id(FHKST01010100) 정정 인메모리 only(DB/스레드/인터페이스 변경 없음), default 미설정 시 기존 동작 불변. 검증: 신규 8 단위(쿨다운 6 + config 2), 전체 278 passed, ruff clean. REQ-052~054 Implemented, BAT-014 release-candidate. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,141 @@
|
||||
# req-053: safety-sell 재시도 쿨다운 env 설정 2종
|
||||
|
||||
- Status: Implemented
|
||||
- Type: Configuration
|
||||
- Priority: Medium
|
||||
- Owner: project maintainers
|
||||
|
||||
## Intent
|
||||
|
||||
safety-sell per-slot 쿨다운(REQ-052)의 튜닝 값을 운영 설정으로 노출한다. `SafetySellConfig`에 `min_retry_interval_sec`와 `max_retry_warn_count` 두 필드를 추가하고, 기존 safety-sell env 5종과 동일 방식으로 optional 파싱한다(dcy-010 FR-5).
|
||||
|
||||
## Requirement
|
||||
|
||||
- `SafetySellConfig`(`trex_core/runtime/config.py`)에 두 필드를 추가한다:
|
||||
- `min_retry_interval_sec: int` — env `TREX_SAFETY_SELL_MIN_RETRY_INTERVAL`, 기본값 `600`(OQ-1 Answered).
|
||||
- `max_retry_warn_count: int` — env `TREX_SAFETY_SELL_MAX_RETRY_WARN_COUNT`, 기본값 `3`(OQ-2 Answered).
|
||||
- `DaemonConfig.from_env()`에서 기존 safety-sell env(`TREX_WATCHDOG_TIMEOUT` 등)와 동일 패턴으로 파싱한다. 미설정 시 기본값으로 동작(회귀 없음).
|
||||
- 이 값들은 `SafetySellService`(REQ-052)에 주입되어 쿨다운/경고 임계로 사용된다.
|
||||
|
||||
## Acceptance Criteria
|
||||
|
||||
1. Given `TREX_SAFETY_SELL_MIN_RETRY_INTERVAL`/`TREX_SAFETY_SELL_MAX_RETRY_WARN_COUNT` 미설정, When `DaemonConfig.from_env()`, Then `min_retry_interval_sec=600`, `max_retry_warn_count=3` 기본값으로 구성된다.
|
||||
2. Given 두 env 가 각각 `300`/`5` 로 설정, When `from_env()`, Then `SafetySellConfig`에 `300`/`5`로 파싱된다.
|
||||
3. Given 두 env 미설정 + 기존 safety-sell 동작, When 전체 회귀, Then 회귀 없음(기존 5종 env 동작 불변).
|
||||
|
||||
## Impacted Area
|
||||
|
||||
- Docs:
|
||||
- `docs/runtime-flows.md`/`docs/project-structure.md` — env 목록(REQ-054 / 또는 본 REQ Notes)
|
||||
- Modules:
|
||||
- `trex_core/runtime/config.py` — `SafetySellConfig` 필드 2종 + `from_env` 파싱
|
||||
- Tests:
|
||||
- `tests/runtime/test_safety_sell_config.py` — 기본값 + 파싱
|
||||
|
||||
## Notes
|
||||
|
||||
- 기존 SafetySellConfig env 5종(REQ-041)과 동일 패턴 확장. additive·optional.
|
||||
- 값의 의미·동작은 REQ-052(쿨다운 로직)에서 정의. 본 REQ 는 설정 표면만.
|
||||
|
||||
## Change Log
|
||||
|
||||
### CHG-20260608-01
|
||||
|
||||
- Date: 2026-06-08
|
||||
- Author: Justin Ko
|
||||
|
||||
#### Change Summary
|
||||
|
||||
- dcy-010(confirmed) → REQ-053 초안 생성.
|
||||
|
||||
#### Intent
|
||||
|
||||
- safety-sell 쿨다운 env 2종(FR-5)을 Configuration REQ 로 정규화.
|
||||
|
||||
#### Acceptance Criteria Delta
|
||||
|
||||
- Added: AC-1~3 전체
|
||||
|
||||
#### Impacted Area Delta
|
||||
|
||||
- Docs: runtime-flows.md/project-structure.md (REQ-054)
|
||||
- Modules: config.py
|
||||
- Tests: test_safety_sell_config.py
|
||||
|
||||
#### Delivery Trace Delta
|
||||
|
||||
- Batches: none (미할당)
|
||||
- Releases: none
|
||||
|
||||
#### Revalidation Impact
|
||||
|
||||
- Reverification Needed: no
|
||||
- Existing Implementation Invalidated: no
|
||||
- Status Recommendation: keep-current
|
||||
- Follow-up Action: confirm-req 로 승인.
|
||||
|
||||
### CHG-20260608-02
|
||||
|
||||
- Date: 2026-06-08
|
||||
- Author: Justin Ko
|
||||
|
||||
#### Change Summary
|
||||
|
||||
- Proposed → Approved (confirm-req).
|
||||
|
||||
#### Intent
|
||||
|
||||
- 승인 게이트 통과: 필수 필드·구체 AC·Change Log 완비. OQ-1(600s)/OQ-2(3) 기본값 확정. 기존 SafetySellConfig env 패턴 확장(additive, 회귀 없음).
|
||||
|
||||
#### Acceptance Criteria Delta
|
||||
|
||||
- (변경 없음)
|
||||
|
||||
#### Impacted Area Delta
|
||||
|
||||
- (변경 없음)
|
||||
|
||||
#### Delivery Trace Delta
|
||||
|
||||
- Batches: none (미할당)
|
||||
- Releases: none
|
||||
|
||||
#### Revalidation Impact
|
||||
|
||||
- Reverification Needed: no
|
||||
- Existing Implementation Invalidated: no
|
||||
- Status Recommendation: keep-current
|
||||
- Follow-up Action: draft-batch 로 delivery 편성(batch-lite).
|
||||
|
||||
### CHG-20260608-03
|
||||
|
||||
- Date: 2026-06-08
|
||||
- Author: Justin Ko
|
||||
|
||||
#### Change Summary
|
||||
|
||||
- Status Approved → Implemented (confirm-req-implemented, 근거 batch BAT-014 release-candidate).
|
||||
|
||||
#### Intent
|
||||
|
||||
- BAT-014 verification: `SafetySellConfig` min_retry_interval_sec/max_retry_warn_count 기본값(600/3) + env 파싱(300/5) 단위 green, 미설정 회귀 없음(278 passed). AC-1~3 충족.
|
||||
|
||||
#### Acceptance Criteria Delta
|
||||
|
||||
- (변경 없음)
|
||||
|
||||
#### Impacted Area Delta
|
||||
|
||||
- (변경 없음)
|
||||
|
||||
#### Delivery Trace Delta
|
||||
|
||||
- Batches: BAT-014 (release-candidate)
|
||||
- Releases: none
|
||||
|
||||
#### Revalidation Impact
|
||||
|
||||
- Reverification Needed: no
|
||||
- Existing Implementation Invalidated: no
|
||||
- Status Recommendation: keep-current (Implemented)
|
||||
- Follow-up Action: draft-release 로 BAT-014 배포 편성.
|
||||
Reference in New Issue
Block a user