Skip to content

Suggest --force when deleting a running service - #351

Open
sdairs wants to merge 1 commit into
codex/issue-339-idempotent-installfrom
codex/issue-335-delete-force-hint
Open

Suggest --force when deleting a running service#351
sdairs wants to merge 1 commit into
codex/issue-339-idempotent-installfrom
codex/issue-335-delete-force-hint

Conversation

@sdairs

@sdairs sdairs commented Aug 1, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • replace the raw running-service deletion conflict with an actionable --force hint
  • include the exact clickhousectl cloud service stop <id> alternative in the error
  • preserve unrelated conflicts and avoid suggesting --force when it was already passed
  • add unit and subprocess regression coverage for the error path

Why

cloud service delete currently passes through the Cloud API's CONFLICT response when the service is running, even though the CLI already supports the recovery path through --force. Users have to discover that remedy separately.

Impact

Deleting a running service without --force now returns a concise error that explains both supported next steps. Other deletion failures retain their original API errors.

Stack

This PR is stacked on #349 and should be reviewed as the delta from codex/issue-339-idempotent-install.

Closes #335.

Validation

  • cargo fmt --all --check
  • cargo build -p clickhousectl
  • cargo test -p clickhousectl
  • cargo clippy -p clickhousectl --all-targets -- -D warnings

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves the ClickHouse Cloud service delete UX by translating a specific “service is running” API conflict into an actionable CLI error that points users to the two supported recovery paths (--force or stopping the service explicitly), while keeping other deletion conflicts unchanged.

Changes:

  • Added targeted error rewriting for running-service deletion conflicts when --force is not set.
  • Updated the service delete handler to apply the new error mapping on API failures.
  • Added unit + subprocess regression tests that assert the exact stderr output for the conflict case.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
crates/clickhousectl/src/cloud/commands.rs Adds service_delete_error and wires it into service_delete, plus unit tests covering the mapping behavior.
crates/clickhousectl/tests/cli_request_shape_test.rs Adds a wiremock-backed subprocess test asserting the improved error message for a 409 running-service delete conflict.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@sdairs
sdairs had a problem deploying to cloud-integration August 3, 2026 12:20 — with GitHub Actions Failure
@sdairs
sdairs force-pushed the codex/issue-335-delete-force-hint branch from f1aeb7c to 9389472 Compare August 3, 2026 18:42
@sdairs
sdairs had a problem deploying to cloud-integration August 3, 2026 18:42 — with GitHub Actions Failure
@sdairs
sdairs temporarily deployed to cloud-integration August 3, 2026 18:50 — with GitHub Actions Inactive
@sdairs
sdairs force-pushed the codex/issue-335-delete-force-hint branch from 9389472 to 195110e Compare August 3, 2026 19:34
@sdairs
sdairs temporarily deployed to cloud-integration August 3, 2026 19:34 — with GitHub Actions Inactive
@sdairs
sdairs marked this pull request as ready for review August 3, 2026 19:38
@sdairs
sdairs requested review from iskakaushik and rndD as code owners August 3, 2026 19:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

service delete on a running service should suggest --force

2 participants