Operant Studio
OPER-2

feat(assignment): rule-based auto-assignment on state transitions

Band
MEDIUM

Body

When a task transitions to certain states, auto-assign based on rules.

## Scope
- New `TeamAssignmentRule` table: `{teamId, trigger: enum(AWAITING_HUMAN|IN_REVIEW|PLANNING_VALIDATED|READY), assigneeId, ordering, active}` — fallback chain.
- Prisma migration + seed of sensible defaults (Operant→Justin, Portico→Justin, until we know better).
- Wire into the state-transition hook — grep `updateTaskStatus` or the equivalent transition function to find the seam.
- Skip auto-assign if `assigneeId` already set.
- Emit `task.auto_assigned` event with rule id for audit.

## Depends on
- OPER-1 (UI to override an auto-assignment)

## Verification
- Create a rule: Operant + AWAITING_HUMAN → Justin.
- Transition a test task through AWAITING_HUMAN.
- Confirm `assigneeId` is set and AuditLog captured the rule id.

Attachments

Loading attachments…

Comments

Loading comments…