Repository navigation
fix(api): remediate remaining OpenAPI drift — Postgres backups, whoami, Kafka Glue registry (#1027) - #1039
Open
sdairs wants to merge 3 commits into
Open
fix(api): remediate remaining OpenAPI drift — Postgres backups, whoami, Kafka Glue registry (#1027)#1039sdairs wants to merge 3 commits into
sdairs wants to merge 3 commits into
Conversation
…postgres_action (#1027) Replace the vendored OpenAPI snapshot with the live document and remediate the small model drift it introduces: - ActivityType: postgres_action - BackupEncryptionConfig: new opaque pass-through alias (BTreeMap<String, serde_json::Value>) for a backup's encryption_config.json, whose shape is versioned and provider-specific - ServicePostRequest.backupEncryptionConfig (optional, skipped when None); the bare $ref trips the description requiredness heuristic, so it gets a documented optionality exemption: backupId's description makes it required only for own-bucket backups and forbidden otherwise The Kafka schema registry, Postgres backup list and whoami findings from the refreshed snapshot are remediated in follow-up commits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The refreshed OpenAPI snapshot makes ClickPipeKafkaSchemaRegistry (response) and ClickPipeMutateKafkaSchemaRegistry (request) oneOf unions over Confluent and AWS Glue registries. Model both as discriminated unions on `type`, where an absent `type` selects Confluent (the API default and legacy payloads) unless a Glue-only key is present, and unknown types stay lossless in Unknown(Value). New types: ClickPipeKafkaConfluentSchemaRegistry (response), ClickPipeMutateKafkaConfluentSchemaRegistry (request), and the split pair ClickPipeKafkaGlueSchemaRegistry / ClickPipeKafkaGlueSchemaRegistryResponse with a TryFrom write-back. Authentication enums follow the renamed variant schemas. The CLI keeps building a Confluent registry without `type`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add the two remaining beta operations from the live OpenAPI spec:
- postgres_service_backup_get_list (GET /v1/organizations/{organizationId}/
postgres/{postgresId}/backups) takes an optional cursor and limit and
returns ApiResponse<Vec<PostgresBackup>>, with limit, totalCount and
nextCursor on the envelope like saved_query_list. PostgresBackup is
all-Option (key, lastModified as DateTime<Utc>).
- whoami_get (GET /v1/whoami) is organization-independent and inherits the
global basicAuth requirement with no permission scopes. It returns the
Whoami response union, dispatched on actorType through
discriminated_union! to WhoamiUser ("user") or WhoamiApiKey ("apiKey");
an unknown, absent or misshapen payload is kept verbatim in
Unknown(Value). WhoamiUser, WhoamiApiKey and WhoamiOrganization are
all-Option; actorType is a single-value enum with an Unknown(String)
catch-all.
Regenerate BETA_OPERATIONS and the operation descriptors
(POSTGRES_SERVICE_BACKUP_GET_LIST, WHOAMI_GET with no required
permissions), map the new whoami domain files in both CI classifiers, and
cover the methods with wiremock, model, facade and live lifecycle tests.
The drift dry run now reports zero actionable drift.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sdairs
added this pull request to stack #1001
October 1, 2026 19:02
This was referenced Oct 1, 2026
cloud service query: bind the caller's own API key (via whoami) instead of minting a query key
#1043
Open
This branch has not been deployed
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.
Part of #1027. Stacked on #1036 (→ #1035 → #1028).
After #1028 was opened, the live spec drifted further. On the head of #1036 the drift dry run still reported 29 actionable findings. This PR fixes all of them, and the dry run now reports
No actionable drift. It is library-only; the CLI exposure is in the next PR, for #1038.Changes
clickhouse_cloud_openapi.jsonis refreshed from the live spec, byte-identical to it. This clears the stale-snapshot findings.ActivityType: addspostgres_action.BackupEncryptionConfig, aBTreeMap<String, serde_json::Value>alias. The spec defines it as an opaqueadditionalPropertiesobject whose shape depends on the provider, so it is passed through verbatim.ServicePostRequest.backup_encryption_config, omitted from the JSON when unset.$ref. The spec'sbackupIdtext makes it conditional (required only for a backup in your own bucket, omitted otherwise), so it staysOption. A documented optionality exemption inconfig.rscovers this.ClickPipeKafkaSchemaRegistryis the response type andClickPipeMutateKafkaSchemaRegistrythe request type. Both are nowdiscriminated_union!ontype. The variants areClickPipeKafkaConfluentSchemaRegistry/ClickPipeMutateKafkaConfluentSchemaRegistryandClickPipeKafkaGlueSchemaRegistry[Response].typestill parses as Confluent, as older payloads did. If such a payload carries anyglue*key it goes toUnknowninstead of being misread. An unrecognizedtypeis kept asUnknown(Value).{Name}/{Name}Response.TryFromconverts the response to the request.postgres_service_backup_get_list(org_id, postgres_id, cursor, limit), which returnsVec<PostgresBackup>with thelimit/totalCount/nextCursorenvelope. The(cursor, limit)signature followssaved_query_list.PostgresBackup { key, last_modified }.whoami_get(). It takes no organization, and its permission metadata is empty (required_permissions: &[]), because the operation inherits the spec's global basic auth with no scopes.Whoamiis a union onactorType:WhoamiUser(withorganizations: Vec<WhoamiOrganization>) orWhoamiApiKey. An unknown, missing or ill-fitting actor goes toUnknown(Value).src/client/whoami.rsandsrc/models/whoami.rs.meta/operations.rs, withALLkept sorted, andBETA_OPERATIONSis regenerated.organizationsuite.Tests
models_test:nullboth giveNone.type, an explicit type, Glue, the Glue-key guard, and unknown values.client_test(wiremock):nextCursor: null.model_facade_test: covers the new export paths.integration_postgres_test.rs, and a Whoami step inintegration_org_test.rsthat expects the suite's API key to resolve toWhoamiApiKeyfor the configured org.Gates
cargo fmtand library clippy (--all-targets) are clean, as are bothclickhousectlclippy configurations.cargo check --workspace --all-featurespasses.cargo test -p clickhousectl.python3 scripts/check-openapi-drift.py --dry-runreportsNo actionable drift.The first commit refreshes the snapshot before the remaining models exist, so the spec-coverage tests fail at that commit alone. They pass at the PR head.
🤖 Generated with Claude Code