ReviewOS

home-lang/home

Port gRPC server interceptor lifecycle

#252
Closed chris opened this 10 days ago ·
10 days ago

Bun corpus source

  • Position: 3994/4708
  • File: js/third_party/grpc-js/test-server-interceptors.test.ts
  • Current state: unsupported module syntax during corpus preparation
  • Upstream coverage: 6 assertions

Scope

Port the gRPC server-interceptor lifecycle used by Bun's copied grpc-js suite:

  • ServerListenerBuilder, ResponderBuilder, and ServerInterceptingCall
  • inbound metadata/message/half-close ordering
  • outbound metadata/message/status interception
  • interceptor composition and short-circuit behavior
  • auth rejection, header mutation, and handler isolation
  • actionable interceptor errors with phase, method, target, original cause, and operation stack context

Tracked from #66. This issue stays focused on position 3994 so implementation and validation evidence remain reviewable.

10 days ago

Implemented and pushed in 754204b71 (feat(third-party): port gRPC server interceptors).

This ports all 6 assertions in Bun corpus position 3994 (js/third_party/grpc-js/test-server-interceptors.test.ts):

  • ServerListenerBuilder, ResponderBuilder, and ServerInterceptingCall
  • ordered inbound metadata/message/half-close delivery
  • outbound metadata/message/status interception
  • interceptor composition with request/header mutation
  • auth short-circuiting that prevents both handler invocation and later interceptor events
  • generic Echo service method descriptors used by interceptor callbacks

The failure path is deliberately actionable. Interceptor exceptions retain the original cause and expose diagnosticCode, lifecycle phase, RPC operation, target, and interceptor index. Their stack includes the original message, a synthetic ServerInterceptor.<phase> frame, and Caused by: chain. Nested wrappers preserve the originating interceptor index, and malformed status codes fail as UNKNOWN instead of being mistaken for success. A client-visible permanent integration regression locks this behavior; the gRPC diagnostic suite is now 21/21.

Validation:

  • position 3994: 6 passed, 0 failed, 0 todo, 0 unsupported
  • positions 3990–3994: 69 passed, 0 failed, 0 todo, 0 unsupported
  • permanent corpus accounting, gRPC diagnostics, SQL adapter contracts, and third-party mini-suite: all green
  • zig fmt --check and git diff --check: clean

Cumulative ledger through position 3994: 336 executable files, 2,860 passed, 213 todo, 0 failed, 0 unsupported, 171 allowed-empty.

Tracked from umbrella #66.

Sign in to comment on this issue.