feat: proxy cloud event queries to dq behind DQ_ENDPOINT flag#78
Open
feat: proxy cloud event queries to dq behind DQ_ENDPOINT flag#78
Conversation
When DQ_ENDPOINT is set, all five GraphQL query resolvers forward to the unified dq service instead of hitting ClickHouse/S3 directly. Auth is validated locally first; the raw JWT is forwarded to dq. latestIndex/indexes are mapped to dq's latestCloudEvent/cloudEvents (header-only selection) and return indexKey: "" since dq no longer exposes that field. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.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.
Summary
DQ_ENDPOINTsetting that, when non-empty, forwards all five GraphQL query resolvers to the unified dq service instead of querying ClickHouse/S3 directly.feat/proxy-to-dq), so both services migrate to dq the same way.requireSubjectOptsByDID) before proxying; the rawAuthorizationheader is captured by middleware and forwarded to dq so no re-signing is needed.Query mapping
latestCloudEventlatestCloudEventheader,data,dataBase64,dataUrl)cloudEventscloudEventsavailableCloudEventTypesavailableCloudEventTypeslatestIndexlatestCloudEvent(header only)indexKey: ""since dq dropped that fieldindexescloudEvents(header only)indexKey: ""The
didargument maps directly to dq'ssubject(same DID string, no conversion). The resolved canonical subject fromrequireSubjectOptsByDIDis used so device-DID → vehicle-DID linking still works under the proxy.Test plan
go build ./...andgo test ./...passDQ_ENDPOINTunset, existing ClickHouse path is unchangedDQ_ENDPOINT=http://dq:3000/query, issue each of the five queries against fetch-api and confirm requests reach dq with the forwardedAuthorizationheaderlatestIndex/indexesreturnindexKey: ""under the proxy pathlatestCloudEvent/cloudEventsreturn inlinedata/dataBase64/ presigneddataUrlas appropriate🤖 Generated with Claude Code