Add a "draft" status to tickets so they can be created and reviewed before appearing in the backlog for workers to claim.
## Problem
Currently all new tickets go directly to "backlog" status. This means:
- Tickets can be claimed before they're fully thought through
- No review step for ticket quality before workers see them
- Orchestrator can't "park" ideas without making them actionable
## Solution
Add a new "draft" status as the initial state for newly created tickets. Draft tickets must be explicitly "confirmed" before entering the backlog.
## Changes Required
### 1. Add draft state to Ticket model (app/models/ticket.rb)
```ruby
aasm column: :status do
state :draft, initial: true # NEW: initial state
state :backlog
state :todo
state :in_progress
state :pending_audit
state :pending_approval
state :done
state :blocked
state :canceled
event :confirm do
transitions from: :draft, to: :backlog
end
# ... existing events
end
```
### 2. Update list_tickets default behavior (app/controllers/api/v1/mcp_controller.rb)
By default, filter out draft tickets from `list_tasks` output unless specifically requested:
```ruby
# Add optional parameter include_drafts (default: false)
# When false: exclude status: "draft" from results
```
### 3. Add confirm transition to MCP tool
The `transition_ticket` tool should support the `confirm` event:
```ruby
# In handle_transition_ticket, add "confirm" as a valid event
```
### 4. Update migration
Add "draft" to status enum if using native enum (not AASM), or add database check constraint.
## Workflow
```
[Orchestrator creates ticket] → draft
↓
[Review/refine ticket]
↓
confirm → backlog → [workers can now see and claim]
```
## Acceptance Criteria
- New tickets start in "draft" status (initial state)
- Draft tickets don't appear in `list_tasks` by default
- `confirm` event moves draft → backlog
- Only orchestrator can create/confirm draft tickets (enforce in controller)
- Once confirmed, ticket behaves normally (backlog → todo → in_progress, etc.)
- Migration updates schema if needed
## Files to Modify
- `app/models/ticket.rb` - add draft state and confirm event
- `app/controllers/api/v1/mcp_controller.rb` - update list_tickets default filter, add confirm event
- `spec/models/ticket_spec.rb` - add tests for draft state
- `spec/requests/api/v1/mcp_spec.rb` - add tests for confirm event and draft filtering
Add a "draft" status to tickets so they can be created and reviewed before appearing in the backlog for workers to claim.
## Problem
Currently all new tickets go directly to "backlog" status. This means:
- Tickets can be claimed before they're fully thought through
- No review step for ticket quality before workers see them
- Orchestrator can't "park" ideas without making them actionable
## Solution
Add a new "draft" status as the initial state for newly created tickets. Draft tickets must be explicitly "confirmed" before entering the backlog.
## Changes Required
### 1. Add draft state to Ticket model (app/models/ticket.rb)
```ruby
aasm column: :status do
state :draft, initial: true # NEW: initial state
state :backlog
state :todo
state :in_progress
state :pending_audit
state :pending_approval
state :done
state :blocked
state :canceled
event :confirm do
transitions from: :draft, to: :backlog
end
# ... existing events
end
```
### 2. Update list_tickets default behavior (app/controllers/api/v1/mcp_controller.rb)
By default, filter out draft tickets from `list_tasks` output unless specifically requested:
```ruby
# Add optional parameter include_drafts (default: false)
# When false: exclude status: "draft" from results
```
### 3. Add confirm transition to MCP tool
The `transition_ticket` tool should support the `confirm` event:
```ruby
# In handle_transition_ticket, add "confirm" as a valid event
```
### 4. Update migration
Add "draft" to status enum if using native enum (not AASM), or add database check constraint.
## Workflow
```
[Orchestrator creates ticket] → draft
↓
[Review/refine ticket]
↓
confirm → backlog → [workers can now see and claim]
```
## Acceptance Criteria
- New tickets start in "draft" status (initial state)
- Draft tickets don't appear in `list_tasks` by default
- `confirm` event moves draft → backlog
- Only orchestrator can create/confirm draft tickets (enforce in controller)
- Once confirmed, ticket behaves normally (backlog → todo → in_progress, etc.)
- Migration updates schema if needed
## Files to Modify
- `app/models/ticket.rb` - add draft state and confirm event
- `app/controllers/api/v1/mcp_controller.rb` - update list_tickets default filter, add confirm event
- `spec/models/ticket_spec.rb` - add tests for draft state
- `spec/requests/api/v1/mcp_spec.rb` - add tests for confirm event and draft filtering