Erfassen und Transparent: Archetyp, Methode und Auspraegung in der UI sichtbar.
Test Suite / pytest-backend (push) Failing after 2s
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 50s

Method-Profiles-API und Auswahl beim Anlegen/Profil; Steuerungs-Meta in Listen und Plan; Projekt-Archetyp-Spiegel, Next-Action-Links und Umlaut-Fix fuer testbare Guidance.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
LarsandCursor committed 2026-07-10 12:36:12 +02:00
1 parent 95b743d6fd
commit efb45a3ee6
31 files changed
+965 -65

No files matched your search

+2
View File
@@ -73,6 +73,7 @@ def create_initiative(
status: InitiativeStatus = "active",
priority: Priority = "normal",
user_id: Optional[str] = None,
method_profile_key: Optional[str] = None,
) -> dict[str, Any]:
title = title.strip()
if not title:
@@ -125,6 +126,7 @@ def create_initiative(
initiative_id=row["id"],
user_id=user_id,
archetype_key=archetype_key,
method_profile_key=method_profile_key,
)
return row
+90
View File
@@ -261,6 +261,89 @@ def update_method_key(
return result
def update_method_profile_key(
*,
tenant_id: str,
initiative_id: str,
method_profile_key: Optional[str],
user_id: Optional[str] = None,
) -> dict[str, Any]:
"""Setzt oder entfernt method_profile_key; passt method_key aus Profile/Archetyp an."""
from entity_archetypes.registry import resolve_default_method_key
from method_profiles.registry import get_method_profile
from steering.methods.registry import get_method
initiative = get_initiative(tenant_id=tenant_id, initiative_id=initiative_id)
if not initiative:
raise ValueError("Vorhaben nicht gefunden")
existing = get_steering_context(tenant_id=tenant_id, initiative_id=initiative_id)
if not existing:
raise ValueError("SteeringContext nicht gefunden")
metadata = dict(existing.get("lifecycle_metadata") or {})
previous_profile = metadata.get("method_profile_key")
if method_profile_key:
profile = get_method_profile(method_profile_key)
if not profile:
raise ValueError(f"Unbekannte Ausprägung: {method_profile_key}")
if profile["initiative_archetype_key"] != initiative["archetype_key"]:
raise ValueError("Ausprägung passt nicht zum Archetyp des Vorhabens")
metadata["method_profile_key"] = method_profile_key
resolved_method = profile["method_key"]
else:
metadata.pop("method_profile_key", None)
resolved_method = resolve_default_method_key(initiative["archetype_key"])
method = get_method(resolved_method)
if not method:
raise ValueError(f"Unbekannte Methode: {resolved_method}")
conn = get_connection()
try:
with conn.cursor(cursor_factory=RealDictCursor) as cur:
cur.execute(
"""
UPDATE steering_contexts
SET method_key = %s,
method_version = %s,
lifecycle_metadata = %s,
updated_at = NOW()
WHERE tenant_id = %s AND initiative_id = %s
RETURNING id, tenant_id, initiative_id, method_key, method_version,
lifecycle_state, lifecycle_metadata, created_at, updated_at
""",
(
method.key,
method.version,
Json(metadata),
tenant_id,
initiative_id,
),
)
row = cur.fetchone()
if not row:
raise ValueError("SteeringContext nicht gefunden")
result = _serialize_row(dict(row))
conn.commit()
finally:
conn.close()
log_audit(
"steering_context.method_profile_changed",
user_id=user_id,
tenant_id=tenant_id,
details={
"initiative_id": initiative_id,
"from_profile": previous_profile,
"to_profile": method_profile_key,
"method_key": method.key,
},
)
return result
def create_context_for_new_initiative(
*,
tenant_id: str,
@@ -275,6 +358,13 @@ def create_context_for_new_initiative(
method_key = resolve_default_method_key(archetype_key)
lifecycle_metadata: dict[str, Any] = {}
if method_profile_key:
from method_profiles.registry import get_method_profile
profile = get_method_profile(method_profile_key)
if not profile:
raise ValueError(f"Unbekannte Ausprägung: {method_profile_key}")
if profile["initiative_archetype_key"] != archetype_key:
raise ValueError("Ausprägung passt nicht zum Archetyp des Vorhabens")
profile_method = resolve_method_for_profile(method_profile_key)
if profile_method:
method_key = profile_method