* fix(stepfunctions): record the iterations a failing Map iteration cuts, and the state each was in
AWS records, for each iteration an inline Map failure cuts, a
MapIterationAborted and then the TaskStateAborted or WaitStateAborted
of the state it was in, all chained to the failing iteration's last
event and ahead of MapIterationFailed and MapStateFailed. Floci cancelled
the iterations and recorded nothing for them.
MapIterationScheduler cancelled the in-flight iterations without knowing
their chains, so the Map saw them only after they had left their states.
It now calls back with each in-flight index before cancelling, and the
Map reads and cuts each one in one step through abandonInState, as the
Parallel does. The failing iteration's MapIterationFailed is recorded by
the Map after the cut, so the aborted events come first; its
previousEventId is unchanged.
Closes#4722
* fix(stepfunctions): never report a Map iteration both ended and cut
The scheduler names every iteration it has not yet taken off its queue,
so an iteration that finished after the failing one was dequeued was
cut as well and recorded MapIterationAborted after its own
MapIterationSucceeded. The iteration's end event is now published under
the chain's lock together with an ended marker, and the cut reads that
marker in the same step it reads the state, so an iteration is reported
either ended or cut, never both.
* fix(stepfunctions): record the iterations a Map failure cut only with its MapIterationFailed
A States.Runtime failure records no MapIterationFailed. When it was a
declared tolerance that failure exceeded, the Map ended with
States.ExceedToleratedFailureThreshold instead, which passed the check
for the cut iterations, so they were recorded aborted without the
MapIterationFailed of the iteration that cut them. Both now follow the
one condition.
* fix(stepfunctions): record a cut Map iteration by the rule of the event it accompanies
The cut iterations are recorded right before MapStateFailed and now
follow its rule, that the failure ending the Map is not States.Runtime,
while MapIterationFailed keeps the iteration's own. Tying both to the
iteration's condition had dropped the cut iterations for an ItemSelector
that fails before its iteration starts, which has nothing to report
itself but still cuts the others and still records MapStateFailed.
An iteration is also reported cut only when its MapIterationStarted is
recorded: the start is published under the chain's lock with a started
marker, read by the cut in the same step, so an iteration cut while its
ItemSelector was still being evaluated records neither a start nor an
abort.
---------
Co-authored-by: mitsukado-shinagawa <mitsukado-shinagawa@users.noreply.github.com>