Skip to content

feat: migrate to Connect-RPC; new wire path /status.v2.StatusService/#122

Merged
rustatian merged 2 commits into
masterfrom
migrate-connect-rpc
May 10, 2026
Merged

feat: migrate to Connect-RPC; new wire path /status.v2.StatusService/#122
rustatian merged 2 commits into
masterfrom
migrate-connect-rpc

Conversation

@rustatian
Copy link
Copy Markdown
Member

@rustatian rustatian commented May 10, 2026

Summary

Switches the status plugin's RPC layer from net/rpc + goridge codec to Connect-RPC over HTTP/2. Plugin.RPC() now returns the generated statusV2connect.NewStatusServiceHandler mounted at /status.v2.StatusService/ on the rpc plugin's HTTP/2 mux.

The 2 wire methods (Status, Ready) reshape from net/rpc's (req, *resp) error to (ctx, *connect.Request[StatusRequest]) (*connect.Response[StatusResponse], error). Errors map to Connect codes via a small connectCodeFor helper: a missing plugin (sentinel errPluginNotFound) becomes CodeNotFound; any other failure from Checker.Status / Readiness.Ready is CodeInternal.

tests/plugin_test.go: replace 4 goridge codec client.Call sites with typed Connect calls via a new newStatusClient h2c helper. Drop net/rpc and goridgeRpc imports. Two test functions (checkRPCReadiness, checkRPCStatus) and two subtests (StatusNonExistent, ReadyNonExistent) swap to the Connect client. Subtests now assert connect.CodeNotFound on the missing-plugin path instead of string-matching err.Error(). TestRPCNonExistentPlugin drops http+server plugins from its Endure stack since the "no such plugin" path doesn't need any Checker/Readiness providers (also makes the test PHP-independent).

Drive-by lint cleanups in tests/plugin_test.go (pre-existing, surfaced by the bulk dep bump):

  • 6x http.NewRequesthttp.NewRequestWithContext(t.Context(), ...)
  • Drop a redundant if rsp != nil guard after require.NotNil(t, rsp)

Renames the api-go import alias from statusv2 to statusV2 to match the proto's go_package canonical name.

