Skip to content

Commit a40f6a6

Browse files
committed
minor fix
1 parent f9989a9 commit a40f6a6

File tree

6 files changed

+3
-39
lines changed

6 files changed

+3
-39
lines changed

cadence/_internal/workflow/workflow_engine.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import asyncio
22
import logging
33
from dataclasses import dataclass
4-
from typing import Callable, Optional, Dict, Any
4+
from typing import Callable, Any
55

66
from cadence._internal.workflow.context import Context
77
from cadence.api.v1.decision_pb2 import Decision
@@ -16,8 +16,6 @@
1616
@dataclass
1717
class DecisionResult:
1818
decisions: list[Decision]
19-
force_create_new_decision_task: bool = False
20-
query_results: Optional[Dict[str, Any]] = None
2119

2220
class WorkflowEngine:
2321
def __init__(self, info: WorkflowInfo, client: Client, workflow_func: Callable[[Any], Any] | None = None):

cadence/worker/_decision_task_handler.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,7 @@ async def _respond_decision_task_completed(self, task: PollForDecisionTaskRespon
136136
task_token=task.task_token,
137137
decisions=decision_result.decisions,
138138
identity=self._identity,
139-
return_new_decision_task=True,
140-
force_create_new_decision_task=False
139+
return_new_decision_task=True
141140
)
142141

143142
await self._client.worker_stub.RespondDecisionTaskCompleted(request)

tests/cadence/_internal/workflow/test_workflow_engine_integration.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,6 @@ async def test_process_decision_success(self, workflow_engine, mock_client):
9696
# Verify the result
9797
assert isinstance(result, DecisionResult)
9898
assert len(result.decisions) == 1
99-
assert result.force_create_new_decision_task is False
100-
assert result.query_results is None
10199

