Skip to content

Commit 3c091e9

Browse files
committed
Error on constructing start operation with invalid conflict policy
1 parent 2ca6a0c commit 3c091e9

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

temporalio/client.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2606,6 +2606,8 @@ def __init__(
26062606
name, result_type_from_run_fn = (
26072607
temporalio.workflow._Definition.get_name_and_result_type(workflow)
26082608
)
2609+
if id_conflict_policy == temporalio.common.WorkflowIDConflictPolicy.UNSPECIFIED:
2610+
raise ValueError("WorkflowIDConflictPolicy is required")
26092611

26102612
self._start_workflow_input = UpdateWithStartStartWorkflowInput(
26112613
workflow=name,

tests/worker/test_update_with_start.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -496,3 +496,22 @@ async def test_update_with_start_client_outbound_interceptor(
496496

497497
wf_handle = await start_op.workflow_handle()
498498
assert await wf_handle.result() == "intercepted-workflow-arg"
499+
500+
501+
def test_with_start_workflow_operation_requires_conflict_policy():
502+
with pytest.raises(ValueError):
503+
WithStartWorkflowOperation(
504+
WorkflowForUpdateWithStartTest.run,
505+
0,
506+
id="wid-1",
507+
id_conflict_policy=WorkflowIDConflictPolicy.UNSPECIFIED,
508+
task_queue="test-queue",
509+
)
510+
511+
with pytest.raises(TypeError):
512+
WithStartWorkflowOperation( # type: ignore
513+
WorkflowForUpdateWithStartTest.run,
514+
0,
515+
id="wid-1",
516+
task_queue="test-queue",
517+
)

0 commit comments

Comments
 (0)