Skip to content

Failed Step Rollback#24

Merged
TanmoySG merged 3 commits into
mainfrom
failed-step-rollback
Oct 11, 2025
Merged

Failed Step Rollback#24
TanmoySG merged 3 commits into
mainfrom
failed-step-rollback

Conversation

@TanmoySG

@TanmoySG TanmoySG commented Sep 27, 2025

Copy link
Copy Markdown
Owner

Closes #22

This pull request introduces support for rollbacks in the step processing framework, allowing steps to define rollback functions that execute when a step fails. The changes include new types for rollback state and result, updates to the step execution logic to trigger rollbacks, and modifications to the context and step definitions to track rollback progress and arguments.

Rollback Functionality and Step Execution:

  • Added RollbackFunction and RollbackArgs fields to the Step struct, enabling steps to specify custom rollback logic and arguments.
  • Introduced the RollbackFn type and new types/constants for RollbackState and RollbackResult to represent the outcome of rollback operations. [1] [2]
  • Updated the step execution logic to check for failed steps and invoke the rollback function if defined, including logging and tracking rollback results in the context. [1] [2] [3]

Step Progress Tracking:

  • Modified the StepProgress struct and context to include rollback results, and added a method to set rollback progress for a step. [1] [2]

Example Usage and Refactoring:

  • Updated the example in example/main.go to demonstrate rollback usage, including a simulated failure and rollback function in the step definition. Also commented out unused code and steps for clarity. [1] [2] [3]

Minor Fixes:

  • Fixed import order in example files for consistency. [1] [2]
  • Added comments and constants for step and rollback states for better code documentation.

Let me know if you have any questions about how rollback is triggered or tracked in the new implementation!

@TanmoySG TanmoySG merged commit 22f0ae2 into main Oct 11, 2025
1 check passed
@TanmoySG TanmoySG deleted the failed-step-rollback branch October 12, 2025 16:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Failure Action - Rollback on failure

1 participant