From 4bba227af5c7059d68939575b6f524c44bde18ed Mon Sep 17 00:00:00 2001 From: Hare Date: Tue, 1 Sep 2026 16:10:59 +0900 Subject: [PATCH] fix: remove legacy resume flag --- crates/tui/src/standalone_picker.rs | 2 +- crates/yoi/src/main.rs | 91 +++++------------------------ 2 files changed, 16 insertions(+), 77 deletions(-) diff --git a/crates/tui/src/standalone_picker.rs b/crates/tui/src/standalone_picker.rs index 35ccbb5f..6ff76d76 100644 --- a/crates/tui/src/standalone_picker.rs +++ b/crates/tui/src/standalone_picker.rs @@ -145,7 +145,7 @@ pub(crate) enum StandalonePickerError { #[error("standalone Worker state is unavailable: {0}")] StateStore(#[source] standalone::StandaloneStoreError), #[error( - "no standalone Workers found for this cwd; use `yoi --local --resume --all` to include all cwd identities" + "no standalone Workers found for this cwd; use `yoi --local resume --all` to include all cwd identities" )] NoWorkers { include_all: bool }, #[error("standalone Worker picker I/O failed: {0}")] diff --git a/crates/yoi/src/main.rs b/crates/yoi/src/main.rs index 8700b670..6ae7d313 100644 --- a/crates/yoi/src/main.rs +++ b/crates/yoi/src/main.rs @@ -571,20 +571,10 @@ fn parse_console_options( let mut socket_override = None; let mut runtime_id = None; let mut worker_id = None; - let mut standalone_resume = false; - let mut standalone_all = false; let mut i = 0; while i < args.len() { let arg = &args[i]; match arg.as_str() { - "--resume" => { - standalone_resume = true; - i += 1; - } - "--all" => { - standalone_all = true; - i += 1; - } "--worker" => { let value = args .get(i + 1) @@ -766,29 +756,6 @@ fn parse_console_options( &workspace_root, )?; - if standalone_all && !standalone_resume { - return Err(ParseError("--all requires --resume".to_string())); - } - if standalone_resume { - if target.kind() != TargetKind::Standalone { - return Err(ParseError( - "--resume is a Standalone option and requires --local".to_string(), - )); - } - if worker_name.is_some() - || profile.is_some() - || session.is_some() - || socket_override.is_some() - || runtime_id.is_some() - || worker_id.is_some() - { - return Err(ParseError( - "--local --resume cannot be combined with Worker, profile, session, socket, or Runtime selectors" - .to_string(), - )); - } - } - if target.kind() == TargetKind::Standalone { if runtime_id.is_some() || worker_id.is_some() { return Err(ParseError( @@ -798,7 +765,7 @@ fn parse_console_options( } if session.is_some() { return Err(ParseError( - "--local does not accept legacy --session; use --local --resume for Standalone Worker restore" + "--local does not accept legacy --session; use `yoi --local resume` for Standalone Worker restore" .to_string(), )); } @@ -834,16 +801,12 @@ fn parse_console_options( if target.kind() == TargetKind::Standalone && (session.is_some() || socket_override.is_some()) { return Err(ParseError( - "Standalone does not accept legacy Worker session or socket selectors; use --resume for the standalone Worker store" + "Standalone does not accept legacy Worker session or socket selectors; use `yoi --local resume` for the standalone Worker store" .to_string(), )); } - let mode = if standalone_resume { - LaunchMode::StandaloneResume { - include_all: standalone_all, - } - } else if target.kind() == TargetKind::Standalone { + let mode = if target.kind() == TargetKind::Standalone { LaunchMode::Spawn { worker_name, profile, @@ -951,7 +914,7 @@ fn parse_workers_args( )?; if target.kind() != TargetKind::Backend { return Err(ParseError( - "yoi workers requires a Backend connection target; use yoi --local --resume for Standalone Workers" + "yoi workers requires a Backend connection target; use yoi --local resume for Standalone Workers" .to_string(), )); } @@ -1741,7 +1704,6 @@ const TOP_LEVEL_HELP: &str = r#"yoi Usage: yoi [TARGET] - yoi --local --resume [--all] yoi [TARGET] workers [-r|--stopped] [--runtime-id ] yoi [TARGET] resume [--all] [--runtime-id ] yoi --backend [--workspace-id ] panel @@ -1750,8 +1712,6 @@ Usage: Target selection: --local Use the client-owned one-process Standalone host - --resume With --local, restore from the Standalone Worker store - --all With Standalone restore, include Workers from every cwd identity --backend Use a Workspace Backend explicitly --workspace-id Scope Backend routes to a Workspace id @@ -1801,7 +1761,7 @@ Usage: Authority: Lists Workers from the selected Backend Workspace. Standalone Workers are restored with - `yoi --local --resume` and are not part of the Workspace Worker catalog. + `yoi --local resume` and are not part of the Workspace Worker catalog. Options: --backend Use this Workspace Backend @@ -2212,35 +2172,14 @@ backend = "shared" } #[test] - fn parser_local_resume_uses_standalone_picker_scope() { - let mode = parse_args_from(["--local", "--resume"]).unwrap(); - let Mode::Tui { target, mode, .. } = mode else { - panic!("expected TUI mode") - }; - assert_eq!(target.kind(), TargetKind::Standalone); - assert!(matches!( - mode, - LaunchMode::StandaloneResume { include_all: false } - )); - let intent = target.standalone_worker_list(false).unwrap(); - assert!(intent.state_dir.ends_with("client/standalone/workers")); - assert!(!intent.include_all); - - let mode = parse_args_from(["--local", "--resume", "--all"]).unwrap(); - let Mode::Tui { mode, .. } = mode else { - panic!("expected TUI mode") - }; - assert!(matches!( - mode, - LaunchMode::StandaloneResume { include_all: true } - )); - - assert_eq!( - parse_args_from(["--local", "--all"]) - .unwrap_err() - .to_string(), - "--all requires --resume" - ); + fn parser_rejects_removed_top_level_resume_flags() { + for (args, expected) in [ + (vec!["--resume"], "unknown argument: --resume"), + (vec!["--local", "--resume"], "unknown argument: --resume"), + (vec!["--all"], "unknown argument: --all"), + ] { + assert_eq!(parse_args_from(args).unwrap_err().to_string(), expected); + } } #[test] @@ -2264,7 +2203,7 @@ backend = "shared" let err = parse_args_slice_with_connection_resolver(&session_args, &resolver).unwrap_err(); assert_eq!( err.0, - "--local does not accept legacy --session; use --local --resume for Standalone Worker restore" + "--local does not accept legacy --session; use `yoi --local resume` for Standalone Worker restore" ); let socket_args = [ @@ -2897,7 +2836,7 @@ backend = "shared" other => panic!("expected WorkersHelp mode, got {other:?}"), } assert!(WORKERS_HELP.contains("selected Backend Workspace")); - assert!(WORKERS_HELP.contains("--local --resume")); + assert!(WORKERS_HELP.contains("--local resume")); assert!(!WORKERS_HELP.contains("[--local|--backend")); assert!(!WORKERS_HELP.contains("local Worker records")); }