generated from coulomb/repo-seed
feat(tasks): adopt canonical task statuses
This commit is contained in:
@@ -3,12 +3,13 @@ from __future__ import annotations
|
||||
from dataclasses import dataclass
|
||||
from typing import Any
|
||||
|
||||
from api.task_status import ACTIVE_TASK_STATUSES, normalize_task_status, status_value
|
||||
from api.workplan_status import normalize_workstream_status
|
||||
|
||||
|
||||
TASK_STARTED_STATUS = "in_progress"
|
||||
TASK_STARTED_STATUS = "progress"
|
||||
TASK_NOT_STARTED_STATUS = "todo"
|
||||
TASK_ACTIVE_STATUSES = {"in_progress", "blocked"}
|
||||
TASK_ACTIVE_STATUSES = ACTIVE_TASK_STATUSES
|
||||
PARENT_ACTIVATION_STATUSES = {"proposed", "ready", "backlog"}
|
||||
|
||||
|
||||
@@ -21,12 +22,6 @@ class LifecycleTransitionResult:
|
||||
parent_activated: bool = False
|
||||
|
||||
|
||||
def status_value(status: Any) -> str:
|
||||
if hasattr(status, "value"):
|
||||
status = status.value
|
||||
return str(status or "").strip().lower()
|
||||
|
||||
|
||||
def should_activate_parent_for_task_start(
|
||||
*,
|
||||
previous_task_status: Any,
|
||||
@@ -109,8 +104,8 @@ def transition_task_status(
|
||||
if previous_task_status is None
|
||||
else previous_task_status
|
||||
)
|
||||
normalised_target = status_value(target_status)
|
||||
task.status = status_coercer(normalised_target) if status_coercer else target_status
|
||||
normalised_target = normalize_task_status(target_status)
|
||||
task.status = status_coercer(normalised_target) if status_coercer else normalised_target
|
||||
parent_activated = activate_parent_for_task_start(
|
||||
previous_task_status=previous_status,
|
||||
new_task_status=normalised_target,
|
||||
|
||||
Reference in New Issue
Block a user