mirror of
https://github.com/floci-io/floci.git
synced 2026-11-22 21:50:46 -05:00
7dc514b52f2c96bdd1ea32ae64a02703f85be2aa
56
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
fc5e1aea0a |
feat(stepfunctions): emit execution status change events to EventBridge (#5567)
* feat(stepfunctions): emit execution status change events to EventBridge STANDARD executions now publish "Step Functions Execution Status Change" events (source aws.states) to the default EventBridge bus on RUNNING, SUCCEEDED, FAILED, TIMED_OUT and ABORTED, so rules matching aws.states fire as they do on AWS. EXPRESS executions emit nothing, as on AWS. StepFunctionsEventPublisher follows the EcsEventPublisher pattern. RUNNING is published when StartExecution creates the execution, terminal statuses from the worker's completion callback, and ABORTED from StopExecution only, so a stopped execution emits exactly one ABORTED. An idempotent StartExecution and the startup sweep of executions abandoned by a restart emit nothing. * fix(stepfunctions): match the documented execution status change event Address review feedback on the aws.states events: - Always send stateMachineVersionArn and stateMachineAliasArn, null when unused, as AWS's documented events do. - Report redrive status as the documented examples do: FAILED and TIMED_OUT are REDRIVABLE with "Execution is <status> and is redrivable"; RUNNING, SUCCEEDED and ABORTED are NOT_REDRIVABLE with "Execution is <status> and cannot be redriven". - Name States.Timeout as the error of a TIMED_OUT event. - Apply the 248 KiB rule: input is left out when the escaped input and output together exceed it, output when the escaped output alone does, and inputDetails/outputDetails.included report it. * test(stepfunctions): check event absences without waiting on empty queues The integration test long-polled SQS for 2 s after each case to show nothing more arrived, so the class waited about 10 s by design. It now asserts only the events that should arrive. The absences that matter are checked in StepFunctionsServiceExecutionEventsTest: it captures the completion callback from a mocked AslExecutor and verifies that an EXPRESS execution publishes nothing and that the worker's callback after StopExecution adds no second ABORTED. Add StepFunctionsExecutions.waitForTerminalState to the shared testing package and use it here; moving the other Step Functions integration tests onto it is left for a separate PR. |
||
|
|
c6c2c609c3 |
fix(stepfunctions): authorize a Lambda task as the state machine's execution role (#5554)
Under IAM enforcement, a Lambda task naming a function in another account was refused outright, because Floci evaluated no Lambda function policy when #5079 added the check, and a task on a function in the state machine's own account was not checked at all. Function policies now take part in authorization (#5476), so a task is decided the way Lambda decides the Invoke call the execution role makes (Step Functions Developer Guide, "I can't invoke a Lambda function from another account"): within one account the role's policies or the function's policy can allow it, and across accounts both have to (IAM User Guide, cross-account policy evaluation logic). - LambdaTaskAuthorizer evaluates the role's policies, its permissions boundary and its account's SCPs together with the function policy LambdaResourcePolicyProvider supplies. The role ARN has to name an existing role, path included, matched as STS AssumeRole matches one (IamService.roleArnMatches), and the role is evaluated under the ARN IAM holds for it. - The task is authorized against the function ARN LambdaArnUtils.functionArn gives for its reference: a full ARN as written, a name or partial ARN completed in the state machine's partition, Region and account, with the version or alias it names, as Lambda authorizes an invoke. - A task whose Credentials name a role invokes the function as that role, once the execution role has assumed it (Developer Guide, Task state "Credentials"). The role's trust policy has to allow the execution role, with the state machine's ARN as sts:ExternalId, which the cross-account tutorial's trust policy checks. The execution role's own policies have to allow sts:AssumeRole on the role too when it is in another account, or when the trust policy names only the execution role's account, since an account principal delegates to the account (IAM User Guide, "AWS account principals"); AssumeRolePolicyEvaluator.decide tells the two grants apart. RoleArn is read the way the task's Parameters or Arguments are. A role the execution role cannot assume fails the task with States.Permissions, the Developer Guide's error for a task without the privileges to run. - A refusal to invoke fails the task with Lambda.AccessDeniedException. The cause names the role's session as the Step Functions Developer Guide shows it (arn:aws:sts::<account>:assumed-role/<role>) and ends in the IAM User Guide's context for the policy type that refused it, explicit denials first, each in AWS's evaluation order: service control policies, the resource-based policy or role trust policy, identity-based policies, the permissions boundary. |
||
|
|
ae75a653d6 |
feat(redshift-data): add async execution and statement status events (#5383)
* feat(redshift-data): add async execution and statement status events
* fix(redshift-data): address review findings on async Data API
- Mark a statement FAILED when its worker dies unexpectedly instead of leaving it active
- Let unexpected publisher errors propagate; the delivery pool logs them at error level
- Run CREATE/DROP INDEX CONCURRENTLY, REINDEX CONCURRENTLY, ALTER SYSTEM and tablespace DDL outside a transaction
- Drop WaitTimeSeconds from Scheduler targets so the shared dispatcher thread never blocks
- Share result rows and column metadata between snapshots; ListStatements no longer copies results
- Replace the global monitor with a ReentrantReadWriteLock for status writes and reset
* fix(redshift-data): reject CancelStatement on terminal statements
- Throw ValidationException ("Could not cancel a query that is already in <STATE> state.") instead of returning Status false, as AWS does
- Use WaitTimeSeconds instead of 30 s polling in the Serverless compatibility test and the Spectrum integration test
* fix(redshift-data): match AWS CancelStatement message and tidy test signature
- Append "with ID: <id>" to the terminal-state ValidationException message
- Drop the unused throws InterruptedException from workgroupLifecycleUsesAwsSdk
|
||
|
|
1a6f336e9f |
feat(redshift): run Data API statements from Step Functions and Scheduler (#5312)
* feat(redshift): run Data API statements from Step Functions and Scheduler Step Functions: add the arn:aws:states:::aws-sdk:redshiftdata:<action> Task integration. It reuses RedshiftDataJsonHandler, so every Data API action Floci implements works for provisioned clusters (ClusterIdentifier) and Serverless workgroups (WorkgroupName). Arguments and results keep the wire PascalCase names, CreatedAt and UpdatedAt are ISO-8601 at any depth, errors surface as RedshiftData.<Code>Exception, and the task fails when redshift or redshift-data is disabled. .sync resources are rejected, as AWS has no such variant. Scheduler: add the redshiftdata:executeStatement and redshiftdata:batchExecuteStatement universal targets. The call runs as the schedule's account and region, because the dispatcher thread carries no request account and cluster and statement storage is account-aware. A SQL error stays on the statement; a request the Data API rejects propagates so the existing retry and dead-letter handling applies. * fix(redshift-data): validate task input and isolate statement storage by account * fix(redshift): run scheduled Data API statements off the dispatcher thread Keep the request check on the dispatcher so a rejected request still retries, and run the SQL on its own thread under the schedule's account. Ask ServiceRegistry whether redshift-data is enabled instead of repeating the rule, keep the resolver and connection factory package-private, and cover the provisioned-cluster account in the resolver test. * fix(scheduler): await scheduled Redshift Data statement in docker test |
||
|
|
da53fc1c05 |
docs(partition): document deployment, test coverage and known gaps (#5292)
* docs(partition): document deployment, test coverage and known gaps partitions.md said every partition-dependent rule had integration tests over all eight partitions and that the China compat allowlist only shrinks. Neither is accurate now: most services are tested in China alone, and the allowlist is empty. The page now states the coverage as it is (unit tests over every partition, IAM, Step Functions and the cross-service smoke test through the emulator, China end to end), gives a recipe for running a China, GovCloud, ISO or EUSC deployment, and lists the known gaps: global state shared across partitions in one process (now naming the Identity Center instance, which the smoke test's inventory exempts for that reason), the commercial managed-policy catalog, and client tooling untested outside the commercial partition. API Gateway, IAM and Step Functions gain a Partitions section, and the WAFv2 scope note names the partition's CloudFront region and where the CLOUDFRONT scope exists. * docs(partition): say only custom domains refuse EDGE, and when FLOCI_HOSTNAME is enough The API Gateway Partitions section said EDGE was refused outside the commercial partition and that REGIONAL and PRIVATE worked everywhere. Only custom domains are checked: createRestApi and the REST API update path accept EDGE in any partition, and createDomainName refuses PRIVATE in all of them. The section now says so. The deployment recipe offered FLOCI_HOSTNAME for a different port, but it replaces only the host and keeps FLOCI_BASE_URL's port, so a different port needs FLOCI_BASE_URL. |
||
|
|
955c11dc56 |
fix(stepfunctions): record the iterations a failing Map iteration cuts, and the state each was in (#4724)
* 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> |
||
|
|
fd094aee05 |
fix(stepfunctions): return the PascalCase execution envelope from states:startExecution, .sync and .sync:2 (#4737)
AWS returns, as the Task result of the optimized states:startExecution
integration (measured in ap-northeast-1 on 2026-09-30):
- request-response: the StartExecution response, {ExecutionArn, StartDate},
StartDate in epoch milliseconds
- .sync: the child's DescribeExecution response, PascalCase with its keys
in alphabetical order, dates in epoch milliseconds, Input and Output as
JSON strings
- .sync:2: the same envelope with Input and Output as JSON values
Floci returned camelCase with dates in seconds for the first two and the
child's output alone for .sync:2, so a state machine written against AWS
found nothing at $.Output, $.ExecutionArn or $.Status.
The failure cause of the two .sync modes already built this envelope
(#4675). It now builds the success result too: a SUCCEEDED child carries
Output, OutputDetails and RedriveStatusReason and reports NOT_REDRIVABLE.
Request-response returns the response TaskSubmitted already records.
This changes the result shape for state machines written against Floci's
earlier one: the child output of .sync:2 moves from $ to $.Output.
Closes #4723
Co-authored-by: mitsukado-shinagawa <mitsukado-shinagawa@users.noreply.github.com>
|
||
|
|
6ca104042b |
fix(stepfunctions): fail a Parallel the moment any branch fails, whichever is listed first (#4713)
executeParallelState joined the branch futures in declaration order, so a failure in a later branch was only seen once every earlier branch had returned: a .sync Task listed before the failing branch kept the Parallel running until its job ended on its own, and a Wait listed first until the Wait ended. AWS fails the Parallel within about 0.1 s of the failing branch either way (measured in #4646). The branches now go through an ExecutorCompletionService, as the Map iterations already do, and are polled as they complete under the same two deadlines. The failed branch is the one whose future came off the queue, so continueFrom and the aborted-state events of #4660 attach to the same chain. The outputs are collected by branch index and still come back in declaration order. Closes #4646 Co-authored-by: mitsukado-shinagawa <mitsukado-shinagawa@users.noreply.github.com> |
||
|
|
2eadc106c5 |
fix(stepfunctions): record TaskSubmitted for a .sync Task, named as AWS names it (#4719)
* fix(stepfunctions): record TaskSubmitted for a .sync Task, named as AWS names it
AWS records TaskSubmitted for every .sync Task once the call that starts
the job has returned and before it waits on the job, chained to
TaskStarted and carrying that call's response as output in PascalCase:
{ExecutionArn, StartDate} in epoch milliseconds for states:startExecution
.sync and .sync:2, {Failures, Tasks} for ecs:runTask.sync. Floci recorded
nothing between TaskStarted and the terminal event, so a client reading
the job's id from the history found nothing until the Task ended.
The two poll loops do not have the HistoryChain; invokeResource hands
them a callback that publishes the event. The SDK's SdkHttpMetadata and
SdkResponseMetadata, which AWS folds into the response, are left out,
as everywhere else in Floci.
The task event profile also split a well-formed integration id at its
last colon, so every event of a .sync:2 Task read resourceType
states:startExecution.sync, resource 2. AWS reports states /
startExecution.sync:2, so a parsed id now splits at its service.
Closes #4648
* test(stepfunctions): name the types in the TaskSubmitted history test
* fix(stepfunctions): stop the job when TaskSubmitted cannot be recorded
TaskSubmitted is the first event after the job exists. When it is the
event that hits the 25,000-event history limit, the publish throws
before the poll loop whose catch stops the job is entered, so the parent
failed with States.Runtime while the child execution or ECS task ran on.
Both loops now abort the job on that path, the way the wait would have.
---------
Co-authored-by: mitsukado-shinagawa <mitsukado-shinagawa@users.noreply.github.com>
|
||
|
|
ae710c04d0 |
test(stepfunctions): pin that a failing Map iteration stops the .sync job of another (#4712)
* test(stepfunctions): pin that a failing Map iteration stops the .sync job of another The Run a Job guide names an uncaught failure in a Map iteration, next to a Parallel branch failure, as a reason a .sync job is aborted. #4660 covers it through the same InterruptedException catch, because MapIterationScheduler cancels the sibling iterations with cancel(true), but only Parallel was named in step-functions.md and no test held the Map case. One executor test now runs an inline Map whose "fail" item fails while the other item's Task waits on a child execution, and asserts the child is aborted with the AWS cause. Without the catch it fails (child never stopped). The doc names the Map case beside the Parallel one, and the gaps paragraph no longer says a cut Parallel branch is unrecorded, which #4660 changed. Follow-up from the review of #4660. * docs(stepfunctions): record what AWS writes for a Map iteration it cuts Measured in ap-northeast-1: an inline Map iteration that fails records a MapIterationAborted for each iteration it cuts and the *StateAborted of the state it was in, all chained to the failing iteration's last event and before MapIterationFailed and MapStateFailed. The child the cut Task waited on is aborted within about 0.15 s with the Task-state cause, with or without a Catch on the Map. The gaps paragraph and the test's javadoc now say so. --------- Co-authored-by: mitsukado-shinagawa <mitsukado-shinagawa@users.noreply.github.com> |
||
|
|
7ff6a7cfa7 |
fix(stepfunctions): fail a .sync Task on its child with States.TaskFailed and the child's description (#4675)
* fix(stepfunctions): fail a .sync Task on its child with States.TaskFailed and the child's description Measured on AWS (ap-northeast-1, 2026-09-29), six child endings under both states:startExecution.sync and .sync:2: FAILED with a custom error with and without a cause, FAILED with States.Timeout from a Task's own TimeoutSeconds, FAILED with States.TaskFailed, TIMED_OUT, and ABORTED by a StopExecution carrying an error and a cause. In every case the parent Task fails with States.TaskFailed, and the cause is the child's DescribeExecution response as JSON: PascalCase, keys in alphabetical order, Cause and Error only when the child has them, dates in epoch milliseconds, no Output. Floci passed the child's own error and cause straight through, falling back to States.TaskFailed and "Nested execution ended with status: X" only when the child had none. The error name matched AWS in two of the six cases and the cause in none, so a parent Catch on States.TaskFailed missed a child that failed with its own error or timed out, and a Catch on the child's error name fired where AWS never takes it. Closes #4562 * fix(stepfunctions): read a nested child's terminal state consistently, and keep its alias and version Review of #4675. The poll read the child's status without the monitor its worker and StopExecution write the terminal fields under (status last), so a terminal status could be seen before the error, cause or stop date behind it, and the cause built from a half-written child. The status is now read under that monitor, which makes everything written before it visible. A child started through an alias or a version also carries StateMachineAliasArn and StateMachineVersionArn in the cause, measured on AWS (ap-northeast-1, 2026-09-29): an alias gives both, a version only the version, each in its alphabetical place between StartDate and Status. --------- Co-authored-by: mitsukado-shinagawa <mitsukado-shinagawa@users.noreply.github.com> |
||
|
|
dc3beadf6a |
fix(stepfunctions): stop a .sync job whenever its Task is cut, and record the cut state (#4660)
* fix(stepfunctions): stop a .sync job whenever its Task is cut, and record the cut state Measured on AWS (ap-northeast-1, 2026-09-29): Step Functions stops the job a .sync Task waits on however the Task ends before the job does. Besides the Task's own TimeoutSeconds and StopExecution, which #4519 covered, that is the execution's budget (child ABORTED, ECS task UserInitiated, both at the budget) and a failure in a sibling Parallel branch (both within about 0.1 s of the failure), always with the cause "The Task state in AWS Step Functions execution [<arn>] which was managing this resource was aborted". Floci left the job running in both cases: the poll loops only stopped it on the Task's own timeout, and an interrupt from a cut Parallel unwound through them untouched. AWS also records the state each cut branch was in: one TaskStateAborted per cut Task, or WaitStateAborted for a cut Wait, each chained to the failing branch's last event and recorded before ParallelStateFailed, which points at that same event. The Parallel now reads each branch's current state before it cuts them and records those events with HistoryChain.publishBeside. The execution's budget records none, as on AWS. Part of #4646 * fix(stepfunctions): read and cut a Parallel branch in one step Review of #4660: the state a branch is in was published apart from the event that enters or exits it, and read apart from the cut. A sibling failure could therefore see a TaskStateEntered with no state marked and record no TaskStateAborted, or mark a state that then exited before the cut and record TaskStateAborted after its TaskStateExited. HistoryChain now publishes the Entered and Exited events together with the marker (publishStateEntered, publishStateExited), and the Parallel reads and cuts each branch with abandonInState, all under the chain's lock. A Task whose own failure ends its branch leaves the state and records its TaskStateAborted in one step too (leaveStateAside), so a concurrent cut reports it at most once. runState leaves the state in a finally for the paths that end by throwing. * fix(stepfunctions): let the cut branch's state alone decide its aborted event Review of #4660: the cut read each branch's future after cutting it, so a branch that finished in between had its Exited event suppressed by the cut and its *StateAborted skipped by the isDone check, leaving a state with neither. The future read is not needed: runState leaves every state it entered before the branch returns, so a finished branch, the failed one included, is always read as between states. The cut now decides on the state it reads under the chain's lock and nothing else. * test(stepfunctions): assert the parent's budget aborts a nested child over HTTP StepFunctionsTimeoutSecondsIntegrationTest still said the child keeps running when the parent's TimeoutSeconds fires, which this PR changes to match AWS. The comment now says the child is aborted, and the test asserts it through ListExecutions, so the change is covered end to end and not only by the executor's unit tests. --------- Co-authored-by: mitsukado-shinagawa <mitsukado-shinagawa@users.noreply.github.com> |
||
|
|
ac41ff339a |
fix(stepfunctions): bound a .sync Task by its TimeoutSeconds, not by a poll count (#4519)
* fix(stepfunctions): bound a .sync Task by its TimeoutSeconds, not by a poll count A Task waiting on ecs:runTask.sync or states:startExecution.sync gave up after 600 polls at 100 ms, about 60 seconds, whatever its TimeoutSeconds said; that clock was read for a task-token wait alone. The deadline is now computed once at schedule time and shared by awaitToken and both .sync loops, which poll until it or the execution's budget fires. The Task's clock ends the state as States.Timeout with a TaskTimedOut event and no cause, the shape the token wait already used. Closes #4518 * fix(stepfunctions): stop the job a timed-out .sync Task was waiting on Measured on AWS: when a Task's TimeoutSeconds fires around an ecs:runTask.sync or states:startExecution.sync, Step Functions stops the ECS task (stopCode UserInitiated) or aborts the child execution, both with the cause "The Task state in AWS Step Functions execution [<arn>] which was managing this resource was aborted". Floci left the job running. Best effort, like AWS: a job already gone is logged and the timeout is still what the state reports. * fix(stepfunctions): end a .sync wait on StopExecution and start its clock at schedule time Review follow-ups on #4519. The Task's TimeoutSeconds is read before the scheduled event is built, so a large input cannot extend it. A late wake re-reads the execution's clock, so a spent budget ends the execution TIMED_OUT rather than the Task. Both .sync loops read the execution back each poll and, once StopExecution has marked it ABORTED, stop the job and unwind without writing an event, instead of polling until a clock ran out. Tests cover .sync:2 under a Catch on States.Timeout and the aborted parent; the nested test imports its types. * docs(stepfunctions): drop the two em dashes the .sync timeout change added * chore(stepfunctions): let sleepOrTimeOutExecution delegate to sleepOrTimeOutTask With no Task deadline (Long.MAX_VALUE) sleepOrTimeOutTask parks on the execution's budget alone and ends the execution TIMED_OUT, which is exactly what sleepOrTimeOutExecution did in its own copy. --------- Co-authored-by: mitsukado-shinagawa <mitsukado-shinagawa@users.noreply.github.com> |
||
|
|
b66c433a9f | feat(sfn): resolve dynamic ItemReader max items (#3731) | ||
|
|
ffe56f735d |
feat(stepfunctions): route RDS Data execute statement (#4179)
Co-authored-by: Vamsi Akavarapu <16164447+vamsiak@users.noreply.github.com> |
||
|
|
1abc817c5d |
fix(stepfunctions): serialize Scheduler target input (#4168)
Co-authored-by: Vamsi Akavarapu <16164447+vamsiak@users.noreply.github.com> |
||
|
|
00cfcef8f9 | fix(stepfunctions): honor Wait Timestamp and TimestampPath (#4099) | ||
|
|
25a74be198 |
fix(stepfunctions): preserve Scheduler task timestamps (#4056)
Co-authored-by: Vamsi Akavarapu <16164447+vamsiak@users.noreply.github.com> |
||
|
|
4c64f2e397 |
fix(stepfunctions): preserve object details in PutEvents (#4022)
Co-authored-by: Vamsi Akavarapu <16164447+vamsiak@users.noreply.github.com> |
||
|
|
748f71c943 |
feat(stepfunctions): support Scheduler DeleteSchedule (#3983)
* feat(stepfunctions): support scheduler deleteSchedule * style(stepfunctions): use explicit result types --------- Co-authored-by: Vamsi Akavarapu <16164447+vamsiak@users.noreply.github.com> |
||
|
|
d348686744 |
feat(sfn): support ItemReader InputType CSV (#3603)
* feat(sfn): support ItemReader InputType CSV
A Distributed Map can read a CSV dataset through ItemReader. Field names come
from the first row, or from ReaderConfig.CSVHeaders when CSVHeaderLocation is
GIVEN, and each data row becomes an object of string values.
Every value is a string, a row shorter than the headers pads with empty
strings, and a longer one drops the surplus, as AWS documents.
Drops the assertion that CSV is not implemented, which this replaces.
* feat(sfn): honour CSVDelimiter and quoted newlines in ItemReader CSV
ReaderConfig.CSVDelimiter selects COMMA, PIPE, SEMICOLON, SPACE or TAB. An
unsupported value fails the state with States.ItemReaderFailed.
CsvParser.parseAll gained a delimiter overload and now tracks quotes across
line breaks, so a quoted field may carry the delimiter or a newline without
ending the record. The single argument overload keeps comma behaviour for the
existing callers.
* fix(sfn): apply the documented CSV quote and backslash escaping
AWS preserves a doubled quote as a single quote whether or not the field is
quoted, so the reference dataset's {""MyKey"":""MyValue""} has to reach
States.StringToJson as {"MyKey":"MyValue"}. The reader dropped both quotes
instead: only a quote opening a field starts a quoted run, and the unquoted
case fell through to the toggle that consumed the pair.
Backslash escaping was missing as well. A backslash escapes another backslash,
a quote or the configured delimiter, and a backslash before anything else is
dropped.
parseLine and parseAll now share one scanner so the rules live in one place.
The backslash rules stay off for parseLine, which S3 Select and Athena use,
where a lone backslash is ordinary data.
|
||
|
|
ef341e1c01 |
feat(sfn): support ItemReader InputType JSONL (#3602)
A Distributed Map could only read a JSON dataset: every other InputType failed the state with "not yet implemented". JSONL now reads one item per line, skipping blank lines, so a trailing newline is not an item. ReaderConfig.ItemsPointer stays JSON only, as on AWS, and MaxItems truncates a JSONL dataset the same way it truncates a JSON one. |
||
|
|
5db516d9d5 |
feat(sfn): Map ItemReader with s3:listObjectsV2 (#3460)
* feat(sfn): support the s3:listObjectsV2 Distributed Map ItemReader The Map state listed the resource as accepted at CreateStateMachine but failed every execution with States.ItemReaderFailed. It now calls the S3 service in process, reads every page under Prefix, and gives each child the AWS item shape: Etag, Key, LastModified, Size and StorageClass. Bucket and Prefix come from Parameters or JSONata Arguments. An empty prefix succeeds with zero iterations and ReaderConfig.MaxItems trims the list. LastModified is epoch seconds. Real AWS renders it as a double in JSONPath state machines and as an integer in JSONata ones, and the emulator does the same. Fixes #3409 * fix(sfn): evaluate ItemSelector in JSONata Map states A JSONata Map state passed ItemSelector through the JSONPath resolver, so every {% %} expression reached the child as a literal string. The Map state now resolves ItemSelector as a JSONata template with $states.input bound to the Map input and $states.context.Map.Item carrying Value and Index, as on AWS. Real AWS evaluates ItemSelector before it records MapIterationStarted. A failing expression therefore fails the Map state without any event for that iteration, in both query languages. The evaluation moved ahead of the iteration event to match. Verified against real Step Functions in us-east-1 on 2026-09-12. * chore(sfn): simplify the listObjectsV2 reader and the ItemSelector failure path The reader listed the bucket page by page although the S3 service returns the whole sorted listing in one call. The Map state kept two copies of the iteration failure handling. The tests reuse the shared mapper and one JSONata Map definition. * perf(sfn): cap the listObjectsV2 listing at MaxItems ReaderConfig.MaxItems keeps the first keys in key order on AWS, which is what the S3 service returns for maxKeys. The reader now passes MaxItems to the listing instead of building every item and trimming afterwards. * chore(sfn): declare local types in the listObjectsV2 reader Replace var with explicit types in the production code this branch added. * chore(sfn): declare local types in the listObjectsV2 reader tests Replace var with explicit types in the test code this branch added. * fix(sfn): list every object when MaxItems is absent S3Service now treats max keys 0 as a request for an empty page, as AWS does for max-keys=0. The listObjectsV2 reader passed 0 when ReaderConfig.MaxItems was not set, so the Map got no items. It now asks for Integer.MAX_VALUE in that case, like the DynamoDB import path. |
||
|
|
1319ed19bc |
feat(sfn): honour ToleratedFailureCount and ToleratedFailurePercentage (#3605)
* feat(sfn): apply ItemBatcher to distributed Map children
ItemBatcher was parsed and then ignored: every child execution received one
item regardless of MaxItemsPerBatch, so a state machine that batches ran with a
different payload shape locally than on AWS, silently.
Items are now grouped into batches and each child execution receives
{"BatchInput": ..., "Items": [...]}. A batch closes on MaxItemsPerBatch or
MaxInputBytesPerBatch, in their literal, Path and JSONata expression forms, and
with neither set every item lands in one batch. ItemSelector still runs per item
before grouping, so the transform sees $$.Map.Item as it did before.
MaxConcurrency now bounds concurrent batches, and DescribeMapRun separates the
two counters it used to share: itemCounts counts items, executionCounts counts
child executions.
* fix(sfn): cap a batch at the 256 KiB child-input ceiling
MaxInputBytesPerBatch being optional let MaxItemsPerBatch alone build a child
input larger than Step Functions would ever start, and the byte count measured
the items alone, so a declared cap could still be exceeded by the envelope,
BatchInput and separators.
Batching now measures the serialized child payload and closes a batch at the
declared limit or at 256 KiB, whichever is smaller.
* fix(sfn): fail an item too large to start a child execution
An item whose serialized batch input already exceeded 256 KiB was added anyway,
because the split branch is skipped while the batch is empty, producing a child
input AWS would refuse to start.
Such an item now fails the state with States.DataLimitExceeded, naming its size
and pointing at ItemSelector as the way to reduce it.
* feat(sfn): honour ToleratedFailureCount and ToleratedFailurePercentage
Both fields were accepted and ignored: any failed item failed the Map run, and
DescribeMapRun reported a hardcoded zero for each, so a state machine that
relies on a failure budget behaved differently here than on AWS.
A declared tolerance now absorbs failed items while the run stays within it. An
absorbed failure contributes no result, so the Map output and any ResultWriter
export cover the successful children only. Exceeding the budget fails the state
with States.ExceedToleratedFailureThreshold. Both fields accept their literal,
Path and JSONata expression forms, the percentage is taken over the item count,
and declaring both applies the stricter of the two.
DescribeMapRun now reports the declared values. A Map that declares neither is
unchanged: the first failed item still fails the state with its own error.
* fix(sfn): export tolerated failures to FAILED_0.json
Filtering the ResultWriter input down to the successful children dropped every
absorbed failure from the export, which is exactly what the tolerance is meant
to keep observable.
Failed children now keep their input, timings and error, and are written to
FAILED_0.json with Status FAILED and the child's Error and Cause, listed under
ResultFiles.FAILED in the manifest.
* refactor(sfn): resolve every integer Map field through one helper
MaxConcurrency and the ItemBatcher limits read the same three forms, literal,
Path and JSONata expression, through two near-identical methods. The batcher one
already parameterized the field name, so the pair collapses into a single
resolver with a minimum: 0 for MaxConcurrency, where it means the service
ceiling, and 1 for a batch limit, where it is meaningless.
The shared resolver also clamps an oversized value to Integer.MAX_VALUE, which
only the MaxConcurrency copy did before.
|
||
|
|
917e94914f |
feat(sfn): apply ItemBatcher to distributed Map children (#3604)
* feat(sfn): apply ItemBatcher to distributed Map children
ItemBatcher was parsed and then ignored: every child execution received one
item regardless of MaxItemsPerBatch, so a state machine that batches ran with a
different payload shape locally than on AWS, silently.
Items are now grouped into batches and each child execution receives
{"BatchInput": ..., "Items": [...]}. A batch closes on MaxItemsPerBatch or
MaxInputBytesPerBatch, in their literal, Path and JSONata expression forms, and
with neither set every item lands in one batch. ItemSelector still runs per item
before grouping, so the transform sees $$.Map.Item as it did before.
MaxConcurrency now bounds concurrent batches, and DescribeMapRun separates the
two counters it used to share: itemCounts counts items, executionCounts counts
child executions.
* fix(sfn): cap a batch at the 256 KiB child-input ceiling
MaxInputBytesPerBatch being optional let MaxItemsPerBatch alone build a child
input larger than Step Functions would ever start, and the byte count measured
the items alone, so a declared cap could still be exceeded by the envelope,
BatchInput and separators.
Batching now measures the serialized child payload and closes a batch at the
declared limit or at 256 KiB, whichever is smaller.
* fix(sfn): fail an item too large to start a child execution
An item whose serialized batch input already exceeded 256 KiB was added anyway,
because the split branch is skipped while the batch is empty, producing a child
input AWS would refuse to start.
Such an item now fails the state with States.DataLimitExceeded, naming its size
and pointing at ItemSelector as the way to reduce it.
* refactor(sfn): resolve every integer Map field through one helper
MaxConcurrency and the ItemBatcher limits read the same three forms, literal,
Path and JSONata expression, through two near-identical methods. The batcher one
already parameterized the field name, so the pair collapses into a single
resolver with a minimum: 0 for MaxConcurrency, where it means the service
ceiling, and 1 for a batch limit, where it is meaningless.
The shared resolver also clamps an oversized value to Integer.MAX_VALUE, which
only the MaxConcurrency copy did before.
|
||
|
|
e82836348b |
fix(stepfunctions): resolve state machine alias ARNs (#3607)
* fix(stepfunctions): resolve state machine alias arns * docs(stepfunctions): list alias actions * fix(stepfunctions): paginate state machine aliases * ci: rerun compatibility checks |
||
|
|
283890dce9 | feat(stepfunctions): add SNS Publish service integration (#3316) | ||
|
|
35159c5aaa |
fix(stepfunctions): persist execution history across restarts (#3291)
* fix(stepfunctions): persist execution history across restarts * fix(stepfunctions): preserve persisted execution history * fix(stepfunctions): preserve running execution snapshot during restart test Keep the in-flight worker alive until the persisted snapshot is reloaded, then wait for cleanup so the test cannot rewrite or retain its temporary state. * fix(stepfunctions): checkpoint persisted execution history |
||
|
|
fd21ac9a6d |
feat(sfn): publish history events for Parallel branches and Map iterations (#3167)
* feat(sfn): publish Parallel branch and Map iteration history events The states inside a Parallel branch or an inline Map iteration now publish their events into the execution history. The cause of a failure the interpreter raises now carries the AWS prefix "An error occurred while executing the state '<name>' (entered at the event id #<n>). ". It is written once, at the innermost state. Every shape was verified against real Step Functions in us-east-1. * feat(sfn): record EvaluationFailed for JSONata failures A JSONata expression that fails now leaves the EvaluationFailed event AWS records, with error, the attributed cause, location and state. The location names the field the way the cause does. The event is recorded once per attempt when the state retries, and before the Failed event and the Catch. A Catch clause whose own expression fails records it from where the state stood before its first Failed event, then fails the state again. Verified against real Step Functions in us-east-1 * fix(sfn): record every Distributed Map run so DescribeMapRun resolves its ARN * fix(sfn): stop counting history events once the execution has ended |
||
|
|
e3230a74ab |
fix(stepfunctions): reject the QueryLanguage definitions AWS rejects (#2972)
* test(stepfunctions): pin that JSONata-only fields are rejected on a JSONPath state Output, Arguments and Items exist only in JSONata. AWS rejects each on a JSONPath state and locates the diagnostic at the state, not at the field. A Map's own QueryLanguage is inert for the states inside its ItemProcessor: the two definitions of the first test fail identically on AWS, so the equality of their diagnostic lists is what is asserted. * test(stepfunctions): locate QueryLanguage field errors at the state, as AWS does Two assertions expected /States/<state>/<field>. Measured on AWS, this message family carries no field suffix: /States/X for a JSONata Pass with InputPath, /States/M for a MaxConcurrencyPath on a JSONata Map. Both turn red until the diagnostic moves. * fix(stepfunctions): reject JSONata-only fields on a JSONPath state Output, Arguments and Items are refused on a JSONPath state, the mirror of the JSONPath-only list already refused on a JSONata state. Assign stays off the list: AWS accepts it under both query languages. This family of diagnostics is located at the state itself rather than at the offending field, so both directions now travel through the marker that already carried Field 'X' is not supported past the generic converter. * test(stepfunctions): pin the JSONPath downgrade and QueryLanguage on a sub-workflow A JSONata state machine cannot be reverted state by state to JSONPath, and the ItemProcessor or branch object carries no QueryLanguage of its own: it is not a state. Both messages and both locations are as AWS returns them. The two accepting cases keep the guard reading the machine's language rather than the presence of the field. * fix(stepfunctions): refuse a JSONPath state under a JSONata machine and QueryLanguage on a sub-workflow A state declaring JSONPath under a JSONata state machine is rejected at the state's path; the upgrade in the other direction stays legal, so the guard reads the machine's language rather than the presence of the field. The ItemProcessor, Iterator and branch objects are key-checked for QueryLanguage, which they cannot carry: they are sub-workflows, not states. validateNestedStates becomes validateSubWorkflow and takes the sub-workflow object, so the check and the paths derived from it live in one place. * test(stepfunctions): pin that an ItemProcessor state runs as the machine's query language A JSONata Map evaluates its own Items expression while the bare Pass inside its ItemProcessor still resolves Parameters with .$, which exists only in JSONPath. Both halves land in one execution, and the outputs are the literals the real service returned. Propagating the Map's language into the ItemProcessor makes two of the three cases produce the raw item instead. * docs(stepfunctions): record why the sub-workflow gets the machine's query language The three call sites that hand a nested sub-workflow the state machine's query language now say so, citing the ASL specification clause that calls the enclosing Map's or Parallel's declaration independent of it. * test(stepfunctions): pin the downgrade diagnostic alone and a QueryLanguage outside the enum * fix(stepfunctions): report the QueryLanguage downgrade alone and the enum value at its field * test(stepfunctions): pin the diagnostic order, the legacy Iterator and a bare ItemProcessor Pass * fix(stepfunctions): emit QueryLanguage field diagnostics in a fixed order * test(stepfunctions): pin that only the exact string JSONPath makes a state JSONPath * fix(stepfunctions): resolve a QueryLanguage to JSONPath only on the exact string * test(stepfunctions): name the Map fixtures after the repo's state naming The nested Map fixtures used SCREAMING_SNAKE state names, which no other fixture in this repo does. ItemsMap and SubItemsMap sit next to the HelloWorld pass they enclose. --------- Co-authored-by: Facundo Paredes <25681464+facuparedes@users.noreply.github.com> |
||
|
|
504203f8e8 |
fix(stepfunctions): abort executions abandoned by a restart (#2969)
* test(stepfunctions): cover executions abandoned by a restart * fix(stepfunctions): abort executions abandoned by a restart An execution runs inside the Floci process, so a restart leaves it stored as RUNNING with no worker behind it: DescribeExecution reported RUNNING forever and GetExecutionHistory reported nothing, so a caller waiting for a final status hung until its own timeout with no diagnosis. EmulatorLifecycle.onStart now calls StepFunctionsService.abortAbandonedExecutions after storageFactory.loadAll(), which retires every still-RUNNING execution with status ABORTED, a stopDate, error ExecutionAbandoned and a cause naming the restart, and seals its history with a single ExecutionAborted event. ABORTED is the status AWS gives an execution ended from outside its own definition, and it is the only terminal status that keeps the execution inside RedriveExecution's reach. The sweep runs with no request context, so it scans every account and writes each execution back under the account that owns it. The terminal write is shared with StopExecution, which handled the same window for its own half already. * fix(stepfunctions): file the abort history under the storage key markAborted read the history key off the stored value. An execution whose executionArn field is null made computeIfAbsent throw out of the startup sweep, which EmulatorLifecycle.onStart calls unguarded, so the process did not boot and the sweep stopped mid list with earlier entries flipped in memory and never written back. A field that disagreed with the storage key filed the ExecutionAborted event where GetExecutionHistory does not look. The key is now a parameter: StopExecution passes the ARN it was called with, the sweep passes the key the entry came under. The tests bound the stopDate between two literal epoch-second instants instead of asserting it is non-null, so a wrong unit fails; assert the sweep stays silent when nothing is RUNNING, which is what the count guard is for; and pin the WARN record by level and count rather than by its whole sentence. The lifecycle test whose plain verify was subsumed by the ordered one is gone. The documentation no longer claims the ExecutionAborted event survives a further restart: histories live in memory, so the event is written on the boot that aborts the execution, while the status, error and cause persist. * test(stepfunctions): require the AWS shape of an abort with no reason The startup sweep is measured against us-east-1 with StopExecution called without --error and --cause: status ABORTED, DescribeExecution omitting both keys, and executionAbortedEventDetails present and empty. The persistence test pins the sweep, and the integration test pins the wire shape, where an omitted key is distinguishable from a null one. * fix(stepfunctions): abort abandoned executions the way AWS aborts ExecutionAbandoned is a code AWS never emits, and the sweep was the only producer of it. Measured against us-east-1 with StopExecution called without --error and --cause, the abort reports status ABORTED, DescribeExecution omits the error and cause keys, and the terminal event carries an empty executionAbortedEventDetails. The sweep now takes that same path; the WARN line with the count is where the reason lives. markAborted keeps both parameters: StopExecution passes the caller's error and cause through them. --------- Co-authored-by: Facundo Paredes <25681464+facuparedes@users.noreply.github.com> |
||
|
|
8a2161ab5e |
fix(stepfunctions): let Express executions reuse names and type the nested StartExecution refusal (#3059)
StartExecution enforced execution-name uniqueness on Express state machines, but AWS does not: an Express name is immediately reusable and every start is its own concurrent execution. Uniqueness, and the 90-day reuse window, applies to Standard workflows only. - StepFunctionsService.startExecution now gives an Express execution a per-start ARN (express:<stateMachine>:<name>:<uuid>) and skips the execution-store collision check, so a reused name starts a new, independent execution instead of failing with ExecutionAlreadyExists. This also closes a data-loss hazard: same-name Express starts would otherwise share one store key, letting a completing execution overwrite another. Standard behavior (idempotent same-input replay while RUNNING, ExecutionAlreadyExists otherwise) is unchanged. - AslExecutor.invokeNestedStateMachine now wraps the child StartExecution call so a refusal becomes a typed, catchable error (StepFunctions.ExecutionAlreadyExistsException) instead of States.Runtime, which no Catch or Retry can match. This mirrors the aws-sdk:sfn:startExecution path, which keeps its Sfn. prefix and is unchanged. Tests cover Express name reuse and a same-name no-clobber regression at the service level; nested-refusal typed-error, catch, retry and Sfn-vs-StepFunctions prefix cases for bare, .sync and .sync:2; a wire-level StartExecution integration test; and a .sync/.sync:2 success guard. The Express idempotency test that pinned the old divergence is removed. AWS Compatibility: Express StartExecution is non-idempotent and enforces no name uniqueness, and the express:<stateMachine>:<name>:<id> ARN shape matches the Step Functions resource-ARN definition; the optimized states:startExecution integration reports StepFunctions.<Code>Exception for a Standard-child collision. Left as documented deviations, not changed here: the 90-day Standard name-reuse window is not modeled, and finished Express executions are retained rather than evicted. |
||
|
|
fad54f3c7a |
fix(stepfunctions): fail an intrinsic argument that matches nothing (#2872)
* fix(stepfunctions): fail an intrinsic argument that matches nothing
States.Format('{}', $.nope) resolved to null and the state succeeded. Real AWS
fails it with States.Runtime and names the whole expression. An index past the
end of an array is a miss here, where the same path written directly resolves
to null.
Closes #2870
* docs(stepfunctions): drop the States.Format template gap note
The gap is not fixed or caused by this change, so it is tracked on its
own issue instead of riding along in this pull request.
* test(stepfunctions): point the format template gap at issue #2927
|
||
|
|
63a2a60a30 |
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 |
||
|
|
f7f16cd2a3 |
fix(stepfunctions): bound $range allocation at the AWS memory limit (#2790)
* fix(stepfunctions): open a JSONata query evaluation cause with the AWS sentence evaluateField now wraps a thrown JSONata failure with "The JSONata expression '<expr>' specified for the field '<field>' threw an error during evaluation" before the existing tail, matching real AWS. The separator is ". " when the tail carries a JSONata error code and ": " when it is a bound message with none. evaluate() keeps producing the bare tail unchanged for its direct callers. evaluate() stays the only place the JSONata engine is called and the only catch around it: evaluateField calls it and enriches the failure it throws, rather than reaching the engine itself. QueryEvaluationFailure carries the separator across that throw, so a catch added to evaluate() later covers both entry points. All 11 AslExecutor call sites reach the evaluator through evaluateField or resolveTemplate, so a catch installed anywhere else would be dead on every real execution path. * fix(stepfunctions): catch Error from JSONata evaluation as States.QueryEvaluationError An OutOfMemoryError or StackOverflowError raised while parsing or evaluating a JSONata expression escaped JsonataEvaluator's catch (Exception) and reached AslExecutor's own last-resort catch (Error), failing the whole execution as States.Runtime before the state's own Retry and Catch ever ran. JsonataEvaluator.evaluate now also catches Error at the same seam and translates it into a FailStateException with States.QueryEvaluationError, so a Catch on the state (or on States.ALL) can recover, matching real AWS. Closes #2738 * fix(stepfunctions): match AWS on the JSONata expressions it refuses Four expression classes where Floci and AWS disagreed on whether the state fails at all, all measured against us-east-1 with test-state. The evaluation-depth ceiling drops from 500 to 100, which is AWS's own: five nesting shapes bisected one n at a time all put its last accepted evaluation at depth 100 and its first refusal at 101. An addition chain nests one level per term and AWS accepts 100 terms; parentheses, brackets and the chain operator nest one level more than their count and AWS accepts 99 of each; a non-tail-recursive $f(n) nests 3n+5 and AWS accepts n=31, depth 98, refusing n=32, depth 101. The memory an expression may hold is now bounded, which it was not: one value an evaluation step produces may hold 6,990,256 bytes, counting a number as eight and a character as one. The two shapes AWS was bisected on, [1..873782] and a string doubled 22 times, bracket a number at between five and nine bytes a character: with the bound at 873,782 numbers, anything in that range leaves 4,194,304 characters inside it and 8,388,608 outside, and four or ten does not. Eight is what a double costs, and it is inside the bracket. The check walks the value and stops at the bound, and a lazy range is counted from its length rather than materialised. $eval is unbound, as AWS disables it, so a call to it answers T1006 the way AWS does and $parse stays the replacement. A non-finite number the expression itself evaluates to comes back as the string AWS writes for it, since JSON has no literal for one: 1/0 and 1e308*10 are "Infinity" and $parseInteger("abc","0") is "NaN", where the first two raised D1001 and the third returned nothing and failed the field. One the library's arithmetic buries inside a value, as in [1/0], still fails the state, because the refusal is the only place the library leaves the value and it has already unwound what was being built; one a function answers nests like any other value. $formatNumber checks its picture string against the fourteen rules of XPath F&O 4.7.3 first, so $formatNumber(1, "x") fails with D3086 instead of answering "x1". Which of the fourteen codes AWS reports is what fixes the order the rules are read in: a picture with no digit breaks D3085 and D3086 at once and AWS reports the second, so the last rule broken names the failure rather than the first. Closes #2737 * fix(stepfunctions): bound $range allocation at the AWS memory limit AWS accepts $range(1, 360145, 1), all 360,145 elements, and refuses one element more on its own memory limit. Floci's $range had no such bound: it built the array in full before the memory check on the value ever ran, so a call far past AWS's limit spent gigabytes and either exhausted the heap or hung instead of failing the state cleanly. range() now refuses a call whose produced element count exceeds the measured bound before allocating, throwing the same States.QueryEvaluationError JException the held-memory check raises, whose message is now a single shared constant. Other built arrays keep the looser, byte-based bound. * test(stepfunctions): pin the number model of the execution input Measured against real AWS (test-state, 2026-08-30): a Pass state with Output {"v": "{% $states.input.amount %}"} answers {"v": 1} for input {"amount": 1.0} and {"v": 9.223372036854776E18} for input {"amount": 9223372036854775808}. That is exactly what routing the execution input through toJsonataValue/toJsonataNumber already produces, so these two tests pin it against silent regression. --------- Co-authored-by: Facundo Paredes <25681464+facuparedes@users.noreply.github.com> |
||
|
|
ead70eae4d |
fix(stepfunctions): refuse the definitions AWS refuses, at both validation entry points (#2786)
* fix(stepfunctions): reject definitions with no terminal state, dangling targets or unsupported fields Enforce the ASL rules AWS applies at both ValidateStateMachineDefinition and CreateStateMachine: a workflow needs a terminal state (MISSING_END_STATE, top-level only, suppressing the unreachable-state reachability check but not a dangling-target check), every reachable state and every Next/Choices[].Next/Default/Catch[].Next target must exist (MISSING_TRANSITION_TARGET), recursing into ItemProcessor and Branches with structured paths, and TimeoutSeconds/Catch/Retry are refused outside the state types that support them (SCHEMA_VALIDATION_FAILED, "Field '<name>' is not supported"). CreateStateMachine's wire message always renders " at <location>", printing the literal "null" when there is none, matching AWS exactly; ValidateStateMachineDefinition keeps omitting the location field entirely when null, which is the correct, unchanged behavior for that API. Remove the now-dead Parallel TimeoutSeconds handling in AslExecutor: no definition carrying that field can reach execution anymore. * fix(stepfunctions): reject JSONata expressions that do not parse at definition time Report INVALID_JSONATA_EXPRESSION when a JSONata expression fails to parse, using the parser's own message with its S0xxx code prefix stripped, at the field's location. Also report UNSUPPORTED_JSONATA_EXPRESSION for '$$' and for '$states.errorOutput' outside a Catch entry's own Output or Assign. Previously these were accepted at ValidateStateMachineDefinition and CreateStateMachine time and only failed later, at execution, with States.QueryEvaluationError. Every message asserted was measured against real AWS us-east-1 with `aws stepfunctions validate-state-machine-definition`, including `phone %.other` and the empty expression, which AWS also refuses. The three booleans the definition walk threaded through every recursive call (insidePayload, isCatchEntry, insideCatchOutputOrAssign) travel as a single JsonataScope value, which drops collectTopLevelReferences back under the Sonar S3776 limit. --------- Co-authored-by: Facundo Paredes <25681464+facuparedes@users.noreply.github.com> |
||
|
|
9288769607 |
fix(stepfunctions): bound a running execution the four ways AWS does (#2782)
* fix(stepfunctions): enforce both TimeoutSeconds clocks The state machine's top-level TimeoutSeconds was read back by DescribeStateMachine and copied into activityScheduledEventDetails but never used as a deadline, so an execution ran to completion however long it took. Compute the budget once in doExecute, check it before every state and inside the Wait sleep, and end the execution TIMED_OUT with stopDate set, no error, no cause, and one ExecutionTimedOut event carrying States.Timeout and previousEventId 0. A Task's two bounds were swapped: HeartbeatSeconds acted as the total wait and TimeoutSeconds was decorative, so "TimeoutSeconds": 5, "HeartbeatSeconds": 60 failed at 60 seconds instead of 5. awaitToken now bounds the whole wait with TimeoutSeconds and the gap between heartbeats with HeartbeatSeconds. SendTaskHeartbeat only logged, so the gap bound needed a per-token timestamp: the service now records one when the token is registered and again on every heartbeat, and forgets it when the waiting task stops listening. Either clock ends the state as a TaskTimedOutException, which is what us-east-1 answers for a heartbeat expiry: an ActivityTimedOut event carrying error States.Timeout and no cause, then an execution reading FAILED with error States.Timeout and no cause key, over the six-event history ExecutionStarted, TaskStateEntered, ActivityScheduled, ActivityStarted, ActivityTimedOut, ExecutionFailed. A Catch still matches a heartbeat expiry under States.HeartbeatTimeout, so ErrorEquals matching now asks the failure which names it answers to rather than comparing one string. The Wait sleep stops at the execution deadline instead of sleeping its full duration first, which would have reported the timeout as many seconds late as the Wait outlasts the budget and left a WaitStateExited behind for a state AWS never finished. awaitToken discards its token on the way out; without that the token would stay pending for the life of the process and a later SendTaskSuccess would be answered as if someone were still waiting. Neither timeout carries a cause, so failExecution now reads a null cause as the failure having none and leaves the key out of both DescribeExecution and the ExecutionFailed event. The two other failures that reach it without a cause -- a Fail state with no Cause, and SendTaskFailure with no cause -- keep reporting an empty one, since AWS's shape for those is unmeasured. Refs #2733 * fix(stepfunctions): bound an execution's history and make StopExecution stop it AWS puts two bounds on a running execution that floci did not: it ends one that reaches 25,000 history events with States.Runtime, event 25,000 being the ExecutionFailed event itself, and StopExecution stops the worker rather than relabelling an execution that goes on to overwrite the status it wrote. Counting an event against that limit and numbering it in the published history are two meanings that one AtomicLong was carrying. They are separated here. producedEventCount counts every event the execution produces, the top-level flow's and those of its Parallel branches and inline Map iterations alike, and is what the limit judges. The published history numbers its own events: an event's id is its position in the list, which makes the list the only authority for the next id, where the counter and the seal in StepFunctionsService used to be a second one that agreed with it only at rest. A branch's events are counted and never built, so executeBranch no longer assembles HistoryEvent objects with full input and output JSON into a list it throws away. A Distributed Map runs each item as a child execution on AWS, and a child execution has a history of its own, so its items are counted against their own limit rather than the parent's: a Distributed Map over 13,000 items no longer fails the parent partway through with States.Runtime. The count is taken before it is judged. Reading it and then taking it let 40 concurrent inline Map iterations through the same check and spent more events than the execution had. StopExecution records its abort against a history that need not be in memory. Executions are stored and histories are not, so a restart in persistent mode brings a RUNNING execution back with nothing behind it, and the same window opens between a reset emptying the cache and emptying the store; the abort was written to the store and then thrown away as a 500. * fix(stepfunctions): end an execution that spends its budget waiting A state machine's TimeoutSeconds budget was read only between states and around the two pauses a definition asks for, a Wait and a Retry backoff. Every other way a state blocks outlasted it: a Task waiting for its token, a states:startExecution.sync or ecs:runTask.sync poll, and a Parallel or Map waiting for its branches. Those executions ended past their budget, and ended FAILED or SUCCEEDED rather than TIMED_OUT. Each of those waits now stops at the budget, and the Task path publishes no failure event for the state it cuts. Measured against us-east-1: a state machine with TimeoutSeconds 5 over an activity Task whose own TimeoutSeconds is 60 stops at exactly 5.000 s with status TIMED_OUT, and its history is ExecutionStarted, TaskStateEntered, ActivityScheduled, ExecutionTimedOut, with no ActivityTimedOut and no ExecutionFailed. --------- Co-authored-by: Facundo Paredes <naranjax@MAC-69786.local> |
||
|
|
08e532ab1a |
feat(cloudformation): CDK Provider-framework custom resources and changeset/SSM param fidelity (#2688)
* feat(cloudformation): changeset diffs, stack params, SSM attributes CDK's deploy loop reads all three: DescribeChangeSet now returns computed Add/Modify/Remove resource changes instead of an empty list (an empty list makes CDK skip ExecuteChangeSet on updates), DescribeStacks echoes the stack's merged parameters, and AWS::SSM::Parameter resources expose Value/Type/Name attributes so Fn::GetAtt resolves the bootstrap version (cherry picked from commit 80ac80063e84ef1be977fe625334e722cc1ed8bb) * feat(cloudformation): resolve SSM-typed stack parameters AWS::SSM::Parameter::Value<String> template parameters resolve through SSM for the stack's account and region; missing parameters fail with the real ValidationError message. Landing Zone Accelerator's security and logging stacks depend on this typed-parameter resolution. The IAM password-policy and S3 replication-config changes from the same source commit ship separately in the iam and s3 branches. (cherry picked from commit 10dbabbf5e31d763a398fc1fff16ab0484958af0) * feat(cloudformation): drive CDK Provider framework custom resources The CDK Provider framework defers its ResponseURL callback to a Step Functions waiter that polls framework.isComplete on a Retry cadence until the resource is ready. The custom-resource provisioner only waited the synchronous single-lambda budget for a ResponseURL PUT, so the waiter-driven PUT never landed. A framework.onEvent ServiceToken is now awaited on a bounded async budget so that PUT is captured; onEvent-only and single-lambda resources are unchanged. The engine-side half of the original commit -- a Task-only Retry implementation for the ASL executor (ErrorEquals/IntervalSeconds/ MaxAttempts/BackoffRate/MaxDelaySeconds) -- is dropped here: upstream #2455 ("feat(sfn): support Retry policies in Task, Parallel, and Map states") landed a broader Retry implementation independently (Task, Parallel, and Map states; JitterStrategy; $$.State.RetryCount; Retry-before-Catch ordering), a strict superset of what this commit needed. The full stepfunctions suite (411 tests) is green against it on this branch, and CustomResourceProviderFrameworkTest (a hermetic test of the provisioner's own detect-and-wait logic, no Step Functions involved) is unaffected by the drop. (cherry picked from commit 5b3502d8c9dddf3766ca3f94fe7f146042dc00fd) * docs(cloudformation): document CDK provisioning Documents the CDK Provider-framework custom-resource support and folds its cross-reference into upstream's existing "Retry policies" section in step-functions.md rather than duplicating it with a separate "State Retry" section (upstream #2455 already documents the Retry engine itself). * feat(cloudformation): budget custom-resource waits by idleness, not total time The async custom-resource wait was a fixed 3-minute total budget. That is a property of the emulator, but the time a CDK provider-framework resource needs is a property of the work: Custom::CreateOrganizationAccounts creates exactly one account per 15s waiter poll, so a 3-account org finishes in ~45s while a 15-account org needs ~195s. Past the budget the Lambda is guillotined mid- success -- the accounts all exist, but the resource reports CREATE_FAILED, the stack rolls back, and CDK's readback then surfaces the misleading "NoStack: CloudFormationStack object does not hold a stack". Measure idleness instead. The provisioner already embeds its callback token in the ResponseURL it puts on every event, and the framework echoes that event into each framework.isComplete poll, so a poll arriving at LambdaService is proof of progress for a specific pending resource. Each poll resets the budget, which makes the wait proportional to the work without CloudFormation needing to know what the work is -- and a genuinely hung resource still fails after 3 idle minutes exactly as before. CustomResourceLiveness lives in core.common so the Lambda service can report progress without depending on CloudFormation; the dependency already runs the other way. (cherry picked from commit 14087c992ebb75d109999153a9e8af7e3c2d79f4) (cherry picked from commit 51349e4e017ed08d90e6e71212414e2f306c826b) * fix(cloudformation): call the caller-scoped getStackOrThrow overload that exists The changeset-diff commit re-derived onto main carried a call to a three-arg getStackOrThrow(name, region, accountId) overload that only existed on the account-scoping commit deliberately skipped as superseded by upstream. Upstream's resolveStack already scopes to the caller's account, so the two-arg form is equivalent and compiles. * fix(cloudformation): honour an arrived custom-resource response past its budget A synchronous custom-resource handler PUTs to the ResponseURL from inside the invoke the provisioner is blocked on, so its response can already be delivered by the time await() is entered. Two independent flaws then threw it away. The idle clock started at register(), before the invoke. A provider-framework onEvent-only handler that took 75s to return -- two nested cold container starts -- had spent its 10s CR_RESPONSE_TIMEOUT six times over before await was reached, so the very first deadline check was already negative. Idleness of the wait cannot include time the handler spent working; the clock now starts when the caller starts waiting. The deadline guard also threw without ever consulting the future, so a response that had completed it was discarded as a timeout. Observed on AccessAnalyzerServiceLinkedRoleCreateServiceLinkedRoleResource: the handler logged its response at 15:52:11.768 and the resource was failed 24ms later. An arrived response outranks the clock. Both are pinned by red-first tests. The existing idle-timeout guarantees are unchanged: nothing arriving still times out, and a resource that stops reporting liveness still dies on schedule from its last touch. (cherry picked from commit 7dc8bbca7d47b2a029b5656a89421a556b8296be) (cherry picked from commit 77b71b31a634ae27d7460a078b52dac250d67dc7) * refactor(cloudformation): extract Provider-framework detection from the provisioner The CDK Provider-framework `framework.onEvent` detection and the longer idle budget it earns lived in CloudFormationResourceProvisioner, adding ~55 lines to a class that is being dismantled rather than grown. Move the concern to ProviderFrameworkDetector: it owns the two waiter marker env vars, the best-effort environment probe, the 3-minute async budget and the test seam that shortens it. CustomResourceResponseStore — which already owns the idle-timeout concept via touch/await — gains an await overload that resolves the budget for a ServiceToken and delegates to the existing one, so the provisioner only passes the token through and appends the store's timeout detail to its error. Behaviour is unchanged. (cherry picked from commit 5f93439f409a32012a01b996c5edd0c29d23b260) * fix(stepfunctions): report custom-resource liveness on waiter polls A CDK provider-framework waiter's framework.isComplete poll is itself a Lambda Task the state machine invokes, so it goes through AslExecutor.invokeResource -> LambdaExecutorService directly, bypassing LambdaService.invoke() and the liveness hook it carries. A long-but- progressing custom resource's idle budget in CustomResourceResponseStore ticked down as if no polls were arriving, even while they kept landing. AslExecutor now reports liveness the same way LambdaService does: extract the callback token from the invoke payload and touch() it before invoking. * perf(core): avoid materializing the full payload string in tokenIn CustomResourceLiveness.tokenIn() ran on every Lambda invoke once liveness reporting is wired in, decoding the whole invoke payload as a UTF-8 String even though the overwhelming majority of invokes carry no callback URL at all. Scan the raw bytes for the ASCII "/cfn-response/" marker instead, and only allocate a String for the small token substring when one is found. * fix(cloudformation): compute accurate changeset resource diffs computeChangeSetChanges never read cs.getParameters(), so an update that only changed parameter values reported an empty diff and CDK skipped execution, leaving the old parameter-derived config deployed. It also diffed a SAM change set's raw template against the stack's expanded deployed template, reporting spurious Modify/Remove on every SAM-generated resource for a no-op update, and hardcoded Replacement=False even when a resource's Type changed. Now the diff expands a SAM change set's template before comparing, marks a resource Modify when it references a changed parameter, and reports Replacement=True when a resource's Type changes. * fix(cloudformation): restore last-successful parameters on update rollback executeTemplate overwrote the stack's live parameter map with an update's attempted values before resolving SSM-typed parameters, which can fail. A failed resolution rolled the stack back, but the update snapshot never captured parameters, so DescribeStacks reported the failed update's attempted values instead of the last successfully deployed ones. StackUpdateSnapshot now captures the stack's parameters alongside its template body, and rollbackFailedUpdate restores them together. * fix(cloudformation): log tolerated wait-slice timeouts in custom-resource poll loop Each slice of the custom-resource poll loop below the outer idle budget hit an intentionally-tolerated TimeoutException that was swallowed with only a comment, against the repo's convention of logging deliberately caught exceptions. * fix(cloudformation): honor Parameters.member.N.UsePreviousValue extractParameters never read UsePreviousValue, so submitting it without a ParameterValue stored an empty string for that key. The new parameter-diff logic in computeChangeSetChanges ( |
||
|
|
5600d21f32 |
feat(stepfunctions): emit task history events and chain previousEventId (#2703)
A Task state now emits Scheduled, Started, and Succeeded or Failed events. Service integrations get Task* events. Direct Lambda ARNs get LambdaFunction* events. Activity ARNs get Activity* events. taskScheduledEventDetails carries the resolved Parameters or Arguments as a JSON string. previousEventId now chains every event to the one before it. The first state's Entered event points to 0, matching real AWS. Details now include inputDetails and outputDetails where AWS has them. Event shapes were verified against real AWS. Fixes #2520 |
||
|
|
ff61c2b2a5 |
feat(stepfunctions): describe a distributed Map run after it finishes (#2694)
* feat(stepfunctions): describe a distributed Map run after it finishes DescribeMapRun was not implemented, and arn:aws:states:::aws-sdk:sfn:describeMapRun reached the end of the dispatch chain in invokeResource, so a distributed Map could not be inspected once it was over: the Map run ARN was minted from a fresh UUID, written into the S3 manifest, returned in the Map result and then dropped. A run is now retained where the ResultWriter mints that ARN, which is also the only place an ASL author reads it. The manifest is no shortcut to the counters, since it writes FAILED and PENDING as empty arrays and puts every item under SUCCEEDED, so the run carries the item count taken where the iterations complete. A Map fails on the first item that fails, so a retained run is one whose every item succeeded. That fixes the status, both tolerances and the redrive counters at the values us-east-1 reports for such a run, and leaves succeeded, total and resultsWritten as the item count. An unbounded Map, which ASL spells as MaxConcurrency 0 or by omitting it, is reported as Integer.MAX_VALUE. The Task integration recases the wire response rather than restating it, so the two renderings of a run cannot drift, and renders both dates as the SDK's ISO-8601. Closes #2671 * refactor(stepfunctions): close a Map run's window on the export that mints its ARN recordMapRun sampled the wall clock and then folded the child timings into both ends of the run's window, but the clock is read after MapIterationScheduler has joined every child and after applyResultWriter has exported, so it is at or past every child's stop. Math.max over the timings could therefore never move stop off that sample, and the javadoc promised a last-item stop the code never computed. The sampled value is the faithful one: AWS closes a Map run's window on the export rather than on the last item, and the sample is taken immediately after it. Only start is recovered from the timings, which is the one end the Map state records nowhere else. DescribeMapRun returns the same startDate and stopDate as before. * test(compatibility): cover DescribeMapRun through the AWS SFN SDK client StepFunctionsDescribeMapRunIntegrationTest only exercises the endpoint via RestAssured, leaving the SDK's own request serialization, endpoint routing and response deserialization untested, contrary to AGENTS.md's rule that management APIs be validated with AWS SDK clients. --------- Co-authored-by: Facundo Paredes <25681464+facuparedes@users.noreply.github.com> |
||
|
|
ea11e67719 |
fix(stepfunctions): fail the state when a JSONata expression returns nothing (#2689)
* fix(stepfunctions): fail the state when a JSONata expression returns nothing An expression that returned nothing lost its key and the execution carried on down the happy path. Real AWS fails the state with States.QueryEvaluationError, names the field the expression was written in and a Catch on that error fires. Three of the positions changed control flow rather than data: a Choice took Default, a Wait did not wait, and a Task sent its request with the argument omitted. evaluateField evaluates one expression and fails the state on a missing node. resolveTemplate calls it at every leaf, carrying the field it is inside and extending it with /key per object key and [i] per array index, so the cause names Output/a/b[0][1] the way AWS does. Choices[n]/Condition, Seconds, Error, Cause, MaxConcurrency and Items call it directly. Three pieces go with it, all of them things a missing node used to need. An undefined array element was a States.Runtime special case with its own wording; AWS answers States.QueryEvaluationError and Output/values[0], the same shape as every other position. resolveTemplateNode existed to let resolveTemplate turn a whole field that returned nothing into a null, so the output would still serialize; there is no output to serialize once the state fails. And the two ResultWriter guards fired only on a key resolveTemplate had dropped, which can no longer happen. An explicit JSON null is a value and still succeeds, everywhere. Closes #2665 * fix(stepfunctions): name a Choice rule's and a Catch clause's own fields under their index A matched Choices[i] rule and a matching Catch[i] clause carry their own Assign and Output, and applyJsonataAssignAndOutput named them 'Output' and 'Assign' as if they were the state's. AWS names them under the rule or the clause: Choices[1]/Output/v, Choices[0]/Assign/x and Catch[1]/Output/v, each measured on the account. The index is the position in Choices or Catch, not the position among the entries that matched. The Catch label was unobservable until now. doExecute calls handleCatch from inside its own catch (FailStateException), so an expression failure raised while resolving the clause's own Output escaped both that clause and its sibling catch (Exception), reaching the method-level handler that answers States.Runtime with the raw message. The execution now fails with the clause's own error, which is what AWS reports and what the clause was catching no longer is. * test(stepfunctions): follow the field path through the crashing evaluator stub * test(stepfunctions): put the Catch clause under test on a Task, as AWS requires aCatchClauseNamesItsOwnOutputUnderTheClauseIndex carried Catch on a Pass state, which AWS refuses: validate-state-machine-definition answers SCHEMA_VALIDATION_FAILED, "Field 'Catch' is not supported" at /States/Boom. The label the test pins is right, Catch[1]/Output/v, and the state now fails on its own Arguments the way the measured execution did, so the definition is one AWS accepts. * docs(stepfunctions): drop the deviation this change removes The key dropped by an expression that returned nothing is no longer Floci's own behaviour: the state fails, as the section below records. --------- Co-authored-by: Facundo Paredes <25681464+facuparedes@users.noreply.github.com> |
||
|
|
5534460492 |
fix(stepfunctions)!: reject JSONata top-level references at definition time (#2699)
* fix(stepfunctions)!: reject JSONata top-level references at definition time
A Step Functions JSONata expression is evaluated with no context item: the
execution input arrives as $states.input and an Assign variable as $name. A
path whose first step is a bare name reads a context item that does not exist,
and real AWS refuses the definition from CreateStateMachine,
UpdateStateMachine and ValidateStateMachineDefinition with
UNSUPPORTED_JSONATA_EXPRESSION: Reference to '<name>' at the top level is not
supported. Floci accepted those definitions and failed the execution instead.
Every JSONata string in a JSONata state is now walked before the state machine
is stored, and each distinct top-level name is reported with the message and
the /States/... location AWS prints. Only the first step of a path is read
against the top-level context, so later steps, predicates, sort terms and
group expressions stay legal; a lambda body keeps the defining context and is
walked. Syntax errors and $$ keep their current behaviour.
The parse tree of com.dashjoin:jsonata is package-private and Quarkus loads
application classes and dependency jars under different class loaders, so the
tree fields are read reflectively, resolved once at class initialization and
registered for native image.
BREAKING CHANGE: state machines whose JSONata expressions reference a bare
top-level name are now rejected at creation, as on AWS. Anchor the reference
with $states.input.<name> for input or $<name> for an Assign variable.
* fix(stepfunctions): parse a JSONata payload key named after an ASL field
The deny list of fields AWS does not parse as JSONata was applied to every
key at every depth, so a payload key named Next, Comment, Resource, Retry,
Default, ErrorEquals, Credentials, Branches, ItemProcessor or Iterator hid
its expression. AWS parses a payload whole: `Assign: {"Next": "{% phone %}"}`
and `Arguments: {"Payload": {"Comment": "{% phone %}"}}` are both refused
with `Reference to 'phone' at the top level is not supported.` The deny list
now stops applying once the walk enters Output, Assign, Arguments,
ItemSelector or BatchInput.
The same walk refused `ItemReader.ReaderConfig.CSVHeaders`, which holds
literal column names: `validate-state-machine-definition` returns OK for it
and `create-state-machine` stores the machine, so CSVHeaders joins the list.
---------
Co-authored-by: Facundo Paredes <25681464+facuparedes@users.noreply.github.com>
|
||
|
|
14112b8ace |
feat(stepfunctions): dispatch the seven Task service integrations of #2663 (#2686)
* feat(sfn): support the aws-sdk:sfn:startSyncExecution task integration Calling an Express child workflow from a Standard parent goes through arn:aws:states:::aws-sdk:sfn:startSyncExecution, which reached the end of the dispatch chain and failed with "Unsupported resource". The integration reuses the existing StartSyncExecution service call and differs from the optimized states:startExecution.sync integration in two observable ways: the response envelope uses PascalCase field names with Output as a JSON string, and a child execution that fails is reported through Status instead of failing the calling task. * feat(stepfunctions): dispatch the six remaining Task service integrations events:putEvents, aws-sdk:sfn:startExecution, aws-sdk:sfn:sendTaskSuccess, aws-sdk:sfn:sendTaskFailure, aws-sdk:scheduler:createSchedule and aws-sdk:scheduler:updateSchedule reached the end of the dispatch chain in invokeResource and failed with "Unsupported resource", although Floci already serves all six APIs. Each branch maps the Task Arguments onto the client the direct call already goes through: putEvents onto EventBridgeHandler, and the scheduler pair onto the controller's own parse and SchedulerService. Two conventions of the aws-sdk: integrations, measured against us-east-1 through test-state, now hold for the whole family and correct the startSyncExecution envelope with them. A timestamp is the SDK's ISO-8601 rendering rather than the epoch seconds the wire response carries, and an error names the SDK exception class, so it always ends in Exception. SendTaskSuccess and SendTaskFailure report whether the token resolved a waiting task, which is what lets the Task integration fail with Sfn.InvalidTokenException instead of reporting a delivery that never happened. The direct API keeps tolerating an unknown token. Closes #2663 * fix(stepfunctions): make scheduler argument validation reachable for Retry and Catch parseScheduleRequest raises the same AwsException the scheduler service raises, so a Task whose Target.EventBridgeParameters is incomplete failed the execution with States.Runtime and skipped the state's Catch. It now runs inside the same translation as the service call and fails with Scheduler.ValidationException. * fix(scheduler): answer a malformed EcsParameters list with ValidationException A CapacityProviderStrategy, PlacementConstraints, PlacementStrategy or Tags list holding anything but objects made ObjectMapper.convertValue raise IllegalArgumentException, which CreateSchedule and UpdateSchedule answered with a server error and the aws-sdk:scheduler Task integration turned into States.Runtime. The conversion failure is now named per field and carries the 400 the rest of the parser's validations carry. * fix(scheduler): answer a malformed awsvpcConfiguration list with ValidationException Subnets and SecurityGroups went through a bare ObjectMapper.convertValue, so an element that is not a string left the same unhandled IllegalArgumentException the EcsParameters object lists left. They now read through a stringList sibling of mapList and carry the parser's 400. * test(stepfunctions): pass the scheduler and eventbridge dependencies to the executor under test * fix(scheduler): refuse a scalar in an awsvpcConfiguration list instead of coercing it * fix(scheduler): refuse a non-list EcsParameters field instead of dropping it * test(stepfunctions): catch a malformed scheduler list as the SDK exception AWS sends --------- Co-authored-by: Facundo Paredes <naranjax@MAC-69786.local> Co-authored-by: Facundo Paredes <25681464+facuparedes@users.noreply.github.com> |
||
|
|
48e0ecd809 |
fix(stepfunctions): keep a JSONata expression's explicit null in the output (#2684)
* fix(stepfunctions): keep a JSONata expression's explicit null in the output
A JSONata expression evaluating to JSON null lost its key, exactly as an
expression that returned nothing did. Real AWS answers {"v":null} to
Output {"v":"{% null %}"} and keeps the null in a nested object, in an
array, in Assign and in a Task's Arguments.
dashjoin flattens JSONata's null marker into a Java null unless
outputConvertNulls is off, which made the two indistinguishable inside the
evaluator. With it off, $states and the workflow variables bind through
toJsonataValue so an input null stays a null the expression can see, the
result is walked back with the marker mapped to a JSON null and a Java null
mapped to a missing node, and resolveTemplate drops only the missing node.
Closes #2664
* fix(stepfunctions): resolve a whole JSONata field that returned nothing to a null
A MissingNode is how the evaluator says "this expression returned nothing", and
resolveTemplate handed it straight to the executor when the whole Output or
Arguments field was that one expression. exec.setOutput writes the state output
with toString(), and a MissingNode writes itself as the empty string, so
DescribeExecution answered "output": "" instead of JSON.
resolveTemplate is now the boundary and answers a JSON value: a whole field that
returned nothing is a null, which is what it was before the marker existed. The
recursion moves to the private resolveTemplateNode, where "returned nothing" is
still itself in the two positions that read it, an object field it drops and an
array element it fails the state on.
AWS fails such a state with States.QueryEvaluationError; that is #2665 and stays
open.
* test(stepfunctions): read $string() with no argument as nothing, not as null
* docs(stepfunctions): mark the key dropped by an expression that returned nothing as a deviation
---------
Co-authored-by: Facundo Paredes <25681464+facuparedes@users.noreply.github.com>
|
||
|
|
395401807b |
fix(stepfunctions): bound JSONata evaluation by time and depth (#2697)
JSONata evaluation ran unbounded. A recursive expression with no base case pinned a core and left the execution RUNNING for ever: the library optimises the tail call, so it loops rather than overflowing the stack and no Error ever reaches the executor. Deep non-tail recursion did throw, but a StackOverflowError the evaluator's catch cannot see. Bound each expression with Frame#setRuntimeBounds, which the library has and Floci never called. Either bound raises a JSONata error, so the existing catch turns it into States.QueryEvaluationError, and the state fails through the same path as any other evaluation error: catchable by Catch, retryable by Retry. Five seconds and 500 levels sit deliberately above AWS. Measured with test-state, AWS refuses a non-tail-recursive function at a nesting depth of 125 and accepts it at 95, and the widest sequence it accepts evaluates here in about 100 ms, so no expression AWS runs can reach either bound. Closes #2667 Co-authored-by: Facundo Paredes <25681464+facuparedes@users.noreply.github.com> |
||
|
|
2a7ee7a605 |
fix(stepfunctions): write a large whole number in full in $string (#2683)
$string switched to exponent notation at Long.MAX_VALUE, so $string(1e20) returned "1e+20" where AWS returns "100000000000000000000". AWS's boundary is 1e21, on both signs. The execution succeeds either way, so a $string used as a MessageGroupId, an S3 key or a DynamoDB key wrote a different key on each engine without either reporting an error. $string is now bound on the evaluation frame next to the six functions of the Step Functions dialect, with the library's own signature so every arity and type error stays what it was. Below the boundary a double is replaced by the exact integer of the shortest decimal that reads back as it, which is the digit string AWS prints; the library formats everything else. Closes #2669 Co-authored-by: Facundo Paredes <25681464+facuparedes@users.noreply.github.com> |
||
|
|
eb5134da2d |
feat(stepfunctions): add the JSONata functions of the Step Functions dialect (#2676)
Step Functions extends JSONata with $parse, $partition, $range, $hash, $random and $uuid. None of them exist in the JSONata language, so an expression calling one failed with "Attempted to invoke a non-function" and the execution failed with States.QueryEvaluationError. Bind the six on the evaluation frame next to $states and the workflow variables. Behaviour follows AWS on the cases a naive reading gets wrong: a non-integer argument rounds towards zero, several argument combinations evaluate to undefined instead of failing, $range collapses a single-element range to a bare number, $parse rejects the JSON AWS rejects, and $random(seed) reproduces java.util.Random. Verified with a 65-expression differential against real AWS Step Functions: 65 match, 0 differ. Co-authored-by: Facundo Paredes <25681464+facuparedes@users.noreply.github.com> |
||
|
|
b6418dbfee |
feat(sfn): support mocked service integrations (SFN_MOCK_CONFIG) (#2452)
* feat(sfn): support mocked service integrations (SFN_MOCK_CONFIG) StartExecution accepts a state machine ARN with a test case suffix in the Step Functions Local format. The test case comes from the mock configuration file named by SFN_MOCK_CONFIG. A mocked Task state returns the configured Return payload or fails with the configured Throw error instead of calling the integrated service. The mocked error and cause reach Retry and Catch unchanged. States not named in the test case still call their real integration, so mocked and real calls combine in one execution. Behavior was verified against Step Functions Local 2.0.0. Closes #2283 * fix(sfn): never retry or catch States.Runtime even when named explicitly * fix(sfn): keep a bare trailing '#' unstripped on StartSyncExecution |
||
|
|
56e74d64c6 |
feat(sfn): support Retry policies in Task, Parallel, and Map states (#2455)
* feat(sfn): honor Retry policies in the ASL executor Task, Parallel, and Map states previously ignored their Retry field, so any failure went straight to Catch or failed the execution. They now retry per the ASL spec. ErrorEquals matching reuses the Catch matcher, including the States.ALL and States.TaskFailed wildcards, and States.Runtime is never retried. AWS defaults apply when fields are omitted (MaxAttempts 3, IntervalSeconds 1, BackoffRate 2.0). MaxDelaySeconds is honored. Each retrier keeps its own attempt counter and an exhausted retrier falls through to Catch. The context object field $$.State.RetryCount increments per attempt. Attempt counts, defaults, backoff timing, retry before catch order, and per attempt RetryCount resolution were verified against real AWS Step Functions in us-east-1 using execution histories. Two deviations are documented. The delay between attempts is capped at 30 seconds, matching the cap Floci applies to Wait states. JitterStrategy is accepted but ignored. Refs #2283 * test(sfn): add end-to-end Retry integration tests Covers the JSON 1.0 wire protocol path. The fail-then-succeed case works without mocks by resolving the DynamoDB table name from $$.State.RetryCount, so attempt 0 targets a missing table and the retry targets one that exists. This also exercises per attempt Parameters re-resolution, which real AWS does the same way. The other cases cover retrier exhaustion falling through to Catch and an unmatched error failing without retry. * fix(sfn): unwrap branch failures so Parallel Retry and Catch apply * fix(sfn): isolate the context object per Parallel branch and per branch state * fix(sfn): fail a missing Lambda function as Lambda.ResourceNotFoundException * test(sfn): cover Retry and Catch for Parallel and Map states * feat(sfn): support JitterStrategy FULL in Retry backoff * fix(sfn): keep branch Error causes wrapped so executions still terminate |
||
|
|
97ac3cabb5 |
feat(stepfunctions): add UpdateStateMachine and update in place on stack updates (#1867)
* feat(stepfunctions): add UpdateStateMachine and update in place on stack updates * test(dynamodb): retain Quarkus port for cleanup * chore: rerun CI after download outage * fix(cloudformation): preserve log group on failed rename * fix(cloudformation): scope update rollback to attempted resources * fix(cloudformation): delete resources after stack updates * test(cloudformation): wire cloudfront fixture dependency * fix: include Step Functions update date in describe response * fix: preserve Step Functions describe response shape * fix: preserve generated Step Functions names |