Skip to content

refactor(api): align client and convert modules with models (#1173) - #1177

Open
sdairs wants to merge 4 commits into
claude/1173-api-client-queryfrom
claude/1173-api-client-align
Open

sdairs wants to merge 4 commits into
claude/1173-api-client-queryfrom
claude/1173-api-client-align

Conversation

@sdairs

@sdairs sdairs commented Oct 30, 2026 •

Copy link
Copy Markdown
Member

Part of #1173 (2 of 6: align client/ and convert/ with models/). Stacked on #1176.

Summary

This splits src/client/organizations.rs (883 lines) into per-domain files that match src/models/, and renames src/convert/service.rs to src/convert/services.rs to match client/services.rs and models/services.rs. Behaviour and the public API are unchanged: every method is still on Client, and all crate-root and models::* paths are unchanged.

File Lines Contents
client/organizations.rs 374 credit/active balances, organization get/list/update, quotas, notifications, the deprecated private endpoint config list, Prometheus, usage cost
client/byoc.rs 212 the eight organization_byoc_infrastructure_* methods (create, validate, get, progress, private endpoint config, tags, delete, update)
client/invitations.rs 97 invitation_get_list, invitation_create, invitation_get, invitation_delete
client/members.rs 98 member_get_list, member_get, member_update, member_delete
client/rbac.rs 122 organization_roles_get_list, organization_role_{post,get,patch,delete}
convert/services.rs — git mv of convert/service.rs, unchanged

Quotas and the organization private endpoint config list stay in organizations.rs. The issue scopes this step to BYOC, invitations, members and roles.

Commits

  1. Pure git mv. convert/service.rs → convert/services.rs (100%), plus the mod services; line in convert.rs.
  2. Moves only. A script cut whole methods out of organizations.rs and kept their order and blank lines. I compared the sorted line multisets before and after this commit. The only added lines are the three use lines, impl Client { and } in each new file, plus four mod lines in client.rs. Visibility did not change. Review it with git show --color-moved=dimmed-zebra.
  3. Classifier.
    • client/{byoc,invitations,members,rbac}.rs map to the organization suite only. Among the live suites, only integration_org_test calls these methods. The common/support.rs cleanup touches them only for resources that integration_org_test registers. The live CLI tests (cloud service query, cloud clickpipe create postgres) don't reach them.
    • organizations.rs keeps service+organization, because integration_test calls organization_get, organization_get_list, organization_update and usage_cost_get.
    • convert/services.rs inherits service+clickpipes. The old convert/service.rs entry stays, following the classifier's rule to retain mappings for renamed paths.
    • classify-install-integration.py needs no change: API-crate paths are not install candidates.
  4. .git-blame-ignore-revs entry for commit 2. This SHA must be updated if the stack is rebased before merge.

No docs change was needed. AGENTS.md and the crate README name these modules only as src/client/*.rs and src/convert/*.rs.

Visibility widenings

None.

Tests

  • Counts match before and after: 916 tests (887 passed, 29 ignored). Test names match once module paths are stripped.
  • python3 scripts/check-openapi-drift.py --dry-run gave identical output before and after (no actionable drift).
  • Gates run:
    • cargo fmt --all (no changes)
    • clippy on both library crates (--all-targets)
    • cargo clippy -p clickhousectl, plus the --all-targets --no-default-features configuration
    • cargo check -p clickhousectl --no-default-features and cargo check --workspace --all-features
    • cargo test -p clickhouse-cloud-api -p clickhouse-openapi-analyzer; spec_coverage_test and model_facade_test are untouched
    • the Python classifier tests

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 splits and a rename only; HTTP paths, method signatures, and crate exports are unchanged per the PR description.

Overview
Reorganizes the ClickHouse Cloud API crate so client and convert layout matches models, without changing behavior or public Client method names.

client/organizations.rs is slimmed down by moving whole impl Client blocks into four new modules: byoc, invitations, members, and rbac. Core org operations (balances, get/list/update, quotas, notifications, Prometheus, usage cost, deprecated private endpoint list) stay in organizations.rs. client.rs declares the new submodules.

convert/service.rs is renamed to convert/services.rs (with mod services in convert.rs) to align with client/services and models/services.

Supporting updates: cloud integration classifier mappings and tests for the new paths, plus a .git-blame-ignore-revs entry for the pure-move commit (merge with a merge commit so that SHA stays valid).

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

sdairs and others added 4 commits October 30, 2026 19:41
Match the client/services.rs and models/services.rs module names. Pure
rename (100% similarity); only the `mod` line in convert.rs changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Move the Client endpoint methods out of client/organizations.rs into
private per-domain files that mirror src/models/:

- client/byoc.rs: the eight organization_byoc_infrastructure_* methods
  (create, validate, get, progress_get, private_endpoint_config_get,
  tags_get, delete, update)
- client/invitations.rs: invitation_get_list, invitation_create,
  invitation_get, invitation_delete
- client/members.rs: member_get_list, member_get, member_update,
  member_delete
- client/rbac.rs: organization_roles_get_list, organization_role_post,
  organization_role_get, organization_role_patch, organization_role_delete

organizations.rs keeps balances, organization get/list/update, quotas,
notifications, the deprecated private endpoint config list, Prometheus
and usage cost. Methods are moved verbatim and keep their relative
order; each new file repeats organizations.rs's three `use` lines.
No visibility changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
client/byoc.rs, client/invitations.rs, client/members.rs and
client/rbac.rs map to the organization suite only, like their
models/invitations.rs, models/members.rs and models/rbac.rs
counterparts. Of the live suites, only integration_org_test calls the
BYOC, invitation, member and role methods; common/support.rs's cleanup
calls invitation_delete, member_update and organization_role_delete
only for resources that integration_org_test registers; and the
clickhousectl commands the live CLI tests spawn (`cloud service query`,
`cloud clickpipe create postgres`) do not reach these methods.
organizations.rs keeps service+organization for organization_get,
organization_get_list, organization_update and usage_cost_get, which
integration_test calls.

convert/services.rs keeps convert/service.rs's service+clickpipes
mapping; the old path stays mapped so diffs that name it remain
classified.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sdairs sdairs added enhancement New feature or request client Affects the HTTP client rust Pull requests that update rust code labels Oct 30, 2026
@sdairs
sdairs requested a review from iskakaushik as a code owner October 30, 2026 19:57
@sdairs
sdairs added this pull request to stack #1153 October 30, 2026 19:57

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

client Affects the HTTP client enhancement New feature or request rust Pull requests that update rust code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant