@@ -3265,3 +3265,36 @@ def test_state_replay_mode():
32653265 assert execution_state .is_replaying () is True
32663266 execution_state .track_replay (operation_id = "op2" )
32673267 assert execution_state .is_replaying () is False
3268+
3269+
3270+ def test_state_replay_mode_with_timed_out ():
3271+ """Test that TIMED_OUT operations are treated as terminal states for replay tracking.
3272+
3273+ This test verifies that when an operation has TIMED_OUT status, it is correctly
3274+ recognized as a completed/terminal state, allowing the replay status to transition
3275+ from REPLAY to NEW once all completed operations have been visited.
3276+
3277+ Regression test for: https://github.com/aws/aws-durable-execution-sdk-python/issues/262
3278+ """
3279+ operation1 = Operation (
3280+ operation_id = "op1" ,
3281+ operation_type = OperationType .STEP ,
3282+ status = OperationStatus .TIMED_OUT ,
3283+ )
3284+ operation2 = Operation (
3285+ operation_id = "op2" ,
3286+ operation_type = OperationType .STEP ,
3287+ status = OperationStatus .SUCCEEDED ,
3288+ )
3289+ execution_state = ExecutionState (
3290+ durable_execution_arn = "arn:aws:test" ,
3291+ initial_checkpoint_token = "test_token" , # noqa: S106
3292+ operations = {"op1" : operation1 , "op2" : operation2 },
3293+ service_client = Mock (),
3294+ replay_status = ReplayStatus .REPLAY ,
3295+ )
3296+ assert execution_state .is_replaying () is True
3297+ execution_state .track_replay (operation_id = "op1" )
3298+ assert execution_state .is_replaying () is True
3299+ execution_state .track_replay (operation_id = "op2" )
3300+ assert execution_state .is_replaying () is False
0 commit comments