Files
trex-core/docs/srs/Interface/req-071_operator-cancel-pending-backstop.md
T
genichinandClaude Sonnet 4.6 fb05a73130 feat(rel-006): dcy-022/023 + BAT-032~034 — 실행 정책·qty 검증·allocated_capital 제거 통합
BAT-032 (dcy-022): timeout_sec/slippage_pct 실행 정책, 미체결 자동 취소,
보호 지정가, `trex-core cancel` 백스톱. 마이그레이션 012.
BAT-033: `trex-core enter --qty` 필수 검증 — 미지정 시 RPC 전 즉시 오류.
BAT-034 (dcy-023): allocated_capital 죽은 필드 전 경로 제거 (domain·intent·
persistence·snapshot·CLI). 마이그레이션 013(비가역 DROP). 외부 발신자
unknown key 무시 수신 의미론 적용.
REL-006 confirmed: BAT-026~034 통합 릴리즈, pre-release smoke 증거 포함.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-11 07:42:03 +09:00

4.5 KiB

req-071: 운영자 강제 취소 백스톱 — trex-core cancel <slot_id>

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

Intent

  • timeout 미지정·취소 실패로 잔여 고착된 pending 슬롯을 운영자가 trex-core cancel <slot_id> 로 강제 취소·롤백할 수 있는 백스톱 경로를 제공한다. dcy-013 Alert-only 는 기본 유지(REQ-014 회귀 없음). (dcy-022 FR-5)

Requirement

  • CLI trex-core cancel <slot_id> 가 daemon 의 control RPC 채널(trex.control.req, REQ-043)에 cancel_pending 액션을 전송한다. daemon 수신 시: ① 슬롯이 pending_buy/pending_sell 이면 broker.cancel_order 를 송신하고, 다음 집행 루프 poll 에서 rollback 이 수렴한다(기존 is_terminal_reject/is_partial_cancel 경로). ② 슬롯이 HOLDING/INACTIVE 이면 not_pending 응답(무동작). ③ 슬롯 없으면 slot_not_found. 기존 kill_switch·pause 와 동일하게 운영자 단일-writer 준수(슬롯 직접 쓰기 없음 — cancel_order 만 송신, 상태 전이는 집행 루프).

Acceptance Criteria

  1. Given pending_buy 슬롯, When trex-core cancel <slot_id>, Then broker.cancel_order 가 호출되고 응답 {status: "ok", slot_id: ...} 를 반환한다.
  2. Given cancel_order 가 호출된 후, When 집행 루프 다음 poll, Then 슬롯이 inactive/holding 으로 수렴한다(기존 is_terminal_reject/is_partial_cancel 경로 재사용).
  3. Given pending_sell 슬롯, When trex-core cancel <slot_id>, Then pending_buy 와 동일하게 cancel_order 호출 + ok 응답.
  4. Given holding/inactive 슬롯, When cancel 시도, Then {status: "ignored", reason: "not_pending"} 응답(무동작).
  5. Given 존재하지 않는 slot_id, When cancel 시도, Then {status: "error", reason: "slot_not_found"}.
  6. Given --dry-run 옵션, When cancel, Then cancel_order 미송신·응답 없이 대상 슬롯 정보만 출력(안전 확인).

Impacted Area

  • Docs: docs/runtime-flows.md(백스톱 취소 흐름)
  • Modules: trex_core/runtime/cli.py(cancel 서브커맨드), trex_core/application/messaging_handlers.py(cancel_pending 액션 추가), execution.py / broker: cancel_order 호출 배선(daemon 제어 핸들러)
  • Tests: tests/runtime/test_cli.py(cancel 서브커맨드), messaging_handlers cancel 단위

Notes

  • 운영자 처분은 백스톱(FR-5) — timeout 미지정 또는 cancel_order 실패 잔여 고착 대비. dcy-013 stale-alert(Alert-only) 는 회귀 없이 유지.
  • 슬롯 직접 쓰기 없이 cancel_order 만 송신 → 집행 루프가 다음 poll 에서 전이. 단일 writer 불변식 유지(REQ-013 NFR-2).
  • 출처: dcy-022 FR-5, NFR-1.

Change Log

CHG-20260610-01

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

Change Summary

  • dcy-022 FR-5 로부터 최초 생성(Proposed). 운영자 강제 취소 백스톱 CLI + control RPC 액션.

Intent

  • 잔여 고착 pending 슬롯의 운영자 처분 경로를 backlog 로 정규화.

Acceptance Criteria Delta

  • Added: AC-1~6 (pending 취소, 집행 루프 수렴, holding 무동작, not_found, dry-run 6개 기준)

Impacted Area Delta

  • Modules: cli.py(cancel 서브커맨드), messaging_handlers(cancel_pending), daemon 제어 배선
  • Tests: cli cancel, messaging cancel_pending 단위

Delivery Trace Delta

  • Batches: none

Revalidation Impact

  • Reverification Needed: no / Existing Implementation Invalidated: no / Status Recommendation: keep-current

Validation Plan

  • cancel CLI 송신 + control RPC cancel_pending + 집행 루프 수렴 단위.

CHG-20260610-02

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

Change Summary

  • Status Proposed → Approved (confirm-req).

Intent

  • delivery input 으로 승격.

Acceptance Criteria Delta

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

Impacted Area Delta

  • Docs: docs/srs/index.md (Register Approved)

Delivery Trace Delta

  • Batches: none

Revalidation Impact

  • Reverification Needed: no / Existing Implementation Invalidated: no / Status Recommendation: keep-current / Follow-up Action: BAT-032.

Validation Plan

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

CHG-20260611-IMPL

  • Date: 2026-06-11
  • Author: Justin Ko
  • Type: status
  • Summary: Approved → Implemented (confirm-req-implemented). 근거: BAT-032(release-candidate) verification — 실행 정책(timeout_sec·slippage_pct) 계약·집행·운영자 cancel 백스톱 전 AC acceptance mapping 존재(신규 71 tests), 단위 425 passed 회귀 없음, baseline 2문서 수동 확인(M5). Blocking Issues 없음.