fix: back to applogger/v1 DTOs, plain-string log methods - #100
Conversation
There was a problem hiding this comment.
Pull request overview
Reverts the app-logger RPC wire contract back to applogger/v1 DTOs and restores plain-string RPC methods for Error/Warning/Info/Debug/Log, aligning behavior with the v1 proto expectations and the PHP app-logger packages.
Changes:
- Switch RPC DTO imports from
applogger/v2back toapplogger/v1and update related types. - Change RPC log-level methods to accept a plain
stringargument again. - Bump
github.com/roadrunner-server/api-go/v6tov6.0.0-beta.14in both main and tests modules.
Reviewed changes
Copilot reviewed 5 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
go.mod |
Bumps api-go/v6 dependency to v6.0.0-beta.14. |
go.sum |
Updates checksums for the api-go/v6 bump. |
rpc.go |
Reverts RPC method arg types to plain strings and v1 DTOs for context logging. |
rpc_test.go |
Updates unit tests to use v1 DTOs and new RPC method signatures. |
tests/go.mod |
Bumps api-go/v6 in the tests module to v6.0.0-beta.14. |
tests/go.sum |
Updates checksums for the tests module dependency bump. |
tests/app_logger_test.go |
Updates integration tests to call RPC methods with plain string args and v1 DTOs. |
Suppressed comments (6)
rpc.go:36
- This RPC method takes a *bool reply but never writes to it, meaning the wire response will always be false. Set the reply to true on success (and guard against nil for direct calls).
func (r *service) Info(in string, _ *bool) error {
r.log.InfoContext(context.Background(), in)
return nil
rpc.go:46
- The *bool reply is currently ignored, so clients will always decode a false response. Set it to true after the log call (nil-guarded) so the reply reflects success.
func (r *service) Warning(in string, _ *bool) error {
r.log.WarnContext(context.Background(), in)
return nil
rpc.go:56
- The reply parameter is a *bool but is never set, so RPC callers always get false. Consider setting it to true on success (with a nil check for direct calls).
func (r *service) Debug(in string, _ *bool) error {
r.log.DebugContext(context.Background(), in)
return nil
rpc.go:68
Lognow uses a *bool reply but never sets it, so callers always receive false even when the write succeeds. Set the reply to true after a successful write (nil-guarded).
func (r *service) Log(in string, _ *bool) error {
if _, err := io.WriteString(r.stderr, ensureNewline(in)); err != nil {
return fmt.Errorf("write log message to stderr: %w", err)
}
return nil
rpc_test.go:215
- This test invokes
Logwith a nil *bool reply, which doesn't reflect how net/rpc will call the method (non-nil reply). Passing a real reply pointer makes the test closer to production usage and compatible ifLogstarts setting the reply.
func TestRPCLog(t *testing.T) {
var buf bytes.Buffer
s := &service{log: slog.New(slog.DiscardHandler), stderr: &buf}
err := s.Log("hello stderr\n", nil)
require.NoError(t, err)
rpc_test.go:242
- The
Logwrite-failure subtest passes a nil *bool reply. Use a real reply pointer so the call pattern matches net/rpc and remains safe if the implementation sets the reply before returning.
t.Run("Log", func(t *testing.T) {
err := s.Log("x", nil)
require.Error(t, err)
assert.ErrorIs(t, err, want)
})
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #100 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 2 2
Lines 62 62
=========================================
Hits 62 62 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
RPC layer back on applogger/v1; Error/Warning/Info/Debug/Log take a plain string again, matching roadrunner-php/app-logger.
Part of the v1 proto revert (roadrunner-server/api#77, roadrunner-server/api-go#35): wire format back to what roadrunner-api-dto v1.14.1 and the released PHP packages speak. Pins api-go v6.0.0-beta.14. Tests temporarily pin sibling revert branches via pseudo-versions; they will be bumped to the new betas once tagged.