Skip to content

Name cloud integration resources after their PR (or 'nightly')#146

Merged
sdairs merged 11 commits into
mainfrom
issue-138-name-resources-after-pr
May 14, 2026
Merged

Name cloud integration resources after their PR (or 'nightly')#146
sdairs merged 11 commits into
mainfrom
issue-138-name-resources-after-pr

Conversation

@sdairs
Copy link
Copy Markdown
Collaborator

@sdairs sdairs commented May 12, 2026

Summary

  • Workflow exports CLICKHOUSE_CLOUD_TEST_RUN_LABEL per event: pr-NNN on pull_request, nightly on schedule, manual-<run_id> on workflow_dispatch.
  • TestContext::from_env reads the new var and folds it into run_id, so existing service names (clickhousectl-it-<run_id>, clickhousectl-it-pg-<run_id>) and the run_id tag value automatically become PR/nightly-prefixed.
  • SHA suffix is preserved (multiple pushes to a PR still get distinct names); local-run behaviour is unchanged.

Closes #138.

Test plan

  • cargo build -p clickhouse-cloud-api --tests
  • cargo test -p clickhouse-cloud-api (all 86 unit tests + 5 spec coverage tests pass)
  • Cloud integration workflow run on this PR produces clickhousectl-it-pr-<NNN>-<sha7> resources and a run_id=pr-<NNN>-<sha7> tag (verify in Cloud console once the workflow finishes)
  • Next nightly run produces nightly-<sha7>

🤖 Generated with Claude Code

Workflow now exports CLICKHOUSE_CLOUD_TEST_RUN_LABEL per event
(pr-NNN / nightly / manual-RUNID). TestContext::from_env folds the
label into run_id so existing service names and tags pick it up,
making leaked resources attributable to their source PR or run.

Closes #138

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@sdairs sdairs requested a review from iskakaushik as a code owner May 12, 2026 17:25
@sdairs sdairs temporarily deployed to cloud-integration May 12, 2026 17:25 — with GitHub Actions Inactive
sdairs and others added 2 commits May 12, 2026 19:14
`cloud service query` now covers the cloud query path over HTTP without
needing a local clickhouse binary or service password, so the
`cloud service client` subcommand and its binary-download helper are no
longer needed.

Closes #147.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
rpassword 7.5.0 referenced `libc::__errno_location` (Linux-only), which
broke `cargo build` on macOS. 7.5.2 restores macOS support.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
sdairs and others added 2 commits May 12, 2026 19:36
README still framed `cloud service query` as the successor to `cloud
service client` on a deprecation path, and the cloud service CONTEXT
FOR AGENTS pointed at `client`. Rewrite both to stand on their own.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Refreshes the OpenAPI snapshot and brings the typed client in sync with the
new horizontal-autoscaling / scaling-schedule feature on ClickHouse Cloud.
Also fixes a resolver bug exposed by a spec convention transition: the
OpenAPI team is starting to add `required[]` arrays to schemas but only
listing newly-introduced fields, which the previous required[]-exclusive
interpretation mis-classified as flipping every other field to optional.

- Adds 7 new model types: `CurrentScaling`, `ScalingSchedule`,
  `ScalingScheduleBaseConfig`, `ScalingScheduleEntry`,
  `ScalingScheduleEntryRequest`, `ScalingSchedulePatchRequest`,
  `ScalingSchedulePostRequest`.
- Adds 5 new fields to `Service` and `ServiceScalingPatchResponse`
  (`currentScaling`, `scalingSchedule`, `minReplicas`, `maxReplicas`,
  `replicaMemoryGb`) and 3 to `ServiceReplicaScalingPatchRequest`.
- Adds 3 new client methods: `scaling_schedule_get`,
  `scaling_schedule_upsert`, `scaling_schedule_replace`.
- Introduces `PARTIAL_REQUIRED_SCHEMAS` (mirrored in Rust and Python
  resolvers) so schemas whose `required[]` only lists new fields fall back
  to the description heuristic for older fields. Currently `Service` and
  `ServiceScalingPatchResponse`.
- Python drift checker now parses `NON_OPENAPI_CLIENT_METHODS` and
  `OPTIONALITY_EXEMPTIONS` from `spec_coverage_test.rs` to stay in sync
  with the Rust test's intentional divergences.

Closes #149.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
sdairs and others added 4 commits May 13, 2026 13:49
Adds `BETA_OPERATIONS` (and `is_beta_operation`) to `clickhouse_cloud_api`,
sourced from `x-badges` Beta markers in the OpenAPI spec. Consumers — the
CLI in this repo, and any external user of the library — can now derive a
"(Beta)" affordance from spec metadata rather than maintaining a parallel
list by hand.

- New `meta.rs` module with a sorted constant of 36 snake-case operation
  names plus a `binary_search`-backed helper.
- `spec_coverage_test.rs` gains `beta_operations_match_spec` (snapshot)
  and `_live` variants. Drift produces a clear failure pointing at the
  regenerator script.
- `scripts/regenerate-beta-lists.py` reads the snapshot and prints the
  array body — run after each `clickhouse_cloud_openapi.json` refresh.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
`check-openapi-drift.py` now parses `BETA_OPERATIONS` out of `meta.rs`
and diffs it against `x-badges` Beta markers in the live spec. The
"Beta Status Changes" issue section calls out newly-Beta operations
(that need adding to the constant) and graduations (that need removing),
and the count rolls into the summary table.

This catches stability transitions that the snapshot-driven Rust test
cannot — e.g. an existing operation flipping from GA to Beta or vice
versa on the published spec before we refresh the snapshot.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The Postgres subcommand's help text already advertised "(beta)" via a
hand-written doc comment. Capitalise it to `(Beta)` (matching how the
OpenAPI spec's `x-badges` renders it) and add a test that asserts the
label is present iff `clickhouse_cloud_api::is_beta_operation` reports
the underlying operation as Beta. If Postgres ever graduates, the daily
drift check flags it, we delete the suffix, and the test keeps passing.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Reverts commit e11d3bd. The label-and-test approach was overbuilt for
what it solved: the CLI never actually consults `is_beta_operation` at
runtime — clap renders help text from compile-time metadata, and
nothing in the CLI declares which client method each subcommand wraps.
The test held a literal string accountable to spec metadata without the
CLI ever consuming that metadata, which is rigour without leverage on a
surface that has one beta-backed command today.

The library-side `BETA_OPERATIONS` constant and the daily drift checker
remain. Those are the genuine consumers: external Rust callers of
`clickhouse-cloud-api` get a programmatic stability signal, and the
drift check flags upstream Beta/GA transitions. The Postgres help text
goes back to a hand-written `(beta)` doc comment — the same it was
before this stack.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
sdairs added 2 commits May 14, 2026 17:49
…ng-schedule

Resolve OpenAPI drift and add scaling-schedule API coverage
Remove deprecated `cloud service client` command
@sdairs sdairs temporarily deployed to cloud-integration May 14, 2026 16:49 — with GitHub Actions Inactive
@sdairs sdairs requested a review from iskakaushik May 14, 2026 16:50
@sdairs sdairs merged commit 2d26b35 into main May 14, 2026
13 checks passed
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.

Name cloud integration test resources after their PR (or 'nightly')

2 participants