Skip to content

feat: migrate to Connect-RPC; new wire path /applogger.v2.AppLoggerService/#78

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

feat: migrate to Connect-RPC; new wire path /applogger.v2.AppLoggerService/#78
rustatian merged 4 commits into
masterfrom
migrate-connect-rpc

Conversation

@rustatian
Copy link
Copy Markdown
Member

@rustatian rustatian commented May 10, 2026

Summary

Switches the app-logger plugin's RPC layer from net/rpc + goridge codec to Connect-RPC over HTTP/2. Plugin.RPC() now returns the generated apploggerV2connect.NewAppLoggerServiceHandler mounted at /applogger.v2.AppLoggerService/ on the rpc plugin's HTTP/2 mux.

The 10 wire methods are reshaped to the Connect handler interface (Error, Info, Warning, Debug, Log + their *WithContext variants). Primitive-string variants take the domain-specific LogMessage proto ({ string message = 1; }); the *WithContext variants keep LogEntry. Log/LogWithContext wrap io.WriteString failures with connect.NewError(connect.CodeInternal, err).

rpc_test.go: in-package unit tests rewritten to call methods through the Connect signatures.

tests/app_logger_test.go: rewritten as a Go-side integration test that boots rpc + applogger + config + mock logger, then drives log calls via an h2c Connect client. Drops the previously required server + http plugins and the PHP worker — those had no role in app-logger's RPC flow and only existed because the old goridge wire was driven from PHP.

Configs (.rr-appl*.yaml): drop server/http blocks; keep rpc.listen + logs.

Deps:

  • api-go/v6 v6.0.0-beta.4 → v6.0.0-beta.5
  • goridge/v4 v4.0.0-beta.1 → v4.0.0-beta.2
  • rpc/v6 v6.0.0-beta.3 → v6.0.0-beta.4
  • + connectrpc.com/connect, + golang.org/x/net (h2c transport for tests)

The PHP test files under tests/php_test_files/ are no longer referenced by any test config but remain in the tree as a template for the future PHP-side migration.

Breaking changes

  • Wire protocol changes from goridge codec to Connect/gRPC over HTTP/2. Downstream Go consumers must use apploggerV2connect.NewAppLoggerServiceClient (or any gRPC client). PHP migrates separately on its own timeline.
  • Primitive-string methods (Error/Info/Warning/Debug/Log) take LogMessage{Message: ...} instead of a bare string.

Summary by CodeRabbit

Release Notes

  • Refactor

    • Migrated RPC logging service to ConnectRPC protocol. All logging methods now use updated signatures with context and structured request/response handling.
  • Tests

    • Updated integration tests to validate logging operations over the ConnectRPC interface.
  • Chores

    • Updated module dependencies for ConnectRPC support.

Review Change Stack

…rvice/

Switches the app-logger plugin's RPC layer from net/rpc + goridge codec
to Connect-RPC over HTTP/2. Plugin.RPC() now returns the generated
apploggerV2connect.NewAppLoggerServiceHandler mounted at
/applogger.v2.AppLoggerService/ on the rpc plugin's HTTP/2 mux.

The 10 wire methods are reshaped to the Connect handler interface
(Error, Info, Warning, Debug, Log + their *WithContext variants).
Primitive-string variants take the domain-specific LogMessage proto
({string message = 1;}); the *WithContext variants keep LogEntry.
Log/LogWithContext wrap io.WriteString failures with
connect.NewError(connect.CodeInternal, err).

rpc_test.go: in-package unit tests rewritten to call methods through
the Connect signatures.

tests/app_logger_test.go: rewritten as a Go-side integration test that
boots rpc + applogger + config + mock logger, then drives log calls via
an h2c Connect client. Drops the previously required server + http
plugins and the PHP worker — those had no role in app-logger's RPC flow
and only existed because the old goridge wire was driven from PHP.

Configs (.rr-appl*.yaml): drop server/http blocks; keep rpc.listen + logs.

Deps:
- api-go/v6 v6.0.0-beta.4 -> v6.0.0-beta.5
- goridge/v4 v4.0.0-beta.1 -> v4.0.0-beta.2
- rpc/v6 v6.0.0-beta.3 -> v6.0.0-beta.4
- + connectrpc.com/connect, + golang.org/x/net (h2c transport)

Breaking changes:
- Wire protocol changes from goridge codec to Connect/gRPC over HTTP/2.
  Downstream Go consumers must use apploggerV2connect.NewAppLoggerServiceClient.
  PHP migrates separately on its own timeline.
- Primitive-string methods take LogMessage{Message: ...} instead of a
  bare string.

The PHP test files under tests/php_test_files/ are no longer referenced
by any test config but remain in the tree as a template for the future
PHP-side migration.
Copilot AI review requested due to automatic review settings May 10, 2026 14:11
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 10, 2026

Warning

Rate limit exceeded

@rustatian has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 21 minutes and 2 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: 39d6ab6a-ef80-4ece-ae5f-45163d552e2f

📥 Commits

Reviewing files that changed from the base of the PR and between 055b0b9 and a054f11.

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

Walkthrough

This PR migrates the app-logger plugin from legacy RPC handlers to ConnectRPC-compatible handlers. The Plugin.RPC() method now returns an HTTP handler instead of a raw RPC object. All RPC methods are refactored to accept context.Context and connect.Request types. Configurations and tests are updated to use RPC listeners and h2c Connect clients.

Changes

ConnectRPC Handler & HTTP Handler Migration

Layer / File(s) Summary
Dependency Updates
go.mod, tests/go.mod
api-go/v6 bumped to beta.5; ConnectRPC packages (connectrpc.com/connect, connectrpc.com/grpcreflect) and related github.com/roadrunner-server/* modules added to indirect dependencies.
RPC Handler Refactor
rpc.go
All logging methods (Error, Info, Warning, Debug, Log, and WithContext variants) converted from legacy signatures to ConnectRPC handlers. Methods now accept context.Context and `connect.Request[LogMessage
Plugin HTTP Handler Integration
plugin.go
Imports updated for net/http and apploggerV2connect. Plugin.RPC() signature changes from returning any to (string, http.Handler), delegating handler creation to apploggerV2connect.NewAppLoggerServiceHandler(&RPC{log: p.log}).
Configuration Migration
tests/configs/.rr-appl.yaml, tests/configs/.rr-appl-context.yaml
HTTP server configuration and listener pool settings removed. RPC listener added at tcp://127.0.0.1:6002. Logs configuration (mode: development, level: debug) preserved.
Unit Test Updates
rpc_test.go
Tests refactored to pass t.Context() and wrap payloads in connect.NewRequest(). All RPC method calls updated to new signatures; assertions adapted for connect.Response return values. connectrpc.com/connect import added.
Integration Test Refactor
tests/app_logger_test.go
New newAppLoggerClient helper constructs an h2c-capable HTTP/2 Connect client. Container wiring simplified to register only rpc.Plugin, applogger.Plugin, and config plugin. Test logic refactored to call RPC methods via Connect client, assert log output, and validate context field propagation via FilterAttr.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • roadrunner-server/app-logger#70: Prior migration to applogger v2 types and formatting—this PR builds on that foundation by converting RPC handlers to ConnectRPC style and updating plugin integration.

Suggested labels

enhancement

Poem

🐰 RPC calls now flow through Connect's door,
HTTP handlers wired like never before.
Context and Protobuf dance hand in hand,
App-logger stands tall with ConnectRPC grand! 🚀

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is comprehensive and covers changes, breaking changes, and dependencies, but the author-provided description section does not follow the repository's template structure. Follow the repository template: add explicit 'Reason for This PR' section with issue reference, clearly separate 'Description of Changes', include 'License Acceptance', and complete the 'PR Checklist' items.
Docstring Coverage ⚠️ Warning Docstring coverage is 12.50% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: migrating the app-logger plugin's RPC layer 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.

✏️ 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 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 app-logger plugin’s RPC surface from the legacy net/rpc + goridge codec to Connect-RPC handlers mounted under the generated service path (/applogger.v2.AppLoggerService/), and updates unit/integration tests plus test configs to exercise the new HTTP/2 (h2c) transport.

Changes:

  • Replace net/rpc-style RPC methods with Connect-RPC handler method signatures and Connect error mapping for Log/LogWithContext.
  • Update plugin RPC exposure to return the generated Connect handler (pattern + http.Handler).
  • Rewrite tests/configs to use an h2c Connect client and remove now-unneeded server/http config blocks.

Reviewed changes

Copilot reviewed 9 out of 11 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
go.mod Bumps api-go to v6.0.0-beta.5 and updates indirect deps for the new RPC stack.
go.sum Updates root module sums due to dependency changes.
go.work.sum Updates workspace sums for new/changed dependencies.
plugin.go Changes Plugin.RPC() to expose the generated Connect handler.
rpc.go Converts RPC methods to Connect request/response handlers; wraps stderr write failures as Connect internal errors.
rpc_test.go Updates unit tests to call Connect-style RPC methods.
tests/app_logger_test.go Reworks integration tests to boot plugins and issue log calls via an h2c Connect client.
tests/configs/.rr-appl.yaml Removes server/http blocks; keeps rpc.listen and logging config.
tests/configs/.rr-appl-context.yaml Same config simplification for context-logging test case.
tests/go.mod Updates test module deps to include Connect + newer RR modules.
tests/go.sum Updates test module sums for the new client-side dependencies.

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

Comment thread go.mod
Comment thread tests/go.mod Outdated
Comment thread tests/go.mod Outdated
Comment thread rpc.go Outdated
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: 3

🤖 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`:
- Around line 7-10: rpc.go imports connectrpc.com/connect but go.mod doesn't
explicitly require it; add an explicit require entry for connectrpc.com/connect
in the require block of go.mod (matching the version currently used by your
build or CI) so the module graph is pinned and -mod=readonly CI won't fail;
locate rpc.go to confirm the import and update the require block in go.mod to
include connectrpc.com/connect at the appropriate version.

In `@tests/app_logger_test.go`:
- Around line 94-109: Replace the fixed time.Sleep calls around server startup
and after logging with readiness/eventual checks: instead of
time.Sleep(time.Second) before creating newAppLoggerClient, poll/connect with
require.Eventually (or a retry loop) until newAppLoggerClient("127.0.0.1:6001")
succeeds or the server port is reachable; after sending logs via
client.Debug/Info/Warning/Error, replace the trailing time.Sleep with
require.Eventually that asserts the expected log side-effect (e.g., a function
that verifies logs were emitted, a mock/collector received entries, or the
server health/last-received timestamp) and use t.Context() for deadlines; ensure
stopCh send remains but only after the eventual assertions pass.
- Around line 34-41: The http.Client instance "httpc" used to create the RPC
client (passed to NewAppLoggerServiceClient) has no timeout and can hang; set a
request timeout on httpc (e.g., httpc.Timeout = <reasonable duration>) or ensure
calls use a context with deadline before constructing the client so RPC calls
cannot block indefinitely; update the httpc initialization near
DialTLSContext/AllowHTTP to include the timeout and adjust any tests to respect
that deadline.
🪄 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: f8fe3bb4-5555-4e51-8792-f202544c0cf5

📥 Commits

Reviewing files that changed from the base of the PR and between 1fc20d6 and 055b0b9.

⛔ Files ignored due to path filters (3)
  • go.sum is excluded by !**/*.sum
  • go.work.sum is excluded by !**/*.sum
  • tests/go.sum is excluded by !**/*.sum
