From f789dc1c0b98b371043cf4ab4c2ac184026693ef Mon Sep 17 00:00:00 2001 From: PatternCatalyst Date: Tue, 3 Nov 2026 23:36:53 -0500 Subject: [PATCH] fix(datamesh): pin protobuf gencode to the 5.29 runtime line The committed inventory stubs were regenerated by buf's unpinned remote plugins, which stamp a protobuf-6 gencode (Protobuf Python Version 7.36.2). Each service pins protobuf >=5.26,<6 (resolves to 5.29.6), and _pb2.py carries a runtime-version guard: the runtime must not be older than the gencode that stamped it. gencode 7.36.2 against runtime 5.29.6 raised VersionError at import, crash-looping inventory-service, order-service and graphql-gateway on OpenShift. Pin buf.gen.yaml to protocolbuffers/python:v29.3 (python protobuf 5.29.3) and grpc/python:v1.70.0 (last gRPC plugin on that line), and regenerate the committed stubs. gencode is now 5.29.3, which the 5.29.6 runtime accepts. Verified live on CRC: all three services Running 1/1; POST /orders drives the order->inventory gRPC check_stock (201 in-stock, 409 out-of-stock); the GraphQL gateway resolves Order.stock over gRPC. --- examples/lgtm-datamesh/buf.gen.yaml | 11 +++++++++-- .../gen/datamesh/inventory/v1/inventory_pb2.py | 8 ++++---- .../gen/datamesh/inventory/v1/inventory_pb2_grpc.py | 6 +++--- .../gen/datamesh/inventory/v1/inventory_pb2.py | 8 ++++---- .../gen/datamesh/inventory/v1/inventory_pb2_grpc.py | 6 +++--- .../gen/datamesh/inventory/v1/inventory_pb2.py | 8 ++++---- .../gen/datamesh/inventory/v1/inventory_pb2_grpc.py | 6 +++--- 7 files changed, 30 insertions(+), 23 deletions(-) diff --git a/examples/lgtm-datamesh/buf.gen.yaml b/examples/lgtm-datamesh/buf.gen.yaml index a38d815..6b14dfb 100644 --- a/examples/lgtm-datamesh/buf.gen.yaml +++ b/examples/lgtm-datamesh/buf.gen.yaml @@ -3,8 +3,15 @@ version: v2 # (_pb2_grpc.py) from the protos. Output goes to a staging dir that # gen-protos.sh then copies into each service that needs the stubs # (option b: per-service committed copies, no buf in the image). +# +# Plugin versions are PINNED to the protobuf 5.29 line. Each service pins +# protobuf >=5.26,<6, and a _pb2.py carries a runtime-version guard: the +# runtime must be >= the gencode version that stamped it. The unpinned +# `latest` plugin stamps a protobuf-6 gencode (7.x), which the 5.29.6 +# runtime rejects at import. protocolbuffers/python v29.x maps to python +# protobuf 5.29.x; grpc/python v1.70.x is the last gRPC plugin on that line. plugins: - - remote: buf.build/protocolbuffers/python + - remote: buf.build/protocolbuffers/python:v29.3 out: .gen-staging - - remote: buf.build/grpc/python + - remote: buf.build/grpc/python:v1.70.0 out: .gen-staging diff --git a/examples/lgtm-datamesh/services/graphql-gateway/gen/datamesh/inventory/v1/inventory_pb2.py b/examples/lgtm-datamesh/services/graphql-gateway/gen/datamesh/inventory/v1/inventory_pb2.py index ba2ea89..b87a541 100644 --- a/examples/lgtm-datamesh/services/graphql-gateway/gen/datamesh/inventory/v1/inventory_pb2.py +++ b/examples/lgtm-datamesh/services/graphql-gateway/gen/datamesh/inventory/v1/inventory_pb2.py @@ -2,7 +2,7 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # NO CHECKED-IN PROTOBUF GENCODE # source: datamesh/inventory/v1/inventory.proto -# Protobuf Python Version: 7.36.2 +# Protobuf Python Version: 5.29.3 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool @@ -11,9 +11,9 @@ from google.protobuf.internal import builder as _builder _runtime_version.ValidateProtobufRuntimeVersion( _runtime_version.Domain.PUBLIC, - 7, - 36, - 2, + 5, + 29, + 3, '', 'datamesh/inventory/v1/inventory.proto' ) diff --git a/examples/lgtm-datamesh/services/graphql-gateway/gen/datamesh/inventory/v1/inventory_pb2_grpc.py b/examples/lgtm-datamesh/services/graphql-gateway/gen/datamesh/inventory/v1/inventory_pb2_grpc.py index 99b115c..e470f38 100644 --- a/examples/lgtm-datamesh/services/graphql-gateway/gen/datamesh/inventory/v1/inventory_pb2_grpc.py +++ b/examples/lgtm-datamesh/services/graphql-gateway/gen/datamesh/inventory/v1/inventory_pb2_grpc.py @@ -5,7 +5,7 @@ from datamesh.inventory.v1 import inventory_pb2 as datamesh_dot_inventory_dot_v1_dot_inventory__pb2 -class InventoryServiceStub: +class InventoryServiceStub(object): """InventoryService answers stock questions for the order flow. r23 ships the single synchronous call order-service needs when placing an order; more RPCs are added as the inventory domain grows. @@ -24,7 +24,7 @@ def __init__(self, channel): _registered_method=True) -class InventoryServiceServicer: +class InventoryServiceServicer(object): """InventoryService answers stock questions for the order flow. r23 ships the single synchronous call order-service needs when placing an order; more RPCs are added as the inventory domain grows. @@ -54,7 +54,7 @@ def add_InventoryServiceServicer_to_server(servicer, server): # This class is part of an EXPERIMENTAL API. -class InventoryService: +class InventoryService(object): """InventoryService answers stock questions for the order flow. r23 ships the single synchronous call order-service needs when placing an order; more RPCs are added as the inventory domain grows. diff --git a/examples/lgtm-datamesh/services/inventory-service/gen/datamesh/inventory/v1/inventory_pb2.py b/examples/lgtm-datamesh/services/inventory-service/gen/datamesh/inventory/v1/inventory_pb2.py index ba2ea89..b87a541 100644 --- a/examples/lgtm-datamesh/services/inventory-service/gen/datamesh/inventory/v1/inventory_pb2.py +++ b/examples/lgtm-datamesh/services/inventory-service/gen/datamesh/inventory/v1/inventory_pb2.py @@ -2,7 +2,7 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # NO CHECKED-IN PROTOBUF GENCODE # source: datamesh/inventory/v1/inventory.proto -# Protobuf Python Version: 7.36.2 +# Protobuf Python Version: 5.29.3 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool @@ -11,9 +11,9 @@ from google.protobuf.internal import builder as _builder _runtime_version.ValidateProtobufRuntimeVersion( _runtime_version.Domain.PUBLIC, - 7, - 36, - 2, + 5, + 29, + 3, '', 'datamesh/inventory/v1/inventory.proto' ) diff --git a/examples/lgtm-datamesh/services/inventory-service/gen/datamesh/inventory/v1/inventory_pb2_grpc.py b/examples/lgtm-datamesh/services/inventory-service/gen/datamesh/inventory/v1/inventory_pb2_grpc.py index 99b115c..e470f38 100644 --- a/examples/lgtm-datamesh/services/inventory-service/gen/datamesh/inventory/v1/inventory_pb2_grpc.py +++ b/examples/lgtm-datamesh/services/inventory-service/gen/datamesh/inventory/v1/inventory_pb2_grpc.py @@ -5,7 +5,7 @@ from datamesh.inventory.v1 import inventory_pb2 as datamesh_dot_inventory_dot_v1_dot_inventory__pb2 -class InventoryServiceStub: +class InventoryServiceStub(object): """InventoryService answers stock questions for the order flow. r23 ships the single synchronous call order-service needs when placing an order; more RPCs are added as the inventory domain grows. @@ -24,7 +24,7 @@ def __init__(self, channel): _registered_method=True) -class InventoryServiceServicer: +class InventoryServiceServicer(object): """InventoryService answers stock questions for the order flow. r23 ships the single synchronous call order-service needs when placing an order; more RPCs are added as the inventory domain grows. @@ -54,7 +54,7 @@ def add_InventoryServiceServicer_to_server(servicer, server): # This class is part of an EXPERIMENTAL API. -class InventoryService: +class InventoryService(object): """InventoryService answers stock questions for the order flow. r23 ships the single synchronous call order-service needs when placing an order; more RPCs are added as the inventory domain grows. diff --git a/examples/lgtm-datamesh/services/order-service/gen/datamesh/inventory/v1/inventory_pb2.py b/examples/lgtm-datamesh/services/order-service/gen/datamesh/inventory/v1/inventory_pb2.py index ba2ea89..b87a541 100644 --- a/examples/lgtm-datamesh/services/order-service/gen/datamesh/inventory/v1/inventory_pb2.py +++ b/examples/lgtm-datamesh/services/order-service/gen/datamesh/inventory/v1/inventory_pb2.py @@ -2,7 +2,7 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # NO CHECKED-IN PROTOBUF GENCODE # source: datamesh/inventory/v1/inventory.proto -# Protobuf Python Version: 7.36.2 +# Protobuf Python Version: 5.29.3 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool @@ -11,9 +11,9 @@ from google.protobuf.internal import builder as _builder _runtime_version.ValidateProtobufRuntimeVersion( _runtime_version.Domain.PUBLIC, - 7, - 36, - 2, + 5, + 29, + 3, '', 'datamesh/inventory/v1/inventory.proto' ) diff --git a/examples/lgtm-datamesh/services/order-service/gen/datamesh/inventory/v1/inventory_pb2_grpc.py b/examples/lgtm-datamesh/services/order-service/gen/datamesh/inventory/v1/inventory_pb2_grpc.py index 99b115c..e470f38 100644 --- a/examples/lgtm-datamesh/services/order-service/gen/datamesh/inventory/v1/inventory_pb2_grpc.py +++ b/examples/lgtm-datamesh/services/order-service/gen/datamesh/inventory/v1/inventory_pb2_grpc.py @@ -5,7 +5,7 @@ from datamesh.inventory.v1 import inventory_pb2 as datamesh_dot_inventory_dot_v1_dot_inventory__pb2 -class InventoryServiceStub: +class InventoryServiceStub(object): """InventoryService answers stock questions for the order flow. r23 ships the single synchronous call order-service needs when placing an order; more RPCs are added as the inventory domain grows. @@ -24,7 +24,7 @@ def __init__(self, channel): _registered_method=True) -class InventoryServiceServicer: +class InventoryServiceServicer(object): """InventoryService answers stock questions for the order flow. r23 ships the single synchronous call order-service needs when placing an order; more RPCs are added as the inventory domain grows. @@ -54,7 +54,7 @@ def add_InventoryServiceServicer_to_server(servicer, server): # This class is part of an EXPERIMENTAL API. -class InventoryService: +class InventoryService(object): """InventoryService answers stock questions for the order flow. r23 ships the single synchronous call order-service needs when placing an order; more RPCs are added as the inventory domain grows.