Extract cloud runtime dispatch and shared helpers from main.rs - #397
Merged
sdairs merged 1 commit intoAug 13, 2026
Merged
Conversation
sdairs
temporarily deployed
to
cloud-integration
August 7, 2026 17:47 — with
GitHub Actions
Inactive
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors the ClickHouse Cloud command runtime in the clickhousectl CLI crate by extracting cloud authentication/client setup, OAuth write-guarding, command dispatch, and CloudError → top-level error adaptation out of main.rs and into crate::cloud::run, establishing a clearer runtime boundary for future domain moves.
Changes:
- Delegate the top-level
cloudcommand frommain.rstocloud::run, keeping JSON-mode resolution (flag + agent detection) at the top level. - Introduce
cloud::run+cloud::dispatchinsrc/cloud/mod.rs, moving over auth/client construction, OAuth write rejection, and CloudError/exit-code preservation logic (with tests). - Add
cloud::sharedhelpers (org resolution, enum/tag parsing, date/time parsers) and update Postgres + cloud CLI/commands to use them; move Postgres dispatch intocloud::postgres::run.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| crates/clickhousectl/src/main.rs | Removes inlined cloud runtime/dispatch and delegates Commands::Cloud to cloud::run after resolving JSON mode. |
| crates/clickhousectl/src/cloud/mod.rs | Adds cloud::run + dispatch, plus error adaptation and tests, centralizing cloud runtime behavior outside main.rs. |
| crates/clickhousectl/src/cloud/shared.rs | New internal shared helpers for org resolution, tag/enum parsing, and date/time clap parsers to avoid domain back-dependencies. |
| crates/clickhousectl/src/cloud/postgres.rs | Moves Postgres dispatch into postgres::run and switches to shared helpers. |
| crates/clickhousectl/src/cloud/commands.rs | Replaces local helper implementations with imports from cloud::shared. |
| crates/clickhousectl/src/cloud/cli.rs | Switches date/time clap parsers to cloud::shared. |
| crates/clickhousectl/src/cli.rs | Stops re-exporting cloud domain enums/args; keeps only what’s needed for top-level CLI assembly. |
| AGENTS.md | Updates contributor docs to reflect the new cloud runtime/dispatch structure (cloud::run, cloud::dispatch, postgres::run). |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
sdairs
force-pushed
the
issue-383-cloud-runtime-boundary
branch
from
August 8, 2026 18:37
d0b8d4e to
e53b87b
Compare
sdairs
had a problem deploying
to
cloud-integration
August 8, 2026 18:37 — with
GitHub Actions
Failure
sdairs
had a problem deploying
to
cloud-integration
August 8, 2026 18:45 — with
GitHub Actions
Failure
sdairs
force-pushed
the
issue-383-cloud-runtime-boundary
branch
from
August 13, 2026 11:37
e53b87b to
4772537
Compare
sdairs
had a problem deploying
to
cloud-integration
August 13, 2026 11:38 — with
GitHub Actions
Failure
sdairs
had a problem deploying
to
cloud-integration
August 13, 2026 11:45 — with
GitHub Actions
Failure
sdairs
force-pushed
the
issue-383-cloud-runtime-boundary
branch
from
August 13, 2026 18:29
4772537 to
5ffb52a
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.
Closes #383
Summary
cloud::run.main.rs.Tests
cargo fmt --allcargo check --workspace --all-featurescargo test -p clickhousectlcargo clippy -p clickhousectl --all-targets -- -D warnings