From f1392ffd6ab032820bab4c757bbe7d2b2fce424e Mon Sep 17 00:00:00 2001 From: Albert Wu Date: Thu, 4 Jun 2026 10:02:30 -0700 Subject: [PATCH 1/3] fix(proto): generate yarpc stubs with v2 codec to match V2 messages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The committed *.pb.yarpc.go stubs were produced by the legacy protoc-gen-yarpc-go, which wires yarpc's gogo-based protobuf codec (github.com/gogo/protobuf). The sibling *.pb.go messages, however, are generated by protoc-gen-go (google.golang.org/protobuf V2 runtime, with the protoimpl `state`/`sizeCache`/`unknownFields` fields). The two halves disagree: the gogo codec assumes gogo-style structs, but is handed V2 ones. This is dormant in this repo because the example servers run the V2-native grpc-go stub; the yarpc stubs are unused here. But when the yarpc procedures are consumed elsewhere (e.g. a yarpc monorepo), the gogo codec's reflection unmarshaler panics on the first untagged V2 field: protobuf tag not enough fields in LandRequest.state: (gogo's encode side tolerates V2 structs by skipping untagged fields, but the decode side parses every field's protobuf tag and panics — so the server inbound / client response path breaks.) Switch the Makefile proto target to protoc-gen-yarpc-go-v2 and regenerate. The v2 generator emits an API-compatible stub (same NewFx*YARPCProcedures symbols) whose codec uses the google.golang.org/protobuf V2 runtime, agreeing with the V2 messages. The codec is per-procedure, so these procedures interoperate with gogo-based services in the same process; the wire bytes are identical. gazelle drops the gogo dep and adds encoding/protobuf/v2; no go.mod/MODULE.bazel change is required. Co-Authored-By: Claude Opus 4.8 (1M context) --- Makefile | 8 +- doc/howto/DEVELOPMENT.md | 2 +- stovepipe/gateway/protopb/BUILD.bazel | 5 +- stovepipe/gateway/protopb/gateway.pb.yarpc.go | 59 ++++++------- stovepipe/orchestrator/protopb/BUILD.bazel | 5 +- .../protopb/orchestrator.pb.yarpc.go | 59 ++++++------- submitqueue/gateway/protopb/BUILD.bazel | 5 +- .../gateway/protopb/gateway.pb.yarpc.go | 83 +++++++++---------- submitqueue/orchestrator/protopb/BUILD.bazel | 5 +- .../protopb/orchestrator.pb.yarpc.go | 59 ++++++------- 10 files changed, 129 insertions(+), 161 deletions(-) diff --git a/Makefile b/Makefile index 7e2411de..85f4c1ea 100644 --- a/Makefile +++ b/Makefile @@ -341,19 +341,19 @@ proto: ## Generate protobuf files from .proto definitions @echo "Generating protobuf files with protoc..." @protoc --go_out=submitqueue/gateway/protopb --go_opt=paths=source_relative \ --go-grpc_out=submitqueue/gateway/protopb --go-grpc_opt=paths=source_relative \ - --yarpc-go_out=submitqueue/gateway/protopb --yarpc-go_opt=paths=source_relative \ + --yarpc-go-v2_out=submitqueue/gateway/protopb --yarpc-go-v2_opt=paths=source_relative \ --proto_path=submitqueue/gateway/proto submitqueue/gateway/proto/gateway.proto @protoc --go_out=submitqueue/orchestrator/protopb --go_opt=paths=source_relative \ --go-grpc_out=submitqueue/orchestrator/protopb --go-grpc_opt=paths=source_relative \ - --yarpc-go_out=submitqueue/orchestrator/protopb --yarpc-go_opt=paths=source_relative \ + --yarpc-go-v2_out=submitqueue/orchestrator/protopb --yarpc-go-v2_opt=paths=source_relative \ --proto_path=submitqueue/orchestrator/proto submitqueue/orchestrator/proto/orchestrator.proto @protoc --go_out=stovepipe/gateway/protopb --go_opt=paths=source_relative \ --go-grpc_out=stovepipe/gateway/protopb --go-grpc_opt=paths=source_relative \ - --yarpc-go_out=stovepipe/gateway/protopb --yarpc-go_opt=paths=source_relative \ + --yarpc-go-v2_out=stovepipe/gateway/protopb --yarpc-go-v2_opt=paths=source_relative \ --proto_path=stovepipe/gateway/proto stovepipe/gateway/proto/gateway.proto @protoc --go_out=stovepipe/orchestrator/protopb --go_opt=paths=source_relative \ --go-grpc_out=stovepipe/orchestrator/protopb --go-grpc_opt=paths=source_relative \ - --yarpc-go_out=stovepipe/orchestrator/protopb --yarpc-go_opt=paths=source_relative \ + --yarpc-go-v2_out=stovepipe/orchestrator/protopb --yarpc-go-v2_opt=paths=source_relative \ --proto_path=stovepipe/orchestrator/proto stovepipe/orchestrator/proto/orchestrator.proto @echo "Protobuf files generated successfully!" diff --git a/doc/howto/DEVELOPMENT.md b/doc/howto/DEVELOPMENT.md index 9fccc2bd..bacb5d2e 100644 --- a/doc/howto/DEVELOPMENT.md +++ b/doc/howto/DEVELOPMENT.md @@ -91,7 +91,7 @@ brew install protobuf grpcurl # Go protoc plugins (only if modifying .proto files) go install google.golang.org/protobuf/cmd/protoc-gen-go@latest go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest -go install go.uber.org/yarpc/encoding/protobuf/protoc-gen-yarpc-go@latest +go install go.uber.org/yarpc/encoding/protobuf/protoc-gen-yarpc-go-v2@latest ``` ## Common Make Targets diff --git a/stovepipe/gateway/protopb/BUILD.bazel b/stovepipe/gateway/protopb/BUILD.bazel index 7f54b03f..e4a862ae 100644 --- a/stovepipe/gateway/protopb/BUILD.bazel +++ b/stovepipe/gateway/protopb/BUILD.bazel @@ -10,18 +10,17 @@ go_library( importpath = "github.com/uber/submitqueue/stovepipe/gateway/protopb", visibility = ["//visibility:public"], deps = [ - "@com_github_gogo_protobuf//jsonpb", - "@com_github_gogo_protobuf//proto", "@org_golang_google_grpc//:grpc", "@org_golang_google_grpc//codes", "@org_golang_google_grpc//status", + "@org_golang_google_protobuf//proto", "@org_golang_google_protobuf//reflect/protoreflect", "@org_golang_google_protobuf//runtime/protoimpl", "@org_uber_go_fx//:fx", "@org_uber_go_yarpc//:yarpc", "@org_uber_go_yarpc//api/transport", "@org_uber_go_yarpc//api/x/restriction", - "@org_uber_go_yarpc//encoding/protobuf", "@org_uber_go_yarpc//encoding/protobuf/reflection", + "@org_uber_go_yarpc//encoding/protobuf/v2:protobuf", ], ) diff --git a/stovepipe/gateway/protopb/gateway.pb.yarpc.go b/stovepipe/gateway/protopb/gateway.pb.yarpc.go index 260f73aa..1619b4da 100644 --- a/stovepipe/gateway/protopb/gateway.pb.yarpc.go +++ b/stovepipe/gateway/protopb/gateway.pb.yarpc.go @@ -8,14 +8,13 @@ import ( "io/ioutil" "reflect" - "github.com/gogo/protobuf/jsonpb" - "github.com/gogo/protobuf/proto" "go.uber.org/fx" "go.uber.org/yarpc" "go.uber.org/yarpc/api/transport" "go.uber.org/yarpc/api/x/restriction" - "go.uber.org/yarpc/encoding/protobuf" "go.uber.org/yarpc/encoding/protobuf/reflection" + "go.uber.org/yarpc/encoding/protobuf/v2" + "google.golang.org/protobuf/proto" ) var _ = ioutil.NopCloser @@ -25,9 +24,9 @@ type StovepipeGatewayYARPCClient interface { Ping(context.Context, *PingRequest, ...yarpc.CallOption) (*PingResponse, error) } -func newStovepipeGatewayYARPCClient(clientConfig transport.ClientConfig, anyResolver jsonpb.AnyResolver, options ...protobuf.ClientOption) StovepipeGatewayYARPCClient { - return &_StovepipeGatewayYARPCCaller{protobuf.NewStreamClient( - protobuf.ClientParams{ +func newStovepipeGatewayYARPCClient(clientConfig transport.ClientConfig, anyResolver v2.AnyResolver, options ...v2.ClientOption) StovepipeGatewayYARPCClient { + return &_StovepipeGatewayYARPCCaller{v2.NewStreamClient( + v2.ClientParams{ ServiceName: "uber.submitqueue.stovepipe.StovepipeGateway", ClientConfig: clientConfig, AnyResolver: anyResolver, @@ -37,7 +36,7 @@ func newStovepipeGatewayYARPCClient(clientConfig transport.ClientConfig, anyReso } // NewStovepipeGatewayYARPCClient builds a new YARPC client for the StovepipeGateway service. -func NewStovepipeGatewayYARPCClient(clientConfig transport.ClientConfig, options ...protobuf.ClientOption) StovepipeGatewayYARPCClient { +func NewStovepipeGatewayYARPCClient(clientConfig transport.ClientConfig, options ...v2.ClientOption) StovepipeGatewayYARPCClient { return newStovepipeGatewayYARPCClient(clientConfig, nil, options...) } @@ -48,19 +47,19 @@ type StovepipeGatewayYARPCServer interface { type buildStovepipeGatewayYARPCProceduresParams struct { Server StovepipeGatewayYARPCServer - AnyResolver jsonpb.AnyResolver + AnyResolver v2.AnyResolver } func buildStovepipeGatewayYARPCProcedures(params buildStovepipeGatewayYARPCProceduresParams) []transport.Procedure { handler := &_StovepipeGatewayYARPCHandler{params.Server} - return protobuf.BuildProcedures( - protobuf.BuildProceduresParams{ + return v2.BuildProcedures( + v2.BuildProceduresParams{ ServiceName: "uber.submitqueue.stovepipe.StovepipeGateway", - UnaryHandlerParams: []protobuf.BuildProceduresUnaryHandlerParams{ + UnaryHandlerParams: []v2.BuildProceduresUnaryHandlerParams{ { MethodName: "Ping", - Handler: protobuf.NewUnaryHandler( - protobuf.UnaryHandlerParams{ + Handler: v2.NewUnaryHandler( + v2.UnaryHandlerParams{ Handle: handler.Ping, NewRequest: newStovepipeGatewayServicePingYARPCRequest, AnyResolver: params.AnyResolver, @@ -68,8 +67,8 @@ func buildStovepipeGatewayYARPCProcedures(params buildStovepipeGatewayYARPCProce ), }, }, - OnewayHandlerParams: []protobuf.BuildProceduresOnewayHandlerParams{}, - StreamHandlerParams: []protobuf.BuildProceduresStreamHandlerParams{}, + OnewayHandlerParams: []v2.BuildProceduresOnewayHandlerParams{}, + StreamHandlerParams: []v2.BuildProceduresStreamHandlerParams{}, }, ) } @@ -87,7 +86,7 @@ type FxStovepipeGatewayYARPCClientParams struct { fx.In Provider yarpc.ClientConfig - AnyResolver jsonpb.AnyResolver `name:"yarpcfx" optional:"true"` + AnyResolver v2.AnyResolver `name:"yarpcfx" optional:"true"` Restriction restriction.Checker `optional:"true"` } @@ -111,13 +110,13 @@ type FxStovepipeGatewayYARPCClientResult struct { // protopb.NewFxStovepipeGatewayYARPCClient("service-name"), // ... // ) -func NewFxStovepipeGatewayYARPCClient(name string, options ...protobuf.ClientOption) interface{} { +func NewFxStovepipeGatewayYARPCClient(name string, options ...v2.ClientOption) interface{} { return func(params FxStovepipeGatewayYARPCClientParams) FxStovepipeGatewayYARPCClientResult { cc := params.Provider.ClientConfig(name) if params.Restriction != nil { if namer, ok := cc.GetUnaryOutbound().(transport.Namer); ok { - if err := params.Restriction.Check(protobuf.Encoding, namer.TransportName()); err != nil { + if err := params.Restriction.Check(v2.Encoding, namer.TransportName()); err != nil { panic(err.Error()) } } @@ -137,7 +136,7 @@ type FxStovepipeGatewayYARPCProceduresParams struct { fx.In Server StovepipeGatewayYARPCServer - AnyResolver jsonpb.AnyResolver `name:"yarpcfx" optional:"true"` + AnyResolver v2.AnyResolver `name:"yarpcfx" optional:"true"` } // FxStovepipeGatewayYARPCProceduresResult defines the output @@ -167,22 +166,16 @@ func NewFxStovepipeGatewayYARPCProcedures() interface{} { Server: params.Server, AnyResolver: params.AnyResolver, }), - ReflectionMeta: StovepipeGatewayReflectionMeta, + ReflectionMeta: reflection.ServerMeta{ + ServiceName: "uber.submitqueue.stovepipe.StovepipeGateway", + FileDescriptors: yarpcFileDescriptorClosuref1a937782ebbded5, + }, } } } -// StovepipeGatewayReflectionMeta is the reflection server metadata -// required for using the gRPC reflection protocol with YARPC. -// -// See https://github.com/grpc/grpc/blob/master/doc/server-reflection.md. -var StovepipeGatewayReflectionMeta = reflection.ServerMeta{ - ServiceName: "uber.submitqueue.stovepipe.StovepipeGateway", - FileDescriptors: yarpcFileDescriptorClosuref1a937782ebbded5, -} - type _StovepipeGatewayYARPCCaller struct { - streamClient protobuf.StreamClient + streamClient v2.StreamClient } func (c *_StovepipeGatewayYARPCCaller) Ping(ctx context.Context, request *PingRequest, options ...yarpc.CallOption) (*PingResponse, error) { @@ -192,7 +185,7 @@ func (c *_StovepipeGatewayYARPCCaller) Ping(ctx context.Context, request *PingRe } response, ok := responseMessage.(*PingResponse) if !ok { - return nil, protobuf.CastError(emptyStovepipeGatewayServicePingYARPCResponse, responseMessage) + return nil, v2.CastError(emptyStovepipeGatewayServicePingYARPCResponse, responseMessage) } return response, err } @@ -207,7 +200,7 @@ func (h *_StovepipeGatewayYARPCHandler) Ping(ctx context.Context, requestMessage if requestMessage != nil { request, ok = requestMessage.(*PingRequest) if !ok { - return nil, protobuf.CastError(emptyStovepipeGatewayServicePingYARPCRequest, requestMessage) + return nil, v2.CastError(emptyStovepipeGatewayServicePingYARPCRequest, requestMessage) } } response, err := h.server.Ping(ctx, request) @@ -256,7 +249,7 @@ var yarpcFileDescriptorClosuref1a937782ebbded5 = [][]byte{ func init() { yarpc.RegisterClientBuilder( func(clientConfig transport.ClientConfig, structField reflect.StructField) StovepipeGatewayYARPCClient { - return NewStovepipeGatewayYARPCClient(clientConfig, protobuf.ClientBuilderOptions(clientConfig, structField)...) + return NewStovepipeGatewayYARPCClient(clientConfig, v2.ClientBuilderOptions(clientConfig, structField)...) }, ) } diff --git a/stovepipe/orchestrator/protopb/BUILD.bazel b/stovepipe/orchestrator/protopb/BUILD.bazel index 698a7494..ec1bb9b0 100644 --- a/stovepipe/orchestrator/protopb/BUILD.bazel +++ b/stovepipe/orchestrator/protopb/BUILD.bazel @@ -10,18 +10,17 @@ go_library( importpath = "github.com/uber/submitqueue/stovepipe/orchestrator/protopb", visibility = ["//visibility:public"], deps = [ - "@com_github_gogo_protobuf//jsonpb", - "@com_github_gogo_protobuf//proto", "@org_golang_google_grpc//:grpc", "@org_golang_google_grpc//codes", "@org_golang_google_grpc//status", + "@org_golang_google_protobuf//proto", "@org_golang_google_protobuf//reflect/protoreflect", "@org_golang_google_protobuf//runtime/protoimpl", "@org_uber_go_fx//:fx", "@org_uber_go_yarpc//:yarpc", "@org_uber_go_yarpc//api/transport", "@org_uber_go_yarpc//api/x/restriction", - "@org_uber_go_yarpc//encoding/protobuf", "@org_uber_go_yarpc//encoding/protobuf/reflection", + "@org_uber_go_yarpc//encoding/protobuf/v2:protobuf", ], ) diff --git a/stovepipe/orchestrator/protopb/orchestrator.pb.yarpc.go b/stovepipe/orchestrator/protopb/orchestrator.pb.yarpc.go index 630fb53b..9271cf06 100644 --- a/stovepipe/orchestrator/protopb/orchestrator.pb.yarpc.go +++ b/stovepipe/orchestrator/protopb/orchestrator.pb.yarpc.go @@ -8,14 +8,13 @@ import ( "io/ioutil" "reflect" - "github.com/gogo/protobuf/jsonpb" - "github.com/gogo/protobuf/proto" "go.uber.org/fx" "go.uber.org/yarpc" "go.uber.org/yarpc/api/transport" "go.uber.org/yarpc/api/x/restriction" - "go.uber.org/yarpc/encoding/protobuf" "go.uber.org/yarpc/encoding/protobuf/reflection" + "go.uber.org/yarpc/encoding/protobuf/v2" + "google.golang.org/protobuf/proto" ) var _ = ioutil.NopCloser @@ -25,9 +24,9 @@ type StovepipeOrchestratorYARPCClient interface { Ping(context.Context, *PingRequest, ...yarpc.CallOption) (*PingResponse, error) } -func newStovepipeOrchestratorYARPCClient(clientConfig transport.ClientConfig, anyResolver jsonpb.AnyResolver, options ...protobuf.ClientOption) StovepipeOrchestratorYARPCClient { - return &_StovepipeOrchestratorYARPCCaller{protobuf.NewStreamClient( - protobuf.ClientParams{ +func newStovepipeOrchestratorYARPCClient(clientConfig transport.ClientConfig, anyResolver v2.AnyResolver, options ...v2.ClientOption) StovepipeOrchestratorYARPCClient { + return &_StovepipeOrchestratorYARPCCaller{v2.NewStreamClient( + v2.ClientParams{ ServiceName: "uber.submitqueue.stovepipe.orchestrator.StovepipeOrchestrator", ClientConfig: clientConfig, AnyResolver: anyResolver, @@ -37,7 +36,7 @@ func newStovepipeOrchestratorYARPCClient(clientConfig transport.ClientConfig, an } // NewStovepipeOrchestratorYARPCClient builds a new YARPC client for the StovepipeOrchestrator service. -func NewStovepipeOrchestratorYARPCClient(clientConfig transport.ClientConfig, options ...protobuf.ClientOption) StovepipeOrchestratorYARPCClient { +func NewStovepipeOrchestratorYARPCClient(clientConfig transport.ClientConfig, options ...v2.ClientOption) StovepipeOrchestratorYARPCClient { return newStovepipeOrchestratorYARPCClient(clientConfig, nil, options...) } @@ -48,19 +47,19 @@ type StovepipeOrchestratorYARPCServer interface { type buildStovepipeOrchestratorYARPCProceduresParams struct { Server StovepipeOrchestratorYARPCServer - AnyResolver jsonpb.AnyResolver + AnyResolver v2.AnyResolver } func buildStovepipeOrchestratorYARPCProcedures(params buildStovepipeOrchestratorYARPCProceduresParams) []transport.Procedure { handler := &_StovepipeOrchestratorYARPCHandler{params.Server} - return protobuf.BuildProcedures( - protobuf.BuildProceduresParams{ + return v2.BuildProcedures( + v2.BuildProceduresParams{ ServiceName: "uber.submitqueue.stovepipe.orchestrator.StovepipeOrchestrator", - UnaryHandlerParams: []protobuf.BuildProceduresUnaryHandlerParams{ + UnaryHandlerParams: []v2.BuildProceduresUnaryHandlerParams{ { MethodName: "Ping", - Handler: protobuf.NewUnaryHandler( - protobuf.UnaryHandlerParams{ + Handler: v2.NewUnaryHandler( + v2.UnaryHandlerParams{ Handle: handler.Ping, NewRequest: newStovepipeOrchestratorServicePingYARPCRequest, AnyResolver: params.AnyResolver, @@ -68,8 +67,8 @@ func buildStovepipeOrchestratorYARPCProcedures(params buildStovepipeOrchestrator ), }, }, - OnewayHandlerParams: []protobuf.BuildProceduresOnewayHandlerParams{}, - StreamHandlerParams: []protobuf.BuildProceduresStreamHandlerParams{}, + OnewayHandlerParams: []v2.BuildProceduresOnewayHandlerParams{}, + StreamHandlerParams: []v2.BuildProceduresStreamHandlerParams{}, }, ) } @@ -87,7 +86,7 @@ type FxStovepipeOrchestratorYARPCClientParams struct { fx.In Provider yarpc.ClientConfig - AnyResolver jsonpb.AnyResolver `name:"yarpcfx" optional:"true"` + AnyResolver v2.AnyResolver `name:"yarpcfx" optional:"true"` Restriction restriction.Checker `optional:"true"` } @@ -111,13 +110,13 @@ type FxStovepipeOrchestratorYARPCClientResult struct { // protopb.NewFxStovepipeOrchestratorYARPCClient("service-name"), // ... // ) -func NewFxStovepipeOrchestratorYARPCClient(name string, options ...protobuf.ClientOption) interface{} { +func NewFxStovepipeOrchestratorYARPCClient(name string, options ...v2.ClientOption) interface{} { return func(params FxStovepipeOrchestratorYARPCClientParams) FxStovepipeOrchestratorYARPCClientResult { cc := params.Provider.ClientConfig(name) if params.Restriction != nil { if namer, ok := cc.GetUnaryOutbound().(transport.Namer); ok { - if err := params.Restriction.Check(protobuf.Encoding, namer.TransportName()); err != nil { + if err := params.Restriction.Check(v2.Encoding, namer.TransportName()); err != nil { panic(err.Error()) } } @@ -137,7 +136,7 @@ type FxStovepipeOrchestratorYARPCProceduresParams struct { fx.In Server StovepipeOrchestratorYARPCServer - AnyResolver jsonpb.AnyResolver `name:"yarpcfx" optional:"true"` + AnyResolver v2.AnyResolver `name:"yarpcfx" optional:"true"` } // FxStovepipeOrchestratorYARPCProceduresResult defines the output @@ -167,22 +166,16 @@ func NewFxStovepipeOrchestratorYARPCProcedures() interface{} { Server: params.Server, AnyResolver: params.AnyResolver, }), - ReflectionMeta: StovepipeOrchestratorReflectionMeta, + ReflectionMeta: reflection.ServerMeta{ + ServiceName: "uber.submitqueue.stovepipe.orchestrator.StovepipeOrchestrator", + FileDescriptors: yarpcFileDescriptorClosure96b6e6782baaa298, + }, } } } -// StovepipeOrchestratorReflectionMeta is the reflection server metadata -// required for using the gRPC reflection protocol with YARPC. -// -// See https://github.com/grpc/grpc/blob/master/doc/server-reflection.md. -var StovepipeOrchestratorReflectionMeta = reflection.ServerMeta{ - ServiceName: "uber.submitqueue.stovepipe.orchestrator.StovepipeOrchestrator", - FileDescriptors: yarpcFileDescriptorClosure96b6e6782baaa298, -} - type _StovepipeOrchestratorYARPCCaller struct { - streamClient protobuf.StreamClient + streamClient v2.StreamClient } func (c *_StovepipeOrchestratorYARPCCaller) Ping(ctx context.Context, request *PingRequest, options ...yarpc.CallOption) (*PingResponse, error) { @@ -192,7 +185,7 @@ func (c *_StovepipeOrchestratorYARPCCaller) Ping(ctx context.Context, request *P } response, ok := responseMessage.(*PingResponse) if !ok { - return nil, protobuf.CastError(emptyStovepipeOrchestratorServicePingYARPCResponse, responseMessage) + return nil, v2.CastError(emptyStovepipeOrchestratorServicePingYARPCResponse, responseMessage) } return response, err } @@ -207,7 +200,7 @@ func (h *_StovepipeOrchestratorYARPCHandler) Ping(ctx context.Context, requestMe if requestMessage != nil { request, ok = requestMessage.(*PingRequest) if !ok { - return nil, protobuf.CastError(emptyStovepipeOrchestratorServicePingYARPCRequest, requestMessage) + return nil, v2.CastError(emptyStovepipeOrchestratorServicePingYARPCRequest, requestMessage) } } response, err := h.server.Ping(ctx, request) @@ -256,7 +249,7 @@ var yarpcFileDescriptorClosure96b6e6782baaa298 = [][]byte{ func init() { yarpc.RegisterClientBuilder( func(clientConfig transport.ClientConfig, structField reflect.StructField) StovepipeOrchestratorYARPCClient { - return NewStovepipeOrchestratorYARPCClient(clientConfig, protobuf.ClientBuilderOptions(clientConfig, structField)...) + return NewStovepipeOrchestratorYARPCClient(clientConfig, v2.ClientBuilderOptions(clientConfig, structField)...) }, ) } diff --git a/submitqueue/gateway/protopb/BUILD.bazel b/submitqueue/gateway/protopb/BUILD.bazel index b9a4d66c..9695fa42 100644 --- a/submitqueue/gateway/protopb/BUILD.bazel +++ b/submitqueue/gateway/protopb/BUILD.bazel @@ -10,18 +10,17 @@ go_library( importpath = "github.com/uber/submitqueue/submitqueue/gateway/protopb", visibility = ["//visibility:public"], deps = [ - "@com_github_gogo_protobuf//jsonpb", - "@com_github_gogo_protobuf//proto", "@org_golang_google_grpc//:grpc", "@org_golang_google_grpc//codes", "@org_golang_google_grpc//status", + "@org_golang_google_protobuf//proto", "@org_golang_google_protobuf//reflect/protoreflect", "@org_golang_google_protobuf//runtime/protoimpl", "@org_uber_go_fx//:fx", "@org_uber_go_yarpc//:yarpc", "@org_uber_go_yarpc//api/transport", "@org_uber_go_yarpc//api/x/restriction", - "@org_uber_go_yarpc//encoding/protobuf", "@org_uber_go_yarpc//encoding/protobuf/reflection", + "@org_uber_go_yarpc//encoding/protobuf/v2:protobuf", ], ) diff --git a/submitqueue/gateway/protopb/gateway.pb.yarpc.go b/submitqueue/gateway/protopb/gateway.pb.yarpc.go index faaa8217..f42db6e0 100644 --- a/submitqueue/gateway/protopb/gateway.pb.yarpc.go +++ b/submitqueue/gateway/protopb/gateway.pb.yarpc.go @@ -8,14 +8,13 @@ import ( "io/ioutil" "reflect" - "github.com/gogo/protobuf/jsonpb" - "github.com/gogo/protobuf/proto" "go.uber.org/fx" "go.uber.org/yarpc" "go.uber.org/yarpc/api/transport" "go.uber.org/yarpc/api/x/restriction" - "go.uber.org/yarpc/encoding/protobuf" "go.uber.org/yarpc/encoding/protobuf/reflection" + "go.uber.org/yarpc/encoding/protobuf/v2" + "google.golang.org/protobuf/proto" ) var _ = ioutil.NopCloser @@ -28,9 +27,9 @@ type SubmitQueueGatewayYARPCClient interface { Status(context.Context, *StatusRequest, ...yarpc.CallOption) (*StatusResponse, error) } -func newSubmitQueueGatewayYARPCClient(clientConfig transport.ClientConfig, anyResolver jsonpb.AnyResolver, options ...protobuf.ClientOption) SubmitQueueGatewayYARPCClient { - return &_SubmitQueueGatewayYARPCCaller{protobuf.NewStreamClient( - protobuf.ClientParams{ +func newSubmitQueueGatewayYARPCClient(clientConfig transport.ClientConfig, anyResolver v2.AnyResolver, options ...v2.ClientOption) SubmitQueueGatewayYARPCClient { + return &_SubmitQueueGatewayYARPCCaller{v2.NewStreamClient( + v2.ClientParams{ ServiceName: "uber.submitqueue.gateway.SubmitQueueGateway", ClientConfig: clientConfig, AnyResolver: anyResolver, @@ -40,7 +39,7 @@ func newSubmitQueueGatewayYARPCClient(clientConfig transport.ClientConfig, anyRe } // NewSubmitQueueGatewayYARPCClient builds a new YARPC client for the SubmitQueueGateway service. -func NewSubmitQueueGatewayYARPCClient(clientConfig transport.ClientConfig, options ...protobuf.ClientOption) SubmitQueueGatewayYARPCClient { +func NewSubmitQueueGatewayYARPCClient(clientConfig transport.ClientConfig, options ...v2.ClientOption) SubmitQueueGatewayYARPCClient { return newSubmitQueueGatewayYARPCClient(clientConfig, nil, options...) } @@ -54,19 +53,19 @@ type SubmitQueueGatewayYARPCServer interface { type buildSubmitQueueGatewayYARPCProceduresParams struct { Server SubmitQueueGatewayYARPCServer - AnyResolver jsonpb.AnyResolver + AnyResolver v2.AnyResolver } func buildSubmitQueueGatewayYARPCProcedures(params buildSubmitQueueGatewayYARPCProceduresParams) []transport.Procedure { handler := &_SubmitQueueGatewayYARPCHandler{params.Server} - return protobuf.BuildProcedures( - protobuf.BuildProceduresParams{ + return v2.BuildProcedures( + v2.BuildProceduresParams{ ServiceName: "uber.submitqueue.gateway.SubmitQueueGateway", - UnaryHandlerParams: []protobuf.BuildProceduresUnaryHandlerParams{ + UnaryHandlerParams: []v2.BuildProceduresUnaryHandlerParams{ { MethodName: "Ping", - Handler: protobuf.NewUnaryHandler( - protobuf.UnaryHandlerParams{ + Handler: v2.NewUnaryHandler( + v2.UnaryHandlerParams{ Handle: handler.Ping, NewRequest: newSubmitQueueGatewayServicePingYARPCRequest, AnyResolver: params.AnyResolver, @@ -75,8 +74,8 @@ func buildSubmitQueueGatewayYARPCProcedures(params buildSubmitQueueGatewayYARPCP }, { MethodName: "Land", - Handler: protobuf.NewUnaryHandler( - protobuf.UnaryHandlerParams{ + Handler: v2.NewUnaryHandler( + v2.UnaryHandlerParams{ Handle: handler.Land, NewRequest: newSubmitQueueGatewayServiceLandYARPCRequest, AnyResolver: params.AnyResolver, @@ -85,8 +84,8 @@ func buildSubmitQueueGatewayYARPCProcedures(params buildSubmitQueueGatewayYARPCP }, { MethodName: "Cancel", - Handler: protobuf.NewUnaryHandler( - protobuf.UnaryHandlerParams{ + Handler: v2.NewUnaryHandler( + v2.UnaryHandlerParams{ Handle: handler.Cancel, NewRequest: newSubmitQueueGatewayServiceCancelYARPCRequest, AnyResolver: params.AnyResolver, @@ -95,8 +94,8 @@ func buildSubmitQueueGatewayYARPCProcedures(params buildSubmitQueueGatewayYARPCP }, { MethodName: "Status", - Handler: protobuf.NewUnaryHandler( - protobuf.UnaryHandlerParams{ + Handler: v2.NewUnaryHandler( + v2.UnaryHandlerParams{ Handle: handler.Status, NewRequest: newSubmitQueueGatewayServiceStatusYARPCRequest, AnyResolver: params.AnyResolver, @@ -104,8 +103,8 @@ func buildSubmitQueueGatewayYARPCProcedures(params buildSubmitQueueGatewayYARPCP ), }, }, - OnewayHandlerParams: []protobuf.BuildProceduresOnewayHandlerParams{}, - StreamHandlerParams: []protobuf.BuildProceduresStreamHandlerParams{}, + OnewayHandlerParams: []v2.BuildProceduresOnewayHandlerParams{}, + StreamHandlerParams: []v2.BuildProceduresStreamHandlerParams{}, }, ) } @@ -123,7 +122,7 @@ type FxSubmitQueueGatewayYARPCClientParams struct { fx.In Provider yarpc.ClientConfig - AnyResolver jsonpb.AnyResolver `name:"yarpcfx" optional:"true"` + AnyResolver v2.AnyResolver `name:"yarpcfx" optional:"true"` Restriction restriction.Checker `optional:"true"` } @@ -147,13 +146,13 @@ type FxSubmitQueueGatewayYARPCClientResult struct { // protopb.NewFxSubmitQueueGatewayYARPCClient("service-name"), // ... // ) -func NewFxSubmitQueueGatewayYARPCClient(name string, options ...protobuf.ClientOption) interface{} { +func NewFxSubmitQueueGatewayYARPCClient(name string, options ...v2.ClientOption) interface{} { return func(params FxSubmitQueueGatewayYARPCClientParams) FxSubmitQueueGatewayYARPCClientResult { cc := params.Provider.ClientConfig(name) if params.Restriction != nil { if namer, ok := cc.GetUnaryOutbound().(transport.Namer); ok { - if err := params.Restriction.Check(protobuf.Encoding, namer.TransportName()); err != nil { + if err := params.Restriction.Check(v2.Encoding, namer.TransportName()); err != nil { panic(err.Error()) } } @@ -173,7 +172,7 @@ type FxSubmitQueueGatewayYARPCProceduresParams struct { fx.In Server SubmitQueueGatewayYARPCServer - AnyResolver jsonpb.AnyResolver `name:"yarpcfx" optional:"true"` + AnyResolver v2.AnyResolver `name:"yarpcfx" optional:"true"` } // FxSubmitQueueGatewayYARPCProceduresResult defines the output @@ -203,22 +202,16 @@ func NewFxSubmitQueueGatewayYARPCProcedures() interface{} { Server: params.Server, AnyResolver: params.AnyResolver, }), - ReflectionMeta: SubmitQueueGatewayReflectionMeta, + ReflectionMeta: reflection.ServerMeta{ + ServiceName: "uber.submitqueue.gateway.SubmitQueueGateway", + FileDescriptors: yarpcFileDescriptorClosuref1a937782ebbded5, + }, } } } -// SubmitQueueGatewayReflectionMeta is the reflection server metadata -// required for using the gRPC reflection protocol with YARPC. -// -// See https://github.com/grpc/grpc/blob/master/doc/server-reflection.md. -var SubmitQueueGatewayReflectionMeta = reflection.ServerMeta{ - ServiceName: "uber.submitqueue.gateway.SubmitQueueGateway", - FileDescriptors: yarpcFileDescriptorClosuref1a937782ebbded5, -} - type _SubmitQueueGatewayYARPCCaller struct { - streamClient protobuf.StreamClient + streamClient v2.StreamClient } func (c *_SubmitQueueGatewayYARPCCaller) Ping(ctx context.Context, request *PingRequest, options ...yarpc.CallOption) (*PingResponse, error) { @@ -228,7 +221,7 @@ func (c *_SubmitQueueGatewayYARPCCaller) Ping(ctx context.Context, request *Ping } response, ok := responseMessage.(*PingResponse) if !ok { - return nil, protobuf.CastError(emptySubmitQueueGatewayServicePingYARPCResponse, responseMessage) + return nil, v2.CastError(emptySubmitQueueGatewayServicePingYARPCResponse, responseMessage) } return response, err } @@ -240,7 +233,7 @@ func (c *_SubmitQueueGatewayYARPCCaller) Land(ctx context.Context, request *Land } response, ok := responseMessage.(*LandResponse) if !ok { - return nil, protobuf.CastError(emptySubmitQueueGatewayServiceLandYARPCResponse, responseMessage) + return nil, v2.CastError(emptySubmitQueueGatewayServiceLandYARPCResponse, responseMessage) } return response, err } @@ -252,7 +245,7 @@ func (c *_SubmitQueueGatewayYARPCCaller) Cancel(ctx context.Context, request *Ca } response, ok := responseMessage.(*CancelResponse) if !ok { - return nil, protobuf.CastError(emptySubmitQueueGatewayServiceCancelYARPCResponse, responseMessage) + return nil, v2.CastError(emptySubmitQueueGatewayServiceCancelYARPCResponse, responseMessage) } return response, err } @@ -264,7 +257,7 @@ func (c *_SubmitQueueGatewayYARPCCaller) Status(ctx context.Context, request *St } response, ok := responseMessage.(*StatusResponse) if !ok { - return nil, protobuf.CastError(emptySubmitQueueGatewayServiceStatusYARPCResponse, responseMessage) + return nil, v2.CastError(emptySubmitQueueGatewayServiceStatusYARPCResponse, responseMessage) } return response, err } @@ -279,7 +272,7 @@ func (h *_SubmitQueueGatewayYARPCHandler) Ping(ctx context.Context, requestMessa if requestMessage != nil { request, ok = requestMessage.(*PingRequest) if !ok { - return nil, protobuf.CastError(emptySubmitQueueGatewayServicePingYARPCRequest, requestMessage) + return nil, v2.CastError(emptySubmitQueueGatewayServicePingYARPCRequest, requestMessage) } } response, err := h.server.Ping(ctx, request) @@ -295,7 +288,7 @@ func (h *_SubmitQueueGatewayYARPCHandler) Land(ctx context.Context, requestMessa if requestMessage != nil { request, ok = requestMessage.(*LandRequest) if !ok { - return nil, protobuf.CastError(emptySubmitQueueGatewayServiceLandYARPCRequest, requestMessage) + return nil, v2.CastError(emptySubmitQueueGatewayServiceLandYARPCRequest, requestMessage) } } response, err := h.server.Land(ctx, request) @@ -311,7 +304,7 @@ func (h *_SubmitQueueGatewayYARPCHandler) Cancel(ctx context.Context, requestMes if requestMessage != nil { request, ok = requestMessage.(*CancelRequest) if !ok { - return nil, protobuf.CastError(emptySubmitQueueGatewayServiceCancelYARPCRequest, requestMessage) + return nil, v2.CastError(emptySubmitQueueGatewayServiceCancelYARPCRequest, requestMessage) } } response, err := h.server.Cancel(ctx, request) @@ -327,7 +320,7 @@ func (h *_SubmitQueueGatewayYARPCHandler) Status(ctx context.Context, requestMes if requestMessage != nil { request, ok = requestMessage.(*StatusRequest) if !ok { - return nil, protobuf.CastError(emptySubmitQueueGatewayServiceStatusYARPCRequest, requestMessage) + return nil, v2.CastError(emptySubmitQueueGatewayServiceStatusYARPCRequest, requestMessage) } } response, err := h.server.Status(ctx, request) @@ -430,7 +423,7 @@ var yarpcFileDescriptorClosuref1a937782ebbded5 = [][]byte{ func init() { yarpc.RegisterClientBuilder( func(clientConfig transport.ClientConfig, structField reflect.StructField) SubmitQueueGatewayYARPCClient { - return NewSubmitQueueGatewayYARPCClient(clientConfig, protobuf.ClientBuilderOptions(clientConfig, structField)...) + return NewSubmitQueueGatewayYARPCClient(clientConfig, v2.ClientBuilderOptions(clientConfig, structField)...) }, ) } diff --git a/submitqueue/orchestrator/protopb/BUILD.bazel b/submitqueue/orchestrator/protopb/BUILD.bazel index eb6e7958..790e5928 100644 --- a/submitqueue/orchestrator/protopb/BUILD.bazel +++ b/submitqueue/orchestrator/protopb/BUILD.bazel @@ -10,18 +10,17 @@ go_library( importpath = "github.com/uber/submitqueue/submitqueue/orchestrator/protopb", visibility = ["//visibility:public"], deps = [ - "@com_github_gogo_protobuf//jsonpb", - "@com_github_gogo_protobuf//proto", "@org_golang_google_grpc//:grpc", "@org_golang_google_grpc//codes", "@org_golang_google_grpc//status", + "@org_golang_google_protobuf//proto", "@org_golang_google_protobuf//reflect/protoreflect", "@org_golang_google_protobuf//runtime/protoimpl", "@org_uber_go_fx//:fx", "@org_uber_go_yarpc//:yarpc", "@org_uber_go_yarpc//api/transport", "@org_uber_go_yarpc//api/x/restriction", - "@org_uber_go_yarpc//encoding/protobuf", "@org_uber_go_yarpc//encoding/protobuf/reflection", + "@org_uber_go_yarpc//encoding/protobuf/v2:protobuf", ], ) diff --git a/submitqueue/orchestrator/protopb/orchestrator.pb.yarpc.go b/submitqueue/orchestrator/protopb/orchestrator.pb.yarpc.go index 7ff6b5bc..3685a5f2 100644 --- a/submitqueue/orchestrator/protopb/orchestrator.pb.yarpc.go +++ b/submitqueue/orchestrator/protopb/orchestrator.pb.yarpc.go @@ -8,14 +8,13 @@ import ( "io/ioutil" "reflect" - "github.com/gogo/protobuf/jsonpb" - "github.com/gogo/protobuf/proto" "go.uber.org/fx" "go.uber.org/yarpc" "go.uber.org/yarpc/api/transport" "go.uber.org/yarpc/api/x/restriction" - "go.uber.org/yarpc/encoding/protobuf" "go.uber.org/yarpc/encoding/protobuf/reflection" + "go.uber.org/yarpc/encoding/protobuf/v2" + "google.golang.org/protobuf/proto" ) var _ = ioutil.NopCloser @@ -25,9 +24,9 @@ type SubmitQueueOrchestratorYARPCClient interface { Ping(context.Context, *PingRequest, ...yarpc.CallOption) (*PingResponse, error) } -func newSubmitQueueOrchestratorYARPCClient(clientConfig transport.ClientConfig, anyResolver jsonpb.AnyResolver, options ...protobuf.ClientOption) SubmitQueueOrchestratorYARPCClient { - return &_SubmitQueueOrchestratorYARPCCaller{protobuf.NewStreamClient( - protobuf.ClientParams{ +func newSubmitQueueOrchestratorYARPCClient(clientConfig transport.ClientConfig, anyResolver v2.AnyResolver, options ...v2.ClientOption) SubmitQueueOrchestratorYARPCClient { + return &_SubmitQueueOrchestratorYARPCCaller{v2.NewStreamClient( + v2.ClientParams{ ServiceName: "uber.submitqueue.orchestrator.SubmitQueueOrchestrator", ClientConfig: clientConfig, AnyResolver: anyResolver, @@ -37,7 +36,7 @@ func newSubmitQueueOrchestratorYARPCClient(clientConfig transport.ClientConfig, } // NewSubmitQueueOrchestratorYARPCClient builds a new YARPC client for the SubmitQueueOrchestrator service. -func NewSubmitQueueOrchestratorYARPCClient(clientConfig transport.ClientConfig, options ...protobuf.ClientOption) SubmitQueueOrchestratorYARPCClient { +func NewSubmitQueueOrchestratorYARPCClient(clientConfig transport.ClientConfig, options ...v2.ClientOption) SubmitQueueOrchestratorYARPCClient { return newSubmitQueueOrchestratorYARPCClient(clientConfig, nil, options...) } @@ -48,19 +47,19 @@ type SubmitQueueOrchestratorYARPCServer interface { type buildSubmitQueueOrchestratorYARPCProceduresParams struct { Server SubmitQueueOrchestratorYARPCServer - AnyResolver jsonpb.AnyResolver + AnyResolver v2.AnyResolver } func buildSubmitQueueOrchestratorYARPCProcedures(params buildSubmitQueueOrchestratorYARPCProceduresParams) []transport.Procedure { handler := &_SubmitQueueOrchestratorYARPCHandler{params.Server} - return protobuf.BuildProcedures( - protobuf.BuildProceduresParams{ + return v2.BuildProcedures( + v2.BuildProceduresParams{ ServiceName: "uber.submitqueue.orchestrator.SubmitQueueOrchestrator", - UnaryHandlerParams: []protobuf.BuildProceduresUnaryHandlerParams{ + UnaryHandlerParams: []v2.BuildProceduresUnaryHandlerParams{ { MethodName: "Ping", - Handler: protobuf.NewUnaryHandler( - protobuf.UnaryHandlerParams{ + Handler: v2.NewUnaryHandler( + v2.UnaryHandlerParams{ Handle: handler.Ping, NewRequest: newSubmitQueueOrchestratorServicePingYARPCRequest, AnyResolver: params.AnyResolver, @@ -68,8 +67,8 @@ func buildSubmitQueueOrchestratorYARPCProcedures(params buildSubmitQueueOrchestr ), }, }, - OnewayHandlerParams: []protobuf.BuildProceduresOnewayHandlerParams{}, - StreamHandlerParams: []protobuf.BuildProceduresStreamHandlerParams{}, + OnewayHandlerParams: []v2.BuildProceduresOnewayHandlerParams{}, + StreamHandlerParams: []v2.BuildProceduresStreamHandlerParams{}, }, ) } @@ -87,7 +86,7 @@ type FxSubmitQueueOrchestratorYARPCClientParams struct { fx.In Provider yarpc.ClientConfig - AnyResolver jsonpb.AnyResolver `name:"yarpcfx" optional:"true"` + AnyResolver v2.AnyResolver `name:"yarpcfx" optional:"true"` Restriction restriction.Checker `optional:"true"` } @@ -111,13 +110,13 @@ type FxSubmitQueueOrchestratorYARPCClientResult struct { // protopb.NewFxSubmitQueueOrchestratorYARPCClient("service-name"), // ... // ) -func NewFxSubmitQueueOrchestratorYARPCClient(name string, options ...protobuf.ClientOption) interface{} { +func NewFxSubmitQueueOrchestratorYARPCClient(name string, options ...v2.ClientOption) interface{} { return func(params FxSubmitQueueOrchestratorYARPCClientParams) FxSubmitQueueOrchestratorYARPCClientResult { cc := params.Provider.ClientConfig(name) if params.Restriction != nil { if namer, ok := cc.GetUnaryOutbound().(transport.Namer); ok { - if err := params.Restriction.Check(protobuf.Encoding, namer.TransportName()); err != nil { + if err := params.Restriction.Check(v2.Encoding, namer.TransportName()); err != nil { panic(err.Error()) } } @@ -137,7 +136,7 @@ type FxSubmitQueueOrchestratorYARPCProceduresParams struct { fx.In Server SubmitQueueOrchestratorYARPCServer - AnyResolver jsonpb.AnyResolver `name:"yarpcfx" optional:"true"` + AnyResolver v2.AnyResolver `name:"yarpcfx" optional:"true"` } // FxSubmitQueueOrchestratorYARPCProceduresResult defines the output @@ -167,22 +166,16 @@ func NewFxSubmitQueueOrchestratorYARPCProcedures() interface{} { Server: params.Server, AnyResolver: params.AnyResolver, }), - ReflectionMeta: SubmitQueueOrchestratorReflectionMeta, + ReflectionMeta: reflection.ServerMeta{ + ServiceName: "uber.submitqueue.orchestrator.SubmitQueueOrchestrator", + FileDescriptors: yarpcFileDescriptorClosure96b6e6782baaa298, + }, } } } -// SubmitQueueOrchestratorReflectionMeta is the reflection server metadata -// required for using the gRPC reflection protocol with YARPC. -// -// See https://github.com/grpc/grpc/blob/master/doc/server-reflection.md. -var SubmitQueueOrchestratorReflectionMeta = reflection.ServerMeta{ - ServiceName: "uber.submitqueue.orchestrator.SubmitQueueOrchestrator", - FileDescriptors: yarpcFileDescriptorClosure96b6e6782baaa298, -} - type _SubmitQueueOrchestratorYARPCCaller struct { - streamClient protobuf.StreamClient + streamClient v2.StreamClient } func (c *_SubmitQueueOrchestratorYARPCCaller) Ping(ctx context.Context, request *PingRequest, options ...yarpc.CallOption) (*PingResponse, error) { @@ -192,7 +185,7 @@ func (c *_SubmitQueueOrchestratorYARPCCaller) Ping(ctx context.Context, request } response, ok := responseMessage.(*PingResponse) if !ok { - return nil, protobuf.CastError(emptySubmitQueueOrchestratorServicePingYARPCResponse, responseMessage) + return nil, v2.CastError(emptySubmitQueueOrchestratorServicePingYARPCResponse, responseMessage) } return response, err } @@ -207,7 +200,7 @@ func (h *_SubmitQueueOrchestratorYARPCHandler) Ping(ctx context.Context, request if requestMessage != nil { request, ok = requestMessage.(*PingRequest) if !ok { - return nil, protobuf.CastError(emptySubmitQueueOrchestratorServicePingYARPCRequest, requestMessage) + return nil, v2.CastError(emptySubmitQueueOrchestratorServicePingYARPCRequest, requestMessage) } } response, err := h.server.Ping(ctx, request) @@ -256,7 +249,7 @@ var yarpcFileDescriptorClosure96b6e6782baaa298 = [][]byte{ func init() { yarpc.RegisterClientBuilder( func(clientConfig transport.ClientConfig, structField reflect.StructField) SubmitQueueOrchestratorYARPCClient { - return NewSubmitQueueOrchestratorYARPCClient(clientConfig, protobuf.ClientBuilderOptions(clientConfig, structField)...) + return NewSubmitQueueOrchestratorYARPCClient(clientConfig, v2.ClientBuilderOptions(clientConfig, structField)...) }, ) } From 48288026d2c9087c3d35241b04576853c1de9592 Mon Sep 17 00:00:00 2001 From: Albert Wu Date: Thu, 4 Jun 2026 12:01:19 -0700 Subject: [PATCH 2/3] build(proto): make `make proto` fully hermetic `make proto` previously shelled out to whatever protoc-gen-go, protoc-gen-go-grpc, and protoc-gen-yarpc-go-v2 happened to be on the host $PATH (installed via `go install ...@latest`), so generated stubs drifted between machines. protoc itself was already pinned by the ./tool/protoc wrapper; this closes the remaining gap by pinning the plugins too. - Pin all three plugins via `tool` directives in go.mod, at the versions stamped in the committed output (protoc-gen-go v1.36.10, protoc-gen-go-grpc v1.5.1, protoc-gen-yarpc-go-v2 from yarpc v1.81.0). protoc-gen-go-grpc is a separate module, now added to the graph. - Add tool/protoc-gen-{go,go-grpc,yarpc-go-v2} wrappers that run the pinned plugins via `go tool`, mirroring ./tool/protoc. - Pass them to protoc with explicit --plugin= flags so $PATH is never consulted, and run a pinned goimports pass so `make proto` emits the committed (formatted) form in one command. - Add a `check-proto` target (regenerate + assert clean) wired into the CI `tidy` job so stale generated files fail the required-checks gate. - Drop the host protoc/plugin install steps from DEVELOPMENT.md. `go mod tidy` also drops the now-unused gogo/protobuf family, which the yarpc v1->v2 codec migration on this branch made dead. Co-Authored-By: Claude Opus 4.8 (1M context) --- .github/workflows/ci.yml | 5 +- .protocversion | 1 + MODULE.bazel | 2 +- Makefile | 28 ++++-- doc/howto/DEVELOPMENT.md | 23 ++--- go.mod | 10 ++- go.sum | 19 +--- stovepipe/gateway/protopb/gateway.pb.yarpc.go | 2 +- .../protopb/orchestrator.pb.yarpc.go | 2 +- .../gateway/protopb/gateway.pb.yarpc.go | 2 +- .../protopb/orchestrator.pb.yarpc.go | 2 +- tool/BUILD.bazel | 4 + tool/protoc | 89 +++++++++++++++++++ tool/protoc-gen-go | 26 ++++++ tool/protoc-gen-go-grpc | 26 ++++++ tool/protoc-gen-yarpc-go-v2 | 26 ++++++ 16 files changed, 226 insertions(+), 41 deletions(-) create mode 100644 .protocversion create mode 100755 tool/protoc create mode 100755 tool/protoc-gen-go create mode 100755 tool/protoc-gen-go-grpc create mode 100755 tool/protoc-gen-yarpc-go-v2 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 39533206..e88328e9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,7 +36,7 @@ jobs: run: make lint # --------------------------------------------------------------------------- - # TIDY (module files + BUILD files in sync) + # TIDY (module files + BUILD files + generated proto in sync) # --------------------------------------------------------------------------- tidy: name: Tidy @@ -52,6 +52,9 @@ jobs: - name: Check BUILD files are up to date run: make check-gazelle + - name: Check generated proto files are up to date + run: make check-proto + # --------------------------------------------------------------------------- # BUILD AND UNIT TESTS # --------------------------------------------------------------------------- diff --git a/.protocversion b/.protocversion new file mode 100644 index 00000000..08a68b85 --- /dev/null +++ b/.protocversion @@ -0,0 +1 @@ +29.3 diff --git a/MODULE.bazel b/MODULE.bazel index d44b8457..9bdd13c0 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -43,12 +43,12 @@ use_repo( go_deps, "com_github_data_dog_go_sqlmock", "com_github_go_sql_driver_mysql", - "com_github_gogo_protobuf", "com_github_spf13_cobra", "com_github_stretchr_testify", "com_github_uber_go_tally_v4", "in_gopkg_yaml_v3", "org_golang_google_grpc", + "org_golang_google_grpc_cmd_protoc_gen_go_grpc", "org_golang_google_protobuf", "org_golang_x_oauth2", "org_uber_go_fx", diff --git a/Makefile b/Makefile index 85f4c1ea..290658cc 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,16 @@ # Bazel wrapper BAZEL = ./tool/bazel +# protoc wrapper (hermetic; pinned by .protocversion) +PROTOC = ./tool/protoc + +# protoc plugins (hermetic; versions pinned by the `tool` directives in go.mod). +# Passed explicitly so protoc never resolves a plugin from the host $PATH. +PROTOC_PLUGINS = \ + --plugin=protoc-gen-go=$(CURDIR)/tool/protoc-gen-go \ + --plugin=protoc-gen-go-grpc=$(CURDIR)/tool/protoc-gen-go-grpc \ + --plugin=protoc-gen-yarpc-go-v2=$(CURDIR)/tool/protoc-gen-yarpc-go-v2 + # Docker Compose wrapper COMPOSE = docker-compose @@ -40,7 +50,7 @@ define assert_clean fi endef -.PHONY: build build-all-linux build-submitqueue-gateway-linux build-submitqueue-orchestrator-linux build-stovepipe-gateway-linux build-stovepipe-orchestrator-linux check-gazelle check-mocks check-tidy clean clean-proto deps e2e-test fmt gazelle integration-test integration-test-submitqueue-consumer integration-test-extensions integration-test-submitqueue-gateway integration-test-submitqueue-orchestrator license-fix lint lint-fmt lint-license local-submitqueue-clean local-submitqueue-gateway-start local-submitqueue-gateway-stop local-init-submitqueue-schemas local-init-stovepipe-queue-schema local-submitqueue-logs local-submitqueue-orchestrator-start local-submitqueue-orchestrator-stop local-submitqueue-ps local-submitqueue-restart local-submitqueue-start local-stop local-stovepipe-gateway-start local-stovepipe-orchestrator-start local-stovepipe-start mocks proto query-deps query-targets run-client-submitqueue-gateway run-client-submitqueue-orchestrator run-client-stovepipe-gateway run-client-stovepipe-orchestrator run-queue-admin test test-no-cache tidy tidy-bazel tidy-go help +.PHONY: build build-all-linux build-submitqueue-gateway-linux build-submitqueue-orchestrator-linux build-stovepipe-gateway-linux build-stovepipe-orchestrator-linux check-gazelle check-mocks check-proto check-tidy clean clean-proto deps e2e-test fmt gazelle integration-test integration-test-submitqueue-consumer integration-test-extensions integration-test-submitqueue-gateway integration-test-submitqueue-orchestrator license-fix lint lint-fmt lint-license local-submitqueue-clean local-submitqueue-gateway-start local-submitqueue-gateway-stop local-init-submitqueue-schemas local-init-stovepipe-queue-schema local-submitqueue-logs local-submitqueue-orchestrator-start local-submitqueue-orchestrator-stop local-submitqueue-ps local-submitqueue-restart local-submitqueue-start local-stop local-stovepipe-gateway-start local-stovepipe-orchestrator-start local-stovepipe-start mocks proto query-deps query-targets run-client-submitqueue-gateway run-client-submitqueue-orchestrator run-client-stovepipe-gateway run-client-stovepipe-orchestrator run-queue-admin test test-no-cache tidy tidy-bazel tidy-go help build: ## Build all services and examples @@ -94,6 +104,10 @@ check-mocks: mocks ## Check mock files are up to date $(call assert_clean,make mocks) @echo "Mock files are up to date." +check-proto: proto ## Check generated proto files are up to date + $(call assert_clean,make proto) + @echo "Proto files are up to date." + check-tidy: tidy ## Check that go.mod and MODULE.bazel are tidy $(call assert_clean,make tidy) @echo "Module files are up to date." @@ -339,22 +353,26 @@ mocks: ## Generate mock files using mockgen proto: ## Generate protobuf files from .proto definitions @echo "Generating protobuf files with protoc..." - @protoc --go_out=submitqueue/gateway/protopb --go_opt=paths=source_relative \ + @$(PROTOC) $(PROTOC_PLUGINS) --go_out=submitqueue/gateway/protopb --go_opt=paths=source_relative \ --go-grpc_out=submitqueue/gateway/protopb --go-grpc_opt=paths=source_relative \ --yarpc-go-v2_out=submitqueue/gateway/protopb --yarpc-go-v2_opt=paths=source_relative \ --proto_path=submitqueue/gateway/proto submitqueue/gateway/proto/gateway.proto - @protoc --go_out=submitqueue/orchestrator/protopb --go_opt=paths=source_relative \ + @$(PROTOC) $(PROTOC_PLUGINS) --go_out=submitqueue/orchestrator/protopb --go_opt=paths=source_relative \ --go-grpc_out=submitqueue/orchestrator/protopb --go-grpc_opt=paths=source_relative \ --yarpc-go-v2_out=submitqueue/orchestrator/protopb --yarpc-go-v2_opt=paths=source_relative \ --proto_path=submitqueue/orchestrator/proto submitqueue/orchestrator/proto/orchestrator.proto - @protoc --go_out=stovepipe/gateway/protopb --go_opt=paths=source_relative \ + @$(PROTOC) $(PROTOC_PLUGINS) --go_out=stovepipe/gateway/protopb --go_opt=paths=source_relative \ --go-grpc_out=stovepipe/gateway/protopb --go-grpc_opt=paths=source_relative \ --yarpc-go-v2_out=stovepipe/gateway/protopb --yarpc-go-v2_opt=paths=source_relative \ --proto_path=stovepipe/gateway/proto stovepipe/gateway/proto/gateway.proto - @protoc --go_out=stovepipe/orchestrator/protopb --go_opt=paths=source_relative \ + @$(PROTOC) $(PROTOC_PLUGINS) --go_out=stovepipe/orchestrator/protopb --go_opt=paths=source_relative \ --go-grpc_out=stovepipe/orchestrator/protopb --go-grpc_opt=paths=source_relative \ --yarpc-go-v2_out=stovepipe/orchestrator/protopb --yarpc-go-v2_opt=paths=source_relative \ --proto_path=stovepipe/orchestrator/proto stovepipe/orchestrator/proto/orchestrator.proto + @echo "Formatting generated files with goimports..." + @go run golang.org/x/tools/cmd/goimports@$(GOIMPORTS_VERSION) -w \ + submitqueue/gateway/protopb submitqueue/orchestrator/protopb \ + stovepipe/gateway/protopb stovepipe/orchestrator/protopb @echo "Protobuf files generated successfully!" # Bazel query helpers diff --git a/doc/howto/DEVELOPMENT.md b/doc/howto/DEVELOPMENT.md index bacb5d2e..9ae46e39 100644 --- a/doc/howto/DEVELOPMENT.md +++ b/doc/howto/DEVELOPMENT.md @@ -2,7 +2,7 @@ ## Prerequisites -- **Go 1.24+** — needed for `gopls`, `go mod`, and installing protoc plugins. Download from [go.dev/dl](https://go.dev/dl/). Note: Bazel manages its own Go toolchain for builds, but a local Go installation is required for editor tooling and dependency management. +- **Go 1.24+** — needed for `gopls`, `go mod`, and running the hermetic protoc plugins (via `go tool`). Download from [go.dev/dl](https://go.dev/dl/). Note: Bazel manages its own Go toolchain for builds, but a local Go installation is required for editor tooling and dependency management. - **Docker** and **Docker Compose** — for integration and e2e tests, and for running services locally. - **direnv** (recommended) — automatically loads `.envrc` so you can use `bazel` directly instead of `./tool/bazel`. @@ -85,15 +85,17 @@ GoLand works with Go modules automatically. Open the project root and GoLand wil ## Optional Tools ```bash -# macOS -brew install protobuf grpcurl - -# Go protoc plugins (only if modifying .proto files) -go install google.golang.org/protobuf/cmd/protoc-gen-go@latest -go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest -go install go.uber.org/yarpc/encoding/protobuf/protoc-gen-yarpc-go-v2@latest +# macOS — grpcurl for poking at running services (optional) +brew install grpcurl ``` +Proto generation is fully hermetic and needs no manual installs: `make proto` +downloads a pinned `protoc` via `./tool/protoc` (see `.protocversion`) and runs +the `protoc-gen-go`, `protoc-gen-go-grpc`, and `protoc-gen-yarpc-go-v2` plugins +at the versions pinned by the `tool` directives in `go.mod` (via `go tool`). A +Go toolchain (and network access on the first run, to fetch protoc and the +plugin modules) is the only requirement. + ## Common Make Targets | Target | Description | @@ -138,8 +140,9 @@ See [TESTING.md](TESTING.md) for the full testing guide, including integration a ## Troubleshooting **Proto generation fails:** -- Ensure all three protoc plugins are installed (see Optional Tools above) -- Check that `protoc` is in your PATH: `which protoc` +- `make proto` is hermetic — it needs no host `protoc` or plugins, only a Go toolchain and (on the first run) network access to download pinned `protoc` and the plugin modules. +- To bump versions: edit `.protocversion` (and add the new platform checksums in `./tool/protoc`) for protoc, or `go get -tool @` followed by `make tidy` for a plugin. +- Run `make check-proto` to confirm the committed generated files match a fresh `make proto`. **Build fails after proto changes:** - Run `make proto` to regenerate proto files diff --git a/go.mod b/go.mod index 12ec655d..26912943 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,6 @@ go 1.24.5 require ( github.com/DATA-DOG/go-sqlmock v1.5.0 github.com/go-sql-driver/mysql v1.6.0 - github.com/gogo/protobuf v1.3.2 github.com/spf13/cobra v1.10.2 github.com/stretchr/testify v1.11.1 github.com/uber-go/tally/v4 v4.1.17 @@ -24,8 +23,6 @@ require ( github.com/beorn7/perks v1.0.1 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect - github.com/gogo/googleapis v1.4.1 // indirect - github.com/gogo/status v1.1.0 // indirect github.com/golang/mock v1.7.0-rc.1 // indirect github.com/golang/protobuf v1.5.4 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect @@ -56,6 +53,13 @@ require ( golang.org/x/tools v0.41.0 // indirect golang.org/x/tools/go/expect v0.1.1-deprecated // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20241230172942-26aa7a208def // indirect + google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.5.1 // indirect gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect honnef.co/go/tools v0.4.3 // indirect ) + +tool ( + go.uber.org/yarpc/encoding/protobuf/protoc-gen-yarpc-go-v2 + google.golang.org/grpc/cmd/protoc-gen-go-grpc + google.golang.org/protobuf/cmd/protoc-gen-go +) diff --git a/go.sum b/go.sum index b12bd5d0..8eff014b 100644 --- a/go.sum +++ b/go.sum @@ -35,11 +35,9 @@ github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG github.com/go-sql-driver/mysql v1.6.0 h1:BCTh4TKNUYmOmMUcQ3IipzF5prigylS7XXjEkfCHuOE= github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/gogo/googleapis v0.0.0-20180223154316-0cd9801be74a/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s= github.com/gogo/googleapis v1.4.1 h1:1Yx4Myt7BxzvUr5ldGSbwYiZG6t9wGBZ+8/fX3Wvtq0= github.com/gogo/googleapis v1.4.1/go.mod h1:2lpHqI5OcWCtVElxXnPt+s8oJvMpySlOyM6xDCrzib4= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/gogo/status v1.1.0 h1:+eIkrewn5q6b30y+g/BJINVVdi2xH7je5MPJ3ZPK3JA= @@ -79,7 +77,6 @@ github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/ github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= -github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/errcheck v1.7.0 h1:+SbscKmWJ5mOK/bO1zS60F5I9WwZDWOfRsC4RwfwRV0= github.com/kisielk/errcheck v1.7.0/go.mod h1:1kLL+jV4e+CFfueBmI1dSK2ADDyQnlrnrY/FqKluHJQ= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= @@ -172,8 +169,6 @@ github.com/uber/jaeger-lib v2.4.1+incompatible h1:td4jdvLcExb4cBISKIpHuGoVXh+dVK github.com/uber/jaeger-lib v2.4.1+incompatible/go.mod h1:ComeNDZlWwrWnDv8aPp0Ba6+uUTzImX/AauajbLI56U= github.com/uber/tchannel-go v1.34.4 h1:Wi7SSfUQbJ4lPqS4trP1uAZvWu46oK0qz0tOodcfcbY= github.com/uber/tchannel-go v1.34.4/go.mod h1:ERHDsQa50nNJxV8Mm6V4nxPWyGvGxiV+T/dUNRzmoC4= -github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= go.uber.org/atomic v1.5.1/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= @@ -212,8 +207,6 @@ golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 h1:VLliZ0d+/avPrXXH+OakdXhp golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= golang.org/x/mod v0.32.0 h1:9F4d3PHLljb6x//jOyokMv3eX+YDeepZSEo3mFJy93c= golang.org/x/mod v0.32.0/go.mod h1:SgipZ/3h2Ci89DlEtEXWUk/HteuRin+HHhN+WbNhguU= @@ -224,9 +217,7 @@ golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.49.0 h1:eeHFmOGUTtaaPSGNmjBKpbng9MulQsJURQUAfUwY++o= golang.org/x/net v0.49.0/go.mod h1:/ysNB2EvaqvesRkuLAyjI1ycPZlQHM3q01F02UY/MV8= @@ -235,10 +226,8 @@ golang.org/x/oauth2 v0.34.0 h1:hqK/t4AKgbqWkdkcAeI8XLmbK+4m4G5YeQRrmiotGlw= golang.org/x/oauth2 v0.34.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.19.0 h1:vV+1eWNmZ5geRlYjzm2adRgW2/mcpevXNg50YZtPCE4= @@ -254,7 +243,6 @@ golang.org/x/sys v0.0.0-20200117145432-59e60aa80a0c/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -265,7 +253,6 @@ golang.org/x/sys v0.40.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.34.0 h1:oL/Qq0Kdaqxa1KbNeMKwQq0reLCCaFtqu2eNuSeNHbk= @@ -278,8 +265,6 @@ golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200117215004-fe56e6335763/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.8/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU= golang.org/x/tools v0.41.0 h1:a9b8iMweWG+S0OBnlU36rzLp20z1Rp10w+IY2czHTQc= golang.org/x/tools v0.41.0/go.mod h1:XSY6eDqxVNiYgezAVqqCeihT4j1U2CCsqvH3WhQpnlg= @@ -290,12 +275,12 @@ golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/genproto v0.0.0-20180518175338-11a468237815/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto/googleapis/rpc v0.0.0-20241230172942-26aa7a208def h1:4P81qv5JXI/sDNae2ClVx88cgDDA6DPilADkG9tYKz8= google.golang.org/genproto/googleapis/rpc v0.0.0-20241230172942-26aa7a208def/go.mod h1:bdAgzvd4kFrpykc5/AC2eLUiegK9T/qxZHD4hXYf/ho= -google.golang.org/grpc v1.12.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.68.1 h1:oI5oTa11+ng8r8XMMN7jAOmWfPZWbYpCFaMUTACxkM0= google.golang.org/grpc v1.68.1/go.mod h1:+q1XYFJjShcqn0QZHvCyeR4CXPA+llXIeUIfIe00waw= +google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.5.1 h1:F29+wU6Ee6qgu9TddPgooOdaqsxTMunOoj8KA5yuS5A= +google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.5.1/go.mod h1:5KF+wpkbTSbGcR9zteSqZV6fqFOWBl4Yde8En8MryZA= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/stovepipe/gateway/protopb/gateway.pb.yarpc.go b/stovepipe/gateway/protopb/gateway.pb.yarpc.go index 1619b4da..fde8278f 100644 --- a/stovepipe/gateway/protopb/gateway.pb.yarpc.go +++ b/stovepipe/gateway/protopb/gateway.pb.yarpc.go @@ -13,7 +13,7 @@ import ( "go.uber.org/yarpc/api/transport" "go.uber.org/yarpc/api/x/restriction" "go.uber.org/yarpc/encoding/protobuf/reflection" - "go.uber.org/yarpc/encoding/protobuf/v2" + v2 "go.uber.org/yarpc/encoding/protobuf/v2" "google.golang.org/protobuf/proto" ) diff --git a/stovepipe/orchestrator/protopb/orchestrator.pb.yarpc.go b/stovepipe/orchestrator/protopb/orchestrator.pb.yarpc.go index 9271cf06..c7a96783 100644 --- a/stovepipe/orchestrator/protopb/orchestrator.pb.yarpc.go +++ b/stovepipe/orchestrator/protopb/orchestrator.pb.yarpc.go @@ -13,7 +13,7 @@ import ( "go.uber.org/yarpc/api/transport" "go.uber.org/yarpc/api/x/restriction" "go.uber.org/yarpc/encoding/protobuf/reflection" - "go.uber.org/yarpc/encoding/protobuf/v2" + v2 "go.uber.org/yarpc/encoding/protobuf/v2" "google.golang.org/protobuf/proto" ) diff --git a/submitqueue/gateway/protopb/gateway.pb.yarpc.go b/submitqueue/gateway/protopb/gateway.pb.yarpc.go index f42db6e0..e04d0127 100644 --- a/submitqueue/gateway/protopb/gateway.pb.yarpc.go +++ b/submitqueue/gateway/protopb/gateway.pb.yarpc.go @@ -13,7 +13,7 @@ import ( "go.uber.org/yarpc/api/transport" "go.uber.org/yarpc/api/x/restriction" "go.uber.org/yarpc/encoding/protobuf/reflection" - "go.uber.org/yarpc/encoding/protobuf/v2" + v2 "go.uber.org/yarpc/encoding/protobuf/v2" "google.golang.org/protobuf/proto" ) diff --git a/submitqueue/orchestrator/protopb/orchestrator.pb.yarpc.go b/submitqueue/orchestrator/protopb/orchestrator.pb.yarpc.go index 3685a5f2..c1570391 100644 --- a/submitqueue/orchestrator/protopb/orchestrator.pb.yarpc.go +++ b/submitqueue/orchestrator/protopb/orchestrator.pb.yarpc.go @@ -13,7 +13,7 @@ import ( "go.uber.org/yarpc/api/transport" "go.uber.org/yarpc/api/x/restriction" "go.uber.org/yarpc/encoding/protobuf/reflection" - "go.uber.org/yarpc/encoding/protobuf/v2" + v2 "go.uber.org/yarpc/encoding/protobuf/v2" "google.golang.org/protobuf/proto" ) diff --git a/tool/BUILD.bazel b/tool/BUILD.bazel index 4626b003..64a8c3a3 100644 --- a/tool/BUILD.bazel +++ b/tool/BUILD.bazel @@ -3,4 +3,8 @@ exports_files([ "bazel", + "protoc", + "protoc-gen-go", + "protoc-gen-go-grpc", + "protoc-gen-yarpc-go-v2", ]) diff --git a/tool/protoc b/tool/protoc new file mode 100755 index 00000000..523adbd9 --- /dev/null +++ b/tool/protoc @@ -0,0 +1,89 @@ +#!/usr/bin/env bash +# +# Copyright (c) 2025 Uber Technologies, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Hermetic protoc wrapper. Downloads and pins protoc to the version in +# .protocversion, then execs it. This mirrors ./tool/bazel (Bazelisk) so that +# `make proto` produces identical output regardless of any host/homebrew protoc. +# +# The binary is cached under ${XDG_CACHE_HOME:-$HOME/.cache}/submitqueue-protoc/ +# and verified against a pinned SHA-256 before use. + +set -euo pipefail + +repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" +version="$(tr -d '[:space:]' <"${repo_root}/.protocversion")" + +# Map the host OS/arch onto the protobuf release asset suffix. +os="$(uname -s)" +arch="$(uname -m)" +case "${os}" in + Darwin) os_part="osx" ;; + Linux) os_part="linux" ;; + *) echo "tool/protoc: unsupported OS: ${os}" >&2; exit 1 ;; +esac +case "${arch}" in + arm64 | aarch64) arch_part="aarch_64" ;; + x86_64 | amd64) arch_part="x86_64" ;; + *) echo "tool/protoc: unsupported arch: ${arch}" >&2; exit 1 ;; +esac +plat="${os_part}-${arch_part}" + +# Pinned SHA-256 of protoc-${version}-${plat}.zip. Add new entries when bumping +# .protocversion (see the release page on github.com/protocolbuffers/protobuf). +checksum="" +case "${version}:${plat}" in + "29.3:osx-aarch_64") checksum="2b8a3403cd097f95f3ba656e14b76c732b6b26d7f183330b11e36ef2bc028765" ;; + "29.3:osx-x86_64") checksum="9a788036d8f9854f7b03c305df4777cf0e54e5b081e25bf15252da87e0e90875" ;; + "29.3:linux-x86_64") checksum="3e866620c5be27664f3d2fa2d656b5f3e09b5152b42f1bedbf427b333e90021a" ;; + "29.3:linux-aarch_64") checksum="6427349140e01f06e049e707a58709a4f221ae73ab9a0425bc4a00c8d0e1ab32" ;; +esac + +cache_root="${XDG_CACHE_HOME:-${HOME}/.cache}/submitqueue-protoc" +install_dir="${cache_root}/${version}/${plat}" +protoc_bin="${install_dir}/bin/protoc" + +sha256() { + if command -v sha256sum >/dev/null 2>&1; then + sha256sum "$1" | awk '{print $1}' + else + shasum -a 256 "$1" | awk '{print $1}' + fi +} + +if [[ ! -x "${protoc_bin}" ]]; then + url="https://github.com/protocolbuffers/protobuf/releases/download/v${version}/protoc-${version}-${plat}.zip" + tmp="$(mktemp -d)" + trap 'rm -rf "${tmp}"' EXIT + echo "tool/protoc: downloading protoc ${version} (${plat})..." >&2 + curl -fsSL -o "${tmp}/protoc.zip" "${url}" + if [[ -n "${checksum}" ]]; then + got="$(sha256 "${tmp}/protoc.zip")" + if [[ "${got}" != "${checksum}" ]]; then + echo "tool/protoc: checksum mismatch for protoc-${version}-${plat}.zip" >&2 + echo " expected ${checksum}" >&2 + echo " got ${got}" >&2 + exit 1 + fi + else + echo "tool/protoc: no pinned checksum for ${version}:${plat}; add one to tool/protoc" >&2 + echo " (downloaded sha256: $(sha256 "${tmp}/protoc.zip"))" >&2 + fi + rm -rf "${install_dir}" + mkdir -p "${install_dir}" + unzip -q "${tmp}/protoc.zip" -d "${install_dir}" +fi + +exec "${protoc_bin}" "$@" diff --git a/tool/protoc-gen-go b/tool/protoc-gen-go new file mode 100755 index 00000000..c4e9b53a --- /dev/null +++ b/tool/protoc-gen-go @@ -0,0 +1,26 @@ +#!/usr/bin/env bash +# +# Copyright (c) 2025 Uber Technologies, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Hermetic protoc-gen-go wrapper. Runs the version pinned by the `tool` +# directive in go.mod via the Go toolchain, so `make proto` produces identical +# output regardless of any host/`go install`ed protoc-gen-go. Mirrors +# ./tool/protoc (which pins protoc itself). protoc invokes this with no args and +# speaks the plugin protocol over stdin/stdout. + +set -euo pipefail + +repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" +exec go -C "${repo_root}" tool protoc-gen-go "$@" diff --git a/tool/protoc-gen-go-grpc b/tool/protoc-gen-go-grpc new file mode 100755 index 00000000..a1fb2707 --- /dev/null +++ b/tool/protoc-gen-go-grpc @@ -0,0 +1,26 @@ +#!/usr/bin/env bash +# +# Copyright (c) 2025 Uber Technologies, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Hermetic protoc-gen-go-grpc wrapper. Runs the version pinned by the `tool` +# directive in go.mod via the Go toolchain, so `make proto` produces identical +# output regardless of any host/`go install`ed protoc-gen-go-grpc. Mirrors +# ./tool/protoc (which pins protoc itself). protoc invokes this with no args and +# speaks the plugin protocol over stdin/stdout. + +set -euo pipefail + +repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" +exec go -C "${repo_root}" tool protoc-gen-go-grpc "$@" diff --git a/tool/protoc-gen-yarpc-go-v2 b/tool/protoc-gen-yarpc-go-v2 new file mode 100755 index 00000000..6eaeab4f --- /dev/null +++ b/tool/protoc-gen-yarpc-go-v2 @@ -0,0 +1,26 @@ +#!/usr/bin/env bash +# +# Copyright (c) 2025 Uber Technologies, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Hermetic protoc-gen-yarpc-go-v2 wrapper. Runs the version pinned by the `tool` +# directive in go.mod via the Go toolchain, so `make proto` produces identical +# output regardless of any host/`go install`ed protoc-gen-yarpc-go-v2. Mirrors +# ./tool/protoc (which pins protoc itself). protoc invokes this with no args and +# speaks the plugin protocol over stdin/stdout. + +set -euo pipefail + +repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" +exec go -C "${repo_root}" tool protoc-gen-yarpc-go-v2 "$@" From ccb4e778978aa65cf47ce0fa2cbca1eb126431aa Mon Sep 17 00:00:00 2001 From: Albert Wu Date: Thu, 4 Jun 2026 15:14:50 -0700 Subject: [PATCH 3/3] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- tool/protoc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tool/protoc b/tool/protoc index 523adbd9..0a0ad2a1 100755 --- a/tool/protoc +++ b/tool/protoc @@ -78,8 +78,9 @@ if [[ ! -x "${protoc_bin}" ]]; then exit 1 fi else - echo "tool/protoc: no pinned checksum for ${version}:${plat}; add one to tool/protoc" >&2 + echo "tool/protoc: no pinned checksum for ${version}:${plat}; refusing to run unverified download" >&2 echo " (downloaded sha256: $(sha256 "${tmp}/protoc.zip"))" >&2 + exit 1 fi rm -rf "${install_dir}" mkdir -p "${install_dir}"