Skip to content

Commit 47bf3f8

Browse files
fix(datamesh): pin protobuf gencode to the 5.29 runtime line (#26)
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.
1 parent dfd3757 commit 47bf3f8

7 files changed

Lines changed: 30 additions & 23 deletions

File tree

‎examples/lgtm-datamesh/buf.gen.yaml‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,15 @@ version: v2
33
# (_pb2_grpc.py) from the protos. Output goes to a staging dir that
44
# gen-protos.sh then copies into each service that needs the stubs
55
# (option b: per-service committed copies, no buf in the image).
6+
#
7+
# Plugin versions are PINNED to the protobuf 5.29 line. Each service pins
8+
# protobuf >=5.26,<6, and a _pb2.py carries a runtime-version guard: the
9+
# runtime must be >= the gencode version that stamped it. The unpinned
10+
# `latest` plugin stamps a protobuf-6 gencode (7.x), which the 5.29.6
11+
# runtime rejects at import. protocolbuffers/python v29.x maps to python
12+
# protobuf 5.29.x; grpc/python v1.70.x is the last gRPC plugin on that line.
613
plugins:
7-
- remote: buf.build/protocolbuffers/python
14+
- remote: buf.build/protocolbuffers/python:v29.3
815
out: .gen-staging
9-
- remote: buf.build/grpc/python
16+
- remote: buf.build/grpc/python:v1.70.0
1017
out: .gen-staging

‎examples/lgtm-datamesh/services/graphql-gateway/gen/datamesh/inventory/v1/inventory_pb2.py‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Generated by the protocol buffer compiler. DO NOT EDIT!
33
# NO CHECKED-IN PROTOBUF GENCODE
44
# source: datamesh/inventory/v1/inventory.proto
5-
# Protobuf Python Version: 7.36.2
5+
# Protobuf Python Version: 5.29.3
66
"""Generated protocol buffer code."""
77
from google.protobuf import descriptor as _descriptor
88
from google.protobuf import descriptor_pool as _descriptor_pool
@@ -11,9 +11,9 @@
1111
from google.protobuf.internal import builder as _builder
1212
_runtime_version.ValidateProtobufRuntimeVersion(
1313
_runtime_version.Domain.PUBLIC,
14-
7,
15-
36,
16-
2,
14+
5,
15+
29,
16+
3,
1717
'',
1818
'datamesh/inventory/v1/inventory.proto'
1919
)

‎examples/lgtm-datamesh/services/graphql-gateway/gen/datamesh/inventory/v1/inventory_pb2_grpc.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from datamesh.inventory.v1 import inventory_pb2 as datamesh_dot_inventory_dot_v1_dot_inventory__pb2
66

77

8-
class InventoryServiceStub:
8+
class InventoryServiceStub(object):
99
"""InventoryService answers stock questions for the order flow. r23 ships the
1010
single synchronous call order-service needs when placing an order; more
1111
RPCs are added as the inventory domain grows.
@@ -24,7 +24,7 @@ def __init__(self, channel):
2424
_registered_method=True)
2525

2626

27-
class InventoryServiceServicer:
27+
class InventoryServiceServicer(object):
2828
"""InventoryService answers stock questions for the order flow. r23 ships the
2929
single synchronous call order-service needs when placing an order; more
3030
RPCs are added as the inventory domain grows.
@@ -54,7 +54,7 @@ def add_InventoryServiceServicer_to_server(servicer, server):
5454

5555

5656
# This class is part of an EXPERIMENTAL API.
57-
class InventoryService:
57+
class InventoryService(object):
5858
"""InventoryService answers stock questions for the order flow. r23 ships the
5959
single synchronous call order-service needs when placing an order; more
6060
RPCs are added as the inventory domain grows.

‎examples/lgtm-datamesh/services/inventory-service/gen/datamesh/inventory/v1/inventory_pb2.py‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Generated by the protocol buffer compiler. DO NOT EDIT!
33
# NO CHECKED-IN PROTOBUF GENCODE
44
# source: datamesh/inventory/v1/inventory.proto
5-
# Protobuf Python Version: 7.36.2
5+
# Protobuf Python Version: 5.29.3
66
"""Generated protocol buffer code."""
77
from google.protobuf import descriptor as _descriptor
88
from google.protobuf import descriptor_pool as _descriptor_pool
@@ -11,9 +11,9 @@
1111
from google.protobuf.internal import builder as _builder
1212
_runtime_version.ValidateProtobufRuntimeVersion(
1313
_runtime_version.Domain.PUBLIC,
14-
7,
15-
36,
16-
2,
14+
5,
15+
29,
16+
3,
1717
'',
1818
'datamesh/inventory/v1/inventory.proto'
1919
)

‎examples/lgtm-datamesh/services/inventory-service/gen/datamesh/inventory/v1/inventory_pb2_grpc.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from datamesh.inventory.v1 import inventory_pb2 as datamesh_dot_inventory_dot_v1_dot_inventory__pb2
66

77

8-
class InventoryServiceStub:
8+
class InventoryServiceStub(object):
99
"""InventoryService answers stock questions for the order flow. r23 ships the
1010
single synchronous call order-service needs when placing an order; more
1111
RPCs are added as the inventory domain grows.
@@ -24,7 +24,7 @@ def __init__(self, channel):
2424
_registered_method=True)
2525