Deps:

  • api-go/v6 v6.0.0-beta.4 → v6.0.0-beta.5 (root + tests)
  • goridge/v4 v4.0.0-beta.1 → v4.0.0-beta.2 (tests)
  • rpc/v6 v6.0.0-beta.3 → v6.0.0-beta.4 (tests)
  • http/v6 v6.0.0-beta.6 → v6.0.0-beta.7 (tests; carries the api-go beta.5 bytes→string header-value fix from fix(handler): adapt to api-go beta.5 HttpHeaderValue.values string type http#245)
  • jobs/v6 v6.0.0-beta.6 → v6.0.0-beta.7, server/v6 → beta.6, memory/v6 → beta.4 (tests; via go get -u all)
  • + connectrpc.com/connect, + golang.org/x/net (tests; h2c transport)

Breaking changes

  • Wire protocol changes from goridge codec (raw TCP frames at 127.0.0.1:6005) to Connect/gRPC over HTTP/2 at /status.v2.StatusService/<Method>. Downstream Go consumers must use statusV2connect.NewStatusServiceClient. PHP migrates separately.
  • "No such plugin" lookups now return connect.CodeNotFound instead of a generic error; clients that string-match the old error text should switch to checking the wire code.

Switches the status plugin's RPC layer from net/rpc + goridge codec to
Connect-RPC over HTTP/2. Plugin.RPC() now returns the generated
statusV2connect.NewStatusServiceHandler mounted at
/status.v2.StatusService/ on the rpc plugin's HTTP/2 mux.

The 2 wire methods (Status, Ready) reshape from net/rpc's (req, *resp)
error to (ctx, *connect.Request[StatusRequest]) (*connect.Response[
StatusResponse], error). Both return CodeInternal on plugin lookup or
inner check failures, with errors.E(op, err) wrapping for traceability.

tests/plugin_test.go: replace 4 goridge codec client.Call sites with
typed Connect calls via a new newStatusClient h2c helper. Drop net/rpc
and goridgeRpc imports. Two test functions (checkRPCReadiness,
checkRPCStatus) and two subtests (StatusNonExistent, ReadyNonExistent)
swap to the Connect client.

Drive-by lint cleanups in tests/plugin_test.go (pre-existing, surfaced
by the bulk dep bump):
- 3x http.NewRequest → http.NewRequestWithContext(t.Context(), ...)
- Drop a redundant `if rsp != nil` guard after require.NotNil(t, rsp)

Deps:
- api-go/v6 v6.0.0-beta.4 -> v6.0.0-beta.5 (root + tests)
- goridge/v4 v4.0.0-beta.1 -> v4.0.0-beta.2 (tests)
- rpc/v6 v6.0.0-beta.3 -> v6.0.0-beta.4 (tests)
- http/v6 v6.0.0-beta.6 -> v6.0.0-beta.7 (tests; carries the api-go
  beta.5 bytes->string header-value fix)
- jobs/v6 v6.0.0-beta.6 -> v6.0.0-beta.7, server/v6 -> beta.6,
  memory/v6 -> beta.4 (tests; via go get -u all)
- + connectrpc.com/connect, + golang.org/x/net (tests; h2c transport)

Renames the api-go import alias from statusv2 to statusV2 to match the
proto's go_package canonical name.

Breaking changes:
- Wire protocol changes from goridge codec (raw TCP frames at
  127.0.0.1:6005) to Connect/gRPC over HTTP/2 at
  /status.v2.StatusService/<Method>. Downstream Go consumers must use
  statusV2connect.NewStatusServiceClient. PHP migrates separately.
Copilot AI review requested due to automatic review settings May 10, 2026 15:11
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 10, 2026

📝 Walkthrough

Walkthrough

This PR migrates the RoadRunner status plugin from legacy goridge net/rpc to Connect RPC. Dependencies are updated to add Connect support; handler signatures in rpc.go now accept context.Context and typed connect.Request parameters, returning typed connect.Response values; the Plugin.RPC() method is rewired to return an HTTP handler; and tests are refactored to use the new Connect client over h2c HTTP/2.

Changes

Connect RPC Migration

Layer / File(s) Summary
Dependency Updates
go.mod, tests/go.mod
Added connectrpc.com/connect v1.19.2 and transitive dependencies; bumped github.com/roadrunner-server/api-go/v6 to v6.0.0-beta.5; removed go.uber.org/zap; promoted golang.org/x/net to direct test dependency.
RPC Handler Signatures
rpc.go
Status and Ready methods now accept context.Context and connect.Request[statusV2.StatusRequest], returning connect.Response[statusV2.StatusResponse] with error wrapping via connect.NewError; response construction moved inside handlers.
Plugin HTTP Handler Registration
plugin.go
Plugin.RPC() now returns (string, http.Handler) tuple via statusV2connect.NewStatusServiceHandler instead of generic any object; wires existing rpc service and logger into the handler constructor.
Test Client Infrastructure
tests/plugin_test.go
Added newStatusClient(t, address) helper constructing http2.Transport with AllowHTTP: true (h2c) and returning statusV2connect.StatusServiceClient; updated test imports for Connect RPC and removed legacy goridge/net/rpc.
RPC Test Assertions
tests/plugin_test.go
Refactored TestRPCNonExistentPlugin, checkRPCReadiness, and checkRPCStatus to use Connect client methods (client.Status, client.Ready) and validate response codes via resp.Msg.GetCode().
HTTP Request Context Tightening
tests/plugin_test.go
Updated checkJobsReadiness, checkHTTPStatus, checkHTTPStatusAll to construct requests with http.NewRequestWithContext using t.Context(); simplified TestShutdown503 response-body close logic.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 Hopping from goridge to Connect,
HTTP/2 clear text—no TLS to inspect!
Handler signatures typed and bright,
Context flows through every site,
Tests now h2c, the migration's tight!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 10.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 clearly and specifically summarizes the main change: migrating to Connect-RPC with the new wire path.
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 The PR description provides a comprehensive summary of changes, including the migration rationale, technical details, testing updates, dependency changes, and breaking changes.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch migrate-connect-rpc

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.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Migrates the status plugin’s RPC surface from net/rpc (Goridge codec) to Connect-RPC handlers mounted on the RPC plugin’s HTTP/2 mux under /status.v2.StatusService/, and updates tests/dependencies to use the generated Connect client.

Changes:

  • Replace net/rpc server methods with Connect-RPC method signatures and error returns in rpc.go.
  • Update Plugin.RPC() to return the Connect handler path + http.Handler instead of a raw service instance.
  • Refactor integration tests to use an h2c-enabled Connect client helper and bump related Go module dependencies.

Reviewed changes

Copilot reviewed 6 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
rpc.go Implements Connect-RPC Status/Ready methods and returns Connect responses/errors.
plugin.go Updates RPC() to return Connect handler path + handler for mounting on HTTP/2 mux.
tests/plugin_test.go Adds newStatusClient and migrates RPC test calls to typed Connect client; minor HTTP request cleanups.
go.mod Adds connectrpc.com/connect and updates module requirements to match the new RPC stack.
go.sum Records new/updated dependency checksums for root module.
tests/go.mod Adds Connect + x/net (http2) deps and bumps RoadRunner-related test deps.
tests/go.sum Records new/updated dependency checksums for the tests module.
go.work.sum Workspace checksum updates from dependency resolution.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread rpc.go Outdated
Comment thread rpc.go Outdated
Code review (pr-review-toolkit):
- rpc.go: drop dead `resp.Message = err.Error()` writes — Connect
  discards the response on any non-nil error, so the assignments were
  never observed by callers. Hoist resp allocation past the err guard
  so the success path is the only allocator.
- plugin.go: introduce errPluginNotFound sentinel and an
  errors.Is-based mapping helper (connectCodeFor) so the rpc handler
  returns connect.CodeNotFound for missing plugins instead of
  CodeInternal. CodeInternal is still the default for any other error.
- plugin.go: rewrite stale doc on the private status()/ready() helpers
  (the prior wording was a copy-paste leftover from the goridge era
  describing a public method that no longer exists).
- tests/plugin_test.go: drive-by lint cleanups — 3 more
  http.NewRequest -> NewRequestWithContext(t.Context(), ...) sites
  surfaced after fixing the first batch.
- tests/plugin_test.go: assert connect.CodeNotFound on the
  StatusNonExistent / ReadyNonExistent subtests instead of string-
  matching err.Error() — the typed sentinel makes the wire-code check
  more robust.
- tests/plugin_test.go: TestRPCNonExistentPlugin no longer registers
  http+server plugins. The test only exercises the "no such plugin"
  path of the status RPC handler, doesn't need any Checker/Readiness
  providers, and the previous setup pulled in a PHP worker dependency
  that broke the test in PHP-less environments.

Simplify:
- Tighten doc comments on errPluginNotFound and connectCodeFor (cut
  WHAT, keep WHY).
- Drop the now-unused errors.Op constants in status() and ready()
  after dropping the errors.E wrap on the not-found path
  (the wrap was hiding the sentinel from errors.Is — *errors.Error
  has no Unwrap method).
@rustatian rustatian self-assigned this May 10, 2026
@rustatian rustatian added the enhancement New feature or request label May 10, 2026
@rustatian rustatian merged commit 6b6aaab into master May 10, 2026
7 checks passed
@rustatian rustatian deleted the migrate-connect-rpc branch May 10, 2026 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants