Skip to content

feat(controlplane): accept http(s) URLs for GRPC_SERVICE subgraphs#2841

Open
fengyuwusong wants to merge 3 commits intowundergraph:mainfrom
fengyuwusong:feat/controlplane-grpc-service-http-url
Open

feat(controlplane): accept http(s) URLs for GRPC_SERVICE subgraphs#2841
fengyuwusong wants to merge 3 commits intowundergraph:mainfrom
fengyuwusong:feat/controlplane-grpc-service-http-url

Conversation

@fengyuwusong
Copy link
Copy Markdown

@fengyuwusong fengyuwusong commented May 8, 2026

Summary by CodeRabbit

  • New Features
    • Subgraph routing URLs now accept HTTP/HTTPS URL formats (e.g., 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, and publishFederatedSubgraph so that GRPC_SERVICE subgraphs can register an http:// or https:// URL alongside the gRPC name resolver schemes that were already accepted (dns://, unix://, vsock://, ipv4://, ipv6://).

A GRPC_SERVICE subgraph 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 isValidGrpcSubgraphRoutingURL helper in controlplane/src/core/util.ts. Accepts:

    • any URL recognised by the existing isValidGrpcNamingScheme (preserves the historical strict gRPC validation), or
    • any well-formed http:// or https:// URL.
  • createFederatedSubgraph, updateSubgraph, and publishFederatedSubgraph switch to the new helper. Error messages are updated to mention both options:

    Routing URL "<value>" is not a valid gRPC subgraph URL. Use http(s)://host:port for ConnectRPC or a gRPC naming scheme (e.g. dns:///host:port) for native gRPC. See https://grpc.io/docs/guides/custom-name-resolution/ for the gRPC schemes.
    
  • controlplane/src/core/util.test.ts: 6 new cases for isValidGrpcSubgraphRoutingURL covering http/https acceptance, case-insensitivity on the scheme, malformed input, delegation to isValidGrpcNamingScheme for 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 for GRPC_SERVICE; flip them to assert acceptance, and rename the test cases accordingly. The companion "valid gRPC naming scheme" tests are unchanged.

Backward compatibility

  • gRPC name resolver URLs continue to be accepted exactly as before.
  • Previously-rejected http(s) URLs are now accepted. This is a relaxation with no breaking effect on existing graphs.

Testing

  • controlplane/src/core/util.test.ts extends isValidGrpcNamingScheme coverage with parallel cases for isValidGrpcSubgraphRoutingURL.
  • controlplane/test/subgraph/{create,update,publish}-subgraph.test.ts integration coverage flipped to acceptance.

Checklist

  • I have discussed my proposed changes in an issue and have received approval to proceed.
  • I have followed the coding standards of the project.
  • Tests or benchmarks have been added or updated.
  • Documentation has been updated on https://github.com/wundergraph/docs-website — covered by the matching router PR that documents grpc_protocol in docs-website/router/configuration.mdx; this control-plane change has no user-facing surface beyond an error-message wording update.
  • I have read the Contributors Guide.

Open Source AI Manifesto

This project follows the principles of the Open Source AI Manifesto. Please ensure your contribution aligns with its principles.

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.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 8, 2026

Review Change Stack

Walkthrough

This 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.

Changes

ConnectRPC Routing URL Support

Layer / File(s) Summary
Core URL Validation Utility
controlplane/src/core/util.ts
Adds isValidGrpcSubgraphRoutingURL function that accepts HTTP/HTTPS URLs or gRPC naming schemes by trimming input, validating HTTP(S) URLs via new URL(), and falling back to isValidGrpcNamingScheme for non-HTTP schemes.
Utility Function Tests
controlplane/src/core/util.test.ts
Imports new validator and adds test cases covering valid HTTP/HTTPS URLs with paths, case-insensitive schemes, malformed URL rejection, gRPC scheme fallback, and empty input rejection.
Service Implementation Updates
controlplane/src/core/bufservices/subgraph/createFederatedSubgraph.ts, publishFederatedSubgraph.ts, updateSubgraph.ts
Each service updates imports and GRPC_SERVICE routing URL validation to call isValidGrpcSubgraphRoutingURL instead of isValidGrpcNamingScheme, with error messages updated to describe both HTTP(S) and gRPC naming scheme acceptance.
Service Test Updates
controlplane/test/subgraph/create-subgraph.test.ts, publish-subgraph.test.ts, update-subgraph.test.ts
Updates test expectations to verify HTTP and HTTPS routing URLs now return EnumStatusCode.OK instead of validation errors, aligning test coverage with the new ConnectRPC routing URL acceptance behavior.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 40.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and concisely summarizes the main change: enabling HTTP(S) URL support for GRPC_SERVICE subgraph routing URLs in the control plane, with ConnectRPC support being the core motivation.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ 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.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@fengyuwusong fengyuwusong marked this pull request as ready for review May 9, 2026 04:20
Copy link
Copy Markdown

@claude claude Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant