Kairo-Jinkendo/backend/steering/strategies/next_action/sequential_dependency.py
Lars 753f178b0c
Some checks failed
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
docs: Archetyp-Vollspecs und Methodenkern vorlaeufig freigeben.
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>
2026-07-26 15:02:04 +02:00

53 lines
1.5 KiB
Python

"""Sequential dependency NextAction strategy — AP2.0d / Spec-D D6."""
from __future__ import annotations
from typing import Any
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,
)
from steering.strategies.next_action.registry import (
get_next_action_strategy,
register_next_action_strategy,
)
from tenant_context import TenantContext
_default = DefaultNextActionStrategy()
class SequentialDependencyStrategy:
key = "sequential_dependency"
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,
)
return ready[:limit]
sequential_dependency_strategy = SequentialDependencyStrategy()
def register_sequential_dependency_strategy() -> None:
if not get_next_action_strategy(sequential_dependency_strategy.key):
register_next_action_strategy(sequential_dependency_strategy)