Resolve remaining OpenAPI drift from #168 (postgres prometheus + PgConfig)#186
Merged
Merged
Conversation
Picks up the postgres prometheus endpoints, PgConfig.ssl_min_protocol_version, and the scaling_schedule PATCH-to-DELETE swap from the live ClickHouse Cloud spec. Each is wired into the typed client in the follow-up commits. Closes the snapshot portion of #168. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Three drift items the snapshot now exposes: - Add `postgres_instance_prometheus_get` and `postgres_org_prometheus_get` to the typed client, mirroring `organization_prometheus_get` (text/plain response, `Result<String, Error>`). Both endpoints are Beta — added to `BETA_OPERATIONS`. - Add `PgConfig.ssl_min_protocol_version` with a new inline `PgConfigSslMinProtocolVersion` enum (`TLSv1`/`TLSv1.1`/`TLSv1.2`/ `TLSv1.3`), matching how `default_transaction_isolation` and `wal_compression` are modelled. - Swap `scaling_schedule_replace` (PATCH, removed from the spec) for `scaling_schedule_delete` (DELETE). Drop the now-unused `ScalingSchedulePatchRequest` model and update `BETA_OPERATIONS`. wiremock coverage added for each new client method. The three spec-coverage tests that were red on PR #178 (`client_methods_cover_every_openapi_operation`, `beta_operations_match_spec`, `struct_fields_cover_every_spec_property`) now pass. Closes #168. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds a Scaling Schedule phase to integration_test.rs covering the Beta
scaling_schedule_{get,upsert,replace} endpoints. The phase captures
pre-state, upserts an inert window, GETs to verify the round-trip,
PATCH-replaces with a different inert window, and GETs again. The
schedule entries use replica counts and memory identical to the current
service state (1 replica, 8 GB) so they're guaranteed no-ops even if
the window happens to be active during the test run.
Pre-state restore is wired through CleanupRegistry as a cleanup step,
not a test-body step, so a mid-phase failure still rolls back the
synthetic schedule. The restore tolerates 404 in case the in-test
delete already removed the service.
Closes #169
Fresh services have no autoscaling schedule configured, so `scaling_schedule_get` returns 404 rather than an empty schedule. The pre-state step was bubbling that 404 via `?`, failing the run under CI's fail-fast NonBlocking mode. Catch the 404 inside the closure and substitute `ScalingSchedule::default()` so the round-trip still exercises upsert/replace. Skip restore registration when the captured pre-state is empty — the API rejects upserts with `entries: []`, and there is nothing meaningful to restore (the service-delete teardown handles synthetic entries anyway).
The scalingSchedule endpoint dropped its PATCH operation; only GET, POST, and DELETE remain. The library-side swap (replace_replace → schedule_delete, plus the dropped ScalingSchedulePatchRequest) now lives in the issue-168-postgres-prometheus-and-pg-config base branch (PR #186); this commit just reworks the integration round-trip to delete + assert 404. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…undtrip Add scaling_schedule round-trip coverage to service suite
# Conflicts: # crates/clickhouse-cloud-api/tests/common/support.rs # crates/clickhouse-cloud-api/tests/integration_test.rs
iskakaushik
approved these changes
May 18, 2026
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
Refreshes the OpenAPI snapshot and resolves the remaining drift items called out by #168 that PR #178's spec-coverage tests fail on. Splits cleanly from #178 so the scaling_schedule integration coverage and the broader library/snapshot drift stay independent concerns.
Three concrete additions on top of the snapshot refresh:
postgres_instance_prometheus_get/postgres_org_prometheus_get— typed client methods mirroringorganization_prometheus_get(text/plain,Result<String, Error>). Both Beta, added toBETA_OPERATIONS.PgConfig.ssl_min_protocol_version— new field plus inlinePgConfigSslMinProtocolVersionenum (TLSv1/TLSv1.1/TLSv1.2/TLSv1.3), modelled like the other inline PgConfig enums.scaling_schedule_replace(PATCH) →scaling_schedule_delete(DELETE) — the live spec dropped PATCH. Also drops the now-unusedScalingSchedulePatchRequestmodel and updatesBETA_OPERATIONS. Overlaps with the equivalent commits in Add scaling_schedule round-trip coverage to service suite #178; Add scaling_schedule round-trip coverage to service suite #178 should rebase on top of this and drop its now-redundant library changes (its integration test stays).wiremockcoverage added for each new client method.Why this unblocks #178
#178's
spec_coverage_test.rswas failing on three assertions:client_methods_cover_every_openapi_operation— missingpostgres_instance_prometheus_get/postgres_org_prometheus_getbeta_operations_match_spec— same two ops absent fromBETA_OPERATIONSstruct_fields_cover_every_spec_property—PgConfig.ssl_min_protocol_versionmissingAll three pass with this PR; rebasing #178 onto an updated
md/add-clickpipes-supportturns it green.Test plan
cargo build -p clickhouse-cloud-apicargo clippy -p clickhouse-cloud-api --tests(no new warnings)cargo test -p clickhouse-cloud-api— 118+86+6 pass, ignored live tests still skippedcargo build(whole workspace) +cargo test -p clickhousectlcleanpython3 scripts/regenerate-beta-lists.pydiffs clean againstmeta.rs🤖 Generated with Claude Code