BAT-035 (dcy-025): trex.snapshot.req → trex.slots.req 즉시 교체
- topology: SNAPSHOT_REQ_QUEUE 제거, SLOTS_REQ_QUEUE = "trex.slots.req" 추가
- portfolio.py: View/build_snapshot_envelope/SnapshotEnvelope/_asset_to_dict 제거;
slot_to_dict 시그니처 확장(snapshot_store/watchdog_store/pause_store/watchdog_timeout_sec)
— asset_quantity(hub)/cash_balance/cash_estimated/warned/watchdog{}/paused 병합 (REQ-074)
- messaging_handlers.py: make_snapshot_rpc_handler 제거, make_slots_rpc_handler 추가
— filter(all/inactive/pending/holding/error) + spy(bool) 처리; strategy 필드 제외 (REQ-073/074)
- daemon.py: _snapshot_rpc_loop → _slots_rpc_loop, make_slots_rpc_handler 연결
- cli.py: universe/slots → slots_queue + spy=True + server-side filter; buyable→inactive 매핑 (REQ-063)
- rabbitmq.py: snapshot_queue → slots_queue
- docs: interface-contract.md + runtime-flows.md slots.req 계약으로 업데이트 (REQ-075)
- REQ-028: Implemented → Deprecated (코드 삭제 완료)
- 테스트: test_snapshot_handler/selection/rpc_watchdog/messaging_snapshot_consumer 삭제;
test_slots_handler.py(신규, 13 cases), test_killswitch_masking_resume 재작성,
test_ledger_option_d._apply_cash_estimate → slots handler 경유, test_topology/cli_operator 갱신
BAT-036 (dcy-024): per-instance safety_sell_enabled 플래그
- config.py: DaemonInstanceConfig + DaemonConfig 에 safety_sell_enabled: bool = True 추가;
from_toml 파싱, from_config 전파
- daemon.py: start() workers 조건부 — safety_sell_enabled=false 시 trex-safety-sell 미기동 + WARNING
- tests: test_instance_config.py 에 safety_sell_enabled 파싱 3개 케이스 추가
REQ: 073/074/075/021/034/063/048/005 Approved → Implemented
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2.4 KiB
BAT-036 Design
- Status: confirmed
- Batch: BAT-036
Architecture Summary
DaemonInstanceConfig에safety_sell_enabled: bool = True필드를 추가하고 per-instance TOML 파싱 경로(from_toml)와DaemonConfig.from_config()전파 경로를 업데이트한다.Daemon.start()내부 workers 리스트 구성 시safety_sell_enabled값을 체크해 False이면("trex-safety-sell", self._safety_sell_loop)항목을 포함하지 않는다.
Changed Areas
- Docs: 없음 (docs 변경 없음)
- Modules:
trex_core/runtime/config.py— DaemonInstanceConfig 필드 + from_toml + from_config 전파trex_core/runtime/daemon.py— start() workers 분기
- Tests:
- config 파싱 단위 테스트
- daemon workers 구성 테스트
Key Decisions
-
absent=true 기본값:
from_toml()내data.get("safety_sell_enabled", True). TOML 키 부재 시 True → 기존 배포 동작 보존. -
DaemonConfig 전파 경로:
DaemonConfig.from_config()→DaemonInstanceConfig.from_toml()→DaemonInstanceConfig.safety_sell_enabled→DaemonConfig생성자 또는 속성으로 전달.Daemon.__init__에서self._config.safety_sell_enabled로 참조. -
workers 조건 분기 위치:
daemon.py:328workers 리스트 구성 블록 내,("trex-safety-sell", self._safety_sell_loop)항목을 조건부로 append. 리스트 구성 후 순회 루프(for name, target in workers:)는 변경 없음. -
로그 메시지:
logger.warning("safety_sell disabled — trex-safety-sell worker not started. Autonomous safety-sell will NOT run."). RUNNING 로그(기존)로 전체 워커 시작 상태를 가시화. -
AC-6 보존:
_safety_sell_loop제거가 아닌 workers 리스트 미포함.Daemon._safety_sell_loop메서드 자체는 삭제하지 않는다(CLI exit/cancel/kill-switch 독립 경로는 이 메서드를 직접 호출하지 않으므로 무관).
Edge Cases
- safety_sell_enabled=True (기본): workers에 포함, 기존 동작과 동일
- safety_sell_enabled=False: workers에 미포함, 경고 로그, 나머지 워커 영향 없음
- TOML 키 오타(예: "safety_sell_enable"): get() 기본값 True 처리 → 활성화(안전한 방향)
Architecture Impact
- runtime-flows: no (daemon 기동 흐름만 경미하게 변경, 문서 갱신 불필요)
- project-structure: no
Reference Doc Update Plan
- docs/interface-contract.md: 없음
- docs/runtime-flows.md: 없음