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
@@ -39,6 +39,16 @@ METHOD_PROFILES: tuple[dict[str, Any], ...] = (
|
||||
"default_actor_setup": "po_plus_vibe_coder",
|
||||
},
|
||||
},
|
||||
{
|
||||
"key": "project.agile_iteration",
|
||||
"label": "Projekt mit Sprint",
|
||||
"description": "Lineares Projekt (A2) mit optionaler Agile-Iteration.",
|
||||
"initiative_archetype_key": "initiative.linear_project",
|
||||
"method_key": "sequential_dependency",
|
||||
"seed_hints": {
|
||||
"agile_iteration_profile": True,
|
||||
},
|
||||
},
|
||||
)
|
||||
|
||||
_PROFILE_INDEX = {item["key"]: item for item in METHOD_PROFILES}
|
||||
|
||||
@@ -22,7 +22,7 @@ _GUIDANCE: dict[str, str] = {
|
||||
"Aktuelle Stufe und heutige Übung steuern deinen nächsten Schritt."
|
||||
),
|
||||
"initiative.linear_project": (
|
||||
"Nächster Schritt am kritischen Pfad — Abhängigkeiten im Plan-Graph."
|
||||
"Kritischer Pfad und Abhängigkeiten steuern Next — nicht die Gesamtliste."
|
||||
),
|
||||
"initiative.product": (
|
||||
"Eingang triagieren, dann committete Actions — optional Sprint-Zeitbox (B3)."
|
||||
@@ -34,7 +34,7 @@ _GUIDANCE: dict[str, str] = {
|
||||
|
||||
_PROFILE_HINTS: dict[str, list[str]] = {
|
||||
"initiative.maturity_journey": ["maturity.karate_kumite"],
|
||||
"initiative.linear_project": [],
|
||||
"initiative.linear_project": ["project.agile_iteration"],
|
||||
"initiative.product": ["product.kairo_dev"],
|
||||
"initiative.program": [],
|
||||
}
|
||||
@@ -75,6 +75,7 @@ def get_starter_preview(
|
||||
{"kind": "milestone", "title": "G4 — Abschluss", "status": "planned"},
|
||||
{"kind": "project", "title": "Hauptpfad"},
|
||||
{"kind": "project", "title": "Begleitung"},
|
||||
{"kind": "action", "title": "Erster Schritt — Planung konkretisieren"},
|
||||
]
|
||||
elif archetype_key == "initiative.product":
|
||||
items = [
|
||||
@@ -128,6 +129,7 @@ def apply_starter_kit(
|
||||
"projects": [],
|
||||
"recurring": [],
|
||||
"backlog_items": [],
|
||||
"actions": [],
|
||||
}
|
||||
|
||||
if archetype_key == "initiative.maturity_journey":
|
||||
@@ -282,9 +284,28 @@ def _apply_a2(
|
||||
user_id=user_id,
|
||||
)
|
||||
|
||||
from services.actions import create_action, list_actions_for_initiative
|
||||
|
||||
projects = list_projects_for_initiative(tenant_id=tenant_id, initiative_id=initiative_id)
|
||||
hauptpfad = _find_by_title(projects, "Hauptpfad")
|
||||
actions = list_actions_for_initiative(tenant_id=tenant_id, initiative_id=initiative_id)
|
||||
if not _find_by_title(actions, "Erster Schritt — Planung konkretisieren"):
|
||||
create_action(
|
||||
tenant_id=tenant_id,
|
||||
initiative_id=initiative_id,
|
||||
title="Erster Schritt — Planung konkretisieren",
|
||||
description="Starter-Arbeitspaket am ersten Gate",
|
||||
status="open",
|
||||
roadmap_item_id=gate_ids[0],
|
||||
project_id=hauptpfad["id"] if hauptpfad else None,
|
||||
sort_order=0,
|
||||
user_id=user_id,
|
||||
)
|
||||
|
||||
return {
|
||||
"roadmap_items": gate_ids,
|
||||
"projects": ["Hauptpfad", "Begleitung"],
|
||||
"actions": ["Erster Schritt — Planung konkretisieren"],
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ from steering.graph.profiles import LIGHT, graph_profile_as_dict
|
||||
from steering.methods.registry import (
|
||||
get_method,
|
||||
list_compatible_methods,
|
||||
list_composable_modifiers,
|
||||
method_to_dict,
|
||||
ui_features_as_dict,
|
||||
)
|
||||
@@ -166,4 +167,32 @@ def get_operating_context(
|
||||
om_capabilities=om_capabilities,
|
||||
active_method_key=method_key,
|
||||
),
|
||||
"composable_modifiers": [
|
||||
method_to_dict(m, include_compatibility=False)
|
||||
for m in list_composable_modifiers(method_key)
|
||||
],
|
||||
"active_composition_modifier": (
|
||||
"agile_iteration"
|
||||
if _resolve_active_agile_composition(
|
||||
tenant_id=tenant_id,
|
||||
initiative_id=initiative_id,
|
||||
primary_method_key=method_key,
|
||||
)
|
||||
else None
|
||||
),
|
||||
}
|
||||
|
||||
|
||||
def _resolve_active_agile_composition(
|
||||
*,
|
||||
tenant_id: str,
|
||||
initiative_id: str,
|
||||
primary_method_key: str,
|
||||
) -> bool:
|
||||
from services.work_cycle import get_active_work_cycle
|
||||
from steering.methods.registry import get_method
|
||||
|
||||
agile = get_method("agile_iteration")
|
||||
if not agile or primary_method_key not in agile.composes_with:
|
||||
return False
|
||||
return get_active_work_cycle(tenant_id=tenant_id, initiative_id=initiative_id) is not None
|
||||
@@ -22,6 +22,9 @@ def bootstrap_steering() -> None:
|
||||
program_delivery.register()
|
||||
continuous_product.register()
|
||||
ap20_method_stubs.register()
|
||||
from steering.methods.registry import validate_method_registry
|
||||
|
||||
validate_method_registry()
|
||||
|
||||
|
||||
bootstrap_steering()
|
||||
@@ -32,7 +32,7 @@ def register() -> None:
|
||||
description="Graph-Pfade, kritischer Pfad (read model)",
|
||||
next_action_strategy_key="sequential_dependency",
|
||||
data_slices=SLICES_OM_STANDARD,
|
||||
compatible_archetype_keys="*",
|
||||
compatible_archetype_keys=frozenset({"initiative.linear_project"}),
|
||||
steering_elements=ELEM_NEXT
|
||||
| frozenset({"critical_path", "gate_fulfillment"}),
|
||||
ui_features=frozenset({"criticalPathControl"}),
|
||||
@@ -50,26 +50,38 @@ def register() -> None:
|
||||
)
|
||||
register_stub_method(
|
||||
key="queue_pull",
|
||||
label="Inbox / Queue",
|
||||
description="Pull oder Empfehlung aus Queue",
|
||||
label="Inbox / Queue (Legacy)",
|
||||
description="Pull oder Empfehlung aus Queue — abgelöst durch checklist_flow",
|
||||
next_action_strategy_key="queue_pull",
|
||||
data_slices=SLICES_QUEUE,
|
||||
compatible_archetype_keys="*",
|
||||
compatible_archetype_keys=frozenset({"initiative.support_queue"}),
|
||||
steering_elements=ELEM_NEXT | frozenset({"queue_inbox"}),
|
||||
graph_profile=LIGHT,
|
||||
)
|
||||
register_stub_method(
|
||||
key="agile_iteration",
|
||||
label="Iterations-Zeitbox",
|
||||
description="Sprint/work_cycle Profil auf Product/Programm",
|
||||
description="Sprint/work_cycle Profil — komponiert mit Primary-Methoden",
|
||||
next_action_strategy_key="agile_iteration",
|
||||
data_slices=SLICES_AGILE,
|
||||
compatible_archetype_keys="*",
|
||||
compatible_archetype_keys=frozenset(
|
||||
{
|
||||
"initiative.linear_project",
|
||||
"initiative.product",
|
||||
"initiative.recurring_program",
|
||||
}
|
||||
),
|
||||
steering_elements=ELEM_NEXT | frozenset({"work_cycle_scope"}),
|
||||
ui_features=frozenset({"steeringSnapshotOnWorkSprint"}),
|
||||
graph_profile=STRICT,
|
||||
method_role="modifier",
|
||||
composes_with=frozenset({"continuous_product", "program_delivery"}),
|
||||
composes_with=frozenset(
|
||||
{
|
||||
"continuous_product",
|
||||
"sequential_dependency",
|
||||
"recurring_control",
|
||||
}
|
||||
),
|
||||
)
|
||||
register_stub_method(
|
||||
key="dispute_procedure",
|
||||
|
||||
@@ -38,8 +38,6 @@ def register() -> None:
|
||||
{
|
||||
"initiative.product",
|
||||
"initiative.generic",
|
||||
"initiative.linear_project",
|
||||
"initiative.program",
|
||||
}
|
||||
),
|
||||
steering_elements=ELEM_NEXT | frozenset({"gate_fulfillment"}),
|
||||
|
||||
@@ -66,9 +66,44 @@ def register_method(defn: MethodDefinition) -> None:
|
||||
raise ValueError(f"Method already registered: {defn.key}")
|
||||
if defn.steering_elements:
|
||||
validate_steering_element_keys(defn.steering_elements)
|
||||
if defn.method_role == "modifier" and not defn.composes_with:
|
||||
raise ValueError(
|
||||
f"Modifier method {defn.key} must declare composes_with primary keys"
|
||||
)
|
||||
_METHODS[defn.key] = defn
|
||||
|
||||
|
||||
def validate_method_registry() -> None:
|
||||
"""Post-bootstrap: strategy keys exist; composes_with targets are primary methods."""
|
||||
from steering.strategies.next_action.registry import get_next_action_strategy
|
||||
|
||||
for method in _METHODS.values():
|
||||
strategy_key = method.next_action_strategy_key
|
||||
if strategy_key != "default" and not get_next_action_strategy(strategy_key):
|
||||
raise ValueError(
|
||||
f"Method {method.key} references unknown next_action_strategy: {strategy_key}"
|
||||
)
|
||||
for primary_key in method.composes_with:
|
||||
primary = get_method(primary_key)
|
||||
if not primary:
|
||||
raise ValueError(
|
||||
f"Method {method.key} composes_with unknown method: {primary_key}"
|
||||
)
|
||||
if primary.method_role != "primary":
|
||||
raise ValueError(
|
||||
f"Method {method.key} composes_with non-primary method: {primary_key}"
|
||||
)
|
||||
|
||||
|
||||
def list_composable_modifiers(primary_method_key: str) -> tuple[MethodDefinition, ...]:
|
||||
"""Modifier methods that may compose with the given primary method."""
|
||||
return tuple(
|
||||
m
|
||||
for m in _METHODS.values()
|
||||
if m.method_role == "modifier" and primary_method_key in m.composes_with
|
||||
)
|
||||
|
||||
|
||||
def get_method(key: str) -> MethodDefinition | None:
|
||||
return _METHODS.get(key)
|
||||
|
||||
|
||||
@@ -25,6 +25,13 @@ def _resolve_method_key(ctx: TenantContext, initiative_id: str | None) -> str:
|
||||
return "generic_operating"
|
||||
|
||||
|
||||
def _primary_composes_with_agile(method_key: str) -> bool:
|
||||
agile = get_method("agile_iteration")
|
||||
if not agile:
|
||||
return False
|
||||
return method_key in agile.composes_with
|
||||
|
||||
|
||||
def _resolve_next_action_strategy_key(
|
||||
ctx: TenantContext, initiative_id: str | None
|
||||
) -> str:
|
||||
@@ -37,7 +44,7 @@ def _resolve_next_action_strategy_key(
|
||||
from services.work_cycle import get_active_work_cycle
|
||||
|
||||
active = get_active_work_cycle(tenant_id=ctx.tenant_id, initiative_id=initiative_id)
|
||||
if active and strategy_key == "continuous_product":
|
||||
if active and _primary_composes_with_agile(method_key):
|
||||
agile = get_next_action_strategy("agile_iteration")
|
||||
if agile:
|
||||
return agile.key
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -86,6 +86,32 @@ def test_create_initiative_b2b_starter_kit(client):
|
||||
assert "Betrieb" in titles
|
||||
|
||||
|
||||
def test_create_initiative_a2_starter_kit_includes_action(client):
|
||||
user = provision_user_in_tenant(tenant_role="admin")
|
||||
token = _login(client, user)
|
||||
|
||||
created = client.post(
|
||||
"/api/initiatives",
|
||||
json={
|
||||
"title": "Test Projekt",
|
||||
"archetype_key": "initiative.linear_project",
|
||||
},
|
||||
headers=_auth(token),
|
||||
)
|
||||
assert created.status_code == 201
|
||||
initiative_id = created.json()["id"]
|
||||
assert created.json()["starter_kit"]["applied"] is True
|
||||
|
||||
actions = client.get(
|
||||
f"/api/initiatives/{initiative_id}/actions",
|
||||
headers=_auth(token),
|
||||
)
|
||||
assert actions.status_code == 200
|
||||
assert any(
|
||||
a["title"] == "Erster Schritt — Planung konkretisieren" for a in actions.json()
|
||||
)
|
||||
|
||||
|
||||
def test_starter_kit_skipped_when_structure_exists(client):
|
||||
user = provision_user_in_tenant(tenant_role="admin")
|
||||
token = _login(client, user)
|
||||
|
||||
@@ -0,0 +1,188 @@
|
||||
"""AP2.2c — A2 sequential_dependency: Gate-Horizont + Agile-Komposition."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from tests.factories import provision_user_in_tenant
|
||||
from tests.test_initiatives_actions import _auth, _create_initiative, _login
|
||||
|
||||
|
||||
def _gate_ids(client, token, initiative_id):
|
||||
roadmap = client.get(
|
||||
f"/api/initiatives/{initiative_id}/roadmap/items",
|
||||
headers=_auth(token),
|
||||
)
|
||||
assert roadmap.status_code == 200
|
||||
items = roadmap.json()
|
||||
active = next(i for i in items if i.get("status") == "active")
|
||||
planned = next(i for i in items if i.get("title", "").startswith("G2"))
|
||||
return active["id"], planned["id"]
|
||||
|
||||
|
||||
def test_sequential_next_action_only_in_active_gate_horizon(client):
|
||||
user = provision_user_in_tenant(tenant_role="admin")
|
||||
token = _login(client, user)
|
||||
|
||||
created = _create_initiative(
|
||||
client,
|
||||
token,
|
||||
title="Horizon Test",
|
||||
archetype_key="initiative.linear_project",
|
||||
)
|
||||
initiative_id = created.json()["id"]
|
||||
g1_id, g2_id = _gate_ids(client, token, initiative_id)
|
||||
|
||||
off_horizon = client.post(
|
||||
f"/api/initiatives/{initiative_id}/actions",
|
||||
json={
|
||||
"title": "Außerhalb Horizont",
|
||||
"status": "open",
|
||||
"roadmap_item_id": g2_id,
|
||||
"sort_order": 0,
|
||||
},
|
||||
headers=_auth(token),
|
||||
)
|
||||
on_horizon = client.post(
|
||||
f"/api/initiatives/{initiative_id}/actions",
|
||||
json={
|
||||
"title": "Im aktiven Gate",
|
||||
"status": "open",
|
||||
"roadmap_item_id": g1_id,
|
||||
"sort_order": 1,
|
||||
},
|
||||
headers=_auth(token),
|
||||
)
|
||||
assert off_horizon.status_code == 201 and on_horizon.status_code == 201
|
||||
|
||||
snap = client.get(
|
||||
f"/api/initiatives/{initiative_id}/steering-snapshot",
|
||||
headers=_auth(token),
|
||||
)
|
||||
assert snap.status_code == 200
|
||||
next_actions = snap.json().get("next_actions") or []
|
||||
assert next_actions
|
||||
next_ids = {n.get("action_id") for n in next_actions}
|
||||
assert off_horizon.json()["id"] not in next_ids
|
||||
assert on_horizon.json()["id"] in next_ids
|
||||
|
||||
|
||||
def test_agile_on_linear_delegates_primary_without_active_sprint(client):
|
||||
user = provision_user_in_tenant(tenant_role="admin")
|
||||
token = _login(client, user)
|
||||
|
||||
created = _create_initiative(
|
||||
client,
|
||||
token,
|
||||
title="Agile Primary",
|
||||
archetype_key="initiative.linear_project",
|
||||
)
|
||||
initiative_id = created.json()["id"]
|
||||
g1_id, _ = _gate_ids(client, token, initiative_id)
|
||||
|
||||
action = client.post(
|
||||
f"/api/initiatives/{initiative_id}/actions",
|
||||
json={
|
||||
"title": "Gate Action",
|
||||
"status": "open",
|
||||
"roadmap_item_id": g1_id,
|
||||
},
|
||||
headers=_auth(token),
|
||||
)
|
||||
assert action.status_code == 201
|
||||
|
||||
snap = client.get(
|
||||
f"/api/initiatives/{initiative_id}/steering-snapshot",
|
||||
headers=_auth(token),
|
||||
)
|
||||
assert snap.status_code == 200
|
||||
assert snap.json().get("active_work_cycle") is None
|
||||
next_actions = snap.json().get("next_actions") or []
|
||||
assert next_actions[0]["action_id"] == action.json()["id"]
|
||||
assert next_actions[0]["reason_code"] in (
|
||||
"execution_ready",
|
||||
"execution_critical_path",
|
||||
)
|
||||
|
||||
|
||||
def test_agile_on_linear_sprint_intersects_gate_horizon(client):
|
||||
user = provision_user_in_tenant(tenant_role="admin")
|
||||
token = _login(client, user)
|
||||
|
||||
created = _create_initiative(
|
||||
client,
|
||||
token,
|
||||
title="Sprint Horizon",
|
||||
archetype_key="initiative.linear_project",
|
||||
)
|
||||
initiative_id = created.json()["id"]
|
||||
g1_id, _ = _gate_ids(client, token, initiative_id)
|
||||
|
||||
cycle = client.post(
|
||||
f"/api/initiatives/{initiative_id}/work-cycles",
|
||||
json={"title": "Montage-Woche", "status": "active"},
|
||||
headers=_auth(token),
|
||||
)
|
||||
assert cycle.status_code == 201
|
||||
cycle_id = cycle.json()["id"]
|
||||
|
||||
outside_sprint = client.post(
|
||||
f"/api/initiatives/{initiative_id}/actions",
|
||||
json={
|
||||
"title": "Nur Gate",
|
||||
"status": "open",
|
||||
"roadmap_item_id": g1_id,
|
||||
},
|
||||
headers=_auth(token),
|
||||
)
|
||||
in_sprint = client.post(
|
||||
f"/api/initiatives/{initiative_id}/actions",
|
||||
json={
|
||||
"title": "Im Sprint",
|
||||
"status": "ready",
|
||||
"roadmap_item_id": g1_id,
|
||||
"work_cycle_id": cycle_id,
|
||||
},
|
||||
headers=_auth(token),
|
||||
)
|
||||
assert outside_sprint.status_code == 201 and in_sprint.status_code == 201
|
||||
|
||||
snap = client.get(
|
||||
f"/api/initiatives/{initiative_id}/steering-snapshot",
|
||||
headers=_auth(token),
|
||||
)
|
||||
assert snap.status_code == 200
|
||||
assert snap.json().get("active_work_cycle")
|
||||
next_actions = snap.json().get("next_actions") or []
|
||||
assert next_actions
|
||||
assert next_actions[0]["action_id"] == in_sprint.json()["id"]
|
||||
assert next_actions[0]["reason_code"] == "work_cycle_ready"
|
||||
|
||||
|
||||
def test_operating_context_active_composition_modifier_with_sprint(client):
|
||||
user = provision_user_in_tenant(tenant_role="member")
|
||||
token = _login(client, user)
|
||||
|
||||
created = _create_initiative(
|
||||
client,
|
||||
token,
|
||||
title="Composition Flag",
|
||||
archetype_key="initiative.linear_project",
|
||||
)
|
||||
initiative_id = created.json()["id"]
|
||||
|
||||
ctx_before = client.get(
|
||||
f"/api/initiatives/{initiative_id}/operating-context",
|
||||
headers=_auth(token),
|
||||
)
|
||||
assert ctx_before.json().get("active_composition_modifier") is None
|
||||
|
||||
client.post(
|
||||
f"/api/initiatives/{initiative_id}/work-cycles",
|
||||
json={"title": "S1", "status": "active"},
|
||||
headers=_auth(token),
|
||||
)
|
||||
|
||||
ctx_after = client.get(
|
||||
f"/api/initiatives/{initiative_id}/operating-context",
|
||||
headers=_auth(token),
|
||||
)
|
||||
assert ctx_after.json().get("active_composition_modifier") == "agile_iteration"
|
||||
@@ -6,7 +6,28 @@ from tests.factories import provision_user_in_tenant
|
||||
from tests.test_initiatives_actions import _auth, _create_initiative, _login
|
||||
|
||||
|
||||
def test_update_method_queue_pull_on_linear_ok(client):
|
||||
def test_update_method_queue_pull_on_support_queue_ok(client):
|
||||
user = provision_user_in_tenant(tenant_role="member")
|
||||
token = _login(client, user)
|
||||
|
||||
created = _create_initiative(
|
||||
client,
|
||||
token,
|
||||
title="Queue Override",
|
||||
archetype_key="initiative.support_queue",
|
||||
)
|
||||
initiative_id = created.json()["id"]
|
||||
|
||||
res = client.patch(
|
||||
f"/api/steering/initiatives/{initiative_id}/context",
|
||||
json={"method_key": "queue_pull"},
|
||||
headers=_auth(token),
|
||||
)
|
||||
assert res.status_code == 200
|
||||
assert res.json()["method_key"] == "queue_pull"
|
||||
|
||||
|
||||
def test_update_method_queue_pull_on_linear_rejected(client):
|
||||
user = provision_user_in_tenant(tenant_role="member")
|
||||
token = _login(client, user)
|
||||
|
||||
@@ -23,8 +44,8 @@ def test_update_method_queue_pull_on_linear_ok(client):
|
||||
json={"method_key": "queue_pull"},
|
||||
headers=_auth(token),
|
||||
)
|
||||
assert res.status_code == 200
|
||||
assert res.json()["method_key"] == "queue_pull"
|
||||
assert res.status_code == 400
|
||||
assert "kompatibel" in res.json()["detail"].lower()
|
||||
|
||||
|
||||
def test_update_method_maturity_on_product_rejected(client):
|
||||
@@ -55,8 +76,8 @@ def test_operating_context_reflects_method_slice_intersection(client):
|
||||
created = _create_initiative(
|
||||
client,
|
||||
token,
|
||||
title="Queue Linear",
|
||||
archetype_key="initiative.linear_project",
|
||||
title="Queue Support",
|
||||
archetype_key="initiative.support_queue",
|
||||
)
|
||||
initiative_id = created.json()["id"]
|
||||
|
||||
|
||||
@@ -30,11 +30,33 @@ def test_continuous_product_ui_features_from_method():
|
||||
assert features["steeringSnapshotOnWorkSprint"] is True
|
||||
|
||||
|
||||
def test_list_compatible_methods_linear_includes_queue_pull():
|
||||
def test_list_compatible_methods_linear_excludes_queue_pull():
|
||||
methods = list_compatible_methods("initiative.linear_project")
|
||||
keys = {m.key for m in methods}
|
||||
assert "sequential_dependency" in keys
|
||||
assert "queue_pull" in keys
|
||||
assert "queue_pull" not in keys
|
||||
assert "agile_iteration" not in keys # modifier, not primary switch target
|
||||
|
||||
|
||||
def test_agile_iteration_composes_with_matrix():
|
||||
method = get_method("agile_iteration")
|
||||
assert method is not None
|
||||
assert method.composes_with == frozenset(
|
||||
{
|
||||
"continuous_product",
|
||||
"sequential_dependency",
|
||||
"recurring_control",
|
||||
}
|
||||
)
|
||||
assert "program_delivery" not in method.composes_with
|
||||
|
||||
|
||||
def test_list_composable_modifiers_for_linear():
|
||||
from steering.methods.registry import list_composable_modifiers
|
||||
|
||||
modifiers = list_composable_modifiers("sequential_dependency")
|
||||
assert len(modifiers) == 1
|
||||
assert modifiers[0].key == "agile_iteration"
|
||||
|
||||
|
||||
def test_list_compatible_methods_product_excludes_maturity():
|
||||
@@ -101,32 +123,43 @@ def test_steering_methods_filtered_by_archetype(client):
|
||||
assert product["is_default"] is True
|
||||
|
||||
|
||||
def test_queue_pull_on_linear_changes_steering_elements(client):
|
||||
from tests.factories import provision_user_in_tenant
|
||||
from tests.test_initiatives_actions import _auth, _create_initiative, _login
|
||||
|
||||
def test_queue_pull_rejected_on_linear(client):
|
||||
user = provision_user_in_tenant(tenant_role="member")
|
||||
token = _login(client, user)
|
||||
|
||||
created = _create_initiative(
|
||||
client,
|
||||
token,
|
||||
title="Linear Queue",
|
||||
title="Linear Block Queue",
|
||||
archetype_key="initiative.linear_project",
|
||||
)
|
||||
initiative_id = created.json()["id"]
|
||||
|
||||
client.patch(
|
||||
res = client.patch(
|
||||
f"/api/steering/initiatives/{initiative_id}/context",
|
||||
json={"method_key": "queue_pull"},
|
||||
headers=_auth(token),
|
||||
)
|
||||
assert res.status_code == 400
|
||||
assert "kompatibel" in res.json()["detail"].lower()
|
||||
|
||||
|
||||
def test_operating_context_composable_modifiers_linear(client):
|
||||
user = provision_user_in_tenant(tenant_role="member")
|
||||
token = _login(client, user)
|
||||
|
||||
created = _create_initiative(
|
||||
client,
|
||||
token,
|
||||
title="Linear Modifiers",
|
||||
archetype_key="initiative.linear_project",
|
||||
)
|
||||
initiative_id = created.json()["id"]
|
||||
|
||||
ctx = client.get(
|
||||
f"/api/initiatives/{initiative_id}/operating-context",
|
||||
headers=_auth(token),
|
||||
)
|
||||
body = ctx.json()
|
||||
assert "queue_inbox" in body["steering_elements"]
|
||||
assert "critical_path" not in body["steering_elements"]
|
||||
assert body["ui_features"].get("criticalPathControl") is not True
|
||||
assert ctx.status_code == 200
|
||||
modifiers = ctx.json().get("composable_modifiers") or []
|
||||
assert any(m["key"] == "agile_iteration" for m in modifiers)
|
||||
Reference in new issue
Block a user