Render Cloud query errors and add organization context - #369
Open
sdairs wants to merge 2 commits into
Open
Conversation
sdairs
temporarily deployed
to
cloud-integration
August 5, 2026 13:04 — with
GitHub Actions
Inactive
sdairs
force-pushed
the
issue-334-cloud-error-rendering
branch
from
August 5, 2026 13:42
b153814 to
decc54c
Compare
sdairs
had a problem deploying
to
cloud-integration
August 5, 2026 13:42 — with
GitHub Actions
Failure
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves ClickHouse Cloud error rendering in both the clickhousectl CLI and the underlying clickhouse-cloud-api library, addressing issue #334 by making Query API failures human-readable and by adding missing organization context to otherwise ambiguous NOT_FOUND errors.
Changes:
- Format documented Query API SQL error envelopes as
SQL error <code>: <details>while preserving HTTP status + raw body for malformed/non-JSON responses. - Add organization request-scope context to bare
NOT_FOUNDAPI errors without changing existing error kinds/exit codes. - Add regression tests in both the API crate and the CLI crate to pin the new error formatting behavior.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| crates/clickhousectl/tests/cli_request_shape_test.rs | Adds CLI-level regression tests for org-scoped NOT_FOUND and Query API error formatting. |
| crates/clickhousectl/src/cloud/service_query.rs | Ensures org-scoped error conversion is used during query endpoint binding. |
| crates/clickhousectl/src/cloud/postgres.rs | Routes Postgres cloud endpoint errors through org-aware error conversion. |
| crates/clickhousectl/src/cloud/client.rs | Introduces org-aware error conversion (convert_error_for_organization) and wires it through org-scoped CloudClient calls. |
| crates/clickhouse-cloud-api/tests/run_query_test.rs | Updates/adds API-level tests to assert new Query API error message formatting and status preservation. |
| crates/clickhouse-cloud-api/src/client.rs | Implements query_api_error_message() and uses it to consistently format Query API errors (including 206 cases). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
sdairs
had a problem deploying
to
cloud-integration
August 5, 2026 17:48 — with
GitHub Actions
Failure
sdairs
had a problem deploying
to
cloud-integration
August 5, 2026 17:57 — with
GitHub Actions
Failure
sdairs
force-pushed
the
issue-334-cloud-error-rendering
branch
from
August 5, 2026 18:28
8e377f3 to
cdb2b4c
Compare
sdairs
had a problem deploying
to
cloud-integration
August 5, 2026 18:28 — with
GitHub Actions
Failure
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
SQL error <code>: <details>.NOT_FOUNDerrors while preserving detailed resource errors and existing error kinds/exit codes.Tests
cargo test -p clickhouse-cloud-api --test run_query_testcargo test -p clickhousectl -p clickhouse-cloud-apicargo clippy -p clickhousectl -p clickhouse-cloud-api --all-targets -- -D warningscargo fmt --all --checkCloses #334