Repository navigation
Conversation
#1112) A typed map whose value schema is an inline oneOf/anyOf has no single Rust value type; serde_json::Value is the only lossless match. Every other value schema still needs a typed value. Co-authored-by: Alasdair Brown <sdairs@users.noreply.github.com>
- Add click_stack_validate_webhook with its operation metadata and beta entry. - Role permissions, dashboard filters and heatmaps become unions matching the spec's oneOf schemas, with TryFrom write-back for permissions and filters. - Add stacked-line tiles and inline alert chart configs; alerts gain displayName, tags and chartConfig, and channel/channels/source are optional. - Add the remaining ClickStack fields and enum values, and type select-item level as a number. Co-authored-by: Alasdair Brown <sdairs@users.noreply.github.com>
#1112) Compile fixes for the library's new unions. Filters and role permissions are checked per variant on the raw JSON so unknown fields are still rejected; inline alerts, non-query-expression filters and series heatmaps stay rejected until the CLI exposes them. Select-item level is now sent as a number. Co-authored-by: Alasdair Brown <sdairs@users.noreply.github.com>
Co-authored-by: Alasdair Brown <sdairs@users.noreply.github.com>
|
|
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 3 of 3 of the API side of the #1112 drift remediation. Fixes #1112. Stacked on API 2 (#1119,
cursor/openapi-drift-1112-api-clickpipes-c05d). The plan, the decisions I was unsure about, and the follow-up issues are in the API 1 description (#1117,cursor/openapi-drift-remediation-1112-c05d).At this head,
python3 scripts/check-openapi-drift.py --dry-runagainst the live spec reports 0 actionable drift.Library
click_stack_validate_webhookchecks aClickStackWebhookInputwithout saving it and returnsClickStackValidateWebhookResponse(valid,errors,normalized). It's added toBETA_OPERATIONS; its metadata was regenerated in API 1.ClickStackCASLPermission/ClickStackCASLPermissionResponseare unions onintegration:ClickStackMongoDBCASLPermission(conditions are a map of raw JSON values) andClickStackClickHouseCASLPermission(typed connection/table/where conditions).actionandsubjectare now enums, and the free-form conditions alias is gone.ClickStackFilter,ClickStackFilterResponseandClickStackFilterInputare unions ontype(query expression, static list, Prometheus label, source). Each variant gainsmin_selections,max_selections(integer enums) andis_global_requirement.ClickStackHeatmapChartConfig{,Response}are unions onheatmapMode. A missingheatmapModeselects the distribution heatmap (the former shape); a missing mode withgroupByis kept verbatim.ClickStackAlertChartConfigis a union of the line, stacked-bar, stacked-line and number configs plus the overlay fields. Create/update requests now require onlythreshold,intervalandthresholdType, sochannel,channelsandsourcebecomeOption. Alerts gaindisplayName,tagsandchartConfig, and the source enums addInline.ClickStackStackedLineChartConfig) join the tile union;lineInterpolation, raw-SQL numbercolorRules, tiledescription, the source expressions and saved-filterallare added;stacked_linejoins the time-chart series enum.level.levelisOption<f64>, matching the numeric schema.TryFromcovers the permission and filter unions and their variants, and the source and saved-filter conversions carry the new fields. Chart and tile configs follow the existing precedent of having no write-back conversions.ClickStackSourceResponsegets#[allow(clippy::large_enum_variant)]: the four new trace-source fields crossed the size threshold, and boxing would break callers that match on the variant.The
ClickStackValidationError*types are no longer in the spec, but nothing reports them and removing them would be an unforced break, so I left them.Analyzer
A typed
additionalPropertiesmap whose value schema is an inlineoneOf/anyOfnow matches onlyserde_json::Value. Without this rule, no Rust type could satisfyClickStackMongoDBCASLPermissionConditions(string or{"$regex", "$options"}values). Fixture tests cover both the accepted and the rejected representations. The report format is unchanged.CLI (compile fixes only)
serde_ignoredcan't see into. So that unknown fields are still rejected, the CLI checks each filter and permission against its variant on the raw JSON. Permissions must now setintegrationtomongodborclickhouse, as the spec requires; integration-less fixtures were updated.source, non-query-expression filters, and series heatmaps. Channel/channels are still both required. A test pins each case.levelis now sent as a number. The dashboard fixture pins"level": 0.95.Tests
Union dispatch (including dropped discriminators and unknown values), request strictness, missing/null tolerance for each new response type, write-back with missing-field names at the nested level, wiremock coverage for the new method (success and API error), facade paths, and analyzer fixtures. The library has no live ClickStack suite, so there's no integration step to extend.
Verification
cargo fmt --all; library clippy; bothclickhousectlclippy configurations;cargo check -p clickhousectl --no-default-features;cargo check --workspace --all-features: all clean.cargo test -p clickhouse-cloud-api -p clickhouse-openapi-analyzer --no-fail-fast: all pass, includingspec_coverage_test.cargo test -p clickhousectlandpython3 -m unittest discover -s scripts/tests -p 'test_*.py': pass.Actionable drift: 0 ... No actionable drift. Library fully covers the live spec.