( ctx context.Context, taskID string, action ExecutionAction, actor ActorContext, )
| 732 | } |
| 733 | |
| 734 | func (m *Service) prepareTaskExecutionBoundary( |
| 735 | ctx context.Context, |
| 736 | taskID string, |
| 737 | action ExecutionAction, |
| 738 | actor ActorContext, |
| 739 | ) (*Task, error) { |
| 740 | switch action { |
| 741 | case ExecutionActionPublish: |
| 742 | _, err := m.publishTaskIntent(ctx, taskID, actor) |
| 743 | return nil, err |
| 744 | case ExecutionActionApproval: |
| 745 | return m.transitionTaskApproval(ctx, taskID, ApprovalStateApproved, taskEventApproved, actor) |
| 746 | case ExecutionActionStart: |
| 747 | taskRecord, err := m.store.GetTask(ctx, taskID) |
| 748 | if err != nil { |
| 749 | return nil, err |
| 750 | } |
| 751 | return nil, m.ensureTaskExecutable(ctx, taskRecord) |
| 752 | default: |
| 753 | return nil, fmt.Errorf("%w: unsupported task execution action %q", ErrValidation, action) |
| 754 | } |
| 755 | } |
| 756 | |
| 757 | func (m *Service) approvalAutoEnqueueExecution( |
| 758 | ctx context.Context, |
no test coverage detected