Repository navigation
Conversation
Move QueryAuth, derive_query_host, the query_api_* error helpers, the query-host methods (with_query_host, configured_query_host, resolved_query_host), run_query, run_query_bearer and run_query_with, plus their unit tests, out of client.rs into the private src/client/query.rs. Code is moved verbatim; only mod/use lines and visibility change: query_api_error and resolved_query_host become pub(super) because client/postgres.rs's run_postgres_query_bearer shares them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Query API (run_query, run_query_bearer) is exercised live only by the service suite: integration_test calls Client::run_query and service_query_key_cli_test spawns `clickhousectl cloud service query`. client.rs stays ALL_SUITES for the shared HTTP machinery. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… doc line (#1173) client.rs has not been generated from the OpenAPI spec for a long time; remove the "Auto-generated" line from its module doc. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Part of #1173 (1 of 6:
client/query.rs). Stacked on #1167.Summary
This moves the Query API out of
crates/clickhouse-cloud-api/src/client.rsinto a new private module,src/client/query.rs. Behaviour and the public surface are unchanged.client.rskeepsClient(including itsquery_hostfield),Auth, the constructors,set_bearer_tokenandrequest().src/client.rsClient,Auth, constructors,set_bearer_token,request()src/client/query.rsQueryAuth,derive_query_host,query_api_sql_error/query_api_error/query_api_reports_timeout/query_api_reports_stopped_service,impl Client { with_query_host, configured_query_host, resolved_query_host, run_query, run_query_bearer, run_query_with }, and the 14 unit tests that exercise themclient/query.rsnow maps to theserviceCloud integration suite only. Before, any Query API change touchedclient.rs, which maps to all four suites.Commits
use super::{Auth, Client};header inquery.rs,mod query;inclient.rs, the twopub(super)widenings below, andclient/postgres.rs's import ofquery_api_error. Review it withgit show --color-moved=dimmed-zebra.scripts/classify-cloud-integration.pymapssrc/client/query.rsto{"service"}, and the source-mapping fixture inscripts/tests/test_classify_cloud_integration.pylists it.servicesuite exercises the Query API live in two places:integration_testcallsClient::run_query, andservice_query_key_cli_testspawnsclickhousectl cloud service query.run_query,run_query_bearerorrun_postgres_query_bearer, or spawns a query command. The ClickPipes CDC test reads rows through its own direct HTTPS helper.client.rsstaysALL_SUITES..git-blame-ignore-revsentry for commit 1. This SHA must be updated if the stack is rebased before merge.crates/clickhouse-cloud-api/AGENTS.mdnamessrc/client/query.rs. The stale "Auto-generated from the OpenAPI specification." line is removed from theclient.rsmodule doc.Visibility widenings
query_api_errorandClient::resolved_query_hostare nowpub(super), becauseclient/postgres.rs(run_postgres_query_bearer) shares them.postgres.rsimportsquery_api_errorfromsuper::query.Tests
clickhouse-cloud-apiandclickhouse-openapi-analyzer(887 passed, 29 ignored). Test names match once module paths are stripped. Only the 14 moved unit tests change path, fromclient::tests::toclient::query::tests::.spec_coverage_testandmodel_facade_testpass untouched.python3 scripts/check-openapi-drift.py --dry-rungives the same output before and after (0 actionable drift).cargo fmt --all--all-targets -D warningsclickhousectlclippy in both configurationscargo check -p clickhousectl --no-default-featurescargo check --workspace --all-featurescargo test -p clickhouse-cloud-api -p clickhouse-openapi-analyzerMerge with a merge commit, not a squash. The
.git-blame-ignore-revsentry names this PR's move commit. A squash merge would leave it pointing at a commit that isn't on main, and git would silently ignore it.🤖 Generated with Claude Code
Note
Low Risk
Mechanical module split with byte-identical logic and no public API changes; only wiring, visibility, docs, and integration-test classifier mappings.
Overview
Extracts all Query API client logic from
client.rsinto a new private moduleclient/query.rs, including host resolution (with_query_host,derive_query_host),run_query/run_query_bearer, shared error classification (query_api_error, idle/stopped/timeout handling), and the 14 unit tests that covered those helpers.client.rsnow only wiresmod queryand keepsClient, auth, constructors, and the managementrequest()helper; public behavior and APIs are unchanged.client/postgres.rsnow importsquery_api_errorfromsuper::queryand relies onpub(super)onquery_api_errorandresolved_query_hostso Postgres Query API paths share the same helpers.CI path classification maps
client/query.rsto theserviceintegration suite only (so Query API edits no longer force all four suites viaclient.rs).AGENTS.mddocuments the new layout;.git-blame-ignore-revsadds the move commit for blame hygiene.Reviewed by Cursor Bugbot for commit 96696c6. Bugbot is set up for automated code reviews on this repo. Configure here.