Repository navigation
Conversation
…pers (#1156) Point postgres list, update (PATCH), restart and the state change at the existing list/patch/state wrappers, and add CloudClient wrappers for create, delete, certs get, config get/replace/patch, reset-password, read-replica create and restore. Every wrapper keeps the error conversion its handler used, so no output or exit code changes. The local unwrap_api helper is gone. The update tag pre-fetch still calls the library directly; it moves onto get_postgres_service in the follow-up commit, which changes how a missing service is reported. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ands (#1156) postgres update read the service's tags with organization-only error conversion, so a missing service surfaced the raw API message and the JSON error had no resource_not_found code. The read now goes through get_postgres_service, which gives the same "No such Postgres service" answer and list hint as postgres get and delete. The other by-id commands (update with --clear-tags, certs get, config get/replace/patch, reset-password, read-replica create, restore, restart, promote, switchover) cannot use lookup conversion directly: it reads any 400 or 404 over well-formed ids as a missing service, but their paths name a subresource (a 404 may mean it is absent) or their bodies carry user input (a 400 may be validation). When such a request is rejected that way, a GET of the service itself now decides: if it also rejects the ids, the original error is reported as a missing service; otherwise the original error stands. The GET is declared as a conditional permission on each command. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…1156) The service query paths were the last handlers calling client.api() directly. They now call CloudClient::run_service_query, run_service_query_bearer and configured_query_host, which pass the library result through unchanged: the callers stream the response and classify the raw error (idle, stopped, wake and readiness handling, key rejections) before convert_query_error records the telemetry failure, so stages and failure kinds are identical. AGENTS.md and the add-cli-command Cloud reference now name these two wrappers as the one deliberate raw-error exception, drop the stale postgres.rs and unwrap_api note, and say when lookup conversion is sound and when to confirm the parent with a GET instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sdairs
force-pushed
the
claude/1156-postgres-cloudclient-wrappers
branch
from
October 30, 2026 17:27
2af970f to
3588448
Compare
This branch has not been deployed
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.
Closes #1156.
Summary
CloudClientwrappers. Four handlers reuse wrappers that already existed (list, get, patch, state). Nine new wrappers cover the remaining call sites, and the localunwrap_apiis gone. No handler callsclient.api()any more.postgres update's tag pre-fetch now goes throughget_postgres_service, so a missing service gives "No such Postgres service", theresource_not_foundJSON code and the list hint. No PATCH is sent.run_service_query,run_service_query_bearerandconfigured_query_hostinservices.rs. They pass the raw library error and the unread response through, so query error classification and telemetry stages are unchanged.AGENTS.mdandadd-cli-command/references/cloud.mdnow name the query wrappers as the one deliberate raw-error exception, replacing the old "postgres.rs exception" note.Commits
refactor(cli): route handlers through wrappers. No behaviour change.fix(cli): by-id not-found reporting.refactor(cli): wrap the service query calls, plus the docs updates.Tests
New wiremock tests in
tests/cli_request_shape_test.rs:updateon a missing service, human and--json. No PATCH is sent.update --clear-tagson a missing service: PATCH, then the confirming GET, then not-found.config patchon a deleted service, human and--json.config patchgetting a validation 400 while the service exists. The server's message is kept and the code stayshttp_4xx.cargo fmt, both clippy configurations,cargo check --no-default-featuresandcargo test -p clickhousectl(2419 passed) were all run locally.Not changed
Metrics, logs, slow-queries, prometheus and backup list. Their query parameters make a 400 ambiguous, and they weren't in the issue's scope.
🤖 Generated with Claude Code
Note
Medium Risk
Postgres error classification and the new latest.txt release path affect every cloud postgres by-id command and all update/install flows; changes are heavily wiremock-tested but a bad publish would block version discovery.
Overview
Cloud Postgres (#1156) moves every handler off direct
client.api()calls ontoCloudClientwrappers (including new ones for create/delete/certs/config/password/replica/restore/state). By-id subresource commands useconvert_postgres_by_id_result: on 400/404 they issue a confirming service GET before mapping to “missing Postgres service,” so validation errors (e.g. config patch) keep the server message. Permissions add aCONFIRM_POSTGRES_SERVICEconditional on affected commands.services.rswraps query calls inrun_service_query{,_bearer}/configured_query_hostwhile still returning raw library errors for streaming/classification.Release & self-update:
release.ymladds apublish-latestjob that writes monotoniclatest.txtto S3 and verifies the CDN;clickhousectl update,install.sh, and release docs now prefer that manifest (GitHubreleases/latestredirect as fallback, not the rate-limited REST API).clickhouse-cloud-api: OpenAPI snapshot adds ClickStack logeventNameExpression/severityNumberExpression, MongoDB table mappingmongoConfig.persistDeletedDocuments, plus tests and README notes. The CLI acceptsmongoConfigin--table-mapping-jsonand documents it.Agent/release reference docs are updated to match (Postgres as the wrapper pattern, query wrappers as the sole raw-error exception,
latest.txtchecklist).Reviewed by Cursor Bugbot for commit 3588448. Bugbot is set up for automated code reviews on this repo. Configure here.