📒 Files selected for processing (8)
  • go.mod
  • plugin.go
  • rpc.go
  • rpc_test.go
  • tests/app_logger_test.go
  • tests/configs/.rr-appl-context.yaml
  • tests/configs/.rr-appl.yaml
  • tests/go.mod
💤 Files with no reviewable changes (1)
  • tests/configs/.rr-appl-context.yaml

Comment thread go.mod
Comment thread tests/app_logger_test.go Outdated
Comment thread tests/app_logger_test.go Outdated
Code review (pr-review-toolkit + bot-style triage):
- newAppLoggerClient: add Timeout to http.Client to fail fast on
  unreachable rpc plugin endpoint instead of blocking until the test
  global deadline.
- Replace fragile time.Sleep(time.Second) for rpc readiness with a
  waitForRPC helper that polls via net.Dialer.DialContext + retries
  via require.Eventually.
- go mod tidy on root + tests: promotes connectrpc.com/connect to a
  direct require, drops the no-longer-used http/v6 and server/v6
  direct deps from tests/go.mod.

Trim PSR-3 comment in rpc.go to describe the implemented subset
(error/info/warning/debug/log + *WithContext) rather than restating
the full PSR-3 interface; producers can map emergency/alert/critical/
notice onto the implemented levels as needed.

Simplify:
- Unexport the RPC handler type — rename to `service` since it's
  constructed only inside the package and passed to the generated
  AppLoggerServiceHandler factory. No external consumer references it.
- Extract the duplicated container-watcher goroutine (was identical in
  TestAppLogger and TestAppLoggerWithContext) into a serveContainer
  helper that returns a stop function. Cuts ~30 lines.
@rustatian rustatian self-assigned this May 10, 2026
@rustatian rustatian added the enhancement New feature or request label May 10, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 10, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 0.00%. Comparing base (1fc20d6) to head (3673ad0).

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

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

rustatian added 2 commits May 10, 2026 16:44
Inject the stderr writer onto the service struct (defaulted to os.Stderr
in Plugin.RPC) so the io.WriteString failure branch in Log and
LogWithContext is reachable from tests. Add TestRPCLogWriteFailureMaps-
ToCodeInternal that injects an errWriter and asserts the response is
nil, the returned error wraps via connect.CodeInternal, and
errors.Is reaches the underlying cause.

Drop the captureStderr helper that redirected os.Stderr globally —
no longer needed now that TestRPCLog and the new TestRPCLogWithContext
inject their own bytes.Buffer.
Use the domain-aware alias (apploggerV2) for the api-go applogger/v2
import instead of the bare v2 alias. v2 is ambiguous when multiple
proto domains are imported in a single file and hides which domain
each type belongs to. apploggerV2 matches the canonical name declared
by the proto's go_package option.
@rustatian rustatian merged commit 7e26a7a into master May 10, 2026
5 checks passed
@rustatian rustatian deleted the migrate-connect-rpc branch May 10, 2026 14:51
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