feat(stepfunctions): real activity worker pool#770
Merged
vieiralucas merged 2 commits intomainfrom Apr 26, 2026
Merged
Conversation
Activities now have a real worker pool. A Task state with an activity ARN inserts a PENDING token, and GetActivityTask long-polls for the oldest pending task (FAKECLOUD_SFN_GET_ACTIVITY_TIMEOUT_SECS, default 5s, empty token returned on timeout to match AWS). SendTaskSuccess unblocks the interpreter with the worker's output. SendTaskFailure unblocks with an error+cause. SendTaskHeartbeat refreshes last_heartbeat_at; the interpreter watches HeartbeatSeconds and TimeoutSeconds and fails the task with States.HeartbeatTimeout or States.Timeout when the windows close. Adds a /_fakecloud/stepfunctions/enqueue-activity-task introspection endpoint that lets tests insert pending tasks without a state-machine execution. Updates the conformance round-trip test to use it (the old synthetic-token shortcut was non-conformant with AWS, which returns an empty token when no task is queued). - TaskTokenState gains input/created_at/last_heartbeat_at/heartbeat_seconds/timeout_seconds - New invoke_activity in interpreter polls until the worker resolves the token, then cleans it up - New E2E tests cover round-trip success + failure paths - Docs updated to describe the worker pool + introspection endpoint
There was a problem hiding this comment.
1 issue found across 8 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="crates/fakecloud-server/src/main.rs">
<violation number="1" location="crates/fakecloud-server/src/main.rs:3886">
P2: Don’t derive Step Functions account state from the request ARN in this introspection route; use the emulator’s default account state so task injection targets the same account namespace as the rest of Step Functions endpoints.
(Based on your team's feedback about treating FakeCloud as single-account by default and avoiding account derivation from arbitrary ARNs.) [FEEDBACK_USED]</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replaces the synthetic GetActivityTask shortcut with a real worker pool: a Task state inserts a PENDING token, GetActivityTask long-polls for the oldest pending task, SendTaskSuccess/Failure unblocks the interpreter. Heartbeat + timeout windows enforced. New introspection endpoint lets tests inject pending tasks directly.
Test plan
Summary by cubic
Implements a real Step Functions activity worker pool: Task states enqueue pending work, workers long‑poll
GetActivityTask, and executions resolve viaSendTaskSuccess/SendTaskFailurewithHeartbeatSeconds/TimeoutSecondsenforced. Adds a test-only endpoint to enqueue tasks directly (uses the default account).New Features
GetActivityTask(long-polls up toFAKECLOUD_SFN_GET_ACTIVITY_TIMEOUT_SECS, default 5s; returns empty token on timeout).SendTaskHeartbeatnow updateslast_heartbeat_atonly; emitsStates.HeartbeatTimeoutorStates.Timeoutwhen windows close.POST /_fakecloud/stepfunctions/enqueue-activity-taskinserts a pending task for an activity (acceptsactivityArn, optionalinput,heartbeatSeconds,timeoutSeconds; returnstaskToken). Tasks are enqueued in the default account namespace.TaskTokenStateextended withinput,created_at,last_heartbeat_at,heartbeat_seconds,timeout_seconds; tokens are cleaned up on completion.Migration
GetActivityTasktokens must handle empty tokens and poll until a task is available.SendTask*without a state machine should use/_fakecloud/stepfunctions/enqueue-activity-taskor start a real execution; for multi-account setups, switch the default account or create the activity in the default account.HeartbeatSecondsis set, workers must callSendTaskHeartbeatperiodically.FAKECLOUD_SFN_GET_ACTIVITY_TIMEOUT_SECSif needed.Written for commit c70cb0b. Summary will update on new commits.