Some checks failed
Test Suite / lint-backend (push) Waiting to run
Test Suite / compose-smoke (push) Waiting to run
Test Suite / k6 /api/health Baseline (push) Blocked by required conditions
Test Suite / playwright-smoke (push) Blocked by required conditions
Deploy Development / deploy (push) Successful in 45s
Test Suite / pytest-backend (push) Has been cancelled
Archetyp-Strategien priorisieren ausführungsbereite APs mit Begründung execution_ready/critical_path; continuous_product und program_delivery integriert. Co-authored-by: Cursor <cursoragent@cursor.com>
77 lines
2.3 KiB
Python
77 lines
2.3 KiB
Python
"""Program delivery NextAction strategy — AP2.0a + AP2.0d (Gate-Horizont)."""
|
|
|
|
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.product_milestone_driven import (
|
|
ProductMilestoneDrivenStrategy,
|
|
)
|
|
from steering.strategies.next_action.registry import (
|
|
get_next_action_strategy,
|
|
register_next_action_strategy,
|
|
)
|
|
from tenant_context import TenantContext
|
|
|
|
_default = DefaultNextActionStrategy()
|
|
_milestone = ProductMilestoneDrivenStrategy()
|
|
|
|
|
|
class ProgramDeliveryStrategy:
|
|
key = "program_delivery"
|
|
|
|
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)
|
|
|
|
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,
|
|
)
|
|
|
|
remaining = limit - len(ready)
|
|
gate_items: list[dict[str, Any]] = []
|
|
if remaining > 0:
|
|
gate_items = _milestone.evaluate(
|
|
ctx, initiative_id=initiative_id, limit=remaining
|
|
)
|
|
gate_items = [
|
|
item for item in gate_items if item.get("kind") == "review_milestone"
|
|
]
|
|
|
|
merged = merge_candidates(ready, gate_items, limit=limit)
|
|
if len(merged) >= limit:
|
|
return merged[:limit]
|
|
|
|
rest = default_rules.get_next_action_candidates_for_initiative(
|
|
ctx, initiative_id=initiative_id, limit=limit - len(merged)
|
|
)
|
|
return merge_candidates(merged, rest, 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)
|