veritas-kanban/shared/src
Brad Groux a58496839d
fix: workflow correctness — human gate blocking, retry bounds, HTTP errors, shared contracts, depends_on enforcement (#805)
Fixes #778, #780, #785, #786, #787

## #778 — Human gate blocking/resume correctness
- Introduce HumanGateBlockError in WorkflowStepExecutor; gate steps with
  on_false.escalate_to=human now throw this typed exception instead of a
  plain Error.
- executeRun() catches HumanGateBlockError before handleStepFailure() so the
  run transitions to blocked (not failed); persists _gateBlock context.
- Add approveGateStep() and rejectGateStep() service methods; fix route
  endpoints to persist state and validate run.status===blocked.

## #780 — Bounded retry_step cycles
- Add max_reroutes field to FailurePolicy and retryRouteCount to WorkflowRun
  in both shared and server type contracts.
- handleStepFailure increments and checks retryRouteCount on every retry_step
  reroute; defaults to MAX_REROUTES_DEFAULT=10; exhaustion fires on_exhausted
  policy or fails deterministically.
- retryRouteCount persists to disk/SQLite; survives process restart.

## #785 — WorkflowRunService domain errors → HTTP mapping
- Remove private NotFoundError and ValidationError from workflow-run-service.ts.
- Import and throw the shared AppError-based NotFoundError/ValidationError from
  middleware/error-handler.ts so central error middleware maps them to 404/400.

## #786 — Shared workflow contracts
- Add provider? and command? fields to WorkflowAgent in
  shared/src/types/workflow.ts to match the server-side definition and expose
  them to web, CLI, and MCP consumers.

## #787 — depends_on enforcement during status transitions
- BlockingService refactored to merge both legacy blockedBy and canonical
  dependencies.depends_on (deduplication via Set) in getBlockingStatus(),
  canMoveToInProgress(), getDependentTasks(), and
  wouldCreateCircularDependency().
- Tasks route transition guard now triggers when either blockedBy or
  dependencies.depends_on is non-empty.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
2026-07-10 12:16:51 -05:00
..
types fix: workflow correctness — human gate blocking, retry bounds, HTTP errors, shared contracts, depends_on enforcement (#805) 2026-07-10 12:16:51 -05:00
utils Add reflection memory promotion queue 2026-06-26 14:00:51 -05:00
index.ts feat: Sprint US-1200 Refactoring batch — 13 tasks complete 2026-01-28 06:08:59 -06:00
types.ts feat: Global System Health Status Bar (#185) (#221) 2026-03-21 11:12:04 -05:00