Skip to content

Commit 16eaa0f

Browse files
albertywuclaude
andcommitted
fix(proto): generate yarpc stubs with v2 codec to match V2 messages
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) <noreply@anthropic.com>
1 parent f17c76f commit 16eaa0f

9 files changed

Lines changed: 128 additions & 160 deletions

File tree

Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -341,19 +341,19 @@ proto: ## Generate protobuf files from .proto definitions
341341
@echo "Generating protobuf files with protoc..."
342342
@protoc --go_out=submitqueue/gateway/protopb --go_opt=paths=source_relative \
343343
--go-grpc_out=submitqueue/gateway/protopb --go-grpc_opt=paths=source_relative \
344-
--yarpc-go_out=submitqueue/gateway/protopb --yarpc-go_opt=paths=source_relative \
344+
--yarpc-go-v2_out=submitqueue/gateway/protopb --yarpc-go-v2_opt=paths=source_relative \
345345
--proto_path=submitqueue/gateway/proto submitqueue/gateway/proto/gateway.proto
346346
@protoc --go_out=submitqueue/orchestrator/protopb --go_opt=paths=source_relative \
347347
--go-grpc_out=submitqueue/orchestrator/protopb --go-grpc_opt=paths=source_relative \
348-
--yarpc-go_out=submitqueue/orchestrator/protopb --yarpc-go_opt=paths=source_relative \
348+
--yarpc-go-v2_out=submitqueue/orchestrator/protopb --yarpc-go-v2_opt=paths=source_relative \
349349
--proto_path=submitqueue/orchestrator/proto submitqueue/orchestrator/proto/orchestrator.proto
350350
@protoc --go_out=stovepipe/gateway/protopb --go_opt=paths=source_relative \
351351
--go-grpc_out=stovepipe/gateway/protopb --go-grpc_opt=paths=source_relative \
352-
--yarpc-go_out=stovepipe/gateway/protopb --yarpc-go_opt=paths=source_relative \
352+
--yarpc-go-v2_out=stovepipe/gateway/protopb --yarpc-go-v2_opt=paths=source_relative \
353353
--proto_path=stovepipe/gateway/proto stovepipe/gateway/proto/gateway.proto
354354
@protoc --go_out=stovepipe/orchestrator/protopb --go_opt=paths=source_relative \
355355
--go-grpc_out=stovepipe/orchestrator/protopb --go-grpc_opt=paths=source_relative \
356-
--yarpc-go_out=stovepipe/orchestrator/protopb --yarpc-go_opt=paths=source_relative \
356+
--yarpc-go-v2_out=stovepipe/orchestrator/protopb --yarpc-go-v2_opt=paths=source_relative \
357357
--proto_path=stovepipe/orchestrator/proto stovepipe/orchestrator/proto/orchestrator.proto
358358
@echo "Protobuf files generated successfully!"
359359

stovepipe/gateway/protopb/BUILD.bazel

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,17 @@ go_library(
1010
importpath = "github.com/uber/submitqueue/stovepipe/gateway/protopb",
1111
visibility = ["//visibility:public"],
1212
deps = [
13-
"@com_github_gogo_protobuf//jsonpb",
14-
"@com_github_gogo_protobuf//proto",
1513
"@org_golang_google_grpc//:grpc",
1614
"@org_golang_google_grpc//codes",
1715
"@org_golang_google_grpc//status",
16+
"@org_golang_google_protobuf//proto",
1817
"@org_golang_google_protobuf//reflect/protoreflect",
1918
"@org_golang_google_protobuf//runtime/protoimpl",
2019
"@org_uber_go_fx//:fx",
2120
"@org_uber_go_yarpc//:yarpc",
2221
"@org_uber_go_yarpc//api/transport",
2322
"@org_uber_go_yarpc//api/x/restriction",
24-
"@org_uber_go_yarpc//encoding/protobuf",
2523
"@org_uber_go_yarpc//encoding/protobuf/reflection",
24+
"@org_uber_go_yarpc//encoding/protobuf/v2:protobuf",
2625
],
2726
)

stovepipe/gateway/protopb/gateway.pb.yarpc.go

Lines changed: 26 additions & 33 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

stovepipe/orchestrator/protopb/BUILD.bazel

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,17 @@ go_library(
1010
importpath = "github.com/uber/submitqueue/stovepipe/orchestrator/protopb",
1111
visibility = ["//visibility:public"],
1212
deps = [
13-
"@com_github_gogo_protobuf//jsonpb",
14-
"@com_github_gogo_protobuf//proto",
1513
"@org_golang_google_grpc//:grpc",
1614
"@org_golang_google_grpc//codes",
1715
"@org_golang_google_grpc//status",
16+
"@org_golang_google_protobuf//proto",
1817
"@org_golang_google_protobuf//reflect/protoreflect",
1918
"@org_golang_google_protobuf//runtime/protoimpl",
2019
"@org_uber_go_fx//:fx",
2120
"@org_uber_go_yarpc//:yarpc",
2221
"@org_uber_go_yarpc//api/transport",
2322
"@org_uber_go_yarpc//api/x/restriction",
24-
"@org_uber_go_yarpc//encoding/protobuf",
2523
"@org_uber_go_yarpc//encoding/protobuf/reflection",
24+
"@org_uber_go_yarpc//encoding/protobuf/v2:protobuf",
2625
],
2726
)

stovepipe/orchestrator/protopb/orchestrator.pb.yarpc.go

Lines changed: 26 additions & 33 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)