Skip to content

[208] add action track#209

Merged
kozmod merged 2 commits into
mainfrom
feature/208_track
Mar 25, 2026
Merged

[208] add action track#209
kozmod merged 2 commits into
mainfrom
feature/208_track

Conversation

@kozmod
Copy link
Copy Markdown
Owner

@kozmod kozmod commented Mar 25, 2026

Description

Breaking Changes ⚠️

Saga Package API Changes
The saga package has undergone significant API changes to improve error tracking and execution visibility. These changes are backward incompatible.

  1. Action and Compensation Function Signatures
// Before:
type ActionFunc func(ctx context.Context) error
type CompensationFunc func(ctx context.Context, aroseErr error) error

// After::
type ActionFunc func(ctx context.Context, track Track) error
type CompensationFunc func(ctx context.Context, track Track) error
  1. Compensation Error Access
// Before:
Compensation: func(ctx context.Context, aroseErr error) error {
    if errors.Is(aroseErr, ErrPaymentFailed) {
        return refundPayment(ctx)
    }
    return nil
}

// After::
Compensation: func(ctx context.Context, track saga.Track) error {
    data := track.GetData()
    if len(data.Action.Errors) > 0 && errors.Is(data.Action.Errors[0], ErrPaymentFailed) {
        return refundPayment(ctx)
    }
    return nil
}
  1. Execute Method Return Type and Result structure
result, err := saga.NewSaga(steps).Execute(ctx)

// ...
type Result struct {
    Steps  []StepData 
    Status StageStatus
}

Closes #208

@kozmod kozmod force-pushed the feature/208_track branch from f67a888 to 5fc433f Compare March 25, 2026 07:23
@kozmod kozmod force-pushed the feature/208_track branch from f748e60 to 176405c Compare March 25, 2026 07:27
@kozmod kozmod merged commit 8624fe1 into main Mar 25, 2026
3 checks passed
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.

[Sage] add "tracking" of actions/compensation execution

1 participant