Files
trex-core/docs/batches/bat-043_20260615_sell-intent-retryable-flag/implementation.md
T
genichinandClaude Opus 4.8 e0d4e71304 feat(slot,intent): slot strategy-state 저장소 (dcy-028) + sell retryable 플래그 (issue #27)
BAT-042 (dcy-028 / issue #26 C-1/C-2/C-2b/C-3, REQ-079~082 + REQ-073/074 CHG):
- slot_strategy_state 별도 테이블 + StrategyStateStore(in-memory+PG) + occupancy_seq·version CAS + opaque UTF-8 data + 2단 size cap (REQ-079)
- trex.slots.strategy_state.set write RPC — reject reason 집합, 멱등 (REQ-080)
- Slot.occupancy_seq 필드 + inactive→pending_buy bump + →INACTIVE close 삭제 훅 → 점유 전환 ABA 구조적 차단 (REQ-081)
- slots.req 응답 행에 strategy_state 맵(batched 조립)·occupancy_seq additive (REQ-073 AC-7/REQ-074 AC-6)
- 마이그레이션 014(occupancy_seq)/015(slot_strategy_state), baseline 문서 정합 (REQ-082)

BAT-043 (issue #27 / REQ-007 CHG):
- rejected SellIntent 응답에 additive retryable: bool (core 소유 reason→retryable 매핑, 미인식 기본 true, bad_request* false) — 손절매 재시도 안전 경로 decoupling

검증: 487 passed, 47 skipped (신규 41: store CAS 6+ABA, occupancy bump/close 4경로, set RPC 9, slots read 5, retryable 8, PG 게이트), ruff clean.
REQ-079·080·081·082·073·074·007 → Implemented. issue #27 close. PG 경로 실 DB 검증은 release 위임.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-15 19:27:57 +09:00

1.6 KiB

BAT-043 Implementation

  • Status: completed
  • Batch: BAT-043

Plan Summary

  • rejected SellIntent 응답에 additive retryable: bool 추가 (core 소유 매핑). 완전 additive·하위호환.

Changed Files

  • trex_core/application/messaging_handlers.py — _SELL_REJECT_RETRYABLE dict + _sell_reject_retryable(reason) helper(미인식 true, bad_request* false) + intent 응답 빌더에 intent_type=="sell" & status=="rejected" 시 retryable 부여(정상 거부 경로 + sell bad_request 조기반환 경로 모두).
  • docs/interface-contract.md — intent RPC 응답 표에 rejected sell retryable 명시 + Change Log.
  • tests/application/test_sell_retryable_flag.py (신규) — 매핑 7 reason + 미인식 + None + bad_request + 응답 필드(inactive/unknown_slot/bad_request → false, admitted/buy → 부재).

Execution Log

  1. _SELL_REJECT_RETRYABLE 매핑 + helper 추가(messaging_handlers).
  2. 응답 빌더 2지점(정상 결정 / sell bad_request)에 additive 부여.
  3. interface-contract 정합 + 테스트 작성.

Validation

  • TREX_BROKER=paper uv run pytest -q → 487 passed, 47 skipped(BAT-042 479 + 본 batch 8). 신규 8: 매핑 3 + 응답 5.
  • uv run ruff check trex_core/ tests/ → All checks passed.
  • 회귀: 기존 intent consumer/handler 테스트 green(admitted/buy 응답 retryable 부재 확인 포함).

Remaining Risks

  • reason 어휘 drift: 새 reason 추가 시 매핑 갱신 필요(미인식 기본 true 안전망 + 매핑 테스트가 현행 reason 전수 커버).
  • 없음(완전 additive, 기존 계약 불변).