2626

27-
class InventoryServiceServicer:
27+
class InventoryServiceServicer(object):
2828
"""InventoryService answers stock questions for the order flow. r23 ships the
2929
single synchronous call order-service needs when placing an order; more
3030
RPCs are added as the inventory domain grows.
@@ -54,7 +54,7 @@ def add_InventoryServiceServicer_to_server(servicer, server):
5454

5555

5656
# This class is part of an EXPERIMENTAL API.
57-
class InventoryService:
57+
class InventoryService(object):
5858
"""InventoryService answers stock questions for the order flow. r23 ships the
5959
single synchronous call order-service needs when placing an order; more
6060
RPCs are added as the inventory domain grows.

‎examples/lgtm-datamesh/services/order-service/gen/datamesh/inventory/v1/inventory_pb2.py‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Generated by the protocol buffer compiler. DO NOT EDIT!
33
# NO CHECKED-IN PROTOBUF GENCODE
44
# source: datamesh/inventory/v1/inventory.proto
5-
# Protobuf Python Version: 7.36.2
5+
# Protobuf Python Version: 5.29.3
66
"""Generated protocol buffer code."""
77
from google.protobuf import descriptor as _descriptor
88
from google.protobuf import descriptor_pool as _descriptor_pool
@@ -11,9 +11,9 @@
1111
from google.protobuf.internal import builder as _builder
1212
_runtime_version.ValidateProtobufRuntimeVersion(
1313
_runtime_version.Domain.PUBLIC,
14-
7,
15-
36,
16-
2,
14+
5,
15+
29,
16+
3,
1717
'',
1818
'datamesh/inventory/v1/inventory.proto'
1919
)

‎examples/lgtm-datamesh/services/order-service/gen/datamesh/inventory/v1/inventory_pb2_grpc.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from datamesh.inventory.v1 import inventory_pb2 as datamesh_dot_inventory_dot_v1_dot_inventory__pb2
66

77

8-
class InventoryServiceStub:
8+
class InventoryServiceStub(object):
99
"""InventoryService answers stock questions for the order flow. r23 ships the
1010
single synchronous call order-service needs when placing an order; more
1111
RPCs are added as the inventory domain grows.
@@ -24,7 +24,7 @@ def __init__(self, channel):
2424
_registered_method=True)
2525

2626

27-
class InventoryServiceServicer:
27+
class InventoryServiceServicer(object):
2828
"""InventoryService answers stock questions for the order flow. r23 ships the
2929
single synchronous call order-service needs when placing an order; more
3030
RPCs are added as the inventory domain grows.
@@ -54,7 +54,7 @@ def add_InventoryServiceServicer_to_server(servicer, server):
5454

5555

5656
# This class is part of an EXPERIMENTAL API.
57-
class InventoryService:
57+
class InventoryService(object):
5858
"""InventoryService answers stock questions for the order flow. r23 ships the
5959
single synchronous call order-service needs when placing an order; more
6060
RPCs are added as the inventory domain grows.

0 commit comments

Comments
 (0)