feat: migrate to Connect-RPC; new wire path /status.v2.StatusService/#122
Conversation
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.
📝 WalkthroughWalkthroughThis PR migrates the RoadRunner status plugin from legacy goridge net/rpc to Connect RPC. Dependencies are updated to add Connect support; handler signatures in ChangesConnect RPC Migration
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 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. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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 |
There was a problem hiding this comment.
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/rpcserver methods with Connect-RPC method signatures and error returns inrpc.go. - Update
Plugin.RPC()to return the Connect handler path +http.Handlerinstead 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.
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).
Summary
Switches the status plugin's RPC layer from net/rpc + goridge codec to Connect-RPC over HTTP/2.
Plugin.RPC()now returns the generatedstatusV2connect.NewStatusServiceHandlermounted 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) errorto(ctx, *connect.Request[StatusRequest]) (*connect.Response[StatusResponse], error). Errors map to Connect codes via a smallconnectCodeForhelper: a missing plugin (sentinelerrPluginNotFound) becomesCodeNotFound; any other failure fromChecker.Status/Readiness.ReadyisCodeInternal.tests/plugin_test.go: replace 4 goridge codecclient.Callsites with typed Connect calls via a newnewStatusClienth2c helper. Dropnet/rpcandgoridgeRpcimports. Two test functions (checkRPCReadiness,checkRPCStatus) and two subtests (StatusNonExistent,ReadyNonExistent) swap to the Connect client. Subtests now assertconnect.CodeNotFoundon the missing-plugin path instead of string-matchingerr.Error().TestRPCNonExistentPlugindropshttp+serverplugins 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):http.NewRequest→http.NewRequestWithContext(t.Context(), ...)if rsp != nilguard afterrequire.NotNil(t, rsp)Renames the api-go import alias from
statusv2tostatusV2to match the proto'sgo_packagecanonical 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
127.0.0.1:6005) to Connect/gRPC over HTTP/2 at/status.v2.StatusService/<Method>. Downstream Go consumers must usestatusV2connect.NewStatusServiceClient. PHP migrates separately.connect.CodeNotFoundinstead of a generic error; clients that string-match the old error text should switch to checking the wire code.