Repository navigation
[BUGFIX] Set ProxyKindName to the proxy kinds accepted by the schema - #132
Merged
Merged
Conversation
http.ProxyKindName and sql.ProxyKindName were "httpproxy" and "sqlproxy", but the schema only accepts "HTTPProxy" and "SQLProxy". Since perses/perses#4077, the Perses go-sdk writes http.ProxyKindName in the kind of the proxy, so the schema rejects the datasources it builds (perses/perses#4775). The constants now hold the kinds accepted by the schema, and the generated CUE follows. The TypeScript SQLProxy kind had the same problem, so it is now 'SQLProxy', like the HTTPProxy kind. Signed-off-by: Augustin Husson <husson.augustin@gmail.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
3 of 8 tasks
There was a problem hiding this comment.
🔵 Needs a closer look
Release sequencing needs maintainer confirmation because the exported constant changes can cause downstream destination and secret-permission checks to be skipped unless the still-draft fix in perses/perses#4777 is adopted before upgrading.
No open issues 🎉
What changed in this PR
Aligns datasource proxy kind values across Go, generated CUE, and TypeScript with the existing schema, allowing SDK-generated datasources to validate without changing accepted stored-resource formats.
Changes:
- Sets Go proxy constants to
HTTPProxyandSQLProxy, documents their use, and updates generated CUE definitions. - Corrects the TypeScript SQL proxy discriminator to
SQLProxy. - Adds Go serialization and CUE validation regression tests for both proxy kinds.
| File | Description |
|---|---|
ts/src/datasource/proxy/sql.ts |
Aligns the SQL proxy discriminator with the schema. |
go/datasource/proxy/sql/sql.go |
Corrects and documents the SQL proxy kind constant. |
go/datasource/proxy/sql/sql_test.go |
Tests serialization with the accepted SQL proxy kind. |
go/datasource/proxy/http/http.go |
Corrects and documents the HTTP proxy kind constant. |
go/datasource/proxy/http/http_test.go |
Tests serialization with the accepted HTTP proxy kind. |
cue/datasource/proxy/sql/sql_go_gen.cue |
Reflects the corrected Go SQL proxy constant and comment. |
cue/datasource/proxy/http/http_go_gen.cue |
Reflects the corrected Go HTTP proxy constant and comment. |
cue-test/datasource/sql.cue |
Checks that the generated SQL kind satisfies the datasource schema. |
cue-test/datasource/http.cue |
Checks that the generated HTTP kind satisfies the datasource schema. |
Review effort: Max (adaptive)
AntoineThebaud
approved these changes
Nov 19, 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.
This fixes the root cause of perses/perses#4775.
http.ProxyKindNameandsql.ProxyKindNamewere"httpproxy"and"sqlproxy", but the schema only accepts"HTTPProxy"and"SQLProxy"(http_patch.cueandsql_patch.cue). Perses lowercases the kind of a proxy before comparing it with these constants, so they worked as matching keys. Since perses/perses#4077, the go-sdk also writeshttp.ProxyKindNamein the kind of the proxy, so the schema rejects the datasources built with it. With the VictoriaLogs SDK from the issue:The constants now hold the kinds that the schema accepts:
http.ProxyKindNameis"HTTPProxy"andsql.ProxyKindNameis"SQLProxy". Their new doc comment says to use them as the kind of a proxy.#ProxyKindNameinhttp_go_gen.cueandsql_go_gen.cuecomes frommake cue-gen. The patch files still define the accepted kinds, and don't change.SQLProxy.kindwas'sqlproxy', so the schema rejected a value of this type too. It's now'SQLProxy', likeHTTPProxy.kind. No Zod schema covers the proxies.Compatibility
The schema doesn't change, so the stored datasources and their validation don't change either.
Go code that compares a lowercased kind with these constants stops matching. Perses does it in
pkg/model/api/v1/datasource/proxy.goandinternal/api/discovery/cuetils/node.go. Built against this branch without other change, Perses doesn't find the proxy of a datasource anymore:TestEndpoint_newProxy_connectionLimits),netguarddoesn't check the destination of the proxy (TestValidateDatasourceSpec),TestHasSecret),TestBuildPluginAndInjectProxy).So Perses must not upgrade spec without the change described below.
Tests
TestMarshalJSONProxy(HTTP and SQL): aProxywith the kindProxyKindNamemarshals to"kind":"HTTPProxy"or"kind":"SQLProxy".cue-test/datasource: a proxy with the kindhttp.#ProxyKindNameorsql.#ProxyKindNamesatisfies#HTTPDatasourceSpecor#SQLDatasourceSpec.On main, both fail, the CUE test with the same conflict as the issue. Both pass with this change.
These checks pass:
make checkformat,make checkunused,make checkstylemake go-testmake cue-genwith CUE v0.16.1, like the CI: only#ProxyKindNameand its comment change in the generated filesmake cue-eval,make cue-testts:npm run lint,npm run format:check,npm run type-check,npm test,npm run buildWith spec v0.3.0, the go-sdk (
http.New("http://localhost:9428")) builds{"kind":"httpproxy",...}, whichcue vet -d '#HTTPDatasourceSpec'rejects. Against this branch, it builds{"kind":"HTTPProxy",...}, whichcue vetaccepts. A lowercase kind is still rejected.Follow-up in Perses
perses/perses#4777 (draft) upgrades spec to the release containing this PR, assumed to be v0.4.0-beta.1. Its first commit compares the proxy kinds with
strings.EqualFoldinstead of lowercasing them. It works with v0.3.0 too, so it can be merged first. With the upgrade, the go-sdk writesHTTPProxy, which fixes perses/perses#4775.