DeleteTask removes one task after verifying it is not still in use by child tasks or non-terminal runs, then reconciles any dependents unblocked by the cascade-deleted dependency edges.
(ctx context.Context, id string, actor ActorContext)
| 403 | // tasks or non-terminal runs, then reconciles any dependents unblocked by the |
| 404 | // cascade-deleted dependency edges. |
| 405 | func (m *Service) DeleteTask(ctx context.Context, id string, actor ActorContext) error { |
| 406 | if err := requireWriteAuthority(actor); err != nil { |
| 407 | return err |
| 408 | } |
| 409 | |
| 410 | trimmedID := strings.TrimSpace(id) |
| 411 | if trimmedID == "" { |
| 412 | return fmt.Errorf("%w: task id is required", ErrValidation) |
| 413 | } |
| 414 | |
| 415 | if txStore, ok := m.store.(DeleteTaskTransactionStore); ok { |
| 416 | return txStore.WithDeleteTaskTransaction(ctx, func(store DeleteTaskMutationStore) error { |
| 417 | return m.deleteTaskWithStore(ctx, store, trimmedID) |
| 418 | }) |
| 419 | } |
| 420 | |
| 421 | return m.deleteTaskWithStore(ctx, m.store, trimmedID) |
| 422 | } |
| 423 | |
| 424 | func (m *Service) deleteTaskWithStore( |
| 425 | ctx context.Context, |
nothing calls this directly
no test coverage detected