MCPcopy Create free account
hub / github.com/apache/maka / canTransitionTaskStatus

Function canTransitionTaskStatus

packages/core/src/task-ledger.ts:392–412  ·  view source on GitHub ↗
(
  from: TaskStatus,
  to: TaskStatus,
  options: TaskStatusTransitionOptions = {},
)

Source from the content-addressed store, hash-verified

390}
391
392export function canTransitionTaskStatus(
393 from: TaskStatus,
394 to: TaskStatus,
395 options: TaskStatusTransitionOptions = {},
396): boolean {
397 if (from === to) return true;
398 switch (from) {
399 case 'pending':
400 return to === 'in_progress' || to === 'cancelled';
401 case 'in_progress':
402 return to === 'blocked' || to === 'completed' || to === 'failed' || to === 'cancelled';
403 case 'blocked':
404 return to === 'in_progress' || to === 'cancelled' || to === 'failed';
405 case 'failed':
406 return to === 'pending' || to === 'cancelled';
407 case 'completed':
408 return options.explicitReopen === true && to === 'in_progress';
409 case 'cancelled':
410 return options.explicitReopen === true && to === 'pending';
411 }
412}
413
414export function validateTaskEvidence(
415 task: Pick<Task, 'status' | 'blockedReason' | 'failureReason' | 'completionEvidence'>,

Callers 3

validateTaskUpdateFunction · 0.85
projectTaskLedgerEventsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected