mirror of
https://github.com/floci-io/floci.git
synced 2026-11-22 21:50:46 -05:00
fee688bd051a5bde4e2e8a4d5e0f5d75c7ffe00a
68
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
32cbf73adc |
fix(eventbridge): answer PutEvents to a missing event bus as AWS does (#6748)
A PutEvents entry naming an event bus that does not exist failed with InvalidArgument "EventBus not found" and counted in FailedEntryCount. The EventBridge User Guide, on handling PutEvents failures: "If you use PutEvents to publish an event to an event bus that does not exist, EventBridge event matching will not find a corresponding rule and will drop the event. Although EventBridge will send a 200 response, it will not fail the request or include the event in the FailedEntryCount value of the request response." botocore models no not-found error for PutEvents, only InternalException, and the API Reference lists none. Such an entry is now answered as published, with an event id and not counted as failed, and dropped: it reaches no rule and no archive. Floci logs the drop at INFO. An entry that is not valid, missing a required field or with a Detail that is no JSON object, still fails as before, whichever bus it names. Only the PutEvents action changes. Floci's own deliveries to a bus, for a rule's event bus target, a pipe, a schedule, a Lambda destination or a replay, still fail an entry for a bus that does not exist: the guide's sentence is about the action, and no document says how AWS answers those deliveries. Step Functions' optimized events:putEvents integration calls the action, so a task publishing to a missing bus no longer fails with EventBridge.FailedEntry; step-functions.md listed that as a deviation, which is gone. Its two tests that used a missing bus to have an entry rejected now leave out the entry's Source instead, and a third checks that a task publishing to a missing bus succeeds. |
||
|
|
47226f76d1 |
fix(stepfunctions): page GetExecutionHistory and honor reverseOrder (#6555)
* fix(stepfunctions): page GetExecutionHistory and honor reverseOrder GetExecutionHistory read only executionArn and includeExecutionData. Every call returned the whole history, oldest event first: maxResults and nextToken were ignored, and reverseOrder=true still listed ExecutionStarted first, so a caller asking for the newest event with reverseOrder and maxResults=1 got the oldest one instead. The API reference pages the history by 100 events unless maxResults says otherwise, allows at most 1,000, returns a nextToken while events remain, and lists the newest event first under reverseOrder. Page the history by event id. Ids rise in the order events are recorded, so a page starts after the last event the previous page returned, even while the execution is still recording events. An omitted or zero maxResults uses 100; a maxResults outside 0 to 1,000 or a nextToken outside 1 to 1,024 characters is a ValidationException, as for ListActivities. A token names its execution and its reverseOrder, so it is refused with InvalidToken for any other, while maxResults and includeExecutionData may change from one page to the next. Tokens are signed with SignedMarkers and carry their issue time. An edited token, one issued before a restart, or one issued more than 24 hours earlier is refused with InvalidToken; the 24-hour expiry is the one the API reference documents. The execution is named in the token by the SHA-256 of its ARN, so a token stays under 200 characters however long the state machine and execution names are. Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com> * test(stepfunctions): page execution history with the SDK paginator Run a 60-state execution, whose history of 122 events is longer than one default page, and read it with the AWS SDK for Java: a plain call returns 100 events and a nextToken, the paginator at 25 events a page returns every event once, oldest first or with reverseOrder newest first, and reverseOrder with maxResults=1 returns ExecutionSucceeded with a token for the rest. Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com> * test(stepfunctions): give the ListExecutions filter test a clock StepFunctionsListExecutionsFilterTest, merged from upstream main, built the handler with the two-argument constructor. On this branch the handler takes the application Clock for the lifetime of execution history tokens, so the merged tree did not compile. Pass the system clock, which ListExecutions does not read. Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com> * test(stepfunctions): pin the page-size checks of ListActivities and history ListActivities and GetExecutionHistory each check maxResults and nextToken on their own, with the same bounds and messages, and page by 100 when maxResults is omitted or 0. Pin the messages of both and the ListActivities default before the two move onto one helper. Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com> * refactor(stepfunctions): share the page-size checks of ListActivities and history ListActivities and GetExecutionHistory each checked that maxResults is 0 to 1,000 and nextToken 1 to 1,024 characters, with the same messages, and turned an omitted or zero maxResults into 100. Move that into StepFunctionsPaging.pageSize, which validates the pair and returns the page size, so the other Step Functions list operations can use it later. Behaviour, messages and the order of the checks are unchanged. Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com> * test(stepfunctions): say why the paginator test ignores cleanup failures The SDK paginator test deleted its state machine in a catch-all that neither logged nor explained the failure it ignored. Say why it is safe: the state machine has a unique name, and a cleanup failure must not hide the test's own result. Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com> * test(stepfunctions): pin the page-size bounds and the order of the checks Pin that ListActivities and GetExecutionHistory accept the bounds themselves (a 1- or 1,024-character nextToken reaches the token lookup, and ListActivities takes maxResults=1000), and that both read maxResults and nextToken before bounding either. The test's cleanup deletes its activities without asserting, so a failed delete can no longer hide the test's own failure. The last check is the one place where the shared helper changed behaviour, which the commit that added it wrongly said it did not. A history request with maxResults=1001 and a non-string nextToken used to report the maxResults bound; it now reports "nextToken must be a string.", as ListActivities always has. The new test fails that way on the commit before the helper and passes after it. Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com> * docs(stepfunctions): describe StepFunctionsPaging by its two callers The class comment said every Step Functions list operation shares this page request. Only ListActivities and GetExecutionHistory do; ListStateMachineAliases still checks its own bounds. Name the two callers and say that both fields are read before either is bounded. Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com> * test(stepfunctions): share one request helper between the paging tests StepFunctionsPageSizeIntegrationTest and StepFunctionsExecutionHistoryPaginationIntegrationTest each carried the same private call() and content type. Add StepFunctionsRequests in the testing package, as CfnRequests and EmrRequests serve their services, and move both tests onto its sfn(action, body). The requests they send are unchanged. Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com> * test(stepfunctions): take the request body of sfn() as a map sfn() took any Object and said it serializes the body as JSON, which holds for a map but not for a string, which RestAssured sends as is. Both callers pass maps, as the private helpers it replaced took, so type the parameter as Map<String, ?>. Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com> --------- Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com> |
||
|
|
74a932bc50 |
fix(stepfunctions): honor explicit Lambda task qualifiers (#6563)
Use the effective Lambda qualifier for optimized task authorization, target resolution and executor handoff. Keep embedded qualifier conflict validation aligned with Lambda. Signed-off-by: Andre Kurait <AndreKurait@gmail.com> |
||
|
|
7c9c8ee398 |
fix(stepfunctions): retain Lambda qualifiers for provisioned capacity (#6540)
Carry the invoked Lambda alias or version into execution capacity selection after authorization, preserving the unqualified path. Signed-off-by: Andre Kurait <AndreKurait@gmail.com> |
||
|
|
40b6bfc204 |
fix(stepfunctions): honor ListExecutions status filters (#6406)
* fix(stepfunctions): honor ListExecutions status filters Filter by the requested current status, validating filter values and types before listing executions. Serialize the captured matching status, preserve unfiltered behavior, and cover the wire path through the normal SDK suite. Signed-off-by: Andre Kurait <AndreKurait@gmail.com> * fix(stepfunctions): reject unsupported pending-redrive listings Reject PENDING_REDRIVE consistently without implying map-run listing support. Exercise execution filters through explicit stop completion instead of polling for asynchronous success. Signed-off-by: Andre Kurait <AndreKurait@gmail.com> * fix(stepfunctions): use Smithy status filter validation Reuse the shared enum validation helper and preserve the AWS status ordering in invalid ListExecutions filter errors. Verify exact messages before service access and through boto3. Signed-off-by: Andre Kurait <AndreKurait@gmail.com> --------- Signed-off-by: Andre Kurait <AndreKurait@gmail.com> |
||
|
|
15de90c3ff |
feat(stepfunctions): add the emr-serverless optimized integrations (#6386)
A Task can now use the six optimized EMR Serverless integrations the
Step Functions guide lists: createApplication, startApplication,
stopApplication, deleteApplication, startJobRun and cancelJobRun, each
request-response and .sync. Each calls Floci's EMR Serverless in the
state machine's Region. They failed with "Unsupported resource" before.
A Task names the API's members in PascalCase where the API writes them
in camelCase, so a request and a response are mapped against botocore's
EMR Serverless model, now vendored as aws/emr-serverless-shapes.json by
tools/aws/regen_emr_serverless_shapes.py: a structure's members are
renamed, a map keeps the keys the state machine wrote (tags,
InitialCapacity's DRIVER, a configuration's Properties such as
spark.executor.memory), and a member the model does not have is
dropped. A member, ApplicationId and JobRunId included, may be written
in either case. One the model has and Floci's request class lacks is
refused rather than dropped, and a test holds the classes to the model.
request_shapes.py can now keep output shapes for it. A request
without ClientToken gets a random one, as the SDK fills an idempotency
token in; the guide's examples leave it out.
The result is the API's response in PascalCase, or {"ApplicationId"}
where the API answers nothing, as the guide's table says. The guide
finds no difference between a .sync response and the API's, so a .sync
result is the starting call's own: state machines read a
createApplication.sync result's ApplicationId and a startJobRun.sync
result's JobRunId. A .sync Task records TaskSubmitted and polls
GetApplication or GetJobRun until the state the guide names, as the
elasticmapreduce ones do; a run that ends FAILED or CANCELLED, or an
application that can no longer get there, fails the Task with
States.TaskFailed and the describe response as the cause. A wait that
ends early cancels the run of a startJobRun.sync, stops the application
of a startApplication.sync and deletes the one a createApplication.sync
made, the call each integration's IAM policy grants beyond its own and
its read. EMR Serverless answering that the application or run is gone
or past undoing is logged and leaves the Task ending as it was; any
other failure is raised.
An EMR Serverless error keeps its code under EmrServerless., the
exception prefix the guide gives the service; no record shows the
optimized integration's. A Task without the ApplicationId, or a
cancelJobRun without the JobRunId, it acts on fails with
States.TaskFailed before EMR Serverless sees it.
CreateApplication now stores the configurations UpdateApplication
already did (runtime, monitoring, scheduler, disk encryption,
interactive, Identity Center and job-level cost allocation), and
ImageConfiguration keeps applicationLevelDigestResolution. Both were
dropped, from a Task and from the API alike. A runtime configuration
kept only its properties, lifted out of their member: Jackson bound the
properties member to the field of that name holding every member read.
It keeps its classification and properties now, on update as well.
GetApplication no longer returns the application's clientToken, which
its Application has no member for and which the .sync waits read. The
token stays with the stored application, which CreateApplication's
retries are matched on.
The .sync wait loop the elasticmapreduce integrations had is now shared
by both, as are their request and failure helpers, and the two EMR
Step Functions tests share their state machine helpers.
Part of #6046 (part 11).
|
||
|
|
d3359662e5 |
fix(stepfunctions): preserve callback token ownership (#6271)
Signed-off-by: Andre Kurait <akurait@amazon.com> |
||
|
|
94c4572fed |
feat(stepfunctions): add the elasticmapreduce optimized integrations (#6261)
A Task can now use the optimized EMR integrations the Step Functions guide lists: createCluster, setClusterTerminationProtection, terminateCluster, addStep, cancelStep, modifyInstanceFleetByName and modifyInstanceGroupByName, with .sync for createCluster, terminateCluster and addStep. Each calls Floci's EMR in the state machine's Region under the guide's field names: ClusterId for JobFlowIds or JobFlowId, a single Step or StepId, and the instance fleet or group found by name through ListInstanceFleets or ListInstanceGroups. They failed with "Unsupported resource" before. A .sync Task records TaskSubmitted with the call's result and polls DescribeCluster or DescribeStep under the Task's TimeoutSeconds and the execution's budget, as ecs:runTask.sync does. Its result is the describe response with the call's result after it, which is the createCluster.sync output recorded on AWS (Cluster, then ClusterId). A step that ends FAILED, CANCELLED or INTERRUPTED, or a cluster that terminates before WAITING, fails the Task with States.TaskFailed and the describe response as the cause. A wait that ends early cancels the step of an addStep.sync; a cluster is left running, as the guide says Step Functions does. An EMR error is named after the SDK exception class under EMR.: InvalidRequestException and InternalServerException keep their names, and any other code is EMR.AmazonElasticMapReduceException, as AWS reports a ValidationException. createCluster refuses KeepJobFlowAliveWhenNoSteps other than true and Steps, as the guide requires, with States.TaskFailed and the guide's wording for each rule. A Task without the ClusterId its API acts on, a cancelStep without a StepId and a ByName request without its name fail the same way. AddJobFlowSteps on an unknown cluster, or on one in another Region, now answers ValidationException "Specified job flow ID does not exist.", as AWS does: a botocore ClientError (raster-foundry/raster-foundry#352) and a CloudTrail record on AWS re:Post show it. It answered DescribeCluster's InvalidRequestException. That re:Post record is an addStep.sync failing on an unknown cluster with EMR.AmazonElasticMapReduceException, which addStep now reports as well. ModifyInstanceGroups and ModifyInstanceFleet on a terminated cluster, which modifyInstanceGroupByName and modifyInstanceFleetByName reach, now answer as AWS does too: ValidationException "An instance group may only be modified when the cluster is running or waiting." (hashicorp/terraform-provider-aws#1355 and hashicorp/terraform-provider-aws#9400) and InvalidRequestException "A job flow that is shutting down, terminated, or finished may not be modified." with ErrorCode INVALID_JOB_SHUT_DOWN (hashicorp/terraform-provider-aws#31375). Both answered InvalidRequestException "Cluster <id> is terminated.", which no AWS response shows, and EMR's error body now carries an error's extra members such as ErrorCode. TerminateJobFlows, the four Set* cluster setters and CancelSteps now refuse a request without a member their model requires (JobFlowIds and the setting, or StepIds) with AWS's framework ValidationException, as RunJobFlow does for Name. They read a missing list as empty and a missing setting as its default and answered success, which the setClusterTerminationProtection and terminateCluster integrations reached too. The "Member must not be null" violation is now one helper in SmithyValidationErrors. Part of #6046 (part 10). |
||
|
|
0750128966 |
fix(stepfunctions): authorize nested task credentials (#6084)
Signed-off-by: Andre Kurait <akurait@amazon.com> |
||
|
|
2c6f2118e8 |
fix(stepfunctions): reject reserved API headers in definitions (#6082)
Reject the live-AWS-verified reserved names and hyphenated prefixes before state-machine creation or update, including JSONata and nested workflows. Share the existing exact-name policy with the invoker, preserve nearby accepted header names and keep the current response parser behavior. Signed-off-by: Andre Kurait <akurait@amazon.com> |
||
|
|
a899318862 |
feat(stepfunctions): invoke regional API Gateway tasks with IAM (#6043)
Signed-off-by: Andre Kurait <akurait@amazon.com> |
||
|
|
f8ab55f319 |
feat(sfn): encode HTTP Task object bodies as form data (#6010)
* feat(sfn): encode HTTP Task object bodies as form data * refactor(sfn): simplify HTTP Task payload encoding Reuse the shared RFC 3986 URI encoder and remove the unused form payload branch while preserving buffer and no-body requests. |
||
|
|
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 ( |