anchor.diff:          <<"timestamp">> => ?RAND_ELEMENT([?NOW_SEC() - 100, ?NOW_SEC(), ?NOW_SEC() + 3700]),
           <<"value">> => ?RAND_INT(10000000)
       }.
  -
  -
  -%% @private
  -interrupt_workflow_execution(AtmMockCallCtx) ->
  -    atm_workflow_execution_test_utils:stop_workflow_execution(interrupt, AtmMockCallCtx).
  -
  -
  -%% @private
  -expect_execution_stopping_while_processing_lane2(ExpState0, Reason) ->
  -    ExpState1 = atm_workflow_execution_exp_state_builder:expect_all_tasks_stopping_due_to({2, 1}, Reason, ExpState0),
  -    ExpState2 = atm_workflow_execution_exp_state_builder:expect_lane_run_stopping({2, 1}, ExpState1),
  -    atm_workflow_execution_exp_state_builder:expect_workflow_execution_stopping(ExpState2).
  -
  -
  -%% @private
  -build_expect_task2_stopped_exp_state_diff(ExpectTask2FinalStatus) ->
  -    fun(#atm_mock_call_ctx{workflow_execution_exp_state = ExpState}) ->
  -        AtmTaskExecutionId = atm_workflow_execution_exp_state_builder:get_task_id(
  -            {{2, 1}, <<"pb2">>, <<"task2">>}, ExpState
  -        ),
  -        {true, expect_lane2_pb_stopped(ExpectTask2FinalStatus, AtmTaskExecutionId, ExpState)}
  -    end.
  -
  -
  -%% @private
  -build_crash_handle_task_execution_stopped_step_mock_spec() ->
  -    #atm_step_mock_spec{
  -        strategy = {yield, {error, crashed}},
  -        after_step_exp_state_diff = no_diff
  -    }.
  -
  -
  -%% @private
  -build_crash_handle_lane_execution_stopped_step_mock_spec(ExpTask1FinalStatus) ->
  -    #atm_step_mock_spec{
  -        after_step_exp_state_diff = fun(#atm_mock_call_ctx{workflow_execution_exp_state = ExpState0}) ->
  -            ExpState1 = expect_pb1_stopped(ExpTask1FinalStatus, ExpState0),
  -            {true, atm_workflow_execution_exp_state_builder:expect_lane_run_crashed({2, 1}, ExpState1)}
  -        end
  -    }.
  -
  -
  -%% @private
  -build_crash_handle_workflow_abruptly_stopped_step_mock_spec(AfterHook) ->
  -    #atm_step_mock_spec{
  -        before_step_hook = AfterHook,
  -        after_step_exp_state_diff = fun(#atm_mock_call_ctx{workflow_execution_exp_state = ExpState0}) ->
  -            {true, atm_workflow_execution_exp_state_builder:expect_workflow_execution_crashed(ExpState0)}
  -        end
  -    }.
  -
  -
  -%% @private
  -build_lane2_task_execution_stopped_after_step_diff(ExpectTask1FinalStatus) ->
  -    fun(#atm_mock_call_ctx{
  -        workflow_execution_exp_state = ExpState0,
  -        call_args = [_AtmWorkflowExecutionId, _AtmWorkflowExecutionEnv, AtmTaskExecutionId]
  -    }) ->
  -        case atm_workflow_execution_exp_state_builder:get_task_selector(AtmTaskExecutionId, ExpState0) of
  -            {_, <<"pb1">>, <<"task1">>} ->
  -                {true, expect_lane2_pb_stopped(ExpectTask1FinalStatus, AtmTaskExecutionId, ExpState0)};
  -            {_, <<"pb2">>, <<"task2">>} ->
  -                % task2 should be stopped before handle_task_execution_stopped callback is called
  -                false
  -        end
  -    end.
  -
  -
  -%% @private
  -expect_pb1_stopped(ExpTask1FinalStatus, ExpState) ->
  -    AtmTask1ExecutionId = atm_workflow_execution_exp_state_builder:get_task_id(
  -        {{2, 1}, <<"pb1">>, <<"task1">>}, ExpState
  -    ),
  -    expect_lane2_pb_stopped(ExpTask1FinalStatus, AtmTask1ExecutionId, ExpState).
  -
  -
  -%% @private
  -expect_lane2_pb_stopped(ExpectTaskFinalStatus, AtmTaskExecutionId, ExpState0) ->
  -    atm_workflow_execution_exp_state_builder:expect_task_parallel_box_transitioned_to_inferred_status(
  -        AtmTaskExecutionId,
  -        % lane2 parallel boxes have only single task and as such their final status
  -        % will be the same as that of their respective task
  -        fun(_, _) -> ExpectTaskFinalStatus end,
  -        expect_lane2_task_stopped(ExpectTaskFinalStatus, AtmTaskExecutionId, ExpState0)
  -    ).
  -
  -
  -%% @private
  -expect_lane2_task_stopped(<<"paused">>, AtmTaskExecutionId, ExpState0) ->
  -    atm_workflow_execution_exp_state_builder:expect_task_paused(AtmTaskExecutionId, ExpState0);
  -
  -expect_lane2_task_stopped(<<"interrupted">>, AtmTaskExecutionId, ExpState0) ->
  -    atm_workflow_execution_exp_state_builder:expect_task_interrupted(AtmTaskExecutionId, ExpState0);
  -
  -expect_lane2_task_stopped(<<"skipped">>, AtmTaskExecutionId, ExpState0) ->
  -    atm_workflow_execution_exp_state_builder:expect_task_skipped(AtmTaskExecutionId, ExpState0);
  -
  -expect_lane2_task_stopped(<<"failed">>, AtmTaskExecutionId, ExpState0) ->
  -    atm_workflow_execution_exp_state_builder:expect_task_failed(AtmTaskExecutionId, ExpState0);
  -
  -expect_lane2_task_stopped(<<"cancelled">>, AtmTaskExecutionId, ExpState0) ->
  -    atm_workflow_execution_exp_state_builder:expect_task_cancelled(AtmTaskExecutionId, ExpState0).
  -
  -
  -%% @private
  -expect_lane_runs_rerunable(AtmLaneRunSelectors, ExpState) ->
  -    lists:foldl(fun(AtmLaneRunSelector, ExpStateAcc) ->
  -        atm_workflow_execution_exp_state_builder:expect_lane_run_rerunable(AtmLaneRunSelector, ExpStateAcc)
  -    end, ExpState, AtmLaneRunSelectors).
  
