AP2.0: Archetyp-Katalog, Method-Stubs und sichtbare Steuerung in Kontrolle.
Deploy Development / deploy (push) Successful in 46s
Test Suite / pytest-backend (push) Failing after 2m2s
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) Successful in 46s
Test Suite / pytest-backend (push) Failing after 2m2s
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
PO-Dokumente (ADP v0.2, MVP v0.3) und Minimal Complete Slice: Registry-Methoden, Initiative/Project-Spiegel, Default-Methode bei Anlage, Lagebild mit Archetyp und Guidance. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
21d948634e
commit
3bd983297b
30 files changed
+2093
-52
No files matched your search
@@ -1,9 +1,15 @@
|
||||
"""Adaptive Steering Core — AP1.0 Foundation."""
|
||||
"""Adaptive Steering Core — AP1.0 Foundation + AP2.0 methods."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from steering.hooks.registry import register_builtin_hooks
|
||||
from steering.methods.registrations import generic_operating, product_milestone_driven
|
||||
from steering.methods.registrations import (
|
||||
ap20_method_stubs,
|
||||
continuous_product,
|
||||
generic_operating,
|
||||
product_milestone_driven,
|
||||
program_delivery,
|
||||
)
|
||||
from steering.strategies.next_action import register_builtin_strategies
|
||||
|
||||
|
||||
@@ -13,6 +19,9 @@ def bootstrap_steering() -> None:
|
||||
register_builtin_strategies()
|
||||
generic_operating.register()
|
||||
product_milestone_driven.register()
|
||||
program_delivery.register()
|
||||
continuous_product.register()
|
||||
ap20_method_stubs.register()
|
||||
|
||||
|
||||
bootstrap_steering()
|
||||
@@ -0,0 +1,70 @@
|
||||
"""Shared registration helper for AP2.0 method stubs."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from steering.lifecycle.states import STANDARD_LIFECYCLE_STEPS
|
||||
from steering.methods.registry import MethodDefinition, get_method, register_method
|
||||
|
||||
_PRODUCT_LIKE_STEPS = (
|
||||
"intake",
|
||||
"method_selection",
|
||||
"structure_setup",
|
||||
"planning",
|
||||
"action_selection",
|
||||
"assignment",
|
||||
"waiting",
|
||||
"result_intake",
|
||||
"validation",
|
||||
"review",
|
||||
"adaptation",
|
||||
"closure",
|
||||
)
|
||||
|
||||
_LIGHT_STEPS = (
|
||||
"intake",
|
||||
"structure_setup",
|
||||
"action_selection",
|
||||
"assignment",
|
||||
"waiting",
|
||||
"review",
|
||||
"adaptation",
|
||||
"closure",
|
||||
)
|
||||
|
||||
|
||||
def register_stub_method(
|
||||
*,
|
||||
key: str,
|
||||
label: str,
|
||||
description: str,
|
||||
next_action_strategy_key: str = "default",
|
||||
lifecycle_steps: tuple[str, ...] | None = None,
|
||||
) -> None:
|
||||
if get_method(key):
|
||||
return
|
||||
register_method(
|
||||
MethodDefinition(
|
||||
key=key,
|
||||
version="0.1.0",
|
||||
label=label,
|
||||
description=description,
|
||||
default_lifecycle_steps=lifecycle_steps or STANDARD_LIFECYCLE_STEPS,
|
||||
next_action_strategy_key=next_action_strategy_key,
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
def register_product_like_method(
|
||||
*,
|
||||
key: str,
|
||||
label: str,
|
||||
description: str,
|
||||
next_action_strategy_key: str,
|
||||
) -> None:
|
||||
register_stub_method(
|
||||
key=key,
|
||||
label=label,
|
||||
description=description,
|
||||
next_action_strategy_key=next_action_strategy_key,
|
||||
lifecycle_steps=_PRODUCT_LIKE_STEPS,
|
||||
)
|
||||
@@ -0,0 +1,50 @@
|
||||
"""AP2.0a — remaining method stubs."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from steering.methods.registrations._helpers import register_stub_method
|
||||
|
||||
|
||||
def register() -> None:
|
||||
register_stub_method(
|
||||
key="maturity_progression",
|
||||
label="Reifegrad-Entwicklung",
|
||||
description="Stufen, Routinen, historische Entwicklung",
|
||||
next_action_strategy_key="default",
|
||||
)
|
||||
register_stub_method(
|
||||
key="sequential_dependency",
|
||||
label="Sequenzielle Abhängigkeit",
|
||||
description="Graph-Pfade, kritischer Pfad (read model)",
|
||||
next_action_strategy_key="default",
|
||||
)
|
||||
register_stub_method(
|
||||
key="recurring_control",
|
||||
label="Rhythmus-Steuerung",
|
||||
description="Dauerprogramm, fällig/überfällig, Abweichungen",
|
||||
next_action_strategy_key="default",
|
||||
)
|
||||
register_stub_method(
|
||||
key="queue_pull",
|
||||
label="Inbox / Queue",
|
||||
description="Pull oder Empfehlung aus Queue",
|
||||
next_action_strategy_key="default",
|
||||
)
|
||||
register_stub_method(
|
||||
key="agile_iteration",
|
||||
label="Iterations-Zeitbox",
|
||||
description="Sprint/work_cycle Profil auf Product/Programm",
|
||||
next_action_strategy_key="default",
|
||||
)
|
||||
register_stub_method(
|
||||
key="dispute_procedure",
|
||||
label="Verfahren / Konflikt",
|
||||
description="Reaktive Steuerung, Fristen, Entscheidungen",
|
||||
next_action_strategy_key="default",
|
||||
)
|
||||
register_stub_method(
|
||||
key="chapter_based_progression",
|
||||
label="Kapitel-Entwicklung",
|
||||
description="Inhaltliche Progression, Reviews",
|
||||
next_action_strategy_key="default",
|
||||
)
|
||||
@@ -0,0 +1,14 @@
|
||||
"""Built-in method: continuous_product — AP2.0a."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from steering.methods.registrations._helpers import register_product_like_method
|
||||
|
||||
|
||||
def register() -> None:
|
||||
register_product_like_method(
|
||||
key="continuous_product",
|
||||
label="Produkt (kontinuierlich)",
|
||||
description="Kontinuierlicher Betrieb — Ist zuerst, Plan als Orientierung",
|
||||
next_action_strategy_key="continuous_product",
|
||||
)
|
||||
@@ -0,0 +1,14 @@
|
||||
"""Built-in method: program_delivery — AP2.0a."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from steering.methods.registrations._helpers import register_product_like_method
|
||||
|
||||
|
||||
def register() -> None:
|
||||
register_product_like_method(
|
||||
key="program_delivery",
|
||||
label="Programm (begrenzt)",
|
||||
description="Meilenstein- und gate-orientierte Steuerung mit Abschluss",
|
||||
next_action_strategy_key="program_delivery",
|
||||
)
|
||||
@@ -2,10 +2,18 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from steering.strategies.next_action.continuous_product import (
|
||||
continuous_product_strategy,
|
||||
register_continuous_product_strategy,
|
||||
)
|
||||
from steering.strategies.next_action.default_strategy import default_strategy
|
||||
from steering.strategies.next_action.product_milestone_driven import (
|
||||
product_milestone_strategy,
|
||||
)
|
||||
from steering.strategies.next_action.program_delivery import (
|
||||
program_delivery_strategy,
|
||||
register_program_delivery_strategy,
|
||||
)
|
||||
from steering.strategies.next_action.registry import (
|
||||
get_next_action_strategy,
|
||||
register_next_action_strategy,
|
||||
@@ -16,3 +24,5 @@ def register_builtin_strategies() -> None:
|
||||
for strategy in (default_strategy, product_milestone_strategy):
|
||||
if not get_next_action_strategy(strategy.key):
|
||||
register_next_action_strategy(strategy)
|
||||
register_program_delivery_strategy()
|
||||
register_continuous_product_strategy()
|
||||
@@ -0,0 +1,114 @@
|
||||
"""Continuous product NextAction strategy — AP2.0a (Ist zuerst)."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
||||
from db import get_connection
|
||||
from psycopg2.extras import RealDictCursor
|
||||
from steering.signals import default_rules
|
||||
from steering.strategies.next_action.default_strategy import DefaultNextActionStrategy
|
||||
from steering.strategies.next_action.registry import (
|
||||
get_next_action_strategy,
|
||||
register_next_action_strategy,
|
||||
)
|
||||
from tenant_context import TenantContext
|
||||
|
||||
_default = DefaultNextActionStrategy()
|
||||
|
||||
_OPEN_ACTION = ("open", "ready", "in_progress", "blocked", "review_required")
|
||||
|
||||
|
||||
class ContinuousProductStrategy:
|
||||
key = "continuous_product"
|
||||
|
||||
def evaluate(
|
||||
self,
|
||||
ctx: TenantContext,
|
||||
*,
|
||||
initiative_id: str | None = None,
|
||||
limit: int = 10,
|
||||
) -> list[dict[str, Any]]:
|
||||
if limit < 1:
|
||||
limit = 1
|
||||
if not initiative_id:
|
||||
return _default.evaluate(ctx, limit=limit)
|
||||
|
||||
candidates: list[dict[str, Any]] = []
|
||||
conn = get_connection()
|
||||
try:
|
||||
with conn.cursor(cursor_factory=RealDictCursor) as cur:
|
||||
cur.execute(
|
||||
"""
|
||||
SELECT
|
||||
'action' AS kind,
|
||||
a.title AS title,
|
||||
'Offenes Arbeitspaket priorisieren' AS summary,
|
||||
a.initiative_id,
|
||||
a.id AS action_id,
|
||||
NULL::uuid AS backlog_item_id,
|
||||
'open_action_priority' AS reason_code,
|
||||
'Als Nächstes ausführen' AS recommended_action
|
||||
FROM actions a
|
||||
WHERE a.tenant_id = %s AND a.initiative_id = %s
|
||||
AND a.status = ANY(%s)
|
||||
ORDER BY
|
||||
CASE a.status
|
||||
WHEN 'blocked' THEN 0
|
||||
WHEN 'review_required' THEN 1
|
||||
WHEN 'in_progress' THEN 2
|
||||
WHEN 'ready' THEN 3
|
||||
ELSE 4
|
||||
END,
|
||||
CASE a.priority WHEN 'critical' THEN 0 WHEN 'high' THEN 1 ELSE 2 END,
|
||||
a.due_at ASC NULLS LAST,
|
||||
a.updated_at DESC
|
||||
LIMIT %s
|
||||
""",
|
||||
(ctx.tenant_id, initiative_id, list(_OPEN_ACTION), limit),
|
||||
)
|
||||
for row in cur.fetchall():
|
||||
item = dict(row)
|
||||
item["initiative_id"] = str(item["initiative_id"])
|
||||
item["action_id"] = str(item["action_id"])
|
||||
candidates.append(item)
|
||||
finally:
|
||||
conn.close()
|
||||
|
||||
remaining = limit - len(candidates)
|
||||
if remaining > 0:
|
||||
from steering.strategies.next_action.product_milestone_driven import (
|
||||
ProductMilestoneDrivenStrategy,
|
||||
)
|
||||
|
||||
gate_items = ProductMilestoneDrivenStrategy().evaluate(
|
||||
ctx, initiative_id=initiative_id, limit=remaining
|
||||
)
|
||||
for item in gate_items:
|
||||
if item.get("kind") == "review_milestone":
|
||||
candidates.append(item)
|
||||
remaining -= 1
|
||||
if remaining <= 0:
|
||||
break
|
||||
|
||||
if len(candidates) < limit:
|
||||
rest = default_rules.get_next_action_candidates_for_initiative(
|
||||
ctx, initiative_id=initiative_id, limit=limit - len(candidates)
|
||||
)
|
||||
seen = {c.get("action_id") for c in candidates if c.get("action_id")}
|
||||
for item in rest:
|
||||
if item.get("action_id") and item["action_id"] in seen:
|
||||
continue
|
||||
candidates.append(item)
|
||||
if len(candidates) >= limit:
|
||||
break
|
||||
|
||||
return candidates[:limit]
|
||||
|
||||
|
||||
continuous_product_strategy = ContinuousProductStrategy()
|
||||
|
||||
|
||||
def register_continuous_product_strategy() -> None:
|
||||
if not get_next_action_strategy(continuous_product_strategy.key):
|
||||
register_next_action_strategy(continuous_product_strategy)
|
||||
@@ -0,0 +1,28 @@
|
||||
"""Program delivery NextAction strategy — AP2.0a (Gate-Horizont)."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from steering.strategies.next_action.product_milestone_driven import (
|
||||
ProductMilestoneDrivenStrategy,
|
||||
)
|
||||
from steering.strategies.next_action.registry import (
|
||||
get_next_action_strategy,
|
||||
register_next_action_strategy,
|
||||
)
|
||||
|
||||
_strategy = ProductMilestoneDrivenStrategy()
|
||||
|
||||
|
||||
class ProgramDeliveryStrategy:
|
||||
key = "program_delivery"
|
||||
|
||||
def evaluate(self, ctx, *, initiative_id=None, limit=10):
|
||||
return _strategy.evaluate(ctx, initiative_id=initiative_id, limit=limit)
|
||||
|
||||
|
||||
program_delivery_strategy = ProgramDeliveryStrategy()
|
||||
|
||||
|
||||
def register_program_delivery_strategy() -> None:
|
||||
if not get_next_action_strategy(program_delivery_strategy.key):
|
||||
register_next_action_strategy(program_delivery_strategy)
|
||||
Reference in new issue
Block a user