Skip to content

Resolve remaining OpenAPI drift from #168 (postgres prometheus + PgConfig)#186

Merged
sdairs merged 7 commits into
mainfrom
issue-168-postgres-prometheus-and-pg-config
May 18, 2026
Merged

Resolve remaining OpenAPI drift from #168 (postgres prometheus + PgConfig)#186
sdairs merged 7 commits into
mainfrom
issue-168-postgres-prometheus-and-pg-config

Conversation

@sdairs
Copy link
Copy Markdown
Collaborator

@sdairs sdairs commented May 16, 2026

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 mirroring organization_prometheus_get (text/plain, Result<String, Error>). Both Beta, added to BETA_OPERATIONS.
  • PgConfig.ssl_min_protocol_version — new field plus inline PgConfigSslMinProtocolVersion enum (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-unused ScalingSchedulePatchRequest model and updates BETA_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).

wiremock coverage added for each new client method.

Why this unblocks #178

#178's spec_coverage_test.rs was failing on three assertions:

  • client_methods_cover_every_openapi_operation — missing postgres_instance_prometheus_get / postgres_org_prometheus_get
  • beta_operations_match_spec — same two ops absent from BETA_OPERATIONS
  • struct_fields_cover_every_spec_propertyPgConfig.ssl_min_protocol_version missing

All three pass with this PR; rebasing #178 onto an updated md/add-clickpipes-support turns it green.

Test plan

  • cargo build -p clickhouse-cloud-api
  • cargo clippy -p clickhouse-cloud-api --tests (no new warnings)
  • cargo test -p clickhouse-cloud-api — 118+86+6 pass, ignored live tests still skipped
  • cargo build (whole workspace) + cargo test -p clickhousectl clean
  • python3 scripts/regenerate-beta-lists.py diffs clean against meta.rs

🤖 Generated with Claude Code

sdairs and others added 2 commits May 16, 2026 13:39
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>
@sdairs sdairs requested a review from iskakaushik as a code owner May 16, 2026 12:40
@sdairs sdairs temporarily deployed to cloud-integration May 16, 2026 12:40 — with GitHub Actions Inactive
sdairs and others added 3 commits May 16, 2026 13:45
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>
@sdairs sdairs linked an issue May 16, 2026 that may be closed by this pull request
iskakaushik
iskakaushik previously approved these changes May 18, 2026
Copy link
Copy Markdown
Collaborator

@iskakaushik iskakaushik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Base automatically changed from md/add-clickpipes-support to main May 18, 2026 14:34
@sdairs sdairs dismissed iskakaushik’s stale review May 18, 2026 14:34

The base branch was changed.

…undtrip

Add scaling_schedule round-trip coverage to service suite
@sdairs sdairs temporarily deployed to cloud-integration May 18, 2026 14:39 — with GitHub Actions Inactive
# Conflicts:
#	crates/clickhouse-cloud-api/tests/common/support.rs
#	crates/clickhouse-cloud-api/tests/integration_test.rs
@sdairs sdairs temporarily deployed to cloud-integration May 18, 2026 15:38 — with GitHub Actions Inactive
@sdairs sdairs merged commit 431e905 into main May 18, 2026
2 checks passed
@sdairs sdairs deleted the issue-168-postgres-prometheus-and-pg-config branch May 18, 2026 15:43
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.

OpenAPI drift: 14 gaps between live spec and library

2 participants