Files
trex-core/docs/srs/Interface/req-063_unified-operator-slot-view.md
T
genichinandClaude Opus 4.8 f0ad37747b feat(rel-007): dcy-025/024 + BAT-035/036 — slots.req 즉시 교체 + safety_sell_enabled
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>
2026-06-11 14:45:45 +09:00

5.9 KiB

req-063: 운영자 표면 단일화 — slots = 자산 포지션 단일 뷰

  • Status: Implemented
  • Type: Interface
  • Priority: Medium
  • Owner: project maintainers

Intent

  • universe(자산 리스트)와 slots(슬롯 상태)의 이중 표면(BAT-022 혼동 원인)을 해소하기 위해, 슬롯=자산 1:1 모델에서 trex-core slots 가 자산 포지션을 단일 뷰로 제공한다. (dcy-020 FR-8)

Requirement

  • trex-core slots 가 자산 슬롯(슬롯=자산)을 단일 뷰로 표시한다: portfolio_id/symbol/status(inactive/pending_buy/holding/pending_sell/error)/holding 수량 미러/universe_detached(tombstone)/retired. universe(자산 리스트)와 slots(자산 포지션)는 같은 자산 집합 위의 view 가 되며, 데몬 RPC(스냅샷)로 통일한다(직접 DB 쓰기 없음). 운영자는 자산별 포지션·활성 여부·tombstone 여부를 한 표면에서 본다.

Acceptance Criteria

  1. Given universe N개 자산, When trex-core slots, Then N개 자산 슬롯이 status·holding·tombstone 표시와 함께 단일 뷰로 출력된다.
  2. Given tombstone(universe-detached holding) 슬롯, When slots, Then universe_detached 로 구분 표시된다.
  3. Given --status 필터, When 조회, Then 자산 슬롯 status 로 필터된다.

Impacted Area

  • Docs: docs/runtime-flows.md, docs/interface-contract.md(snapshot envelope slots[])
  • Modules: trex_core/runtime/cli.py, snapshot envelope 빌더
  • Tests: tests/application/test_messaging_snapshot_consumer.py, CLI 테스트

Notes

  • 기존 REQ-032(운영자 CLI)·REQ-028/029(snapshot envelope) 와 연계 change-req. BAT-022 슬롯 가시화의 자산 중심 재정의.
  • 출처: dcy-020 FR-8.

Change Log

CHG-20260610-01

  • Date: 2026-06-10
  • Author: Justin Ko

Change Summary

  • dcy-020 FR-8 로부터 최초 생성(Proposed). trex-core slots = 자산 포지션 단일 뷰(universe↔slots 이중 표면 해소).

Intent

  • 운영 관측 단일화(자산별 포지션·활성·tombstone)를 backlog 정규화.

Acceptance Criteria Delta

  • Added: 단일 뷰 출력/tombstone 표시/status 필터 3개 기준
  • Updated: 없음
  • Removed: 없음

Impacted Area Delta

  • Docs: docs/runtime-flows.md, docs/interface-contract.md
  • Modules: runtime/cli.py, snapshot envelope 빌더
  • Tests: test_messaging_snapshot_consumer.py, CLI 테스트

Delivery Trace Delta

  • Batches: none
  • Releases: none

Revalidation Impact

  • Reverification Needed: no
  • Existing Implementation Invalidated: no (REQ-032/028/029 연계 change-req)
  • Status Recommendation: keep-current
  • Follow-up Action: confirm-req.

Validation Plan

  • slots 단일 뷰 출력·tombstone·필터 단위테스트 green.

CHG-20260610-02

  • Date: 2026-06-10
  • Author: Justin Ko

Change Summary

  • Status Proposed → Approved (confirm-req). 필수 필드·구체 AC 충족, source dcy-020(confirmed, handoff 승인)과 모순 없음.

Intent

  • delivery input 으로 승격.

Acceptance Criteria Delta

  • Added: 없음 / Updated: 없음 / Removed: 없음

Impacted Area Delta

  • Docs: docs/srs/index.md (Register Approved) / Modules: 없음 / Tests: 없음

Delivery Trace Delta

  • Batches: none / Releases: none

Revalidation Impact

  • Reverification Needed: no / Existing Implementation Invalidated: no / Status Recommendation: keep-current / Follow-up Action: suggest-batch-reqs / draft-batch.

Validation Plan

  • 승인 후 batch planning 에서 본 REQ AC 를 검증 기준으로 사용.

CHG-20260610-IMPL

  • Date: 2026-06-10
  • Author: Justin Ko
  • Type: status
  • Summary: Approved → Implemented (confirm-req-implemented). 근거: BAT-029(+BAT-030 trading_date 키 제거·buyable=inactive 필터) — 모든 AC 가 release-candidate 배치 verification 의 evidence 와 연결됨(단위 367/PG 29/MQ 21 passed + run-the-app 자산 중심 e2e). Blocking Issues 없음.

CHG-20260611-01

  • Date: 2026-06-11
  • Author: Justin Ko

Change Summary

  • (change-req, dcy-025) 운영자 CLI(trex-core slots/universe)의 데몬 RPC 를 trex.snapshot.req → trex.slots.req(REQ-073)로 교체한다. 운영자 조회는 spy=true 로 발신(기존 actor="operator"/touch_watchdog=false 대체 — 비침습 유지). --status 필터는 새 filter(status 단일: all/inactive/pending/holding/error)로 매핑. 출력 행은 REQ-074 병합 스키마(asset_quantity+qty 미러+warned, cash_balance+cash_estimated, watchdog nested, paused) 사용. universe↔slots 단일 표면 의도(본 REQ Intent)는 새 표면에서 완성된다.

Intent

  • 운영자 단일 뷰를 새 read 표면 위로 이전(비침습·필터·병합 행 유지).

Acceptance Criteria Delta

  • Updated:
    • AC-1~3 의 underlying RPC 가 trex.slots.req 이고, 조회는 spy=true(워치독 무터치)로 수행된다. --status → filter 매핑(buyable→inactive 동치 포함).
  • Added:
    • AC-4: slots 출력 행에 REQ-074 병합 필드(asset_quantity/qty/warned/cash_balance/cash_estimated/watchdog/paused)가 표시된다.
  • Removed: none

Impacted Area Delta

  • Modules: trex_core/runtime/cli.py(_cmd_slots/_cmd_universe — 새 큐·spy·filter·행 필드)
  • Docs: docs/interface-contract.md CLI↔RPC 매핑(REQ-075)
  • Tests: tests/runtime/test_cli_operator.py(새 payload·행 표시)

Delivery Trace Delta

  • Batches: 신규 batch(REQ-073/074/075 와 동일 배치, dcy-025)
  • Releases: none

Revalidation Impact

  • Reverification Needed: yes (신규 batch 에서 갱신 AC 검증)
  • Existing Implementation Invalidated: yes (snapshot RPC 기반 CLI evidence 가 표면 교체로 무효화)
  • Status Recommendation: Implemented → Approved (batch 재구현·재검증 후 복귀)
  • Follow-up Action: draft-batch → 구현/검증 → confirm-req-implemented

Validation Plan

  • 신규 BAT: CLI payload(trex.slots.req/spy=true/filter 매핑) 단위 + 행 필드 표시 단위 + buyable→inactive 동치 회귀.