102100
@pytest.mark.asyncio
103101
async def test_process_decision_with_history(self, workflow_engine, mock_client):
@@ -305,5 +303,4 @@ async def test_process_decision_with_query_results(self, workflow_engine, mock_c
305303
# Verify the result
306304
assert isinstance(result, DecisionResult)
307305
assert len(result.decisions) == 1
308-
assert result.force_create_new_decision_task is False
309-
assert result.query_results is None # Not set in this test
306+
# Not set in this test

tests/cadence/worker/test_decision_task_handler.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,6 @@ async def test_handle_task_implementation_success(self, handler, sample_decision
8787
mock_engine = Mock(spec=WorkflowEngine)
8888
mock_decision_result = Mock(spec=DecisionResult)
8989
mock_decision_result.decisions = [Decision()]
90-
mock_decision_result.force_create_new_decision_task = False
91-
mock_decision_result.query_results = {}
9290
mock_engine.process_decision = AsyncMock(return_value=mock_decision_result)
9391

9492
with patch('cadence.worker._decision_task_handler.WorkflowEngine', return_value=mock_engine):
@@ -147,8 +145,6 @@ async def test_handle_task_implementation_creates_new_engines(self, handler, sam
147145
mock_engine = Mock(spec=WorkflowEngine)
148146
mock_decision_result = Mock(spec=DecisionResult)
149147
mock_decision_result.decisions = []
150-
mock_decision_result.force_create_new_decision_task = False
151-
mock_decision_result.query_results = {}
152148
mock_engine.process_decision = AsyncMock(return_value=mock_decision_result)
153149

154150
with patch('cadence.worker._decision_task_handler.WorkflowEngine', return_value=mock_engine) as mock_engine_class:
@@ -231,8 +227,6 @@ async def test_respond_decision_task_completed_success(self, handler, sample_dec
231227
"""Test successful decision task completion response."""
232228
decision_result = Mock(spec=DecisionResult)
233229
decision_result.decisions = [Decision(), Decision()]
234-
decision_result.force_create_new_decision_task = False
235-
decision_result.query_results = None
236230

237231
await handler._respond_decision_task_completed(sample_decision_task, decision_result)
238232

@@ -242,31 +236,25 @@ async def test_respond_decision_task_completed_success(self, handler, sample_dec
242236
assert call_args.task_token == sample_decision_task.task_token
243237
assert call_args.identity == handler._identity
244238
assert call_args.return_new_decision_task
245-
assert not call_args.force_create_new_decision_task
246239
assert len(call_args.decisions) == 2
247240

248241
@pytest.mark.asyncio
249242
async def test_respond_decision_task_completed_no_query_results(self, handler, sample_decision_task):
250243
"""Test decision task completion response without query results."""
251244
decision_result = Mock(spec=DecisionResult)
252245
decision_result.decisions = []
253-
decision_result.force_create_new_decision_task = False
254-
decision_result.query_results = None
255246

256247
await handler._respond_decision_task_completed(sample_decision_task, decision_result)
257248

258249
call_args = handler._client.worker_stub.RespondDecisionTaskCompleted.call_args[0][0]
259250
assert call_args.return_new_decision_task
260-
assert not call_args.force_create_new_decision_task
261251
assert len(call_args.decisions) == 0
262252

263253
@pytest.mark.asyncio
264254
async def test_respond_decision_task_completed_error(self, handler, sample_decision_task):
265255
"""Test decision task completion response error handling."""
266256
decision_result = Mock(spec=DecisionResult)
267257
decision_result.decisions = []
268-
decision_result.force_create_new_decision_task = False
269-
decision_result.query_results = None
270258

271259
handler._client.worker_stub.RespondDecisionTaskCompleted.side_effect = Exception("Respond failed")
272260

@@ -283,8 +271,6 @@ async def test_workflow_engine_creation_with_workflow_info(self, handler, sample
283271
mock_engine = Mock(spec=WorkflowEngine)
284272
mock_decision_result = Mock(spec=DecisionResult)
285273
mock_decision_result.decisions = []
286-
mock_decision_result.force_create_new_decision_task = False
287-
mock_decision_result.query_results = {}
288274
mock_engine.process_decision = AsyncMock(return_value=mock_decision_result)
289275

290276
with patch('cadence.worker._decision_task_handler.WorkflowEngine', return_value=mock_engine) as mock_workflow_engine_class:

tests/cadence/worker/test_decision_task_handler_integration.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,6 @@ async def test_handle_decision_task_success(self, decision_task_handler, mock_cl
9898
decision = Decision()
9999
mock_engine.process_decision = AsyncMock(return_value=Mock(
100100
decisions=[decision], # Proper Decision object
101-
force_create_new_decision_task=False,
102-
query_results=None
103101
))
104102

105103
with patch('cadence.worker._decision_task_handler.WorkflowEngine', return_value=mock_engine):
@@ -155,8 +153,6 @@ async def test_workflow_engine_creation_each_task(self, decision_task_handler, m
155153
mock_engine = Mock()
156154
mock_engine.process_decision = AsyncMock(return_value=Mock(
157155
decisions=[],
158-
force_create_new_decision_task=False,
159-
query_results=None
160156
))
161157
mock_engine_class.return_value = mock_engine
162158

@@ -201,8 +197,6 @@ async def test_respond_decision_task_completed(self, decision_task_handler, mock
201197
# Create mock decision result
202198
decision_result = Mock()
203199
decision_result.decisions = [Decision()] # Proper Decision object
204-
decision_result.force_create_new_decision_task = False
205-
decision_result.query_results = None
206200

207201
# Call the response method
208202
await decision_task_handler._respond_decision_task_completed(decision_task, decision_result)

tests/cadence/worker/test_task_handler_integration.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,6 @@ async def test_full_task_handling_flow_success(self, handler, sample_decision_ta
6666
mock_engine = Mock(spec=WorkflowEngine)
6767
mock_decision_result = Mock(spec=DecisionResult)
6868
mock_decision_result.decisions = []
69-
mock_decision_result.force_create_new_decision_task = False
70-
mock_decision_result.query_results = None
7169
mock_engine.process_decision = AsyncMock(return_value=mock_decision_result)
7270

7371
with patch('cadence.worker._decision_task_handler.WorkflowEngine', return_value=mock_engine):
@@ -111,8 +109,6 @@ async def test_context_activation_integration(self, handler, sample_decision_tas
111109
mock_engine = Mock(spec=WorkflowEngine)
112110
mock_decision_result = Mock(spec=DecisionResult)
113111
mock_decision_result.decisions = []
114-
mock_decision_result.force_create_new_decision_task = False
115-
mock_decision_result.query_results = None
116112
mock_engine.process_decision = AsyncMock(return_value=mock_decision_result)
117113

118114
# Track if context is activated
@@ -162,8 +158,6 @@ async def test_multiple_workflow_executions(self, handler, mock_registry):
162158

163159
mock_decision_result = Mock(spec=DecisionResult)
164160
mock_decision_result.decisions = []
165-
mock_decision_result.force_create_new_decision_task = False
166-
mock_decision_result.query_results = None
167161

168162
mock_engine.process_decision = AsyncMock(return_value=mock_decision_result)
169163

@@ -189,8 +183,6 @@ async def test_workflow_engine_creation_integration(self, handler, sample_decisi
189183
mock_engine = Mock(spec=WorkflowEngine)
190184
mock_decision_result = Mock(spec=DecisionResult)
191185
mock_decision_result.decisions = []
192-
mock_decision_result.force_create_new_decision_task = False
193-
mock_decision_result.query_results = None
194186
mock_engine.process_decision = AsyncMock(return_value=mock_decision_result)
195187

196188
with patch('cadence.worker._decision_task_handler.WorkflowEngine', return_value=mock_engine) as mock_engine_class:
@@ -258,8 +250,6 @@ async def test_concurrent_task_handling(self, handler, mock_registry):
258250
mock_engine = Mock(spec=WorkflowEngine)
259251
mock_decision_result = Mock(spec=DecisionResult)
260252
mock_decision_result.decisions = []
261-
mock_decision_result.force_create_new_decision_task = False
262-
mock_decision_result.query_results = None
263253
mock_engine.process_decision = AsyncMock(return_value=mock_decision_result)
264254

265255
with patch('cadence.worker._decision_task_handler.WorkflowEngine', return_value=mock_engine):

0 commit comments

Comments
 (0)