# ListPipelineStagesByPipeline

## Overview

ListPipelineStagesByPipeline retrieves all stages belonging to a specific pipeline, ordered by their position. This supports rendering the pipeline layout with columns in the correct left-to-right order.

**Input:** pipelineId (uuid, required) — the ID of the pipeline to list stages for.

**Output:** List of PipelineStage records ordered by position ascending.

## Business Rules

- pipelineId is required and must reference an existing Pipeline record
- Results are ordered by position ascending to reflect the pipeline's column layout
- Returns an empty list when the pipeline has no stages
- Query: `SELECT * FROM PipelineStage WHERE pipelineId = input.pipelineId ORDER BY position ASC`

## Process Flow

```mermaid
flowchart TD
    A[Receive input with pipelineId] --> B{Pipeline exists?}
    B -->|No| C[Return error: PIPELINE_NOT_FOUND]
    B -->|Yes| D[SELECT * FROM PipelineStage WHERE pipelineId = input.pipelineId ORDER BY position ASC]
    D --> E[Return stage list]
```

## External Dependencies

- None

## Error Scenarios

- **PIPELINE_NOT_FOUND**: Specified pipeline ID does not exist

## Test Cases

- returns stages ordered by position ascending
- returns empty list when pipeline has no stages
- filters stages to the specified pipeline only
- returns error when pipeline does not exist
