diff --git a/app/api/routers/tasks.py b/app/api/routers/tasks.py index a250e6a..d07e17d 100644 --- a/app/api/routers/tasks.py +++ b/app/api/routers/tasks.py @@ -209,6 +209,21 @@ def update_task(task_id: int, task_update: schemas.TaskUpdate, db: Session = Dep body_fields = {k for k in update_data.keys() if k not in _always_allowed} if body_fields: + # P3.6 supplement: feature story tasks locked after milestone freeze + task_type = task.task_type.value if hasattr(task.task_type, 'value') else (task.task_type or "") + task_subtype = task.task_subtype or "" + if task_type == "story" and task_subtype == "feature" and task.milestone_id: + from app.models.milestone import Milestone + ms = db.query(Milestone).filter(Milestone.id == task.milestone_id).first() + if ms: + ms_status = ms.status.value if hasattr(ms.status, 'value') else ms.status + if ms_status in ("freeze", "undergoing", "completed", "closed"): + raise HTTPException( + status_code=400, + detail=f"Feature story task cannot be edited: milestone is '{ms_status}'. " + f"Blocked fields: {sorted(body_fields)}", + ) + # undergoing/completed/closed: body edits forbidden if current_status in ("undergoing", "completed", "closed"): raise HTTPException(