Fix: cloud service delete surfaces NOT_FOUND instead of exiting 0 - #618
Open
sdairs wants to merge 1 commit into
Open
Fix: cloud service delete surfaces NOT_FOUND instead of exiting 0#618sdairs wants to merge 1 commit into
sdairs wants to merge 1 commit into
Conversation
sdairs
force-pushed
the
fix/601-service-delete-not-found
branch
from
August 28, 2026 14:46
e6683fb to
c593e95
Compare
sdairs
force-pushed
the
fix/601-service-delete-not-found
branch
from
August 28, 2026 19:42
c593e95 to
9562a91
Compare
…exiting 0 `instance_delete` silently swallowed a 404 into `Ok(None)`, which `service_delete` rendered as `null`/exit 0 (or "already absent" in human output) instead of surfacing the NOT_FOUND error, misleading scripts into thinking a delete of an already-deleted service succeeded. `CloudClient::delete_service` now propagates the 404 the same way `get_service` does, so `service delete` on a nonexistent ID fails with `Error: NOT_FOUND: ...` and exit code 1, consistent with `service get`. Fixes #601 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
sdairs
force-pushed
the
fix/601-service-delete-not-found
branch
from
September 1, 2026 20:36
9562a91 to
c7bd2f7
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
clickhousectl cloud service delete <nonexistent-id>printednulland exited0instead of failing.CloudClient::delete_service_if_existsswallowed any 404 from the delete endpoint intoOk(None), and the handler rendered that asnull(with--json) or "Service X is already absent" (human output) with exit code 0.Why
Exit 0 on a delete of a nonexistent service misleads scripts/agents into believing the delete succeeded.
cloud service geton the same missing ID already fails correctly withError: NOT_FOUND: ...and exit 1 — delete should behave the same way.Fix
Replaced
delete_service_if_exists(which special-cased 404 by additionally checking the organization still existed, then swallowing the service-not-found intoOk(None)) with a strictdelete_servicethat maps errors viaconvert_error_for_organizationexactly likeget_servicedoes, so a 404 propagates as a normalCloudError(exit code 1,NOT_FOUND: ...message, with the same organization-scoping noteget/listalready add for a bareNOT_FOUND).Tests
forced_service_delete_treats_an_absent_key_and_service_as_success(renamed toforced_service_delete_surfaces_not_found_for_an_absent_service) to assert exit 1 /NOT_FOUNDerror and that local query-key cleanup and the org-scoped key deletion are not attempted after a failed delete.service_delete_does_not_treat_a_missing_organization_as_an_absent_serviceto reflect that delete no longer performs an extra organization-existence probe before failing.service_delete_preserves_a_detailed_not_found_error, mirroring the existingservice_get_preserves_a_detailed_not_found_errorcoverage, to pin that a detailed API-provided NOT_FOUND message passes through verbatim.Verified locally:
cargo fmt --all,cargo clippy --workspace --all-targets -- -D warnings,cargo test -p clickhousectl, andcargo test -p clickhouse-cloud-api --test spec_coverage_test(unaffected crate, sanity only).Fixes #601
Note: this PR is part of a stacked chain and targets
fix/609-local-init-json-pathsas its base branch, notmain.🤖 Generated with Claude Code