Skip to content

feat(sdk): serve any named gRPC service - #1

Merged
jonasz-lasut merged 1 commit into
mainfrom
feat/serve-service
Aug 25, 2026
Merged

jonasz-lasut merged 1 commit into
mainfrom
feat/serve-service

Conversation

@jonasz-lasut

Copy link
Copy Markdown
Collaborator

What

Adds serve_service, which runs an arbitrary tonic Service + NamedService over the same spec-compliant transport as serve: mTLS from --tls-certs-dir (or --insecure), v1 and v1alpha gRPC server reflection, the gRPC health service reporting the service's NAME as serving, and graceful shutdown on SIGTERM/SIGINT. serve becomes a thin wrapper over it - no behavior change for existing users.

Why

The generated FunctionRunnerServiceServer hard-wires the prost codec, and prost drops protobuf fields newer than the generated types. A runtime that must forward request bytes verbatim - function-wasm's transparent proxy, where the wasm guest must see the caller's exact bytes including fields this SDK's vendored proto does not know yet - needs a raw-bytes codec, and therefore has to register its own service. Until now that meant duplicating the whole transport (TLS, health, reflection, shutdown) downstream; serve_service provides the transport for any service.

Also useful for wrapping the generated server for instrumentation.

Notes

  • Message-size limits are the service's own business (the codec enforces them); serve still applies --max-recv-message-size to the generated server before delegating, and Args::max_recv_message_size carries the flag for custom services to honor.
  • The integration test serves a hand-rolled Service + NamedService impl end to end and checks routing and health under its NAME. One find from writing it: tonic routes by NamedService::NAME, so a stand-in for the FunctionRunnerService must keep its service name - documented in the test.

Slated for 0.3.0.

serve_service runs an arbitrary tonic Service + NamedService over the
same spec-compliant transport as serve (mTLS or insecure, v1/v1alpha
reflection, health keyed by the service's NAME, graceful shutdown);
serve becomes a thin wrapper over it.

The generated server's prost codec drops protobuf fields newer than
the generated types, so a runtime that must forward request bytes
verbatim (function-wasm's transparent proxy) needs its own codec -
which requires registering its own service. serve_service gives such
a server the spec transport without duplicating it.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@jonasz-lasut
jonasz-lasut merged commit 9e88b2f into main Aug 25, 2026
4 checks passed
@jonasz-lasut
jonasz-lasut deleted the feat/serve-service branch August 25, 2026 21:51
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