AP2.4: Steuerungselement-Registry und Methoden-Vertrag.
Deploy Development / deploy (push) Successful in 46s
Test Suite / pytest-backend (push) Failing after 3m17s
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 2s
Test Suite / compose-smoke (push) Has been skipped

MethodDefinition traegt steering_elements/ui_features/graph_profile; operating-context und FE-Registry ohne Archetyp-Ifs.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
LarsandCursor committed 2026-07-25 11:27:59 +02:00
1 parent ac475ab92c
commit d3bf3c36e0
25 files changed
+837 -118

No files matched your search

+15
View File
@@ -0,0 +1,15 @@
"""Steering element catalog — AP2.4."""
from steering.elements.registry import (
STEERING_ELEMENTS,
get_steering_element,
list_steering_elements,
validate_steering_element_keys,
)
__all__ = [
"STEERING_ELEMENTS",
"get_steering_element",
"list_steering_elements",
"validate_steering_element_keys",
]
+90
View File
@@ -0,0 +1,90 @@
"""Steering element catalog — AP2.4."""
from __future__ import annotations
from dataclasses import dataclass
from typing import Literal
ModeKey = Literal["plan", "work", "control"]
@dataclass(frozen=True)
class SteeringElementDefinition:
key: str
label: str
description: str
modes: tuple[ModeKey, ...]
STEERING_ELEMENTS: dict[str, SteeringElementDefinition] = {
"next_action_primary": SteeringElementDefinition(
key="next_action_primary",
label="Nächster Schritt",
description="Next-Action-Widget als primäre Steuerungsansicht",
modes=("control", "work"),
),
"critical_path": SteeringElementDefinition(
key="critical_path",
label="Kritischer Pfad",
description="Execution-Graph und Pfad-Priorisierung",
modes=("control",),
),
"gate_fulfillment": SteeringElementDefinition(
key="gate_fulfillment",
label="Gate-Erfüllung",
description="Zielzustände, Verify und Fortschritt",
modes=("control", "plan"),
),
"work_cycle_scope": SteeringElementDefinition(
key="work_cycle_scope",
label="Sprint-Zeitbox",
description="Aktive work_cycle und Sprint-Backlog",
modes=("work", "plan"),
),
"recurring_rhythm": SteeringElementDefinition(
key="recurring_rhythm",
label="Rhythmen",
description="RecurringElement und Journey-Fokus",
modes=("control",),
),
"queue_inbox": SteeringElementDefinition(
key="queue_inbox",
label="Queue / Eingang",
description="Pull-Steuerung aus Backlog/Queue",
modes=("plan", "work"),
),
"maturity_stage": SteeringElementDefinition(
key="maturity_stage",
label="Reifegrad-Stufen",
description="Stufen und Routinen in Plan/Kontrolle",
modes=("plan", "control"),
),
"chapter_progression": SteeringElementDefinition(
key="chapter_progression",
label="Kapitel-Fortschritt",
description="Kapitel-basierte Progression",
modes=("plan", "control"),
),
"dispute_timeline": SteeringElementDefinition(
key="dispute_timeline",
label="Verfahren / Fristen",
description="Fristen, Entscheidungen, Verfahrensstrang",
modes=("control",),
),
}
def get_steering_element(key: str) -> SteeringElementDefinition | None:
return STEERING_ELEMENTS.get(key)
def list_steering_elements() -> tuple[SteeringElementDefinition, ...]:
return tuple(STEERING_ELEMENTS.values())
def validate_steering_element_keys(keys: frozenset[str]) -> None:
unknown = [k for k in keys if k not in STEERING_ELEMENTS]
if unknown:
raise ValueError(
f"Unbekannte steering_elements: {', '.join(sorted(unknown))}"
)
+11 -16
View File
@@ -1,4 +1,4 @@
"""Method graph profiles — AP1.4e."""
"""Method graph profiles — AP1.4e / AP2.4 (via MethodDefinition)."""
from __future__ import annotations
@@ -19,25 +19,20 @@ _STRICT = GraphMethodProfile(enforce_gate_blocking=True, emphasize_fulfillment=F
_FULFILLMENT = GraphMethodProfile(enforce_gate_blocking=False, emphasize_fulfillment=True)
_LIGHT = GraphMethodProfile(enforce_gate_blocking=False, emphasize_fulfillment=False)
METHOD_GRAPH_PROFILES: dict[str, GraphMethodProfile] = {
"generic_operating": _LIGHT,
"queue_pull": _LIGHT,
"dispute_procedure": _LIGHT,
"continuous_product": _FULFILLMENT,
"maturity_progression": _FULFILLMENT,
"chapter_based_progression": _FULFILLMENT,
"product_milestone_driven": _STRICT,
"program_delivery": _STRICT,
"sequential_dependency": _STRICT,
"agile_iteration": _STRICT,
"recurring_control": _FULFILLMENT,
}
STRICT = _STRICT
FULFILLMENT = _FULFILLMENT
LIGHT = _LIGHT
def get_graph_profile(method_key: str | None) -> GraphMethodProfile:
if not method_key:
return METHOD_GRAPH_PROFILES[DEFAULT_METHOD_KEY]
return METHOD_GRAPH_PROFILES.get(method_key, _STRICT)
return LIGHT
from steering.methods.registry import get_method
method = get_method(method_key)
if method:
return method.graph_profile
return _STRICT
def enforce_gate_blocking_for_method(method_key: str | None) -> bool:
@@ -1,9 +1,15 @@
"""Shared registration helper for AP2.0 method stubs — AP2.3e data_slices."""
"""Shared registration helper for AP2.0 method stubs — AP2.3e / AP2.4."""
from __future__ import annotations
from typing import Literal
from steering.graph.profiles import (
FULFILLMENT,
GraphMethodProfile,
LIGHT,
STRICT,
)
from steering.lifecycle.states import STANDARD_LIFECYCLE_STEPS
from steering.methods.registry import MethodDefinition, get_method, register_method
@@ -74,6 +80,8 @@ SLICES_GENERIC = SLICES_OM_STANDARD
SLICES_AGILE = SLICES_PRODUCT
ELEM_NEXT = frozenset({"next_action_primary"})
def register_stub_method(
*,
@@ -84,6 +92,11 @@ def register_stub_method(
lifecycle_steps: tuple[str, ...] | None = None,
data_slices: frozenset[str] | None = None,
compatible_archetype_keys: frozenset[str] | Literal["*"] = "*",
steering_elements: frozenset[str] | None = None,
ui_features: frozenset[str] | None = None,
graph_profile: GraphMethodProfile = LIGHT,
method_role: Literal["primary", "modifier"] = "primary",
composes_with: frozenset[str] | None = None,
) -> None:
if get_method(key):
return
@@ -97,6 +110,11 @@ def register_stub_method(
next_action_strategy_key=next_action_strategy_key,
data_slices=data_slices or SLICES_GENERIC,
compatible_archetype_keys=compatible_archetype_keys,
steering_elements=steering_elements or ELEM_NEXT,
ui_features=ui_features or frozenset(),
graph_profile=graph_profile,
method_role=method_role,
composes_with=composes_with or frozenset(),
)
)
@@ -109,6 +127,9 @@ def register_product_like_method(
next_action_strategy_key: str,
data_slices: frozenset[str] | None = None,
compatible_archetype_keys: frozenset[str] | Literal["*"] | None = None,
steering_elements: frozenset[str] | None = None,
ui_features: frozenset[str] | None = None,
graph_profile: GraphMethodProfile = STRICT,
) -> None:
register_stub_method(
key=key,
@@ -120,4 +141,8 @@ def register_product_like_method(
compatible_archetype_keys=compatible_archetype_keys
if compatible_archetype_keys is not None
else frozenset({"initiative.product"}),
steering_elements=steering_elements
or (ELEM_NEXT | frozenset({"gate_fulfillment", "work_cycle_scope"})),
ui_features=ui_features or frozenset(),
graph_profile=graph_profile,
)
@@ -1,13 +1,15 @@
"""AP2.0a — remaining method stubs."""
"""AP2.0a — remaining method stubs — AP2.4 steering elements."""
from __future__ import annotations
from steering.graph.profiles import FULFILLMENT, LIGHT, STRICT
from steering.methods.registrations._helpers import (
ELEM_NEXT,
SLICES_AGILE,
SLICES_MATURITY,
SLICES_OM_STANDARD,
SLICES_QUEUE,
SLICES_RECURRING,
SLICES_AGILE,
SLICES_OM_STANDARD,
register_stub_method,
)
@@ -20,6 +22,9 @@ def register() -> None:
next_action_strategy_key="maturity_progression",
data_slices=SLICES_MATURITY,
compatible_archetype_keys=frozenset({"initiative.maturity_journey"}),
steering_elements=ELEM_NEXT
| frozenset({"maturity_stage", "recurring_rhythm"}),
graph_profile=FULFILLMENT,
)
register_stub_method(
key="sequential_dependency",
@@ -28,6 +33,10 @@ def register() -> None:
next_action_strategy_key="sequential_dependency",
data_slices=SLICES_OM_STANDARD,
compatible_archetype_keys="*",
steering_elements=ELEM_NEXT
| frozenset({"critical_path", "gate_fulfillment"}),
ui_features=frozenset({"criticalPathControl"}),
graph_profile=STRICT,
)
register_stub_method(
key="recurring_control",
@@ -36,6 +45,8 @@ def register() -> None:
next_action_strategy_key="recurring_control",
data_slices=SLICES_RECURRING,
compatible_archetype_keys=frozenset({"initiative.recurring_program"}),
steering_elements=ELEM_NEXT | frozenset({"recurring_rhythm"}),
graph_profile=FULFILLMENT,
)
register_stub_method(
key="queue_pull",
@@ -44,6 +55,8 @@ def register() -> None:
next_action_strategy_key="queue_pull",
data_slices=SLICES_QUEUE,
compatible_archetype_keys="*",
steering_elements=ELEM_NEXT | frozenset({"queue_inbox"}),
graph_profile=LIGHT,
)
register_stub_method(
key="agile_iteration",
@@ -52,6 +65,11 @@ def register() -> None:
next_action_strategy_key="agile_iteration",
data_slices=SLICES_AGILE,
compatible_archetype_keys="*",
steering_elements=ELEM_NEXT | frozenset({"work_cycle_scope"}),
ui_features=frozenset({"steeringSnapshotOnWorkSprint"}),
graph_profile=STRICT,
method_role="modifier",
composes_with=frozenset({"continuous_product", "program_delivery"}),
)
register_stub_method(
key="dispute_procedure",
@@ -69,6 +87,8 @@ def register() -> None:
}
),
compatible_archetype_keys=frozenset({"initiative.dispute_case"}),
steering_elements=ELEM_NEXT | frozenset({"dispute_timeline"}),
graph_profile=LIGHT,
)
register_stub_method(
key="chapter_based_progression",
@@ -87,4 +107,7 @@ def register() -> None:
}
),
compatible_archetype_keys=frozenset({"initiative.content_project"}),
steering_elements=ELEM_NEXT
| frozenset({"chapter_progression", "gate_fulfillment"}),
graph_profile=FULFILLMENT,
)
@@ -1,8 +1,12 @@
"""Built-in method: continuous_product — AP2.0a."""
"""Built-in method: continuous_product — AP2.0a / AP2.4."""
from __future__ import annotations
from steering.methods.registrations._helpers import register_product_like_method
from steering.graph.profiles import FULFILLMENT
from steering.methods.registrations._helpers import (
ELEM_NEXT,
register_product_like_method,
)
def register() -> None:
@@ -11,4 +15,10 @@ def register() -> None:
label="Produkt (kontinuierlich)",
description="Kontinuierlicher Betrieb — Ist zuerst, Plan als Orientierung",
next_action_strategy_key="continuous_product",
graph_profile=FULFILLMENT,
ui_features=frozenset(
{"continuousProductWorkMode", "steeringSnapshotOnWorkSprint"}
),
steering_elements=ELEM_NEXT
| frozenset({"gate_fulfillment", "work_cycle_scope"}),
)
@@ -1,10 +1,11 @@
"""Built-in method: generic_operating."""
"""Built-in method: generic_operating — AP2.4."""
from __future__ import annotations
from steering.lifecycle.states import STANDARD_LIFECYCLE_STEPS
from steering.graph.profiles import LIGHT
from steering.methods.registrations._helpers import ELEM_NEXT, SLICES_GENERIC
from steering.methods.registry import MethodDefinition, get_method, register_method
from steering.methods.registrations._helpers import SLICES_GENERIC
def register() -> None:
@@ -20,5 +21,7 @@ def register() -> None:
next_action_strategy_key="default",
data_slices=SLICES_GENERIC,
compatible_archetype_keys="*",
steering_elements=ELEM_NEXT,
graph_profile=LIGHT,
)
)
@@ -1,10 +1,10 @@
"""Built-in method: product_milestone_driven — AP1.1."""
"""Built-in method: product_milestone_driven — AP1.1 / AP2.4."""
from __future__ import annotations
from steering.lifecycle.states import STANDARD_LIFECYCLE_STEPS
from steering.graph.profiles import STRICT
from steering.methods.registrations._helpers import ELEM_NEXT, SLICES_PRODUCT
from steering.methods.registry import MethodDefinition, get_method, register_method
from steering.methods.registrations._helpers import SLICES_PRODUCT
_PRODUCT_STEPS = (
"intake",
@@ -42,5 +42,8 @@ def register() -> None:
"initiative.program",
}
),
steering_elements=ELEM_NEXT
| frozenset({"gate_fulfillment", "work_cycle_scope"}),
graph_profile=STRICT,
)
)
@@ -1,8 +1,9 @@
"""Built-in method: program_delivery — AP2.0a."""
"""Built-in method: program_delivery — AP2.0a / AP2.4."""
from __future__ import annotations
from steering.methods.registrations._helpers import (
ELEM_NEXT,
SLICES_PROGRAM,
register_product_like_method,
)
@@ -16,4 +17,6 @@ def register() -> None:
next_action_strategy_key="program_delivery",
data_slices=SLICES_PROGRAM,
compatible_archetype_keys=frozenset({"initiative.program"}),
steering_elements=ELEM_NEXT
| frozenset({"gate_fulfillment", "work_cycle_scope"}),
)
+69 -6
View File
@@ -1,9 +1,12 @@
"""Method Registry — built-in steering methods."""
"""Method Registry — built-in steering methods — AP2.3e / AP2.4."""
from __future__ import annotations
from dataclasses import dataclass
from typing import Literal
from typing import Any, Literal
from steering.elements.registry import validate_steering_element_keys
from steering.graph.profiles import GraphMethodProfile, LIGHT
_METHODS: dict[str, "MethodDefinition"] = {}
@@ -18,20 +21,51 @@ class MethodDefinition:
next_action_strategy_key: str = "default"
data_slices: frozenset[str] = frozenset()
compatible_archetype_keys: frozenset[str] | Literal["*"] = "*"
steering_elements: frozenset[str] = frozenset()
ui_features: frozenset[str] = frozenset()
graph_profile: GraphMethodProfile = LIGHT
method_role: Literal["primary", "modifier"] = "primary"
composes_with: frozenset[str] = frozenset()
def ui_features_as_dict(features: frozenset[str]) -> dict[str, bool]:
return {key: True for key in sorted(features)}
def method_compatible_with_archetype(
method: MethodDefinition, archetype_key: str
method: MethodDefinition,
archetype_key: str,
*,
om_capabilities: frozenset[str] | None = None,
) -> bool:
compat = method.compatible_archetype_keys
if compat == "*":
return True
return archetype_key in compat
if compat != "*" and archetype_key not in compat:
return False
if om_capabilities is not None and method.data_slices:
if not method.data_slices.issubset(om_capabilities):
return False
return True
def list_compatible_methods(
archetype_key: str,
*,
om_capabilities: frozenset[str] | None = None,
) -> tuple[MethodDefinition, ...]:
return tuple(
m
for m in _METHODS.values()
if method_compatible_with_archetype(
m, archetype_key, om_capabilities=om_capabilities
)
)
def register_method(defn: MethodDefinition) -> None:
if defn.key in _METHODS:
raise ValueError(f"Method already registered: {defn.key}")
if defn.steering_elements:
validate_steering_element_keys(defn.steering_elements)
_METHODS[defn.key] = defn
@@ -43,5 +77,34 @@ def list_methods() -> tuple[MethodDefinition, ...]:
return tuple(_METHODS.values())
def method_to_dict(
method: MethodDefinition,
*,
include_compatibility: bool = True,
) -> dict[str, Any]:
payload: dict[str, Any] = {
"key": method.key,
"version": method.version,
"label": method.label,
"description": method.description,
"next_action_strategy_key": method.next_action_strategy_key,
"steering_elements": sorted(method.steering_elements),
"ui_features": ui_features_as_dict(method.ui_features),
"graph_profile": {
"enforce_gate_blocking": method.graph_profile.enforce_gate_blocking,
"emphasize_fulfillment": method.graph_profile.emphasize_fulfillment,
},
"method_role": method.method_role,
"composes_with": sorted(method.composes_with),
"data_slices": sorted(method.data_slices),
}
if include_compatibility:
compat = method.compatible_archetype_keys
payload["compatible_archetype_keys"] = (
"*" if compat == "*" else sorted(compat)
)
return payload
def clear_methods_for_tests() -> None:
_METHODS.clear()