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>
This commit is contained in:
@@ -41,6 +41,7 @@ from trex_core.adapters.messaging.topology import (
|
||||
direct_routing_key,
|
||||
intent_queue,
|
||||
slots_queue,
|
||||
strategy_state_set_queue,
|
||||
)
|
||||
from trex_core.application.messaging import (
|
||||
EventHandler,
|
||||
@@ -140,7 +141,11 @@ class RabbitMQTransport:
|
||||
iq = intent_queue(instance_key)
|
||||
sq = slots_queue(instance_key)
|
||||
cq = control_queue(instance_key)
|
||||
for q, channel_type in ((iq, "intent"), (sq, "slots"), (cq, "control")):
|
||||
ssq = strategy_state_set_queue(instance_key) # dcy-028 / REQ-080
|
||||
for q, channel_type in (
|
||||
(iq, "intent"), (sq, "slots"), (cq, "control"),
|
||||
(ssq, "strategy_state_set"),
|
||||
):
|
||||
ch.queue_declare(q, durable=True, arguments=dlx)
|
||||
# Directed binding: trex.direct → {instance_key}.{channel_type}
|
||||
ch.queue_bind(q, DIRECT_EXCHANGE,
|
||||
|
||||
@@ -14,6 +14,7 @@ from __future__ import annotations
|
||||
# --- RPC queues (durable for intent; transient-ish for slots but kept
|
||||
# durable for simplicity since the queue itself is shared) ---
|
||||
SLOTS_REQ_QUEUE = "trex.slots.req" # REQ-073 / dcy-025: replaces snapshot.req
|
||||
STRATEGY_STATE_SET_QUEUE = "trex.slots.strategy_state.set" # dcy-028 / REQ-080
|
||||
INTENT_REQ_QUEUE = "trex.intent.req"
|
||||
PAUSE_REQ_QUEUE = "trex.pause.req" # BAT-008 / REQ-032 (legacy alias of control)
|
||||
CONTROL_REQ_QUEUE = "trex.control.req" # BAT-012 / REQ-043 operator control channel
|
||||
@@ -44,6 +45,10 @@ def slots_queue(instance_key: str | None = DEFAULT_INSTANCE_KEY) -> str:
|
||||
return _instance_queue(SLOTS_REQ_QUEUE, instance_key)
|
||||
|
||||
|
||||
def strategy_state_set_queue(instance_key: str | None = DEFAULT_INSTANCE_KEY) -> str:
|
||||
return _instance_queue(STRATEGY_STATE_SET_QUEUE, instance_key)
|
||||
|
||||
|
||||
def control_queue(instance_key: str | None = DEFAULT_INSTANCE_KEY) -> str:
|
||||
return _instance_queue(CONTROL_REQ_QUEUE, instance_key)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user