Skip to content

feat(rpc): add Connect v2 server error boundary - #27

Merged
toxsick merged 1 commit into
mainfrom
feat/connect-v2-error-redaction
Nov 14, 2026
Merged

toxsick merged 1 commit into
mainfrom
feat/connect-v2-error-redaction

Conversation

@toxsick

@toxsick toxsick commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Add package rpc/connectv2 with NormalizeError and ServerErrorInterceptor for servers built on connectrpc.com/connect/v2. The interceptor wraps the whole server call, so it covers unary and streaming RPCs. Internal, unknown and unclassified errors are redacted. Remote errors from upstream peers now become internal errors. Context errors keep stable codes.

Deprecate the Connect v1 rpc package in favor of rpc/connectv2. It stays available until the next major release. Move the observability correlation test to Connect v2.

Summary

Public and product boundaries

  • Affected packages:
  • Public API impact: none / additive / breaking
  • Consumer proving the need:
  • Why the change is product-neutral:
  • Migration notes:

Verification

  • Focused tests passed
  • make check passed
  • Cancellation, timeout, failure, and concurrency behavior was considered
  • Documentation and examples were updated where required
  • Module and generated files are clean

Commands and evidence:

make check

AI assistance

  • Tools used:
  • What was generated or suggested:
  • Manual review and verification performed:

Summary by CodeRabbit

  • New Features
    • Added Connect v2 server error handling that protects private diagnostics while preserving recognized public errors and their details. Cancellation and deadline errors retain their corresponding classifications.
  • Documentation
    • Added guidance for using Connect v2 error handling, including streaming behavior and configuration.
  • Deprecation
    • Connect v1 error handling is deprecated and scheduled for removal in the next major release. Existing Connect v1 support remains available until then.

Add package rpc/connectv2 with NormalizeError and ServerErrorInterceptor
for servers built on connectrpc.com/connect/v2. The interceptor wraps the
whole server call, so it covers unary and streaming RPCs. Internal, unknown
and unclassified errors are redacted. Remote errors from upstream peers now
become internal errors. Context errors keep stable codes.

Deprecate the Connect v1 rpc package in favor of rpc/connectv2. It stays
available until the next major release. Move the observability correlation
test to Connect v2.
@coderabbitai

coderabbitai Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The pull request adds a Connect v2 server error interceptor and error normalization, updates tests to exercise the boundary, and documents the Connect v1 package as deprecated.

Changes: Connect v2 server error boundary

Layer / File(s) Summary
Error normalization and interceptor
go.mod, rpc/connectv2/errors.go, rpc/connectv2/errors_test.go, rpc/connectv2/README.md
Adds NormalizeError and ServerErrorInterceptor for Connect v2. Tests cover error classification, redaction, unary and streaming HTTP responses, interceptor behavior, and successful RPCs. The README describes the boundary and its stated coverage.
Observability test integration
observability/rpc_test.go
Switches the correlation test to a Connect v2 server and client. The test checks the response error and the correlated safe log record.
Package documentation and deprecation
AGENTS.md, README.md, docs/architecture.md, rpc/README.md, rpc/errors.go
Documents the Connect v1 and v2 package split. Marks rpc as deprecated and states that it is planned for removal in the next major release.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant ConnectV2Client
  participant ConnectV2Server
  participant ServerErrorInterceptor
  participant RPCHandler
  ConnectV2Client->>ConnectV2Server: Send RPC
  ConnectV2Server->>ServerErrorInterceptor: Invoke intercepted handler
  ServerErrorInterceptor->>RPCHandler: Call handler
  RPCHandler-->>ServerErrorInterceptor: Return error
  ServerErrorInterceptor->>ServerErrorInterceptor: NormalizeError
  ServerErrorInterceptor-->>ConnectV2Client: Return normalized error
Loading
Merge Risk: Minimal · up to f0d8c

This adds a Connect v2 server error boundary that redacts internal errors and deprecates the v1 package, with tests and documentation. No actionable merge-blocking risk was found, though the author should confirm that make check passes.

Pre-merge checks: Passed 3 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Description check Warning The description gives a clear summary of the Connect v2 error boundary (NormalizeError, ServerErrorInterceptor), the v1 rpc deprecation, and the moved observability test. The template's Summary placeh… 1. Fill in the Summary section with the concrete consumer problem this solves (for example, servers on connectrpc.com/connect/v2 leaking internal error details).
2. Complete Public and product boundaries: list affected packages (rpc/connect…
Passed Passed checks: 3 passed

Check name Status Explanation
Title check Passed The title names the main change: a new Connect v2 server error boundary in rpc/connectv2. The changeset adds NormalizeError and ServerErrorInterceptor for Connect v2, which matches the title. The titl…
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.
Full details: Title check

Explanation

The title names the main change: a new Connect v2 server error boundary in rpc/connectv2. The changeset adds NormalizeError and ServerErrorInterceptor for Connect v2, which matches the title. The title does not mention the v1 deprecation or the test move, but those are secondary.

Full details: Description check

Explanation

The description gives a clear summary of the Connect v2 error boundary (NormalizeError, ServerErrorInterceptor), the v1 rpc deprecation, and the moved observability test. The template's Summary placeholder comment is left unfilled. The Public and product boundaries section is blank: Affected packages, Public API impact (none/additive/breaking), consumer proving the need, product-neutral rationale, and migration notes are not filled in, even though the PR adds new public functions and deprecates the v1 package. Unchecked items remain for cancellation/timeout/concurrency consideration and documentation updates, though docs were in fact changed. The AI assistance section is empty. The verification checkboxes are marked as passed, but the PR objectives note that the make check result is not reported in the evidence block.

Resolution

  1. Fill in the Summary section with the concrete consumer problem this solves (for example, servers on connectrpc.com/connect/v2 leaking internal error details).
  2. Complete Public and product boundaries: list affected packages (rpc/connectv2, rpc, observability tests), state Public API impact (additive for rpc/connectv2 and the new functions, plus deprecation of rpc), name the consumer that needs it, explain why the change is product-neutral, and give migration notes for moving from rpc to rpc/connectv2.
  3. Confirm the cancellation, timeout, failure, and concurrency item. The PR covers deadline and cancellation mapping, so check it or explain the remaining gaps.
  4. Check the documentation item. The PR updates rpc/README.md, rpc/errors.go, docs/architecture.md, and README.md.
  5. Confirm the module and generated files are clean (go.mod adds connectrpc.com/connect/v2 v2.0.2) and check the box.
  6. Paste the actual make check output in the Commands and evidence block, or state the result.
  7. Complete the AI assistance section: list the tools used, what was generated, and the manual review performed.
Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 9ee03649-2114-4224-acda-e2a2d106a378
Commits

Reviewing files that changed from the base of the PR and between 1cfd30f and f0d8ca9.

Files ignored due to path filters: 1

  • go.sum is excluded by !**/*.sum
Files selected for processing: 10

  • AGENTS.md
  • README.md
  • docs/architecture.md
  • go.mod
  • observability/rpc_test.go
  • rpc/README.md
  • rpc/connectv2/README.md
  • rpc/connectv2/errors.go
  • rpc/connectv2/errors_test.go
  • rpc/errors.go

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@toxsick
toxsick merged commit dc60c45 into main Nov 14, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant