Skip to content

Commit 893447d

Browse files
committed
Edit TODOs
1 parent 70cccee commit 893447d

File tree

5 files changed

+25
-32
lines changed

5 files changed

+25
-32
lines changed

temporalio/nexus/_util.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,15 +85,13 @@ def _get_start_method_input_and_output_type_annotations(
8585
try:
8686
type_annotations = typing.get_type_hints(start)
8787
except TypeError:
88-
# TODO(preview): stacklevel
8988
warnings.warn(
9089
f"Expected decorated start method {start} to have type annotations"
9190
)
9291
return None, None
9392
output_type = type_annotations.pop("return", None)
9493

9594
if len(type_annotations) != 2:
96-
# TODO(preview): stacklevel
9795
suffix = f": {type_annotations}" if type_annotations else ""
9896
warnings.warn(
9997
f"Expected decorated start method {start} to have exactly 2 "
@@ -104,7 +102,6 @@ def _get_start_method_input_and_output_type_annotations(
104102
else:
105103
ctx_type, input_type = type_annotations.values()
106104
if not issubclass(ctx_type, WorkflowRunOperationContext):
107-
# TODO(preview): stacklevel
108105
warnings.warn(
109106
f"Expected first parameter of {start} to be an instance of "
110107
f"WorkflowRunOperationContext, but is {ctx_type}."

temporalio/worker/_workflow_instance.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -869,7 +869,7 @@ def _apply_resolve_nexus_operation_start(
869869
# Note that core will still send a `ResolveNexusOperation` job in the same
870870
# activation, so there does not need to be an exceptional case for this in
871871
# lang.
872-
# TODO(dan): confirm appropriate to take no action here
872+
# TODO(nexus-prerelease): confirm appropriate to take no action here
873873
pass
874874
else:
875875
raise ValueError(f"Unknown Nexus operation start status: {job}")
@@ -893,7 +893,6 @@ def _apply_resolve_nexus_operation(
893893
)
894894
handle._resolve_success(output)
895895
elif result.HasField("failed"):
896-
# TODO(dan): test failure converter
897896
handle._resolve_failure(
898897
self._failure_converter.from_failure(
899898
result.failed, self._payload_converter
@@ -2991,9 +2990,9 @@ async def cancel(self) -> None:
29912990
await self._instance._cancel_external_workflow(command)
29922991

29932992

2994-
# TODO(dan): are we sure we don't want to inherit from asyncio.Task as ActivityHandle and
2995-
# ChildWorkflowHandle do? I worry that we should provide .done(), .result(), .exception()
2996-
# etc for consistency.
2993+
# TODO(nexus-preview): are we sure we don't want to inherit from asyncio.Task as
2994+
# ActivityHandle and ChildWorkflowHandle do? I worry that we should provide .done(),
2995+
# .result(), .exception() etc for consistency.
29972996
class _NexusOperationHandle(temporalio.workflow.NexusOperationHandle[OutputT]):
29982997
def __init__(
29992998
self,
@@ -3011,7 +3010,7 @@ def __init__(
30113010

30123011
@property
30133012
def operation_token(self) -> Optional[str]:
3014-
# TODO(dan): How should this behave?
3013+
# TODO(nexus-prerelease): How should this behave?
30153014
# Java has a separate class that only exists if the operation token exists:
30163015
# https://github.com/temporalio/sdk-java/blob/master/temporal-sdk/src/main/java/io/temporal/internal/sync/NexusOperationExecutionImpl.java#L26
30173016
# And Go similar:

temporalio/workflow.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1983,7 +1983,7 @@ class _AsyncioTask(asyncio.Task[AnyType]):
19831983
pass
19841984

19851985
else:
1986-
# TODO(dan): inherited classes should be other way around?
1986+
# TODO: inherited classes should be other way around?
19871987
class _AsyncioTask(Generic[AnyType], asyncio.Task):
19881988
pass
19891989

tests/nexus/test_handler.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,6 @@ async def run(self, input: Input) -> Output:
130130
return Output(value=f"from link test workflow: {input.value}")
131131

132132

133-
# TODO: implement some of these ops as explicit OperationHandler classes to provide coverage for that?
134-
135-
136133
# The service_handler decorator is applied by the test
137134
class MyServiceHandler:
138135
@sync_operation

tests/nexus/test_workflow_caller.py

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@
5151
from temporalio.worker import Worker
5252
from tests.helpers.nexus import create_nexus_endpoint, make_nexus_endpoint_name
5353

54-
# TODO(dan): test availability of Temporal client etc in async context set by worker
55-
# TODO(dan): test worker shutdown, wait_all_completed, drain etc
56-
# TODO(dan): test worker op handling failure
54+
# TODO(nexus-prerelease): test availability of Temporal client etc in async context set by worker
55+
# TODO(nexus-prerelease): test worker shutdown, wait_all_completed, drain etc
56+
# TODO(nexus-prerelease): test worker op handling failure
5757

5858
# -----------------------------------------------------------------------------
5959
# Test definition
@@ -145,7 +145,7 @@ async def run(
145145
)
146146

147147

148-
# TODO: make types pass pyright strict mode
148+
# TODO(nexus-prerelease): check type-checking passing in CI
149149

150150

151151
class SyncOrAsyncOperation(OperationHandler[OpInput, OpOutput]):
@@ -156,7 +156,7 @@ async def start(
156156
StartOperationResultAsync,
157157
]:
158158
if input.response_type.exception_in_operation_start:
159-
# TODO(dan): don't think RPCError should be used here
159+
# TODO(nexus-prerelease): don't think RPCError should be used here
160160
raise RPCError(
161161
"RPCError INVALID_ARGUMENT in Nexus operation",
162162
RPCStatusCode.INVALID_ARGUMENT,
@@ -381,7 +381,7 @@ class UntypedCallerWorkflow:
381381
def __init__(
382382
self, input: CallerWfInput, request_cancel: bool, task_queue: str
383383
) -> None:
384-
# TODO(dan): untyped caller cannot reference name of implementation. I think this is as it should be.
384+
# TODO(nexus-prerelease): untyped caller cannot reference name of implementation. I think this is as it should be.
385385
service_name = "ServiceInterface"
386386
self.nexus_client = workflow.NexusClient(
387387
service=service_name,
@@ -427,9 +427,9 @@ async def run(
427427
#
428428

429429

430-
# TODO(dan): cross-namespace tests
431-
# TODO(dan): nexus endpoint pytest fixture?
432-
# TODO(dan): test headers
430+
# TODO(nexus-prerelease): cross-namespace tests
431+
# TODO(nexus-prerelease): nexus endpoint pytest fixture?
432+
# TODO(nexus-prerelease): test headers
433433
@pytest.mark.parametrize("exception_in_operation_start", [False, True])
434434
@pytest.mark.parametrize("request_cancel", [False, True])
435435
@pytest.mark.parametrize(
@@ -476,7 +476,7 @@ async def test_sync_response(
476476
task_queue=task_queue,
477477
)
478478

479-
# TODO(dan): check bidi links for sync operation
479+
# TODO(nexus-prerelease): check bidi links for sync operation
480480

481481
# The operation result is returned even when request_cancel=True, because the
482482
# response was synchronous and it could not be cancelled. See explanation below.
@@ -551,7 +551,7 @@ async def test_async_response(
551551
)
552552
return
553553

554-
# TODO(dan): race here? How do we know it hasn't been canceled already?
554+
# TODO(nexus-prerelease): race here? How do we know it hasn't been canceled already?
555555
handler_wf_info = await handler_wf_handle.describe()
556556
assert handler_wf_info.status in [
557557
WorkflowExecutionStatus.RUNNING,
@@ -736,8 +736,8 @@ class ServiceClassNameOutput:
736736
name: str
737737

738738

739-
# TODO(dan): test interface op types not matching
740-
# TODO(dan): async and non-async cancel methods
739+
# TODO(nexus-prerelease): test interface op types not matching
740+
# TODO(nexus-prerelease): async and non-async cancel methods
741741

742742

743743
@nexusrpc.service
@@ -822,12 +822,12 @@ async def run(
822822
endpoint=make_nexus_endpoint_name(task_queue),
823823
)
824824

825-
# TODO(dan): maybe not surprising that this doesn't type check given complexity of
825+
# TODO(nexus-prerelease): maybe not surprising that this doesn't type check given complexity of
826826
# the union?
827827
return await nexus_client.execute_operation(service_cls.op, None) # type: ignore
828828

829829

830-
# TODO(dan): check missing decorator behavior
830+
# TODO(nexus-prerelease): check missing decorator behavior
831831

832832

833833
async def test_service_interface_and_implementation_names(client: Client):
@@ -979,8 +979,8 @@ async def test_workflow_run_operation_can_execute_workflow_before_starting_backi
979979
assert result == "result-1-result-2"
980980

981981

982-
# TODO(dan): test invalid service interface implementations
983-
# TODO(dan): test caller passing output_type
982+
# TODO(nexus-prerelease): test invalid service interface implementations
983+
# TODO(nexus-prerelease): test caller passing output_type
984984

985985

986986
async def assert_caller_workflow_has_link_to_handler_workflow(
@@ -1444,10 +1444,10 @@ def __init__(self, input: ErrorTestInput):
14441444
async def run(self, input: ErrorTestInput) -> None:
14451445
try:
14461446
await self.nexus_client.execute_operation(
1447-
# TODO(nexus-preview): why wasn't this a type error?
1447+
# TODO(nexus-prerelease): why wasn't this a type error?
14481448
# ErrorTestService.op, ErrorTestCallerWfInput()
14491449
ErrorTestService.op,
1450-
# TODO(nexus-preview): why wasn't this a type error?
1450+
# TODO(nexus-prerelease): why wasn't this a type error?
14511451
# None
14521452
input,
14531453
)

0 commit comments

Comments
 (0)