feat(steering): Backlog-Vokabular aus Methoden-Vertrag (ADP P3)
Deploy Development / deploy (push) Successful in 47s
Test Suite / pytest-backend (push) Successful in 3m56s
Test Suite / lint-backend (push) Successful in 2s
Test Suite / compose-smoke (push) Has been skipped
Test Suite / k6 /api/health Baseline (push) Successful in 19s
Test Suite / playwright-smoke (push) Successful in 13s
Deploy Development / deploy (push) Successful in 47s
Test Suite / pytest-backend (push) Successful in 3m56s
Test Suite / lint-backend (push) Successful in 2s
Test Suite / compose-smoke (push) Has been skipped
Test Suite / k6 /api/health Baseline (push) Successful in 19s
Test Suite / playwright-smoke (push) Successful in 13s
backlog_epic_hierarchy als Steuerungselement, effektive steering_elements im Operating Context, Backend-Guards und UI ohne Slice-Ifs. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
f33135b87f
commit
a3b14d9c00
18 files changed
+489
-35
No files matched your search
@@ -10,6 +10,7 @@ from db import get_connection
|
||||
from services.actions import create_action
|
||||
from services.audit import log_audit
|
||||
from services.initiatives import PRIORITIES, get_initiative
|
||||
from services.operating_context import get_operating_context
|
||||
from services.plan_ist import validate_roadmap_item_in_initiative
|
||||
|
||||
BacklogStatus = Literal["new", "triaged", "accepted", "rejected", "converted"]
|
||||
@@ -61,6 +62,28 @@ def _validate_item_kind(item_kind: str) -> None:
|
||||
raise ValueError(f"Ungültiger Backlog-Typ: {item_kind}")
|
||||
|
||||
|
||||
def _backlog_vocabulary_for_initiative(*, tenant_id: str, initiative_id: str) -> dict[str, Any]:
|
||||
context = get_operating_context(tenant_id=tenant_id, initiative_id=initiative_id)
|
||||
if not context:
|
||||
raise ValueError("Initiative nicht gefunden")
|
||||
return context.get("backlog_vocabulary") or {}
|
||||
|
||||
|
||||
def _validate_item_kind_for_initiative(
|
||||
*, tenant_id: str, initiative_id: str, item_kind: str
|
||||
) -> dict[str, Any]:
|
||||
_validate_item_kind(item_kind)
|
||||
vocabulary = _backlog_vocabulary_for_initiative(
|
||||
tenant_id=tenant_id, initiative_id=initiative_id
|
||||
)
|
||||
allowed = vocabulary.get("kinds") or []
|
||||
if allowed and item_kind not in allowed:
|
||||
raise ValueError(
|
||||
f"Backlog-Typ '{item_kind}' ist für dieses Vorhaben nicht erlaubt"
|
||||
)
|
||||
return vocabulary
|
||||
|
||||
|
||||
def _item_kind_to_action_kind(item_kind: str) -> str:
|
||||
if item_kind == "bug":
|
||||
return "bug"
|
||||
@@ -103,7 +126,11 @@ def _validate_backlog_hierarchy(
|
||||
parent_backlog_id: Optional[str],
|
||||
parent_action_id: Optional[str],
|
||||
backlog_item_id: Optional[str] = None,
|
||||
epic_hierarchy: bool = True,
|
||||
) -> None:
|
||||
if item_kind == "epic" and not epic_hierarchy:
|
||||
raise ValueError("Epic ist für dieses Vorhaben nicht verfügbar")
|
||||
|
||||
if item_kind == "epic":
|
||||
if parent_backlog_id:
|
||||
raise ValueError("Epic kann keinem übergeordneten Backlog-Item zugeordnet werden")
|
||||
@@ -114,6 +141,9 @@ def _validate_backlog_hierarchy(
|
||||
if not parent_backlog_id:
|
||||
return
|
||||
|
||||
if not epic_hierarchy:
|
||||
raise ValueError("Epic-Zuordnung ist für dieses Vorhaben nicht verfügbar")
|
||||
|
||||
if backlog_item_id and parent_backlog_id == backlog_item_id:
|
||||
raise ValueError("Item kann nicht sich selbst als Epic referenzieren")
|
||||
|
||||
@@ -156,7 +186,10 @@ def create_backlog_item(
|
||||
raise ValueError("Titel ist erforderlich")
|
||||
_validate_status(status)
|
||||
_validate_priority(priority)
|
||||
_validate_item_kind(item_kind)
|
||||
vocabulary = _validate_item_kind_for_initiative(
|
||||
tenant_id=tenant_id, initiative_id=initiative_id, item_kind=item_kind
|
||||
)
|
||||
epic_hierarchy = bool((vocabulary.get("capabilities") or {}).get("epic_hierarchy"))
|
||||
if not get_initiative(tenant_id=tenant_id, initiative_id=initiative_id):
|
||||
raise ValueError("Initiative nicht gefunden")
|
||||
|
||||
@@ -182,6 +215,7 @@ def create_backlog_item(
|
||||
item_kind=item_kind,
|
||||
parent_backlog_id=parent_backlog_id,
|
||||
parent_action_id=parent_action_id,
|
||||
epic_hierarchy=epic_hierarchy,
|
||||
)
|
||||
cur.execute(
|
||||
"""
|
||||
@@ -336,6 +370,15 @@ def update_backlog_item(
|
||||
_validate_item_kind(item_kind)
|
||||
updates.append("item_kind = %s")
|
||||
params.append(item_kind)
|
||||
|
||||
effective_kind = item_kind if item_kind is not None else existing.get("item_kind") or "story"
|
||||
vocabulary = _validate_item_kind_for_initiative(
|
||||
tenant_id=tenant_id,
|
||||
initiative_id=existing["initiative_id"],
|
||||
item_kind=effective_kind,
|
||||
)
|
||||
epic_hierarchy = bool((vocabulary.get("capabilities") or {}).get("epic_hierarchy"))
|
||||
|
||||
if clear_parent_action:
|
||||
updates.append("parent_action_id = NULL")
|
||||
elif parent_action_id is not None:
|
||||
@@ -350,7 +393,6 @@ def update_backlog_item(
|
||||
if not updates:
|
||||
return existing
|
||||
|
||||
effective_kind = item_kind if item_kind is not None else existing.get("item_kind") or "story"
|
||||
effective_parent_backlog = (
|
||||
None
|
||||
if clear_parent_backlog
|
||||
@@ -380,6 +422,7 @@ def update_backlog_item(
|
||||
parent_backlog_id=effective_parent_backlog,
|
||||
parent_action_id=effective_parent_action,
|
||||
backlog_item_id=backlog_item_id,
|
||||
epic_hierarchy=epic_hierarchy,
|
||||
)
|
||||
if parent_action_id is not None and not clear_parent_action:
|
||||
_validate_parent_action_in_initiative(
|
||||
|
||||
@@ -15,6 +15,8 @@ from entity_archetypes.registry import (
|
||||
from services.initiatives import get_initiative
|
||||
from services.steering_context import ensure_steering_context, get_steering_context
|
||||
from steering.graph.profiles import LIGHT, graph_profile_as_dict
|
||||
from steering.backlog_vocabulary import resolve_backlog_vocabulary
|
||||
from steering.effective_contract import resolve_effective_steering_elements
|
||||
from steering.methods.registry import (
|
||||
get_method,
|
||||
list_compatible_methods,
|
||||
@@ -169,6 +171,25 @@ def get_operating_context(
|
||||
method_key=method_key,
|
||||
)
|
||||
method_contract = _resolve_method_contract(method_key)
|
||||
active_composition_modifier = (
|
||||
"agile_iteration"
|
||||
if _resolve_active_agile_composition(
|
||||
tenant_id=tenant_id,
|
||||
initiative_id=initiative_id,
|
||||
primary_method_key=method_key,
|
||||
)
|
||||
else None
|
||||
)
|
||||
effective_steering_elements = resolve_effective_steering_elements(
|
||||
method_key,
|
||||
data_slices=data_slices,
|
||||
active_composition_modifier=active_composition_modifier,
|
||||
)
|
||||
backlog_vocabulary = resolve_backlog_vocabulary(
|
||||
data_slices=data_slices,
|
||||
method_key=method_key,
|
||||
steering_elements=effective_steering_elements,
|
||||
)
|
||||
|
||||
return {
|
||||
"initiative_id": initiative_id,
|
||||
@@ -179,7 +200,8 @@ def get_operating_context(
|
||||
"om_capabilities": sorted(om_capabilities),
|
||||
"data_slices": data_slices,
|
||||
"method_capabilities": _method_capabilities(method_key),
|
||||
"steering_elements": method_contract["steering_elements"],
|
||||
"steering_elements": sorted(effective_steering_elements),
|
||||
"primary_steering_elements": method_contract["steering_elements"],
|
||||
"ui_features": method_contract["ui_features"],
|
||||
"graph_profile": method_contract["graph_profile"],
|
||||
"compatible_methods": _compatible_methods_payload(
|
||||
@@ -191,15 +213,8 @@ def get_operating_context(
|
||||
method_to_dict(m, include_compatibility=False)
|
||||
for m in list_composable_modifiers(method_key)
|
||||
],
|
||||
"active_composition_modifier": (
|
||||
"agile_iteration"
|
||||
if _resolve_active_agile_composition(
|
||||
tenant_id=tenant_id,
|
||||
initiative_id=initiative_id,
|
||||
primary_method_key=method_key,
|
||||
)
|
||||
else None
|
||||
),
|
||||
"active_composition_modifier": active_composition_modifier,
|
||||
"backlog_vocabulary": backlog_vocabulary,
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user