From 6f64d234ee93547e1188ebfaf9c13fee20c2184b Mon Sep 17 00:00:00 2001 From: Jakub Duchek Date: Thu, 24 Sep 2026 22:30:57 +0200 Subject: [PATCH] Allow retrying failed run-step skips --- .../execution_plan/steps/finalize_step.rb | 2 ++ test/rescue_test.rb | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/lib/dynflow/execution_plan/steps/finalize_step.rb b/lib/dynflow/execution_plan/steps/finalize_step.rb index 57532153..c771a5a9 100644 --- a/lib/dynflow/execution_plan/steps/finalize_step.rb +++ b/lib/dynflow/execution_plan/steps/finalize_step.rb @@ -24,6 +24,8 @@ def phase end def mark_to_skip + return if state == :skipped + self.state = :skipped self.save end diff --git a/test/rescue_test.rb b/test/rescue_test.rb index 3e3388e4..8efd3dee 100644 --- a/test/rescue_test.rb +++ b/test/rescue_test.rb @@ -34,6 +34,25 @@ def execute(*args) end end + describe 'when skipping a run step fails' do + let :execution_plan do + execute(Example::ActionWithSkip, 1, :error_on_skip) + end + + it 'allows retrying the skip' do + 2.times do + plan = world.persistence.load_execution_plan(execution_plan.id) + plan.skip(plan.failed_steps.first) + world.execute(plan.id).value + end + + plan = world.persistence.load_execution_plan(execution_plan.id) + _(plan.state).must_equal :paused + _(plan.run_steps.first.state).must_equal :error + _(plan.finalize_steps.first.state).must_equal :skipped + end + end + describe 'of simple skippable action in finalize phase' do let :execution_plan do execute(Example::ActionWithSkip, 1, :error_on_finalize)