# CreatePipelineItemComment

## Permission Scope

itemComment

## Overview

Creates a new comment on an existing item. The comment is attributed to the calling user, and `createdAt` is set automatically to the current timestamp.

## Business Rules

- PipelineItem must exist
- Body must be non-empty
- The author is always the calling user (`ctx.actorId`); no separate author input is accepted and no additional existence check is performed
- `createdAt` is set automatically to the current timestamp
- The newly created comment is returned to the caller
- Consumer extension fields (declared via the `fields` extension point) are passed through to the insert

## Process Flow

```mermaid
flowchart TD
    A[Receive createPipelineItemComment input] --> B{PipelineItem exists?}
    B -->|No| C[Return ITEM_NOT_FOUND]
    B -->|Yes| D{Body non-empty?}
    D -->|No| E[Return INVALID_BODY]
    D -->|Yes| F[Persist PipelineItemComment]
    F --> G[Return created PipelineItemComment]
```

## External Dependencies

- None

## Error Scenarios

- **ITEM_NOT_FOUND**: Specified item ID does not exist
- **INVALID_BODY**: Body is empty

## Test Cases

- creating a comment with a valid body and existing item succeeds
- returns error when item does not exist
- returns error when body is empty
- createdAt is set automatically at creation time
