fix(stepfunctions): let a mocked response with no attempts start the execution (#2823)

A MockedResponses entry with no attempt keys was rejected at StartExecution, so a
generated mock file failed the whole execution when the collection it was built from
was empty. Step Functions Local starts the execution and fails it with States.Runtime
only when the state that names the entry is entered.

An empty entry is a lookup that finds nothing, not a malformed entry. Floci already
accepts a mock that defines attempt 1 but not attempt 0 and fails the same way at run
time. Every other malformed entry keeps its 400 at StartExecution, which stays stricter
than Step Functions Local.

Verified against amazon/aws-stepfunctions-local:2.0.0.

Refs #2523
This commit is contained in:
TATSUNO “Taz” Yasuhiro authored and GitHub committed 2026-08-31 11:09:43 -04:00
1 parent b0fe8311a0
commit 63a2a60a30
5 files changed
+85 -5

No files matched your search

@@ -121,14 +121,15 @@ public class SfnMockLoader {
return root;
}
/**
* An entry with no attempts stays empty instead of being rejected. Step Functions Local
* treats it as a lookup that finds nothing, so the execution starts and fails with
* {@code States.Runtime} only if the state that names it is entered.
*/
private List<MockedResponseStep> parseSteps(String responseKey, JsonNode responseNode) {
var steps = new ArrayList<MockedResponseStep>();
responseNode.fields().forEachRemaining(
entry -> steps.add(parseStep(responseKey, entry.getKey(), entry.getValue())));
if (steps.isEmpty()) {
throw new AwsException("ValidationException",
"Mocked response '" + responseKey + "' must define at least one attempt entry", 400);
}
steps.sort(Comparator.comparingInt(MockedResponseStep::fromAttempt));
return List.copyOf(steps);
}