@@ -313,8 +313,12 @@ async def check_behavior_for_try_cancel(
313313) -> None :
314314 """
315315 Check that a cancellation request is sent and the caller workflow nexus op future is unblocked
316- as cancelled before the cancel handler returns (i.e. before the
317- NexusOperationCancelRequestCompleted in the caller workflow history).
316+ as cancelled before the caller server writes CANCEL_REQUESTED.
317+
318+ There is a race between (a) the caller server writing CANCEL_REQUEST_COMPLETED in response to
319+ the cancel handler returning, and (b) the caller server writing CANCELED in response to the
320+ handler workflow exiting as canceled. If (b) happens first then (a) may never happen, therefore
321+ we do not make any assertions regarding CANCEL_REQUEST_COMPLETED.
318322 """
319323 try :
320324 await handler_wf .result ()
@@ -343,23 +347,14 @@ async def check_behavior_for_try_cancel(
343347 await assert_event_subsequence (
344348 [
345349 (caller_wf , EventType .EVENT_TYPE_NEXUS_OPERATION_CANCEL_REQUESTED ),
346- (caller_wf , EventType .EVENT_TYPE_NEXUS_OPERATION_CANCEL_REQUEST_COMPLETED ),
347350 (caller_wf , EventType .EVENT_TYPE_NEXUS_OPERATION_CANCELED ),
348351 ]
349352 )
350353 op_cancel_requested_event = await get_event_time (
351354 caller_wf ,
352355 EventType .EVENT_TYPE_NEXUS_OPERATION_CANCEL_REQUESTED ,
353356 )
354- op_cancel_request_completed_event = await get_event_time (
355- caller_wf ,
356- EventType .EVENT_TYPE_NEXUS_OPERATION_CANCEL_REQUEST_COMPLETED ,
357- )
358- assert (
359- caller_op_future_resolved
360- < op_cancel_requested_event
361- < op_cancel_request_completed_event
362- )
357+ assert caller_op_future_resolved < op_cancel_requested_event
363358
364359
365360async def check_behavior_for_wait_cancellation_requested (
0 commit comments