fix: wire keepalive configuration fields into gRPC server options#399
fix: wire keepalive configuration fields into gRPC server options#399raballew wants to merge 2 commits intojumpstarter-dev:mainfrom
Conversation
The five keepalive config fields (Timeout, IntervalTime, MaxConnectionIdle, MaxConnectionAge, MaxConnectionAgeGrace) were parsed from configuration but never passed to keepalive.ServerParameters, making them silently ignored. Changes LoadGrpcConfiguration to return []grpc.ServerOption and constructs a ServerParameters option when any keepalive field is non-zero. Propagates the slice type change through all callers. Closes jumpstarter-dev#363 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
✅ Deploy Preview for jumpstarter-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (3)
📝 WalkthroughWalkthroughThe code refactors gRPC server configuration handling to support multiple Changes
Sequence Diagram(s)sequenceDiagram
participant CLI as Main (cmd)
participant Config as Config Loader
participant Service as Router/Controller Service
participant gRPC as gRPC Server
CLI->>Config: LoadConfiguration / LoadGrpcConfiguration
Config-->>CLI: []grpc.ServerOption (enforcement, params...)
CLI->>Service: construct service with ServerOptions slice
Service->>Service: append interceptors/credentials to options
Service->>gRPC: grpc.NewServer(opts...)
gRPC-->>Service: server running
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Warning Review ran into problems🔥 ProblemsTimed out fetching pipeline failures after 30000ms 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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
controller/internal/service/controller_service.go (1)
941-959: Ordering difference fromrouter_service.go.In this file, user-configured options (
s.ServerOptions) are placed first viaappend(s.ServerOptions, interceptors...), whereasrouter_service.goplaces defaults first and appends user options. While this likely doesn't cause functional issues (gRPC options are typically additive rather than overriding), consider aligning the ordering across both services for consistency and easier maintenance.♻️ Optional: Align ordering with router_service.go
- opts := append(s.ServerOptions, + opts := []grpc.ServerOption{ grpc.ChainUnaryInterceptor(func( gctx context.Context, req any, _ *grpc.UnaryServerInfo, handler grpc.UnaryHandler, ) (resp any, err error) { return handler(logContext(gctx), req) }, recovery.UnaryServerInterceptor()), grpc.ChainStreamInterceptor(func( srv any, ss grpc.ServerStream, _ *grpc.StreamServerInfo, handler grpc.StreamHandler, ) error { return handler(srv, &wrappedStream{ServerStream: ss}) }, recovery.StreamServerInterceptor()), - ) + } + opts = append(opts, s.ServerOptions...) server := grpc.NewServer(opts...)🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@controller/internal/service/controller_service.go` around lines 941 - 959, The append ordering of server options is inconsistent with router_service.go: currently opts := append(s.ServerOptions, grpc.ChainUnaryInterceptor(...), grpc.ChainStreamInterceptor(...)) places user options first; change it to construct opts by starting with the default interceptors (the grpc.ChainUnaryInterceptor and grpc.ChainStreamInterceptor entries) and then append s.ServerOptions so defaults come first, ensuring the same ordering used when creating the server via grpc.NewServer; update the block that builds opts (references: s.ServerOptions, grpc.ChainUnaryInterceptor, grpc.ChainStreamInterceptor, grpc.NewServer) accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@controller/internal/service/controller_service.go`:
- Around line 941-959: The append ordering of server options is inconsistent
with router_service.go: currently opts := append(s.ServerOptions,
grpc.ChainUnaryInterceptor(...), grpc.ChainStreamInterceptor(...)) places user
options first; change it to construct opts by starting with the default
interceptors (the grpc.ChainUnaryInterceptor and grpc.ChainStreamInterceptor
entries) and then append s.ServerOptions so defaults come first, ensuring the
same ordering used when creating the server via grpc.NewServer; update the block
that builds opts (references: s.ServerOptions, grpc.ChainUnaryInterceptor,
grpc.ChainStreamInterceptor, grpc.NewServer) accordingly.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 593c602c-894a-4978-88e9-b03ec3d765ad
📒 Files selected for processing (7)
controller/cmd/main.gocontroller/cmd/router/main.gocontroller/internal/config/config.gocontroller/internal/config/grpc.gocontroller/internal/config/grpc_test.gocontroller/internal/service/controller_service.gocontroller/internal/service/router_service.go
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary
keepalive.ServerParameters, making them silently ignoredLoadGrpcConfigurationnow returns[]grpc.ServerOptionand constructs aServerParametersoption when any keepalive field is non-zeroTest plan
go build ./...cleanCloses #363
🤖 Generated with Claude Code