Skip to content

feat(cli): expose service deletion protection (#1470) - #1481

Open
sdairs wants to merge 1 commit into
claude/drift-1466-api-clickstackfrom
claude/drift-1466-cli-services
Open

sdairs wants to merge 1 commit into
claude/drift-1466-api-clickstackfrom
claude/drift-1466-cli-services

Conversation

@sdairs

@sdairs sdairs commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

Fixes #1470. CLI PR for the services part of #1466, stacked on #1476.

  • cloud service create --deletion-protection (a switch) and cloud service update --deletion-protection true|false.
  • list has a Deletion protection column; get already shows the field.
  • cloud service delete refuses a protected service with the new JSON error code deletion_protected (exit 1). The error's command field holds the update --deletion-protection false command to run.
    • With --force, the service is checked before it is stopped, so a protected service is never stopped.
    • Without --force, a 409 from the DELETE triggers a GET to tell deletion protection apart from other conflicts.
  • Help:
    • extra authorization lines on create and update;
    • the delete context explains that protection blocks delete;
    • the JWT provider context says EC keys (ES256/384/512) work on ClickHouse 26.8+.
  • The postgres yes_no helper moves to cloud/output.rs so services can share it.
  • Tests:
    • clap parsing;
    • builders;
    • a unit test for the protected error, which re-parses the suggested command;
    • two wiremock tests: --force delete with no stop, and DELETE 409 → GET → deletion_protected.
  • The cloud service guide and the automation reference are updated.

🤖 Generated with Claude Code


Note

Medium Risk
Changes irreversible delete paths and structured error codes; mis-handling could stop or delete the wrong service, though protection is meant to reduce accidental deletion risk.

Overview
Adds deletion protection to ClickHouse Cloud services in clickhousectl: cloud service create --deletion-protection and cloud service update --deletion-protection true|false, with a Deletion protection column on service list and updated help/permissions text.

Delete behavior is stricter: protected services are refused with JSON code deletion_protected and a command pointing at service update … --deletion-protection false. With --force, protection is checked before any stop attempt; without --force, DELETE 409 is disambiguated via a follow-up GET.

Also moves shared yes_no formatting to cloud/output.rs, documents EC JWT keys (ES256/384/512) on ClickHouse 26.8+ in help/docs, and adds parsing, builder, unit, and wiremock tests plus guide/automation reference updates.

Reviewed by Cursor Bugbot for commit b2701f8. Bugbot is set up for automated code reviews on this repo. Configure here.

@sdairs
sdairs requested a review from iskakaushik as a code owner November 17, 2026 15:44
- `cloud service create --deletion-protection` and
  `cloud service update --deletion-protection true|false` send the new
  `deletionProtection` field; update prints the resulting setting.
- `cloud service list` gains a Deletion protection column; `get` already
  renders the field.
- `cloud service delete` refuses a protected service with the new
  `deletion_protected` error code, whose `command` is the update that turns
  protection off. `--force` checks the service it already reads and refuses
  before stopping it; a 409 from the DELETE is diagnosed with a read so a
  protected service is no longer told to stop or use --force.
- Help: permission notes for create/update, the delete gotcha, and EC JWKS
  keys (ES256/384/512) on ClickHouse 26.8+ for jwt-provider.
- Docs: cloud-service guide section and automation error-code reference.

Fixes #1470

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sdairs
sdairs force-pushed the claude/drift-1466-cli-services branch from 1de8f41 to b2701f8 Compare November 17, 2026 16:45
@sdairs
sdairs changed the base branch from claude/drift-1466-api-services to claude/drift-1466-api-clickstack November 17, 2026 16:45
@sdairs
sdairs added this pull request to stack #1483 November 17, 2026 16:46

This branch has not been deployed

No deployments
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.

CLI: expose service deletion protection

1 participant