Manually transition to a different phase.
(
pipeline_id: str,
target_phase: WorkflowPhase,
reason: Optional[str] = None,
manager: WorkflowManager = Depends(get_manager)
)
| 133 | |
| 134 | @router.post("/workflow/{pipeline_id}/transition") |
| 135 | async def manual_transition( |
| 136 | pipeline_id: str, |
| 137 | target_phase: WorkflowPhase, |
| 138 | reason: Optional[str] = None, |
| 139 | manager: WorkflowManager = Depends(get_manager) |
| 140 | ): |
| 141 | """Manually transition to a different phase.""" |
| 142 | workflow = manager.get_workflow(pipeline_id) |
| 143 | if not workflow: |
| 144 | raise HTTPException(status_code=404, detail="Workflow not found") |
| 145 | |
| 146 | if not workflow.can_transition_to(target_phase): |
| 147 | raise HTTPException( |
| 148 | status_code=400, |
| 149 | detail=f"Cannot transition from {workflow.phase} to {target_phase}" |
| 150 | ) |
| 151 | |
| 152 | workflow.add_transition( |
| 153 | target_phase, |
| 154 | reason or "Manual transition", |
| 155 | "user" |
| 156 | ) |
| 157 | |
| 158 | # Broadcast update |
| 159 | await manager._broadcast_workflow_update(workflow) |
| 160 | |
| 161 | return { |
| 162 | "success": True, |
| 163 | "workflow": workflow.dict(), |
| 164 | "message": f"Transitioned to {target_phase}" |
| 165 | } |
| 166 | |
| 167 | |
| 168 | @router.get("/workflow/{pipeline_id}/history") |
nothing calls this directly
no test coverage detected