docs: Archetyp-Vollspecs und Methodenkern vorlaeufig freigeben.
Deploy Development / deploy (push) Successful in 48s
Test Suite / pytest-backend (push) Failing after 3m23s
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 48s
Test Suite / pytest-backend (push) Failing after 3m23s
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
Decision-Lock, Spec-D-Methoden und C1-Massstab-Vollspecs als Zielbild; Steering-Registry/Compat und Horizon-Tests an die Normierung anbinden. Implementierungsausreichendheit bleibt bewusst offen. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
005b371ac0
commit
753f178b0c
48 files changed
+5113
-531
No files matched your search
@@ -1,19 +1,16 @@
|
||||
"""Agile iteration NextAction strategy — AP2.0f (active work_cycle first)."""
|
||||
"""Agile iteration NextAction strategy — Komposition (Primary ∩ Sprint)."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
||||
from steering.signals import default_rules
|
||||
from steering.strategies.next_action.continuous_product import (
|
||||
ContinuousProductStrategy,
|
||||
)
|
||||
from steering.methods.registry import get_method
|
||||
from steering.strategies.next_action.default_strategy import DefaultNextActionStrategy
|
||||
from steering.strategies.next_action.execution_ready import (
|
||||
blocked_execution_action_ids,
|
||||
build_execution_ready_candidates,
|
||||
list_execution_ready_candidates,
|
||||
merge_candidates,
|
||||
filter_actions_for_work_cycle,
|
||||
gate_horizon_scope_for_method,
|
||||
resolve_initiative_method_key,
|
||||
)
|
||||
from steering.strategies.next_action.registry import (
|
||||
get_next_action_strategy,
|
||||
@@ -23,7 +20,13 @@ from services.work_cycle import get_active_work_cycle
|
||||
from tenant_context import TenantContext
|
||||
|
||||
_default = DefaultNextActionStrategy()
|
||||
_continuous = ContinuousProductStrategy()
|
||||
|
||||
|
||||
def _primary_strategy_for_initiative(ctx: TenantContext, initiative_id: str):
|
||||
method_key = resolve_initiative_method_key(ctx, initiative_id)
|
||||
method = get_method(method_key)
|
||||
strategy_key = method.next_action_strategy_key if method else _default.key
|
||||
return get_next_action_strategy(strategy_key) or _default
|
||||
|
||||
|
||||
class AgileIterationStrategy:
|
||||
@@ -41,58 +44,54 @@ class AgileIterationStrategy:
|
||||
if not initiative_id:
|
||||
return _default.evaluate(ctx, limit=limit)
|
||||
|
||||
primary = _primary_strategy_for_initiative(ctx, initiative_id)
|
||||
active = get_active_work_cycle(
|
||||
tenant_id=ctx.tenant_id, initiative_id=initiative_id
|
||||
)
|
||||
if not active:
|
||||
return _continuous.evaluate(ctx, initiative_id=initiative_id, limit=limit)
|
||||
return primary.evaluate(ctx, initiative_id=initiative_id, limit=limit)
|
||||
|
||||
primary_key = resolve_initiative_method_key(ctx, initiative_id)
|
||||
gate_scope = gate_horizon_scope_for_method(primary_key, ctx, initiative_id)
|
||||
cycle_id = str(active["id"])
|
||||
|
||||
cycle_id = active["id"]
|
||||
from services import actions as action_service
|
||||
from steering.graph.execution_engine import load_initiative_execution_graph_state
|
||||
|
||||
actions = action_service.list_actions_for_initiative(
|
||||
tenant_id=ctx.tenant_id, initiative_id=initiative_id
|
||||
)
|
||||
cycle_actions = [
|
||||
a for a in actions if str(a.get("work_cycle_id") or "") == cycle_id
|
||||
]
|
||||
if not cycle_actions:
|
||||
ready = list_execution_ready_candidates(
|
||||
ctx, initiative_id, limit=limit, prefer_critical_path=True
|
||||
)
|
||||
if ready:
|
||||
return ready[:limit]
|
||||
return _continuous.evaluate(ctx, initiative_id=initiative_id, limit=limit)
|
||||
scoped = filter_actions_for_work_cycle(actions, work_cycle_id=cycle_id)
|
||||
if gate_scope:
|
||||
scope = str(gate_scope)
|
||||
scoped = [
|
||||
a
|
||||
for a in scoped
|
||||
if a.get("roadmap_item_id") and str(a["roadmap_item_id"]) == scope
|
||||
]
|
||||
|
||||
if not scoped:
|
||||
return []
|
||||
|
||||
graph_state = load_initiative_execution_graph_state(
|
||||
tenant_id=ctx.tenant_id,
|
||||
initiative_id=initiative_id,
|
||||
scope_roadmap_item_id=gate_scope,
|
||||
)
|
||||
blocked_ids = blocked_execution_action_ids(ctx, initiative_id)
|
||||
ready = build_execution_ready_candidates(
|
||||
actions=cycle_actions,
|
||||
actions=scoped,
|
||||
graph_state=graph_state,
|
||||
limit=limit,
|
||||
prefer_critical_path=True,
|
||||
)
|
||||
for item in ready:
|
||||
item["reason_code"] = "work_cycle_ready"
|
||||
item["summary"] = f"Aktive Zeitbox „{active['title']}“ — ausführungsbereit"
|
||||
item["summary"] = (
|
||||
f"Aktive Zeitbox „{active['title']}“ — ausführungsbereit im Horizont"
|
||||
)
|
||||
item["recommended_action"] = "In dieser Iteration ausführen"
|
||||
|
||||
if len(ready) >= limit:
|
||||
return ready[:limit]
|
||||
|
||||
rest = _continuous.evaluate(
|
||||
ctx, initiative_id=initiative_id, limit=limit - len(ready)
|
||||
)
|
||||
filtered = [
|
||||
item
|
||||
for item in rest
|
||||
if not item.get("action_id") or item["action_id"] not in blocked_ids
|
||||
]
|
||||
return merge_candidates(ready, filtered, limit=limit, exclude_action_ids=blocked_ids)
|
||||
return ready[:limit]
|
||||
|
||||
|
||||
agile_iteration_strategy = AgileIterationStrategy()
|
||||
|
||||
@@ -184,7 +184,9 @@ def first_active_gate_id(ctx: TenantContext, initiative_id: str) -> str | None:
|
||||
JOIN roadmaps r ON r.id = ri.roadmap_id AND r.tenant_id = ri.tenant_id
|
||||
WHERE ri.tenant_id = %s AND r.initiative_id = %s
|
||||
AND ri.status = 'active'
|
||||
ORDER BY ri.target_date ASC NULLS LAST, ri.updated_at DESC
|
||||
ORDER BY ri.sort_order ASC NULLS LAST,
|
||||
ri.target_date ASC NULLS LAST,
|
||||
ri.updated_at DESC
|
||||
LIMIT 1
|
||||
""",
|
||||
(ctx.tenant_id, initiative_id),
|
||||
@@ -193,3 +195,32 @@ def first_active_gate_id(ctx: TenantContext, initiative_id: str) -> str | None:
|
||||
return str(row["id"]) if row else None
|
||||
finally:
|
||||
conn.close()
|
||||
|
||||
|
||||
def resolve_initiative_method_key(ctx: TenantContext, initiative_id: str) -> str:
|
||||
from services import steering_context as sc_service
|
||||
|
||||
row = sc_service.get_steering_context(
|
||||
tenant_id=ctx.tenant_id, initiative_id=initiative_id
|
||||
)
|
||||
if row:
|
||||
return row["method_key"]
|
||||
return "generic_operating"
|
||||
|
||||
|
||||
def gate_horizon_scope_for_method(method_key: str, ctx: TenantContext, initiative_id: str) -> str | None:
|
||||
"""Plan-Horizont (aktives Gate) für gate-geführte Primary-Methoden."""
|
||||
if method_key in (
|
||||
"sequential_dependency",
|
||||
"program_delivery",
|
||||
"maturity_progression",
|
||||
):
|
||||
return first_active_gate_id(ctx, initiative_id)
|
||||
return None
|
||||
|
||||
|
||||
def filter_actions_for_work_cycle(
|
||||
actions: list[dict[str, Any]], *, work_cycle_id: str
|
||||
) -> list[dict[str, Any]]:
|
||||
cycle = str(work_cycle_id)
|
||||
return [a for a in actions if str(a.get("work_cycle_id") or "") == cycle]
|
||||
@@ -1,14 +1,13 @@
|
||||
"""Sequential dependency NextAction strategy — AP2.0d."""
|
||||
"""Sequential dependency NextAction strategy — AP2.0d / Spec-D D6."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
||||
from steering.signals import default_rules
|
||||
from steering.strategies.next_action.default_strategy import DefaultNextActionStrategy
|
||||
from steering.strategies.next_action.execution_ready import (
|
||||
first_active_gate_id,
|
||||
list_execution_ready_candidates,
|
||||
merge_candidates,
|
||||
)
|
||||
from steering.strategies.next_action.registry import (
|
||||
get_next_action_strategy,
|
||||
@@ -34,29 +33,15 @@ class SequentialDependencyStrategy:
|
||||
if not initiative_id:
|
||||
return _default.evaluate(ctx, limit=limit)
|
||||
|
||||
gate_scope = first_active_gate_id(ctx, initiative_id)
|
||||
ready = list_execution_ready_candidates(
|
||||
ctx,
|
||||
initiative_id,
|
||||
limit=limit,
|
||||
scope_roadmap_item_id=gate_scope,
|
||||
prefer_critical_path=True,
|
||||
)
|
||||
if len(ready) >= limit:
|
||||
return ready[:limit]
|
||||
|
||||
from steering.strategies.next_action.execution_ready import (
|
||||
blocked_execution_action_ids,
|
||||
)
|
||||
|
||||
rest = default_rules.get_next_action_candidates_for_initiative(
|
||||
ctx, initiative_id=initiative_id, limit=limit - len(ready)
|
||||
)
|
||||
blocked_ids = blocked_execution_action_ids(ctx, initiative_id)
|
||||
filtered = [
|
||||
item
|
||||
for item in rest
|
||||
if not item.get("action_id") or item["action_id"] not in blocked_ids
|
||||
]
|
||||
return merge_candidates(ready, filtered, limit=limit)
|
||||
return ready[:limit]
|
||||
|
||||
|
||||
sequential_dependency_strategy = SequentialDependencyStrategy()
|
||||
|
||||
Reference in new issue
Block a user