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>
4.3 KiB
4.3 KiB
BAT-035 Verification
- Status: confirmed
- Batch: BAT-035
Acceptance Mapping
- REQ-073 AC-1: topology 선언 —
trex.slots.req큐 존재,trex.snapshot.req큐·핸들러 부재 - REQ-073 AC-2: filter 분기 — inactive/pending(buy∪sell)/holding/error/all/invalid 처리
- REQ-073 AC-3: 응답 키 집합 — {slots/degraded/reason/message} only, assets/available_slots/watchdog(top) 키 부재
- REQ-073 AC-4: spy=true → last_seen_at 미갱신; spy=false(default) → holding watchdog 갱신
- REQ-073 AC-5: degraded=true + reason 전파, credentials sanitized
- REQ-074 AC-1: 행 필드 — slot_id/status/avg_price/entry_price/forced_close_at/symbol/portfolio_id/cash_balance/asset_quantity/qty/watchdog:{expired,last_seen}/paused/warned 포함
- REQ-074 AC-2: qty≠asset_quantity → warned=true, 두 값 모두 노출
- REQ-074 AC-3: cash_estimated=true 구간 + 수렴 시 false
- REQ-074 AC-4: paused holding → filter=holding 반환, paused=true (직교)
- REQ-074 AC-5: strategy 계열 키 부재 (strategy_id/sell_strategy_id/strategy_params/active_strategy_id)
- REQ-075 AC-1: interface-contract.md 에 slots.req 계약 + 필드 소스 테이블 추가, snapshot.req 현행 계약 섹션 제거
- REQ-075 AC-2: runtime-flows.md read 흐름 slots.req 기준으로 업데이트
- REQ-075 AC-3:
trex.snapshot.req현행 계약 서술 제거됨 (change log 이력 제외) - REQ-021 CHG-01 AC: 토폴로지에 slots.req 선언, snapshot.req 없음 (SNAPSHOT_REQ_QUEUE 상수 제거)
- REQ-034 CHG-01 AC: spy=true → watchdog 미갱신; spy=false → holding watchdog 갱신
- REQ-063 CHG-01 AC: CLI spy=true 전송, --status 인자 server-side filter 매핑 (buyable→inactive)
Evidence
Tests (420 passed, 45 skipped — 2026-06-11)
- REQ-073 AC-1:
tests/adapters/messaging/test_topology.py::test_topology_constantstopology.SLOTS_REQ_QUEUE == "trex.slots.req"✓not hasattr(topology, "SNAPSHOT_REQ_QUEUE")✓
- REQ-073 AC-2:
tests/application/test_slots_handler.pytest_filter_all_returns_all_slots✓test_filter_inactive_returns_inactive_slots✓test_filter_holding_returns_holding_slots✓test_filter_pending_returns_pending_buy_and_sell✓test_invalid_filter_treated_as_all✓
- REQ-073 AC-3:
test_response_keys_only_slots_health✓ - REQ-073 AC-4:
test_spy_true_no_watchdog_update,test_spy_false_updates_watchdog✓ - REQ-073 AC-5:
test_degraded_signal_propagated✓ - REQ-074 AC-1:
test_slot_row_contains_merged_fields✓ - REQ-074 AC-2:
test_warned_true_when_qty_diverges✓ - REQ-074 AC-3:
tests/application/test_ledger_option_d.py::test_apply_cash_estimate_overlays_pending_delta✓ - REQ-074 AC-4:
test_paused_holding_orthogonal_to_filter✓ - REQ-074 AC-5:
test_strategy_fields_absent✓ - REQ-021 CHG-01:
test_topology_constants+tests/adapters/messaging/test_instance_topology.py::test_named_instance_suffix✓ - REQ-034 CHG-01: spy 워치독 억제 tests (위) ✓
- REQ-063 CHG-01:
tests/runtime/test_cli_operator.pytest_universe_uses_slots_queue_with_spy✓test_slots_status_sends_server_side_filter✓test_slots_buyable_maps_to_inactive_filter✓
Manual
tests/application/test_killswitch_masking_resume.py: View/build_snapshot_envelope 의존 제거 후 재작성 완료tests/application/test_ledger_option_d.py: _apply_cash_estimate 직접 테스트 → slots handler 경유 재작성 완료
Code Review
trex_core/adapters/messaging/topology.py: SNAPSHOT_REQ_QUEUE 제거, SLOTS_REQ_QUEUE 추가 ✓trex_core/application/portfolio.py: View, build_snapshot_envelope, _asset_to_dict, SnapshotEnvelope 제거 ✓trex_core/application/messaging_handlers.py: make_snapshot_rpc_handler 제거, make_slots_rpc_handler 추가 ✓trex_core/runtime/daemon.py: _snapshot_rpc_loop → _slots_rpc_loop, make_slots_rpc_handler 연결 ✓trex_core/runtime/cli.py: slots_queue + spy=True + server-side filter ✓docs/interface-contract.md: slots.req 계약 추가, snapshot.req envelope 섹션 제거 ✓docs/runtime-flows.md: 슬롯 RPC flow 추가, snapshot RPC flow 교체 ✓docs/srs/index.md: REQ-028 → Deprecated ✓
Result
- Ready for Release: true
- Blocking Issues: 없음