AP2.0f: work_cycle Zeitbox und actions.work_cycle_id.
Deploy Development / deploy (push) Failing after 48s
Test Suite / pytest-backend (push) Failing after 1s
Test Suite / k6 /api/health Baseline (push) Has been skipped
Test Suite / playwright-smoke (push) Has been skipped
Test Suite / lint-backend (push) Successful in 3s
Test Suite / compose-smoke (push) Has been skipped
Deploy Development / deploy (push) Failing after 48s
Test Suite / pytest-backend (push) Failing after 1s
Test Suite / k6 /api/health Baseline (push) Has been skipped
Test Suite / playwright-smoke (push) Has been skipped
Test Suite / lint-backend (push) Successful in 3s
Test Suite / compose-smoke (push) Has been skipped
RoadmapItem type work_cycle, Sprint-API, agile_iteration Next-Action-Strategie; Steering-Snapshot zeigt active_work_cycle. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
5dc372c043
commit
d1bc725ab5
19 files changed
+564
-24
No files matched your search
@@ -31,6 +31,8 @@ class ActionUpdateRequest(BaseModel):
|
||||
clear_roadmap_item: bool = False
|
||||
sort_order: Optional[int] = None
|
||||
action_kind: Optional[Literal["delivery", "planning", "review"]] = None
|
||||
work_cycle_id: Optional[str] = None
|
||||
clear_work_cycle: bool = False
|
||||
|
||||
|
||||
class TaskCreateRequest(BaseModel):
|
||||
@@ -137,6 +139,8 @@ def update_action(
|
||||
clear_project=body.clear_project,
|
||||
roadmap_item_id=body.roadmap_item_id,
|
||||
clear_roadmap_item=body.clear_roadmap_item,
|
||||
work_cycle_id=body.work_cycle_id,
|
||||
clear_work_cycle=body.clear_work_cycle,
|
||||
sort_order=body.sort_order,
|
||||
action_kind=body.action_kind,
|
||||
)
|
||||
|
||||
@@ -66,6 +66,7 @@ class ActionCreateRequest(BaseModel):
|
||||
due_at: Optional[str] = None
|
||||
project_id: Optional[str] = None
|
||||
roadmap_item_id: Optional[str] = None
|
||||
work_cycle_id: Optional[str] = None
|
||||
assigned_actor_ids: list[str] = Field(default_factory=list)
|
||||
sort_order: int = 0
|
||||
action_kind: Literal["delivery", "planning", "review"] = "delivery"
|
||||
@@ -332,6 +333,7 @@ def create_initiative_action(
|
||||
due_at=due_at,
|
||||
project_id=body.project_id,
|
||||
roadmap_item_id=body.roadmap_item_id,
|
||||
work_cycle_id=body.work_cycle_id,
|
||||
assigned_actor_ids=body.assigned_actor_ids,
|
||||
sort_order=body.sort_order,
|
||||
action_kind=body.action_kind,
|
||||
|
||||
@@ -109,6 +109,7 @@ def operational_context(
|
||||
"lifecycle": snapshot.get("lifecycle"),
|
||||
"signals": snapshot.get("signals"),
|
||||
"attention": snapshot.get("attention"),
|
||||
"active_work_cycle": snapshot.get("active_work_cycle"),
|
||||
}
|
||||
return _ok(ctx, subset)
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ router = APIRouter(tags=["roadmap"])
|
||||
|
||||
class RoadmapItemCreateRequest(BaseModel):
|
||||
title: str = Field(min_length=1, max_length=255)
|
||||
item_type: Literal["milestone", "review_gate", "maturity_stage"] = "milestone"
|
||||
item_type: Literal["milestone", "review_gate", "maturity_stage", "work_cycle"] = "milestone"
|
||||
goal_description: str = ""
|
||||
definition_of_done: list[Any] = Field(default_factory=list)
|
||||
status: Literal[
|
||||
@@ -32,7 +32,7 @@ class RoadmapItemCreateRequest(BaseModel):
|
||||
|
||||
class RoadmapItemUpdateRequest(BaseModel):
|
||||
title: Optional[str] = Field(default=None, min_length=1, max_length=255)
|
||||
item_type: Optional[Literal["milestone", "review_gate", "maturity_stage"]] = None
|
||||
item_type: Optional[Literal["milestone", "review_gate", "maturity_stage", "work_cycle"]] = None
|
||||
goal_description: Optional[str] = None
|
||||
definition_of_done: Optional[list[Any]] = None
|
||||
status: Optional[
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
"""Work cycle (Sprint/Zeitbox) API — AP2.0f."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from datetime import date
|
||||
from typing import Literal, Optional
|
||||
|
||||
from capabilities import require_capability
|
||||
from fastapi import APIRouter, Depends, HTTPException
|
||||
from pydantic import BaseModel, Field
|
||||
from services import work_cycle as work_cycle_service
|
||||
from tenant_context import TenantContext
|
||||
|
||||
initiative_router = APIRouter(
|
||||
prefix="/api/initiatives/{initiative_id}/work-cycles",
|
||||
tags=["work-cycles"],
|
||||
)
|
||||
|
||||
|
||||
class WorkCycleCreateRequest(BaseModel):
|
||||
title: str = Field(min_length=1, max_length=255)
|
||||
goal_description: str = ""
|
||||
status: Literal["planned", "active"] = "planned"
|
||||
target_date: Optional[date] = None
|
||||
sort_order: int = 0
|
||||
|
||||
|
||||
@initiative_router.get("")
|
||||
def list_work_cycles(
|
||||
initiative_id: str,
|
||||
ctx: TenantContext = Depends(require_capability("kairo.milestone.read")),
|
||||
):
|
||||
return work_cycle_service.list_work_cycles_for_initiative(
|
||||
tenant_id=ctx.tenant_id, initiative_id=initiative_id
|
||||
)
|
||||
|
||||
|
||||
@initiative_router.get("/active")
|
||||
def get_active_work_cycle(
|
||||
initiative_id: str,
|
||||
ctx: TenantContext = Depends(require_capability("kairo.milestone.read")),
|
||||
):
|
||||
item = work_cycle_service.get_active_work_cycle(
|
||||
tenant_id=ctx.tenant_id, initiative_id=initiative_id
|
||||
)
|
||||
if not item:
|
||||
return None
|
||||
item["open_action_count"] = work_cycle_service.count_actions_in_work_cycle(
|
||||
tenant_id=ctx.tenant_id,
|
||||
initiative_id=initiative_id,
|
||||
work_cycle_id=item["id"],
|
||||
)
|
||||
return item
|
||||
|
||||
|
||||
@initiative_router.post("", status_code=201)
|
||||
def create_work_cycle(
|
||||
initiative_id: str,
|
||||
body: WorkCycleCreateRequest,
|
||||
ctx: TenantContext = Depends(require_capability("kairo.milestone.manage")),
|
||||
):
|
||||
try:
|
||||
item = work_cycle_service.create_work_cycle(
|
||||
tenant_id=ctx.tenant_id,
|
||||
initiative_id=initiative_id,
|
||||
title=body.title,
|
||||
goal_description=body.goal_description,
|
||||
status=body.status,
|
||||
target_date=body.target_date,
|
||||
sort_order=body.sort_order,
|
||||
user_id=ctx.user_id,
|
||||
)
|
||||
if body.status == "active":
|
||||
item = work_cycle_service.activate_work_cycle(
|
||||
tenant_id=ctx.tenant_id,
|
||||
initiative_id=initiative_id,
|
||||
work_cycle_id=item["id"],
|
||||
user_id=ctx.user_id,
|
||||
)
|
||||
return item
|
||||
except ValueError as exc:
|
||||
detail = str(exc)
|
||||
if detail == "Initiative nicht gefunden":
|
||||
raise HTTPException(status_code=404, detail=detail) from exc
|
||||
raise HTTPException(status_code=400, detail=detail) from exc
|
||||
|
||||
|
||||
@initiative_router.post("/{work_cycle_id}/activate")
|
||||
def activate_work_cycle(
|
||||
initiative_id: str,
|
||||
work_cycle_id: str,
|
||||
ctx: TenantContext = Depends(require_capability("kairo.milestone.manage")),
|
||||
):
|
||||
try:
|
||||
return work_cycle_service.activate_work_cycle(
|
||||
tenant_id=ctx.tenant_id,
|
||||
initiative_id=initiative_id,
|
||||
work_cycle_id=work_cycle_id,
|
||||
user_id=ctx.user_id,
|
||||
)
|
||||
except ValueError as exc:
|
||||
detail = str(exc)
|
||||
if detail in ("Initiative nicht gefunden", "Zeitbox nicht gefunden"):
|
||||
raise HTTPException(status_code=404, detail=detail) from exc
|
||||
raise HTTPException(status_code=400, detail=detail) from exc
|
||||
Reference in new issue
Block a user