cli

Command-line interface for Radroots
git clone https://radroots.dev/git/cli.git
Log | Files | Refs | README | LICENSE

commit ebbb908c84140402c8b7c647ab654c13ca682595
parent 0eaf5d04063be0e02d3b020490d28ae1be4cd601
Author: triesap <tyson@radroots.org>
Date:   Sat,  9 May 2026 00:40:34 +0000

cli: remove legacy order watch runtime

- delete unreachable order watch runtime views and args
- remove the old draft-backed order watch runtime function
- keep canonical order event watch on the operation adapter path
- preserve removed-command coverage for old order watch aliases

Diffstat:
Msrc/domain/runtime.rs | 57---------------------------------------------------------
Msrc/runtime/order.rs | 65++---------------------------------------------------------------
Msrc/runtime_args.rs | 7-------
3 files changed, 2 insertions(+), 127 deletions(-)

diff --git a/src/domain/runtime.rs b/src/domain/runtime.rs @@ -2063,63 +2063,6 @@ impl OrderStatusView { } #[derive(Debug, Clone, Serialize)] -pub struct OrderSubmitWatchView { - pub submit: OrderSubmitView, - pub watch: OrderWatchView, -} - -impl OrderSubmitWatchView { - pub fn disposition(&self) -> CommandDisposition { - let submit = self.submit.disposition(); - if submit != CommandDisposition::Success { - return submit; - } - self.watch.disposition() - } -} - -#[derive(Debug, Clone, Serialize)] -pub struct OrderWatchView { - pub state: String, - pub source: String, - pub order_id: String, - #[serde(skip_serializing_if = "Option::is_none")] - pub job_id: Option<String>, - pub interval_ms: u64, - #[serde(skip_serializing_if = "Option::is_none")] - pub reason: Option<String>, - #[serde(skip_serializing_if = "Option::is_none")] - pub workflow: Option<OrderWorkflowView>, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub frames: Vec<OrderWatchFrameView>, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub actions: Vec<String>, -} - -impl OrderWatchView { - pub fn disposition(&self) -> CommandDisposition { - match self.state.as_str() { - "unconfigured" => CommandDisposition::Unconfigured, - "unavailable" => CommandDisposition::ExternalUnavailable, - "error" => CommandDisposition::InternalError, - _ => CommandDisposition::Success, - } - } -} - -#[derive(Debug, Clone, Serialize)] -pub struct OrderWatchFrameView { - pub sequence: usize, - pub observed_at_unix: u64, - pub state: String, - pub terminal: bool, - pub signer_mode: String, - #[serde(skip_serializing_if = "Option::is_none")] - pub signer_session_id: Option<String>, - pub summary: String, -} - -#[derive(Debug, Clone, Serialize)] pub struct OrderWorkflowView { pub state: String, pub source: String, diff --git a/src/runtime/order.rs b/src/runtime/order.rs @@ -86,8 +86,7 @@ use crate::domain::runtime::{ OrderReceiptView, OrderRevisionDecisionView, OrderRevisionProposalView, OrderSettlementView, OrderStatusFulfillmentView, OrderStatusLifecycleCancellationView, OrderStatusLifecycleReceiptView, OrderStatusLifecycleView, OrderStatusPaymentView, - OrderStatusRevisionView, OrderStatusView, OrderSubmitView, OrderSummaryView, OrderWatchView, - RelayFailureView, + OrderStatusRevisionView, OrderStatusView, OrderSubmitView, OrderSummaryView, RelayFailureView, }; use crate::runtime::RuntimeError; use crate::runtime::accounts; @@ -101,7 +100,7 @@ use crate::runtime_args::{ OrderCancelArgs, OrderDecisionArg, OrderDecisionArgs, OrderDraftCreateArgs, OrderFulfillmentArgs, OrderPaymentArgs, OrderReceiptArgs, OrderRevisionDecisionArg, OrderRevisionDecisionArgs, OrderRevisionProposeArgs, OrderSettlementArgs, - OrderSettlementDecisionArg, OrderStatusArgs, OrderSubmitArgs, OrderWatchArgs, RecordLookupArgs, + OrderSettlementDecisionArg, OrderStatusArgs, OrderSubmitArgs, RecordLookupArgs, }; const ORDER_DRAFT_KIND: &str = "order_draft_v1"; @@ -119,8 +118,6 @@ const ORDER_PAYMENT_SOURCE: &str = "direct Nostr relay payment publish · local const ORDER_SETTLEMENT_SOURCE: &str = "direct Nostr relay settlement publish · local key"; const ORDER_EVENT_LIST_SOURCE: &str = "direct Nostr relay fetch · selected seller identity"; const ORDER_STATUS_SOURCE: &str = "direct Nostr relay status fetch · active order reducer"; -const ORDER_EVENT_WATCH_UNAVAILABLE_REASON: &str = - "relay-backed order event watch is not implemented"; const ORDER_EVENT_LIST_RELAY_ACTION: &str = "radroots --relay wss://relay.example.com order event list"; const ORDERS_DIR: &str = "orders/drafts"; @@ -710,64 +707,6 @@ pub fn submit( } } -pub fn watch( - config: &RuntimeConfig, - args: &OrderWatchArgs, -) -> Result<OrderWatchView, RuntimeError> { - if args.frames == Some(0) { - return Err(RuntimeError::Config( - "--frames must be greater than zero when provided".to_owned(), - )); - } - - let file = draft_lookup_path(config, args.key.as_str()); - if !file.exists() { - return Ok(OrderWatchView { - state: "missing".to_owned(), - source: ORDER_SOURCE.to_owned(), - order_id: args.key.clone(), - job_id: None, - interval_ms: args.interval_ms, - reason: Some(format!("order draft `{}` was not found", args.key)), - workflow: None, - frames: Vec::new(), - actions: vec!["radroots order list".to_owned()], - }); - } - - let loaded = match load_draft(file.as_path()) { - Ok(loaded) => loaded, - Err(reason) => { - return Ok(OrderWatchView { - state: "error".to_owned(), - source: ORDER_SOURCE.to_owned(), - order_id: args.key.clone(), - job_id: None, - interval_ms: args.interval_ms, - reason: Some(reason), - workflow: None, - frames: Vec::new(), - actions: Vec::new(), - }); - } - }; - - Ok(OrderWatchView { - state: "unavailable".to_owned(), - source: ORDER_SOURCE.to_owned(), - order_id: loaded.document.order.order_id.clone(), - job_id: None, - interval_ms: args.interval_ms, - reason: Some(ORDER_EVENT_WATCH_UNAVAILABLE_REASON.to_owned()), - workflow: None, - frames: Vec::new(), - actions: vec![format!( - "radroots order get {}", - loaded.document.order.order_id - )], - }) -} - pub fn event_list( config: &RuntimeConfig, order_id: Option<&str>, diff --git a/src/runtime_args.rs b/src/runtime_args.rs @@ -325,13 +325,6 @@ pub struct OrderStatusArgs { } #[derive(Debug, Clone)] -pub struct OrderWatchArgs { - pub key: String, - pub frames: Option<usize>, - pub interval_ms: u64, -} - -#[derive(Debug, Clone)] pub struct RecordLookupArgs { pub key: String, }