Skip to content

[SP-8499] Introduce always step#40

Merged
msx2 merged 3 commits into
masterfrom
SP-8499-always-executor
Apr 16, 2026
Merged

[SP-8499] Introduce always step#40
msx2 merged 3 commits into
masterfrom
SP-8499-always-executor

Conversation

@msx2

@msx2 msx2 commented Apr 16, 2026

Copy link
Copy Markdown
Contributor

Introduces a new always DSL instruction that runs a step unconditionally at the end of the operation pipeline — regardless of whether prior steps succeeded, failed, or halted early via finish! or finish_if DSL.

How it works

always steps are declared after all regular instructions and execute even when the normal break condition (failure or early finish) would have stopped execution. Inside an always step, result.success? and result.failure? reflect the final state of the operation, allowing conditional logic based on outcome.

step :build
step :charge
step :send_confirmation
always :audit_log
always :cleanup

Placement rules enforced at class load time

  • always steps must appear after all other instructions at the top level of the operation.
  • Once an always is declared, only further always steps may follow — any other instruction (step, operation, transaction, within, etc.) raises an ArgumentError at class load time.
  • always cannot be used inside blocks (transaction do, within do, success do, validate do). Doing so raises an ArgumentError at class load time.

@msx2 msx2 added the enhancement New feature or request label Apr 16, 2026
@msx2 msx2 requested review from cintrzyk, kikorb and petergebala April 16, 2026 07:23
@petergebala petergebala linked an issue Apr 16, 2026 that may be closed by this pull request
@msx2 msx2 merged commit 1276757 into master Apr 16, 2026
4 checks passed
@msx2 msx2 deleted the SP-8499-always-executor branch April 16, 2026 12:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ensure step

3 participants