Add lifecycle renormalization consistency repair

This commit is contained in:
2026-05-23 16:54:38 +02:00
parent 6496ef851a
commit 0aa02d9117
4 changed files with 284 additions and 7 deletions

View File

@@ -7,6 +7,7 @@ from api.workplan_status import normalize_workstream_status
TASK_STARTED_STATUS = "in_progress"
TASK_NOT_STARTED_STATUS = "todo"
TASK_ACTIVE_STATUSES = {"in_progress", "blocked"}
PARENT_ACTIVATION_STATUSES = {"proposed", "ready", "backlog"}
@@ -31,6 +32,24 @@ def should_activate_parent_for_task_start(
)
def has_active_task_status(task_statuses: list[Any] | tuple[Any, ...]) -> bool:
"""Return whether any task status represents currently active work."""
return any(status_value(status) in TASK_ACTIVE_STATUSES for status in task_statuses)
def should_activate_parent_for_active_tasks(
*,
parent_workstream_status: Any,
task_statuses: list[Any] | tuple[Any, ...],
) -> bool:
"""Return whether existing task state implies an active parent workstream."""
return (
normalize_workstream_status(parent_workstream_status)
in PARENT_ACTIVATION_STATUSES
and has_active_task_status(task_statuses)
)
def activate_parent_for_task_start(
*,
previous_task_status: Any,