Skip to content

refactor(cli): split cloud services into a module directory (#1157) - #1168

Open
sdairs wants to merge 4 commits into
claude/1156-postgres-cloudclient-wrappersfrom
claude/1157-split-cloud-services
Open

sdairs wants to merge 4 commits into
claude/1156-postgres-cloudclient-wrappersfrom
claude/1157-split-cloud-services

Conversation

@sdairs

@sdairs sdairs commented Oct 30, 2026 •

Copy link
Copy Markdown
Member

Part of #1157 (1 of 5: services). Stacked on #1165.

Summary

This splits src/cloud/services.rs (9.6k lines) into src/cloud/services/. Behaviour is unchanged.

File Lines Contents
mod.rs 637 PERMISSIONS, run dispatch, re-exports
cli.rs 3199 clap definitions and their parse tests (about 2.2k lines are tests)
client.rs 510 impl CloudClient wrappers
lifecycle.rs 2010 list/get/create/update/delete/start/stop/wake/scale/reset-password/prometheus
settings.rs 317
scaling_schedule.rs 371
upgrade_window.rs 291 also replica-aware routing and profiles
endpoints.rs 334 query and private endpoints
query.rs 2077 service query and repair-query-key
query_key.rs 2581 git mv of service_query.rs, unchanged

Commits

  1. Pure git mvs, plus path edits. services.rs → services/mod.rs (99%) and service_query.rs → services/query_key.rs (100%), so blame follows both files.
  2. Moves only. I compared the sorted line multisets before and after this commit. The only differences are mod declarations, use lists and visibility, plus a few signature rewraps rustfmt made after adding pub(super). Review it with git show --color-moved=dimmed-zebra.
  3. .git-blame-ignore-revs entry for commit 2. This SHA must be updated if the stack is rebased before merge.
  4. Docs. AGENTS.md, the add-cli-command and cli-help-text skills, and docs/development.md now describe src/cloud/<domain>/ modules.

Visibility widenings

  • Handlers and the option structs that run builds are now pub(super).
  • build_service_state_patch_request and service_delete_error are pub(super) for the wrappers.
  • CloudClient::{configured_query_host, run_service_query, run_service_query_bearer} are pub(super).
  • ServiceSettingTarget::parts is now pub(in crate::cloud), because shared.rs uses it.

Tests

  • Counts match before and after: 2419 passed, 7 ignored. Test names match once module paths are stripped.
  • fmt, both clippy configurations, the --no-default-features check, cargo test -p clickhousectl and the Python classifier tests all pass.
  • The classifiers needed no change: src/cloud/ is a prefix rule.

Merge with a merge commit, not a squash. The .git-blame-ignore-revs entry 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 file moves and visibility adjustments only; PR claims unchanged behavior and matching test counts.

Overview
Refactors the monolithic src/cloud/services.rs into src/cloud/services/, splitting clap definitions, CloudClient wrappers, dispatch/permissions, and handlers into separate files (cli.rs, client.rs, lifecycle.rs, query.rs, settings.rs, etc.) without changing CLI behavior.

Moves service_query.rs into services/query_key.rs and drops the standalone service_query module from cloud/mod.rs. Several helpers are widened to pub(super) (or pub(in crate::cloud) for ServiceSettingTarget::parts) so the split modules can share the same code paths as before.

Updates contributor docs (AGENTS.md, add-cli-command/cli-help-text skills, docs/development.md) to describe the src/cloud/<domain>/ layout for large domains, and adds a .git-blame-ignore-revs entry for the bulk move commit (merge with a merge commit so blame stays valid).

Reviewed by Cursor Bugbot for commit f55058c. Bugbot is set up for automated code reviews on this repo. Configure here.

sdairs and others added 4 commits October 30, 2026 16:38
Move `cloud/services.rs` to `cloud/services/mod.rs` and
`cloud/service_query.rs` to `cloud/services/query_key.rs`, so blame
follows both files into the new layout. Only the module declaration and
the `service_query` paths change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
)

Move the `service` command code out of `cloud/services/mod.rs` into one
file per command family, each with the tests for its code:

- `cli.rs`: clap definitions and private endpoint ID value parser
- `client.rs`: `CloudClient` wrappers
- `lifecycle.rs`: list, get, create, update, delete, start, stop, wake,
  scale, reset-password and prometheus
- `settings.rs`, `scaling_schedule.rs`, `endpoints.rs`
- `upgrade_window.rs`: upgrade window, replica-aware routing and profiles
- `query.rs`: `service query` and `service repair-query-key`

`mod.rs` keeps `PERMISSIONS`, the `run` dispatch and re-exports of the
command enums. Only visibility and imports change; no behaviour change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A large Cloud domain can now be a directory: `PERMISSIONS` and dispatch
in `mod.rs`, clap definitions in `cli.rs`, `CloudClient` wrappers in
`client.rs`, and one file per command family with its tests. Point the
`run_service_query` exception at `services/client.rs`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sdairs
sdairs force-pushed the claude/1157-split-cloud-services branch from b519ead to f55058c Compare October 30, 2026 17:27
@sdairs
sdairs added this pull request to stack #1153 October 30, 2026 17:28

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant