Skip to content

Fix proto compilation errors and gRPC reflection failures - #20

Open
KshitijKaushik123 wants to merge 1 commit into
IABTechLab:mainfrom
KshitijKaushik123:fix/proto-grpc-reflection-bugs
Open

Fix proto compilation errors and gRPC reflection failures#20
KshitijKaushik123 wants to merge 1 commit into
IABTechLab:mainfrom
KshitijKaushik123:fix/proto-grpc-reflection-bugs

Conversation

@KshitijKaushik123

Copy link
Copy Markdown

Summary

While trying to build and test the gRPC interface locally, I ran into a chain of issues that all trace back to a partial proto refactor (services split into a separate file + migration to edition = "2023") where the generated code and sample payloads weren't updated to match.

Here's what I found and fixed:

1. Wrong nested type reference in proto
agenticrtbframework.proto:198 referenced BidRequest.Metric, but Metric is actually nested inside Imp in the OpenRTB v2 proto. The generated Go code already had the correct path (BidRequest_Imp_Metric), but the proto source couldn't be regenerated because of this mismatch.

2. Import path mismatch
The proto imported from com/iabtechlab/openrtb/v2.6/openrtb.proto, but the actual file sits at v2/openrtb.proto. This caused the describe reflection failure — the registered FileDescriptors didn't match what the stubs declared.

3. Generated code out of sync
The committed .pb.go files were generated with an older protoc from before the services were split into agenticrtbframeworkservices.proto. Neither proto file had go_package options, generate.sh only processed the main proto (not the services file), and the Makefile bindings target referenced a non-existent root-level openrtb.proto with the now-unnecessary --experimental_editions flag.

Fixed by:

  • Restoring go_package options in both proto files
  • Updating generate.sh to also process the services proto and emit gRPC stubs
  • Fixing the Makefile bindings target with correct proto paths
  • Regenerating all pkg/pb/ files with current protoc
  • Removing the stale agenticrtbframework_grpc.pb.go (services now generate their own grpc file)

4. Sample payloads use integers for bool fields
multi-impression.json and native-ad.json used 0/1 for fields that the OpenRTB proto declares as bool (device.js, regs.coppa, regs.gdpr, source.fd). The web UI path is lenient about this, but the gRPC path fails with expecting boolean ; instead got 1 due to the strict protobuf-JSON marshaler.

Testing

After applying all fixes:

  • go build ./... passes clean
  • go vet ./... passes clean
  • scripts/generate.sh runs without errors and produces consistent output on re-run
  • Regenerated code compiles and matches the updated proto definitions

Tested against the reproduction steps from #11 — proto compilation, reflection, and sample payload issues are all resolved.

Closes #11

- Fix wrong nested type reference: BidRequest.Metric -> BidRequest.Imp.Metric
  in agenticrtbframework.proto (Metric is nested inside Imp, not BidRequest)
- Fix import path mismatch: openrtb proto lives at v2/, not v2.6/
- Add go_package option to both proto files so protoc-gen-go can regenerate
- Update generate.sh to process the services proto and emit gRPC stubs
- Fix Makefile bindings target: correct proto paths, drop --experimental_editions
- Regenerate pkg/pb/ with current protoc to match updated proto sources
- Remove stale agenticrtbframework_grpc.pb.go (services now in separate proto)
- Fix sample JSON payloads: use true/false for bool-typed OpenRTB fields
  instead of 1/0 which breaks the strict protobuf-JSON marshaler via gRPC

Closes IABTechLab#11
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.

Multiple proto/generated-code/sample bugs prevent gRPC reflection and break sample payloads

1 participant