Show HN: Stepped Actions – distributed workflow orchestration for Rails
6 days ago
- #ActiveJob
- #Workflow
- #Rails
- Stepped is a Rails engine for orchestrating complex workflows as a tree of actions.
- Each action is persisted, runs through Active Job, and can fan out into more actions.
- Stepped was extracted from Envirobly for tasks like application deployment involving DNS provisioning, retries, and health checks.
- Action trees allow defining a root action with multiple steps; each step completes only when all its actions finish.
- Models are the actors in Stepped, allowing actions to be defined and run on all models.
- Concurrency lanes ensure actions with the same concurrency_key run one at a time.
- Reuse is possible with checksums, allowing Stepped to skip work already done or share actions.
- Outbound completion lets actions stay performing until explicitly completed by an external event.
- Installation involves adding the gem, running migrations, and defining actions on models.
- Actions can be run synchronously (*_now) or asynchronously (*_later).
- Steps can enqueue more actions, wait for timed intervals, or fail deliberately.
- Before and after callbacks allow mutating arguments or running code at specific action stages.
- Concurrency keys can be overridden to coordinate actions across records or different actions.
- Deadlocks are prevented by marking actions that try to join their ancestor's concurrency lane as deadlocked.
- Checksums enable reuse by storing successful checksums in Stepped::Achievement.
- Outbound actions remain performing until explicitly completed, useful for webhooks or external systems.
- Job-backed actions are treated as outbound and must call action.complete! when finished.
- Timeouts can be set for actions, with timed-out actions failing parent steps.
- Handled exceptions can be configured to mark actions as failed instead of raising.
- Stepped::TestHelper aids in testing by draining the full action tree and handling outbound actions.
- The gem is open-source under the MIT License.