ListTaskBlocks returns task block rows after enforcing read authority and task existence.
( ctx context.Context, taskID string, includeCleared bool, actor ActorContext, )
| 427 | |
| 428 | // ListTaskBlocks returns task block rows after enforcing read authority and task existence. |
| 429 | func (m *Service) ListTaskBlocks( |
| 430 | ctx context.Context, |
| 431 | taskID string, |
| 432 | includeCleared bool, |
| 433 | actor ActorContext, |
| 434 | ) ([]TaskBlock, error) { |
| 435 | if err := requireReadAuthority(actor); err != nil { |
| 436 | return nil, err |
| 437 | } |
| 438 | normalizedTaskID := strings.TrimSpace(taskID) |
| 439 | if normalizedTaskID == "" { |
| 440 | return nil, fmt.Errorf("%w: task_block.task_id is required", ErrValidation) |
| 441 | } |
| 442 | if err := m.requireAgentSessionTaskLease(ctx, normalizedTaskID, actor); err != nil { |
| 443 | return nil, err |
| 444 | } |
| 445 | if _, err := m.store.GetTask(ctx, normalizedTaskID); err != nil { |
| 446 | return nil, err |
| 447 | } |
| 448 | return m.store.ListTaskBlocks(ctx, normalizedTaskID, includeCleared) |
| 449 | } |
| 450 | |
| 451 | func (m *Service) taskBlockFromRequest(req BlockRequest, actor ActorContext) (TaskBlock, string, string, error) { |
| 452 | now := m.now().UTC() |
nothing calls this directly
no test coverage detected