Skip to content

Commit 5bca401

Browse files
THardy98tconley1428
authored andcommitted
Bump core commit to latest (#1413)
* Bump core commit to latest * Test fix - pass None to worker when deployment versioning is not configured * Support openapiv2 proto annotations sdk-core added protoc-gen-openapiv2 imports to cloud service protos. This broke proto generation in two ways: 1. protoc couldn't resolve the import — none of the existing --proto_path entries covered protoc-gen-openapiv2/. Added the protos/ root dir as a --proto_path so protoc-gen-openapiv2/options/annotations.proto is reachable. 2. The generated service_pb2.py requires the openapiv2 Python modules, which didn't exist. Generated openapiv2 protos and move them into temporalio/api/dependencies/protoc_gen_openapiv2/, with import rewrites to match. Also fixed the Docker proto generation (gen-protos-docker): google-adk requires protobuf>=5 which conflicts with the protobuf<4 downgrade needed for generation. Fix: remove google-adk before downgrading, matching the CI workflow. Mirrors sdk-dotnet#633.
1 parent b8bf04c commit 5bca401

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+7827
-1176
lines changed

scripts/gen_protos.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@
3939
partial(
4040
re.compile(r"from dependencies\.").sub, r"from temporalio.api.dependencies."
4141
),
42+
partial(
43+
re.compile(r"from protoc_gen_openapiv2\.").sub,
44+
r"from temporalio.api.dependencies.protoc_gen_openapiv2.",
45+
),
4246
partial(
4347
re.compile(r"from temporal\.sdk\.core\.").sub, r"from temporalio.bridge.proto."
4448
),
@@ -50,6 +54,10 @@
5054

5155
pyi_fixes = [
5256
partial(re.compile(r"temporal\.api\.").sub, r"temporalio.api."),
57+
partial(
58+
re.compile(r"protoc_gen_openapiv2\.").sub,
59+
r"temporalio.api.dependencies.protoc_gen_openapiv2.",
60+
),
5361
partial(re.compile(r"temporal\.sdk\.core\.").sub, r"temporalio.bridge.proto."),
5462
]
5563

@@ -163,6 +171,7 @@ def generate_protos(output_dir: Path):
163171
f"--proto_path={core_proto_dir}",
164172
f"--proto_path={testsrv_proto_dir}",
165173
f"--proto_path={health_proto_dir}",
174+
f"--proto_path={proto_dir}",
166175
f"--proto_path={test_proto_dir}",
167176
f"--proto_path={additional_proto_dir}",
168177
f"--python_out={output_dir}",
@@ -182,11 +191,16 @@ def generate_protos(output_dir: Path):
182191
grpc_file.unlink()
183192
# Apply fixes before moving code
184193
fix_generated_output(output_dir)
194+
# Move openapiv2 dependency protos
195+
deps_out_dir = api_out_dir / "dependencies"
196+
shutil.rmtree(deps_out_dir / "protoc_gen_openapiv2", ignore_errors=True)
197+
deps_out_dir.mkdir(exist_ok=True)
198+
(output_dir / "protoc_gen_openapiv2").replace(deps_out_dir / "protoc_gen_openapiv2")
199+
(deps_out_dir / "__init__.py").touch()
185200
# Move protos
186201
for p in (output_dir / "temporal" / "api").iterdir():
187202
shutil.rmtree(api_out_dir / p.name, ignore_errors=True)
188203
p.replace(api_out_dir / p.name)
189-
shutil.rmtree(api_out_dir / "dependencies", ignore_errors=True)
190204
for p in (output_dir / "temporal" / "sdk" / "core").iterdir():
191205
shutil.rmtree(sdk_out_dir / p.name, ignore_errors=True)
192206
p.replace(sdk_out_dir / p.name)

temporalio/api/cloud/account/v1/__init__.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
1-
from .message_pb2 import Account, AccountSpec, AuditLogSinkSpec, Metrics, MetricsSpec
1+
from .message_pb2 import (
2+
Account,
3+
AccountSpec,
4+
AuditLogSink,
5+
AuditLogSinkSpec,
6+
Metrics,
7+
MetricsSpec,
8+
)
29

310
__all__ = [
411
"Account",
512
"AccountSpec",
13+
"AuditLogSink",
614
"AuditLogSinkSpec",
715
"Metrics",
816
"MetricsSpec",

temporalio/api/cloud/account/v1/message_pb2.py

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

temporalio/api/cloud/account/v1/message_pb2.pyi

Lines changed: 101 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,17 @@ isort:skip_file
55

66
import builtins
77
import sys
8+
import typing
89

910
import google.protobuf.descriptor
11+
import google.protobuf.internal.enum_type_wrapper
1012
import google.protobuf.message
13+
import google.protobuf.timestamp_pb2
1114

1215
import temporalio.api.cloud.resource.v1.message_pb2
1316
import temporalio.api.cloud.sink.v1.message_pb2
1417

15-
if sys.version_info >= (3, 8):
18+
if sys.version_info >= (3, 10):
1619
import typing as typing_extensions
1720
else:
1821
import typing_extensions
@@ -200,3 +203,100 @@ class AuditLogSinkSpec(google.protobuf.message.Message):
200203
) -> typing_extensions.Literal["kinesis_sink", "pub_sub_sink"] | None: ...
201204

202205
global___AuditLogSinkSpec = AuditLogSinkSpec
206+
207+
class AuditLogSink(google.protobuf.message.Message):
208+
"""AuditLogSink is only used by Audit Log"""
209+
210+
DESCRIPTOR: google.protobuf.descriptor.Descriptor
211+
212+
class _Health:
213+
ValueType = typing.NewType("ValueType", builtins.int)
214+
V: typing_extensions.TypeAlias = ValueType
215+
216+
class _HealthEnumTypeWrapper(
217+
google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[
218+
AuditLogSink._Health.ValueType
219+
],
220+
builtins.type,
221+
): # noqa: F821
222+
DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor
223+
HEALTH_UNSPECIFIED: AuditLogSink._Health.ValueType # 0
224+
HEALTH_OK: AuditLogSink._Health.ValueType # 1
225+
"""The audit log sink is healthy and functioning correctly."""
226+
HEALTH_ERROR_INTERNAL: AuditLogSink._Health.ValueType # 2
227+
"""The audit log sink has an internal error."""
228+
HEALTH_ERROR_USER_CONFIGURATION: AuditLogSink._Health.ValueType # 3
229+
"""The audit log sink has a configuration error."""
230+
231+
class Health(_Health, metaclass=_HealthEnumTypeWrapper):
232+
"""The health status of the audit log sink."""
233+
234+
HEALTH_UNSPECIFIED: AuditLogSink.Health.ValueType # 0
235+
HEALTH_OK: AuditLogSink.Health.ValueType # 1
236+
"""The audit log sink is healthy and functioning correctly."""
237+
HEALTH_ERROR_INTERNAL: AuditLogSink.Health.ValueType # 2
238+
"""The audit log sink has an internal error."""
239+
HEALTH_ERROR_USER_CONFIGURATION: AuditLogSink.Health.ValueType # 3
240+
"""The audit log sink has a configuration error."""
241+
242+
NAME_FIELD_NUMBER: builtins.int
243+
RESOURCE_VERSION_FIELD_NUMBER: builtins.int
244+
STATE_FIELD_NUMBER: builtins.int
245+
SPEC_FIELD_NUMBER: builtins.int
246+
HEALTH_FIELD_NUMBER: builtins.int
247+
ERROR_MESSAGE_FIELD_NUMBER: builtins.int
248+
LAST_SUCCEEDED_TIME_FIELD_NUMBER: builtins.int
249+
name: builtins.str
250+
"""Name of the sink e.g. "audit_log_01" """
251+
resource_version: builtins.str
252+
"""The version of the audit log sink resource."""
253+
state: temporalio.api.cloud.resource.v1.message_pb2.ResourceState.ValueType
254+
"""The current state of the audit log sink."""
255+
@property
256+
def spec(self) -> global___AuditLogSinkSpec:
257+
"""The specification details of the audit log sink."""
258+
health: global___AuditLogSink.Health.ValueType
259+
"""The health status of the audit log sink."""
260+
error_message: builtins.str
261+
"""An error message describing any issues with the audit log sink, if applicable."""
262+
@property
263+
def last_succeeded_time(self) -> google.protobuf.timestamp_pb2.Timestamp:
264+
"""The last succeeded timestamp for the internal workflow responsible for adding data to the sink."""
265+
def __init__(
266+
self,
267+
*,
268+
name: builtins.str = ...,
269+
resource_version: builtins.str = ...,
270+
state: temporalio.api.cloud.resource.v1.message_pb2.ResourceState.ValueType = ...,
271+
spec: global___AuditLogSinkSpec | None = ...,
272+
health: global___AuditLogSink.Health.ValueType = ...,
273+
error_message: builtins.str = ...,
274+
last_succeeded_time: google.protobuf.timestamp_pb2.Timestamp | None = ...,
275+
) -> None: ...
276+
def HasField(
277+
self,
278+
field_name: typing_extensions.Literal[
279+
"last_succeeded_time", b"last_succeeded_time", "spec", b"spec"
280+
],
281+
) -> builtins.bool: ...
282+
def ClearField(
283+
self,
284+
field_name: typing_extensions.Literal[
285+
"error_message",
286+
b"error_message",
287+
"health",
288+
b"health",
289+
"last_succeeded_time",
290+
b"last_succeeded_time",
291+
"name",
292+
b"name",
293+
"resource_version",
294+
b"resource_version",
295+
"spec",
296+
b"spec",
297+
"state",
298+
b"state",
299+
],
300+
) -> None: ...
301+
302+
global___AuditLogSink = AuditLogSink

temporalio/api/cloud/auditlog/__init__.py

Whitespace-only changes.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
from .message_pb2 import LogRecord, Principal
2+
3+
__all__ = [
4+
"LogRecord",
5+
"Principal",
6+
]

temporalio/api/cloud/auditlog/v1/message_pb2.py

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

0 commit comments

Comments
 (0)