mirror of
https://github.com/floci-io/floci.git
synced 2026-12-01 01:12:48 -05:00
* feat(stepfunctions): add ecs:runTask service integration Wire the Step Functions task executor to the existing docker-backed ECS service so state machines can launch ECS tasks via the optimized integrations: arn:aws:states:::ecs:runTask (request-response) arn:aws:states:::ecs:runTask.sync (wait until the task STOPs) Previously AslExecutor had no ecs:runTask branch, so a state machine using these resources failed with "Unsupported resource" even though Floci can run ECS tasks. This unblocks orchestration patterns that launch a task and wait for it to finish (e.g. a provisioning runner). Step Functions optimized integrations use PascalCase member names for both parameters and results, while Floci's ECS handlers use the lowerCamelCase of the ECS data-plane API. A small recursive key-recasing bridge maps parameters in (PascalCase -> camelCase) and results out (camelCase -> PascalCase), reusing EcsJsonHandler.taskNode / parseContainerOverrides so the output matches the ECS task shape exactly. For .sync, the executor polls DescribeTasks until the task reaches STOPPED and fails the state (States.TaskFailed) when an essential container exits non-zero or the task never ran a container, matching real Step Functions. Tests: recaseKeys unit coverage (nested objects/arrays, inverse, scalar round-trip); integration tests for the PascalCase Tasks/Failures envelope, TaskDefinition validation, and .sync error propagation (ECS mock profile, so the wiring is asserted independently of a container runtime). * fix(stepfunctions): poll all ecs:runTask.sync tasks and validate mode Greptile review on #1564: - .sync now polls every launched task (not just the first), so with Count > 1 a failure in any task fails the state instead of leaving later tasks unmonitored. Single task returns its description; multiple return the array. - Reject unknown ecs:runTask mode suffixes (e.g. a '.Sync' typo) with States.TaskFailed instead of silently treating them as .sync. * fix(stepfunctions): treat a STOPPED ecs task with no exit code as failed Greptile follow-up on #1564: ecsTaskFailureCause reported success whenever no container had a non-zero exit, but a container with a null exit code never completed cleanly (OOM-killed, failed to start, force-stopped). Treat any null exit code on a STOPPED task as a failure, matching AWS Step Functions. * fix(stepfunctions): only essential containers fail an ecs:runTask.sync state Greptile follow-up on #1564: ecsTaskFailureCause checked exit codes on all containers, so a non-essential sidecar (log shipper, metrics agent) exiting non-zero would fail the state. Resolve the task definition and skip containers explicitly marked essential:false; anything not resolvable stays essential. * fix(stepfunctions): log when an ecs:runTask task definition can't be resolved nonEssentialContainerNames swallowed the RuntimeException from describeTaskDefinition and silently returned an empty set (all containers treated as essential), violating the AGENTS.md rule against silent catch blocks. Log the tolerated failure with the task definition ARN so the lost essential/non-essential distinction is diagnosable. No behavior change (still conservatively treats all containers as essential). * fix(stepfunctions): request-response ecs:runTask must not fail on placement failure Request-response returns the {Tasks,Failures} envelope even when no task is placed (AWS: 200 with a non-empty Failures list); only .sync and .waitForTaskToken fail the state, using the AWS error name AmazonECS.Unknown. Previously the launched.isEmpty() check threw States.TaskFailed before the mode branch, so it fired for request-response too. .waitForTaskToken is distinguished by its non-null task token. Also thread NetworkConfiguration (awsvpc) through runTask -> EcsTask across all three runTask callers (real RunTask API, service reconciler, ecs:runTask integration) so it is no longer dropped at the boundary; awsvpc ENI attachments remain unemulated in the local mock profile.