# DeletePipelineLabel

## Permission Scope

label

## Overview

Deletes a label and cascades to remove every PipelineItemLabel join row that referenced it. Items themselves are not affected — they simply lose the label from their attached set.

## Business Rules

- PipelineLabel must exist
- All PipelineItemLabel join rows referencing the label are removed in the same transaction

## Process Flow

```mermaid
flowchart TD
    A[Receive deletePipelineLabel input] --> B{PipelineLabel exists?}
    B -->|No| C[Return LABEL_NOT_FOUND]
    B -->|Yes| D[Delete all PipelineItemLabel rows where labelId matches]
    D --> E[Delete PipelineLabel]
    E --> F[Return deleted PipelineLabel]
```

## External Dependencies

- None

## Error Scenarios

- **LABEL_NOT_FOUND**: Specified label ID does not exist

## Test Cases

- deletes the label and its item-label join rows
- returns error when label does not exist