positive.code:                     % Failure occurs during streamed data processing
                      process_streamed_task_data = #atm_step_mock_spec{
                          before_step_hook = fun atm_workflow_execution_test_utils:pause_workflow_execution/1,
  
                          before_step_exp_state_diff = fun(#atm_mock_call_ctx{workflow_execution_exp_state = ExpState0}) ->
                              {true, expect_execution_stopping_while_processing_lane2(ExpState0, pause)}
                          end,
                          %% already stopped task2 changes status from paused to interrupted due to task1 failure
                          after_step_exp_state_diff = build_expect_task2_stopped_exp_state_diff(<<"interrupted">>)
                      },
                      handle_task_execution_stopped = #atm_step_mock_spec{
                          % Ensure failure prevails against pause
                          before_step_hook = fun atm_workflow_execution_test_utils:pause_workflow_execution/1,
  
                          after_step_exp_state_diff = build_lane2_task_execution_stopped_after_step_diff(<<"failed">>)
                      },
                      handle_lane_execution_stopped = #atm_step_mock_spec{
                          after_step_exp_state_diff = fun(#atm_mock_call_ctx{workflow_execution_exp_state = ExpState0}) ->
                              {true, atm_workflow_execution_exp_state_builder:expect_lane_run_failed({2, 1}, ExpState0)}
                          end
                      }
                  }
              ],
              handle_workflow_execution_stopped = #atm_step_mock_spec{
                  after_step_exp_state_diff = fun(#atm_mock_call_ctx{workflow_execution_exp_state = ExpState0}) ->
                      ExpState1 = expect_lane_runs_rerunable([{1, 1}, {2, 1}], ExpState0),
                      {true, atm_workflow_execution_exp_state_builder:expect_workflow_execution_failed(ExpState1)}
                  end
              }
          }]
      }).
  
negative.code:         }
      }
  ).
  
  -define(TASK1_SELECTOR(__ATM_LANE_RUN_SELECTOR), {__ATM_LANE_RUN_SELECTOR, <<"pb1">>, <<"task1">>}).
  -define(TASK2_SELECTOR(__ATM_LANE_RUN_SELECTOR), {__ATM_LANE_RUN_SELECTOR, <<"pb2">>, <<"task2">>}).
  
  -define(PB1_SELECTOR(__ATM_LANE_RUN_SELECTOR), {__ATM_LANE_RUN_SELECTOR, <<"pb1">>}).
  -define(PB2_SELECTOR(__ATM_LANE_RUN_SELECTOR), {__ATM_LANE_RUN_SELECTOR, <<"pb2">>}).
  
  -define(PB1_TASK1_STATUS_EXPECTATIONS(Status), [
      {task, ?TASK1_SELECTOR({2, 1}), Status},
      {parallel_box, ?PB1_SELECTOR({2, 1}), Status}
  ]).
  -define(PB2_TASK2_STATUS_EXPECTATIONS(Status), [
      {task, ?TASK2_SELECTOR({2, 1}), Status},
      {parallel_box, ?PB2_SELECTOR({2, 1}), Status}
  ]).
  
  -define(CRASHING_TASK_EXECUTION_STOPPED_STEP_MOCK, #atm_step_mock_spec{
      strategy = {yield, {error, crashed}},
      after_step_exp_state_diff = no_diff
  }).
  
  -define(INVALID_DISPATCH_RULE, #atm_time_series_dispatch_rule{
      measurement_ts_name_matcher_type = exact,
  