Fix cloud postgres delete --json returning raw API envelope - #624
Merged
sdairs merged 2 commits intoSep 3, 2026
Merged
Conversation
sdairs
force-pushed
the
fix/614-postgres-delete-json
branch
from
August 28, 2026 14:46
23609f5 to
c6c4c70
Compare
sdairs
force-pushed
the
fix/614-postgres-delete-json
branch
2 times, most recently
from
September 1, 2026 15:05
03b5afb to
b6daf73
Compare
…raw envelope
The delete endpoint only ever returns the raw API envelope
({"status":...,"requestId":...}); fetch the Postgres service before
deleting it and render that instead, matching every other `cloud
postgres` subcommand's --json shape.
Fixes #614
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The pre-delete GET added for #614 called `client.api().postgres_service_get` directly, copying the pre-modularization pattern CLAUDE.md asks new code not to copy. Add a thin `CloudClient::get_postgres_service` wrapper in the module's `impl CloudClient` block (same shape as `get_service` in services.rs) and use it from the delete handler. The two post-delete result lines also used `println!`; by then the DELETE has already succeeded, so a closed stdout would turn a completed deletion into a panic (exit 101, the #598 class). Emit them with `print_line`, exactly as `service delete` does. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This was referenced Sep 1, 2026
sdairs
force-pushed
the
fix/614-postgres-delete-json
branch
from
September 1, 2026 20:36
b6daf73 to
352b74b
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.
Summary
cloud postgres delete --jsonwas printing the raw API envelope ({"status":200,"requestId":"..."}) returned directly by the delete endpoint, instead of the Postgres resource object every othercloud postgressubcommand emits under--json.result(it'sApiResponse<serde_json::Value>), so the fix fetches the service viapostgres_service_getbefore issuing the delete, and renders that fetched object under--json. Human output (Postgres service <id> deletion initiated) was already not envelope-shaped, so it is unchanged.cloud service delete --jsonhas the same underlying envelope shape (itsDeleteResponsewrapper only carriesstatus/requestId), but that's out of scope for this issue, which is specifically aboutcloud postgres delete.This PR is part of a stacked chain based on
fix/613-postgres-usage-exit-codes(notmain).Test plan
postgres_delete_json_emits_the_resource_object_not_the_envelopewiremock subprocess test incrates/clickhousectl/tests/cli_request_shape_test.rs, asserting the resource fields are present andstatus/requestIdare absent from--jsonoutput.cargo fmt --allcargo clippy --workspace --all-targets -- -D warningscargo test -p clickhousectl(all passing)Fixes #614
🤖 Generated with Claude Code