Skip to content

Commit 30870b7

Browse files
verify actor is REVERTING before finalizing revert
1 parent eaf34c5 commit 30870b7

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

‎cmd/ateapi/internal/controlapi/workflow_revert.go‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,9 @@ func (w *ActorWorkflow) ensureRevertedFinalized(ctx context.Context, actorRef re
242242
if err != nil {
243243
return nil, err
244244
}
245+
if got := latestActor.GetStatus().GetState(); got != ateapipb.ActorState_ACTOR_STATE_REVERTING {
246+
return nil, status.Errorf(codes.FailedPrecondition, "FinalizeReverted prerequisite not met for Actor: %s (got: %v, want %s)", actorRef, got, ateapipb.ActorState_ACTOR_STATE_REVERTING)
247+
}
245248

246249
storedActor, err := w.store.UpdateActor(ctx, actorRef, store.PreconditionFrom(latestActor), func(toUpdate *ateapipb.Actor) error {
247250
toUpdate.Status.State = ateapipb.ActorState_ACTOR_STATE_SUSPENDED

0 commit comments

Comments
 (0)