fix(cli,host-service): report per id what workspace delete did
Problem
superset workspaces delete --local/--host reported every id as deleted. The host returns success for an id it has no row for, such as an unknown id, a short prefix, or a workspace on another host. An error on one id also stopped the batch. With --json, a partial failure put the deleted ids only inside the error text, so scripts could not parse them.
Root cause
The host destroy saga answers success: true when it finds no row, and the CLI did not look at the result. The CLI also had no way to return data together with a non-zero exit, so a partial failure could only throw a plain CLIError.
Fix
- host-service: the destroy result gets an additive
foundfield. Unknown ids still succeed for existing callers. - cli: each id is reported as deleted (with teardown warnings), not found, or failed with its reason. Against a host without
found, the CLI checksworkspace.getafter the delete. - cli-framework:
CLIErrortakes optionaldata. Under--jsonthe runner prints it to stdout, then reports the error on stderr and exits 1. Without--jsonthe output does not change. - cli: the host and cloud branches always return
{ deleted, notFound, failed, warnings }. The command still exits non-zero whennotFoundorfailedis not empty, with the same lines and hint. - A regression test pins that teardown runs before the worktree is removed and that a teardown failure is reported.
Compat
foundis an additive output field onworkspace.deleteandworkspaceCleanup.destroy. No input, error code, or procedure type changes. NoMIN_HOST_SERVICE_VERSIONbump is needed.- The
--jsondata ofworkspaces deletegets new fields. Existing fields keep their names. - Unknown ids on a host now exit non-zero. Scripts that deleted unknown ids may notice this.
Verification
bun run typecheckinpackages/cliandpackages/cli-framework: pass.bun testinpackages/cli(428 pass) andpackages/cli-framework(75 pass).- New tests: the runner prints
CLIErrordata under--jsonand exits 1, and prints only the error under--quiet. A mixed host batch and a mixed cloud batch carry every id in the error data. bun run lint:fix: clean.- Not run against a real host or cloud workspace.
Summary by cubic
superset workspaces delete now reports each ID as deleted, not found, or failed, and continues after individual errors. Partial results are available as structured JSON, while missing or failed IDs still produce a non-zero exit.
Behavior
- Host responses include an additive
foundfield; older hosts are checked withworkspace.get, and check errors count as failures. - Host and cloud results include
{ deleted, notFound, failed, warnings }; teardown warnings are preserved.
Compatibility
foundis output-only and needs no host version bump. Unknown IDs now cause a non-zero exit, and JSON output includes the new fields.
Summary by CodeRabbit
-
New Features
- Workspace archiving now reports deleted, missing, and failed workspaces, along with any warnings. It continues processing other workspaces after an individual deletion fails, and partial failures include outcome details.
- In JSON mode, CLI errors can include structured data in the output.
-
Bug Fixes
- Host workspace deletion now distinguishes missing workspaces from deleted ones and reports teardown warnings when cleanup encounters issues.