Skip to content

feat: migrate RPC surface to Connect-RPC#111

Merged
rustatian merged 3 commits into
masterfrom
feature/connect-rpc-migration
May 12, 2026
Merged

feat: migrate RPC surface to Connect-RPC#111
rustatian merged 3 commits into
masterfrom
feature/connect-rpc-migration

Conversation

@rustatian
Copy link
Copy Markdown
Member

@rustatian rustatian commented May 12, 2026

Summary

Migrates the tcp plugin's RPC surface from net/rpc + goridge codec to Connect-RPC over HTTP/2 (h2c) using tcpV1connect.NewTCPServiceHandler from api-go v6.0.0-beta.9.

The single RPC method Close(uuid) is now reachable via three wire protocols on the same rpc.listen port:

  • Connect-RPC (default for Go clients via tcpV1connect.NewTCPServiceClient)
  • plain HTTP/1.1 + protojson (PHP / curl)
  • plain gRPC (PHP gRPC extension)

The existing closeConn helper in tcp_plugin_test.go was rewritten to use the Connect client. A new tests/tcp_api_test.go covers all three wire protocols, with tests/configs/.rr-tcp-api.yaml providing a minimal container config.

Breaking changes

Wire protocol change: callers using net/rpc + goridge codec (client.Call("tcp.Close", uuid, &ret)) must switch to a Connect / HTTP / gRPC client targeting the same rpc.listen port. The path /tcp.v1.TCPService/Close accepts plain JSON over POST for clients without a Connect SDK.

Dep bumps:

  • github.com/roadrunner-server/api-go/v6v6.0.0-beta.9
  • github.com/roadrunner-server/goridge/v4v4.0.0-beta.2 (note: pkg/rpc is gone in this release)
  • github.com/roadrunner-server/rpc/v6 (tests) → v6.0.0-beta.4

Summary by CodeRabbit

  • New Features

    • TCP service now exposes HTTP-based handlers compatible with Connect-style protocol, HTTP/1.1, and gRPC for remote procedure calls
  • Tests

    • Added comprehensive integration test suite validating TCP API Close operation across Connect, HTTP, and gRPC protocols
  • Chores

    • Updated module dependencies to support ConnectRPC protocol

Review Change Stack

- plugin.go RPC() now returns (string, http.Handler) using the generated
  tcpV1connect.NewTCPServiceHandler from api-go v6.0.0-beta.9
- rpc.go reshaped to the Connect handler interface; the single Close method
  takes tcpV1.CloseRequest and returns tcpV1.Response
- tests/tcp_plugin_test.go closeConn helper switched from goridge codec to
  the Connect client over h2c
- new tests/tcp_api_test.go adds 3-protocol coverage (Connect, plain HTTP +
  protojson, plain gRPC) against the same handler
- new tests/configs/.rr-tcp-api.yaml minimal config for the new tests
- bump api-go to v6.0.0-beta.9, goridge to v4.0.0-beta.2, rpc/v6 to v6.0.0-beta.4
Copilot AI review requested due to automatic review settings May 12, 2026 16:07
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 12, 2026

Warning

Rate limit exceeded

@rustatian has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 55 minutes and 3 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 3242cfde-0ed1-48a2-ba52-efa0e6311b6d

📥 Commits

Reviewing files that changed from the base of the PR and between 0de115d and cc708f4.

⛔ Files ignored due to path filters (2)
  • go.sum is excluded by !**/*.sum
  • tests/go.sum is excluded by !**/*.sum
📒 Files selected for processing (2)
  • go.mod
  • tests/go.mod
📝 Walkthrough

Walkthrough

This PR migrates the TCP plugin's RPC interface from a goridge-based net/rpc model to Connect-RPC HTTP handlers. The plugin's RPC() method now returns an HTTP handler, the Close handler is refactored to accept Connect-RPC requests, dependencies are updated to include Connect libraries, and comprehensive integration tests validate the endpoint across Connect, HTTP, and gRPC protocols.

Changes

Connect-RPC Handler Migration

