mirror of
https://github.com/floci-io/floci.git
synced 2026-11-22 21:50:46 -05:00
feat(stepfunctions): implement States.JsonMerge intrinsic (#1662)
* feat(stepfunctions): implement States.JsonMerge intrinsic The DPS provisioning state machine uses States.JsonMerge, which AslExecutor rejected with "Unsupported intrinsic function: States.JsonMerge". Implement the shallow merge (second object's top-level fields win on conflict); reject the deep-merge form (third argument true) and non-object arguments, as AWS does. Also resolve boolean/null literal intrinsic arguments so the third argument evaluates correctly. Covered by AslExecutorJsonMergeTest. * fix(stepfunctions): reject a non-boolean States.JsonMerge third argument The third (deep) argument was read with JsonNode.asBoolean(), which silently coerces null/number/string/object nodes to false, so States.JsonMerge($.a,$.b,$.x) with a non-boolean $.x quietly performed a shallow merge instead of failing. Validate that the resolved third argument is a boolean and raise States.Runtime otherwise. Covered by AslExecutorJsonMergeTest.nonBooleanThirdArgumentRejected. * fix(stepfunctions): validate JsonMerge argument types before the deep-merge flag AWS validates the argument types of States.JsonMerge before evaluating the deep-merge flag, so two non-objects passed with true should report "requires two JSON objects" rather than "shallow merge only". Reorder the object-type check ahead of the deep-flag rejection and add a precedence test. * test(stepfunctions): adapt JsonMerge test to main's AslExecutor constructor main's AslExecutor constructor now takes EcsService and EcsJsonHandler; pass the two new mocks. Also generalize a comment that named a specific downstream system. * docs: regenerate action tables * fix(stepfunctions): thread context into States.JsonMerge intrinsic args The intrinsic pipeline gained a context argument on main (resolveIntrinsicArg / evaluateIntrinsic now take three parameters). Thread the surrounding case's root/context through the three States.JsonMerge argument resolutions so the branch compiles against current main. * fix: align JsonMerge intrinsic failures * fix(athena): harden compatibility query polling
This commit is contained in:
1 parent
024d74e5c4
commit
b245632a2e
5 files changed
+192
-32
No files matched your search
@@ -39,6 +39,9 @@ import software.amazon.awssdk.services.sts.StsClient;
|
||||
import software.amazon.awssdk.services.kafka.KafkaClient;
|
||||
import software.amazon.awssdk.services.mq.MqClient;
|
||||
import software.amazon.awssdk.services.athena.AthenaClient;
|
||||
import software.amazon.awssdk.services.athena.model.GetQueryExecutionRequest;
|
||||
import software.amazon.awssdk.services.athena.model.QueryExecutionState;
|
||||
import software.amazon.awssdk.services.athena.model.QueryExecutionStatus;
|
||||
import software.amazon.awssdk.services.glue.GlueClient;
|
||||
import software.amazon.awssdk.services.firehose.FirehoseClient;
|
||||
import software.amazon.awssdk.services.resourcegroupstaggingapi.ResourceGroupsTaggingApiClient;
|
||||
@@ -401,6 +404,30 @@ public final class TestFixtures {
|
||||
.build();
|
||||
}
|
||||
|
||||
static QueryExecutionStatus awaitAthenaQueryTerminal(
|
||||
AthenaClient athena, String queryExecutionId, Duration timeout) throws InterruptedException {
|
||||
long deadline = System.nanoTime() + timeout.toNanos();
|
||||
while (true) {
|
||||
QueryExecutionStatus status = athena.getQueryExecution(
|
||||
GetQueryExecutionRequest.builder()
|
||||
.queryExecutionId(queryExecutionId)
|
||||
.build())
|
||||
.queryExecution()
|
||||
.status();
|
||||
QueryExecutionState state = status.state();
|
||||
if (state != QueryExecutionState.QUEUED && state != QueryExecutionState.RUNNING) {
|
||||
return status;
|
||||
}
|
||||
|
||||
long remainingNanos = deadline - System.nanoTime();
|
||||
if (remainingNanos <= 0) {
|
||||
return status;
|
||||
}
|
||||
long sleepMillis = Math.min(500, Math.max(1, Duration.ofNanos(remainingNanos).toMillis()));
|
||||
Thread.sleep(sleepMillis);
|
||||
}
|
||||
}
|
||||
|
||||
public static GlueClient glueClient() {
|
||||
return GlueClient.builder()
|
||||
.endpointOverride(ENDPOINT)
|
||||
|
||||
Reference in new issue
Block a user