Kairo-Jinkendo/backend/steering/effective_contract.py

37 lines
1.2 KiB
Python
Raw Permalink Normal View History

"""Effective method contract — primary + composition modifier (AP2.4)."""
from __future__ import annotations
from steering.methods.registry import get_method
PLAN_PHASE_MODIFIER_KEY = "agile_iteration"
def resolve_effective_steering_elements(
primary_method_key: str,
*,
data_slices: list[str],
active_composition_modifier: str | None,
) -> frozenset[str]:
"""
Primärmethode + aktiver Modifier; Plan-Phase: agile_iteration wenn work_cycles
Slice aktiv und Methode komponierbar (Epic-Planung vor aktivem Sprint).
"""
primary = get_method(primary_method_key)
elements: set[str] = set(primary.steering_elements if primary else [])
modifier_keys: list[str] = []
if active_composition_modifier:
modifier_keys.append(active_composition_modifier)
elif "work_cycles" in data_slices:
agile = get_method(PLAN_PHASE_MODIFIER_KEY)
if agile and primary_method_key in agile.composes_with:
modifier_keys.append(PLAN_PHASE_MODIFIER_KEY)
for modifier_key in modifier_keys:
modifier = get_method(modifier_key)
if modifier:
elements.update(modifier.steering_elements)
return frozenset(elements)