Layer / File(s) Summary
Plugin RPC handler signature and Connect handler factory
plugin.go
Plugin.RPC() returns (string, http.Handler) and constructs a Connect handler via tcpV1connect.NewTCPServiceHandler. Imports for net/http and tcpV1connect are added.
Close handler implementation for Connect-RPC
rpc.go
rpc.Close is refactored from a traditional RPC signature to a Connect-RPC handler accepting context and *connect.Request[tcpV1.CloseRequest], returning *connect.Response[tcpV1.Response] with UUID extraction and error mapping.
Dependency updates for Connect-RPC support
go.mod, tests/go.mod
Root and test module dependencies are updated to add Connect-RPC, gRPC, and protobuf libraries. The goridge module is bumped to v4.0.0-beta.2.
Integration test suite and TCP API test configuration
tests/configs/.rr-tcp-api.yaml, tests/tcp_api_test.go
New integration tests validate the tcp.v1.TCPService/Close endpoint across Connect, HTTP/1.1, and gRPC protocols. A test helper manages plugin lifecycle and container orchestration. YAML config defines TCP server, RPC listener, worker pool, and logging settings.
Update existing test helper to use Connect client
tests/tcp_plugin_test.go
The closeConn helper is rewritten to use tcpV1connect.NewTCPServiceClient over an HTTP/2-capable client instead of goridge net/rpc, with TLS dialing support.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 From RPC calls through network strands,
Connect-RPC now lends its hands!
HTTP handlers, gRPC's might,
Three protocols—tested just right! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat: migrate RPC surface to Connect-RPC' accurately and concisely describes the primary change—migrating from net/rpc with goridge to Connect-RPC.
Description check ✅ Passed The PR description is comprehensive and includes all required template sections: reasoning (migration rationale), detailed description of changes, breaking changes documentation, and dependency bumps. However, the PR checklist section is incomplete.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/connect-rpc-migration

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 tcp plugin’s RPC API from the legacy net/rpc + goridge codec to a Connect-RPC HTTP/2 (h2c) handler generated from api-go/v6, and updates/adds tests to exercise the new wire surface (Connect, plain JSON over HTTP/1.1, and gRPC).

Changes:

  • Switch tcp plugin RPC registration to return a Connect-RPC http.Handler (generated handler) and update the RPC implementation to Connect request/response types.
  • Update existing tcp plugin tests to call Close via a Connect client instead of net/rpc.
  • Add a new integration test + minimal RR config to validate Connect, plain HTTP+JSON, and gRPC access on the same rpc.listen port.

Reviewed changes

Copilot reviewed 7 out of 9 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
rpc.go Replaces legacy RPC method signature with Connect-RPC request/response types and error mapping.
plugin.go Changes RPC() to return a Connect-RPC handler (string + http.Handler) for registration with the RPC plugin.
tests/tcp_plugin_test.go Rewrites closeConn helper to use a Connect client over h2c.
tests/tcp_api_test.go Adds protocol-surface tests for Connect, HTTP/1.1 JSON, and gRPC.
tests/configs/.rr-tcp-api.yaml Adds minimal RR config used by the new API-surface test.
tests/go.mod / tests/go.sum Adds/bump test-module dependencies needed for Connect + gRPC clients.
go.mod / go.sum Bumps goridge/v4 dependency.

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

Comment thread plugin.go
Comment thread tests/tcp_api_test.go
Comment thread tests/tcp_api_test.go
Comment thread tests/tcp_api_test.go
Comment thread tests/tcp_api_test.go
- drop TestTCPConnectAPI doc (what-narration; name+imports already say it)
- soften TestTCPHTTPApi doc to "non-Connect HTTP client" (Guzzle/curl
  was an unverified-in-repo specifier)
@rustatian rustatian self-assigned this May 12, 2026
@rustatian rustatian added the enhancement New feature or request label May 12, 2026
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@go.mod`:
- Line 10: The dependency entry for module
github.com/roadrunner-server/goridge/v4 is using a non-existent tag
v4.0.0-beta.2; update that require line to the valid release v4.0.0-beta.1 so
the go.mod references the existing version (ensure you run `go get`/`go mod
tidy` afterwards to update go.sum and vendor if needed).

In `@tests/tcp_api_test.go`:
- Around line 59-65: The test currently calls wg.Go(...) which doesn't exist on
sync.WaitGroup; replace that with wg.Add(1) before spawning a goroutine and use
go func() { defer wg.Done(); ... }() to run the select body; locate the block
around wg, ch and stop in tests/tcp_api_test.go (the anonymous goroutine using
wg.Go) and change it to increment the wait group with wg.Add(1), start a plain
go func(), and ensure defer wg.Done() is the first line inside the goroutine so
the wait group is decremented when the goroutine exits.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e361ec3e-0a1a-47f0-96b2-ed380d7fac8f

📥 Commits

Reviewing files that changed from the base of the PR and between afd8aa3 and 0de115d.

⛔ Files ignored due to path filters (2)
  • go.sum is excluded by !**/*.sum
  • tests/go.sum is excluded by !**/*.sum
📒 Files selected for processing (7)
  • go.mod
  • plugin.go
  • rpc.go
  • tests/configs/.rr-tcp-api.yaml
  • tests/go.mod
  • tests/tcp_api_test.go
  • tests/tcp_plugin_test.go

Comment thread go.mod
Comment thread tests/tcp_api_test.go
@codecov
Copy link
Copy Markdown

codecov Bot commented May 12, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 0.00%. Comparing base (afd8aa3) to head (0de115d).

Additional details and impacted files
@@      Coverage Diff      @@
##   master   #111   +/-   ##
=============================
=============================

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Catches drift in transitive deps + server/v6 beta.5 → beta.6 in tests/.
@rustatian rustatian merged commit 3f1c037 into master May 12, 2026
7 checks passed
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