feat(controlplane): accept http(s) URLs for GRPC_SERVICE subgraphs#2841
feat(controlplane): accept http(s) URLs for GRPC_SERVICE subgraphs#2841fengyuwusong wants to merge 3 commits intowundergraph:mainfrom
Conversation
The routing URL validator on createFederatedSubgraph, updateSubgraph
and publishFederatedSubgraph rejected anything that did not match a
gRPC name resolver scheme (dns://, unix://, vsock://, ipv4://, ipv6://).
That blocks ConnectRPC subgraphs, which serve over plain HTTP/1.1 and
need an http(s):// routing URL even though their subgraph type is
GRPC_SERVICE.
Add isValidGrpcSubgraphRoutingURL that accepts either form:
- any URL recognised by the existing isValidGrpcNamingScheme
(preserves the historical strict gRPC validation), or
- any well-formed http:// or https:// URL.
The router decides at request time which transport to use via the new
grpc_protocol configuration block, so the control plane no longer
needs to commit to one or the other at registration time. The error
message is updated to mention both options.
…tance Three integration tests previously asserted that an http:// or https:// routing URL was rejected for GRPC_SERVICE subgraphs. Now that the control plane accepts those URLs (so ConnectRPC subgraphs can register their HTTP endpoint directly), invert the assertions: - createFederatedSubgraph with http(s) -> EnumStatusCode.OK - updateSubgraph with http(s) -> EnumStatusCode.OK - publishFederatedSubgraph with http(s) -> EnumStatusCode.OK Test names updated accordingly. The companion 'Should allow ... with gRPC naming scheme' tests remain unchanged so the gRPC path keeps the same coverage.
WalkthroughThis PR extends gRPC service subgraph routing URL validation to accept ConnectRPC-style HTTP/HTTPS URLs alongside native gRPC naming schemes. A new utility function validates routing URLs by checking for well-formed HTTP(S) schemes or delegating to existing gRPC naming scheme validation. All three subgraph mutation operations (create, publish, update) and their test suites are updated accordingly. ChangesConnectRPC Routing URL Support
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary by CodeRabbit
http(s)://host:port) in addition to gRPC naming schemes, providing greater configuration flexibility for subgraph routing.Summary
Loosen the routing-URL validator on
createFederatedSubgraph,updateSubgraph, andpublishFederatedSubgraphso thatGRPC_SERVICEsubgraphs can register anhttp://orhttps://URL alongside the gRPC name resolver schemes that were already accepted (dns://,unix://,vsock://,ipv4://,ipv6://).A
GRPC_SERVICEsubgraph backed by a ConnectRPC handler serves over plain HTTP/1.1, not HTTP/2, so its routing URL has to be a regular http URL. The router selects the actual transport (gRPC or ConnectRPC) at request time via separate configuration, so the control plane no longer needs to commit to one or the other at registration.This is part of the work that supersedes #2808; it is fully self-contained and can land independently of the matching router/gRPC-data-source changes.
Related
What's changed
New
isValidGrpcSubgraphRoutingURLhelper incontrolplane/src/core/util.ts. Accepts:isValidGrpcNamingScheme(preserves the historical strict gRPC validation), orhttp://orhttps://URL.createFederatedSubgraph,updateSubgraph, andpublishFederatedSubgraphswitch to the new helper. Error messages are updated to mention both options:controlplane/src/core/util.test.ts: 6 new cases forisValidGrpcSubgraphRoutingURLcovering http/https acceptance, case-insensitivity on the scheme, malformed input, delegation toisValidGrpcNamingSchemefor non-http schemes, and empty / whitespace-only input.controlplane/test/subgraph/{create,update,publish}-subgraph.test.ts: three integration tests previously asserted that http(s) URLs were rejected forGRPC_SERVICE; flip them to assert acceptance, and rename the test cases accordingly. The companion "valid gRPC naming scheme" tests are unchanged.Backward compatibility
Testing
controlplane/src/core/util.test.tsextendsisValidGrpcNamingSchemecoverage with parallel cases forisValidGrpcSubgraphRoutingURL.controlplane/test/subgraph/{create,update,publish}-subgraph.test.tsintegration coverage flipped to acceptance.Checklist
grpc_protocolindocs-website/router/configuration.mdx; this control-plane change has no user-facing surface beyond an error-message wording update.Open Source AI Manifesto
This project follows the principles of the Open Source AI Manifesto. Please ensure your contribution aligns with its principles.