Skip to content

fix(api): remediate OpenAPI drift — BYOC infrastructure and saved queries (#1027) - #1028

Open
sdairs wants to merge 5 commits into
codex/postgres-query-endpointfrom
claude/drift-remediation-http-client-c7a937
Open

sdairs wants to merge 5 commits into
codex/postgres-query-endpointfrom
claude/drift-remediation-http-client-c7a937

Conversation

@sdairs

@sdairs sdairs commented Sep 30, 2026

Copy link
Copy Markdown
Collaborator

Fixes #1027

Remediates all 70 OpenAPI drift findings in clickhouse-cloud-api. The dry run against the live spec now reports Actionable drift: 0. This is library-only: no new CLI surface.

Changes

  • Snapshot: refreshed clickhouse_cloud_openapi.json from the live spec. This clears the 18 stale-snapshot findings.
  • Enums:
    • ActivityType gains 7 new values: the organization_approved_domain_* values, organization_update_public_preview and organization_update_saml_query_ownership_migration.
    • ByocConfigState gains infra-degraded, infra-terminating and infra-upgrading.
    • Both Kafka tombstone-mode enums gain soft_delete.
  • ByocConfig: adds account_id. account_name is now spec-deprecated, so it moves behind deprecated-fields and into DEPRECATED_FIELDS.
  • BYOC infrastructure (beta):
    • New methods: organization_byoc_infrastructure_get, _progress_get and _validate.
    • New models: ByocInfrastructureDetails, Progress, ProgressStage (recursive), Validation, ValidationCheck, ValidatePostRequest, and the ByocInfrastructureTags map alias.
    • ByocInfrastructurePostRequest gains 9 BYO-VPC, Azure and tag fields. availabilityZoneSuffixes, displayName and vpcCidrRange are now Option, matching the spec's required[] (breaking for Rust callers; see the crate README).
  • Saved queries (beta):
    • New domain files src/client/saved_queries.rs and src/models/saved_queries.rs.
    • New methods saved_query_list, _create, _get, _update and _delete. saved_query_list takes cursor/limit.
    • New models PublicSavedQuery, PublicSavedQueryListItem and PublicSavedQueryRequest. None is used in both directions, so no *Response split was needed.
  • BETA_OPERATIONS now lists all 8 new operations.
  • CLI: compile fix only. build_byoc_create_request wraps the now-optional fields in Some, and a new test pins the exact request JSON, which is unchanged.
  • Classifiers: both classify-*.py scripts map the new saved-query files (the Cloud classifier to the service suite), and their fixtures are updated.
  • The crate README.md is updated; the root README is unchanged.

Tests

  • models_test: for every new response type, a missing key and an explicit null both give None. Also covers request strictness, a 3-level recursive progress stage, dynamic tag keys and the new enum round-trips.
  • client_test (wiremock): all 8 new methods, checked for verb, path, cursor encoding, body, parsed response and error paths.
  • Live integration: a new blocking Saved Queries phase in cloud_service_crud_lifecycle. It runs create ×2, a duplicate-name 409, paginated list, get, update and delete, then checks for 404s. Cleanup goes through CleanupRegistry.
    • Run live against the test org (aws/eu-west-1): passed in 363s, and the service was deleted afterwards.
    • That run used the endpoint phase's names. A final commit switches to a distinct -sq prefix, so the renamed version has not been run live.
  • BYOC: no live coverage (there was none before either). Get and progress need real BYOC infrastructure, and validate needs a BYOC-enabled org.

Gates

cargo fmt, both clippy configurations and library --all-targets are clean. cargo check --workspace --all-features passes. The library and analyzer tests pass, including spec_coverage_test and the analyzer entrypoint_test, and so do the Python classifier tests. cargo test -p clickhousectl passes apart from the local_postgres_* tests, which need Docker and it wasn't running locally.

🤖 Generated with Claude Code

sdairs and others added 5 commits October 1, 2026 18:07
…ft (#1027)

Replace the vendored OpenAPI snapshot with the live document and remediate
the enum-value, field and deprecation findings that do not belong to the
BYOC infrastructure or saved-query surfaces:

- ActivityType: approved-domain, public-preview and SAML query-ownership
  migration activity types
- ByocConfigState: infra-terminating, infra-degraded, infra-upgrading
- ClickPipe(Post)KafkaSourceTombstonemode: soft_delete
- ByocConfig.accountId (response, optional); ByocConfig.accountName is now
  deprecated and gated behind the deprecated-fields feature

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e request drift (#1027)

Add organization_byoc_infrastructure_get, _progress_get and _validate with
all-Option response models (ByocInfrastructureDetails, ByocInfrastructureProgress,
recursive ByocInfrastructureProgressStage, ByocInfrastructureValidation,
ByocInfrastructureValidationCheck), the strict ByocInfrastructureValidatePostRequest,
and the ByocInfrastructureTags string-map alias.

ByocInfrastructurePostRequest now requires only accountId and regionId, gains
the BYO-VPC, AWS externalId, Azure tenant/service-principal and tags fields,
and the CLI builder wraps the now-optional fields. Mark the three new
operations Beta.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add the beta saved query methods saved_query_create, saved_query_get,
saved_query_list, saved_query_update and saved_query_delete in a new
saved_queries domain (client and models), with all-Option response models
PublicSavedQuery and PublicSavedQueryListItem and the strict
PublicSavedQueryRequest. saved_query_list takes an optional cursor and limit
and returns ApiResponse<Vec<PublicSavedQueryListItem>>, whose envelope
carries limit, totalCount and nextCursor as the spec defines.

Mark the five operations Beta, map the new files in both CI classifiers,
and cover the methods with wiremock, model and live service-lifecycle tests.

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

Saved Query API endpoints are backed by saved queries, so reusing the
endpoint phase's names risks a 409 if the endpoint's query is still
being removed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…uery endpoints

Regenerated meta/operations.rs from the vendored snapshot so the permission
drift check covers the endpoints added in #1027.

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

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.

OpenAPI drift: 141 gaps between live spec and library

1 participant