feat(steering): Backlog-Vokabular aus Methoden-Vertrag (ADP P3)
Deploy Development / deploy (push) Successful in 47s
Test Suite / pytest-backend (push) Successful in 3m56s
Test Suite / lint-backend (push) Successful in 2s
Test Suite / compose-smoke (push) Has been skipped
Test Suite / k6 /api/health Baseline (push) Successful in 19s
Test Suite / playwright-smoke (push) Successful in 13s

backlog_epic_hierarchy als Steuerungselement, effektive steering_elements im Operating Context, Backend-Guards und UI ohne Slice-Ifs.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
LarsandCursor committed 2026-07-27 10:44:38 +02:00
1 parent f33135b87f
commit a3b14d9c00
18 files changed
+489 -35

No files matched your search

@@ -0,0 +1,77 @@
"""AP2.2g — Profilgebundenes Backlog-Vokabular (ADP P3)."""
from __future__ import annotations
from tests.factories import provision_user_in_tenant
from tests.test_initiatives_actions import _auth, _create_initiative, _login
def test_operating_context_product_has_agile_backlog_vocabulary(client):
user = provision_user_in_tenant(tenant_role="admin")
token = _login(client, user)
created = _create_initiative(
client,
token,
title="Product Vocab",
archetype_key="initiative.product",
)
initiative_id = created.json()["id"]
res = client.get(
f"/api/initiatives/{initiative_id}/operating-context",
headers=_auth(token),
)
assert res.status_code == 200
vocab = res.json()["backlog_vocabulary"]
assert vocab["profile_key"] == "agile_intake"
assert "epic" in vocab["kinds"]
assert vocab["labels"]["story"] == "Story"
assert vocab["capabilities"]["epic_hierarchy"] is True
assert vocab["capabilities"]["sprint_commit"] is True
assert "backlog_epic_hierarchy" in res.json()["steering_elements"]
def test_operating_context_linear_has_standard_backlog_vocabulary(client):
user = provision_user_in_tenant(tenant_role="admin")
token = _login(client, user)
created = _create_initiative(
client,
token,
title="Linear Vocab",
archetype_key="initiative.linear_project",
)
initiative_id = created.json()["id"]
res = client.get(
f"/api/initiatives/{initiative_id}/operating-context",
headers=_auth(token),
)
vocab = res.json()["backlog_vocabulary"]
assert vocab["profile_key"] == "standard_intake"
assert vocab["kinds"] == ["story", "bug", "issue"]
assert "epic" not in vocab["kinds"]
assert vocab["capabilities"]["epic_hierarchy"] is False
assert "backlog_epic_hierarchy" not in res.json()["steering_elements"]
def test_linear_initiative_rejects_epic_backlog_item(client):
user = provision_user_in_tenant(tenant_role="admin")
token = _login(client, user)
created = _create_initiative(
client,
token,
title="Linear Epic Block",
archetype_key="initiative.linear_project",
)
initiative_id = created.json()["id"]
epic = client.post(
f"/api/initiatives/{initiative_id}/backlog",
json={"title": "Not allowed", "item_kind": "epic", "status": "new"},
headers=_auth(token),
)
assert epic.status_code == 400
assert "nicht erlaubt" in epic.json()["detail"]
@@ -30,6 +30,7 @@ def test_operating_context_product(client):
assert body["initiative_id"] == initiative_id
assert body["archetype_key"] == "initiative.product"
assert body["method_key"] == "continuous_product"
assert "backlog_epic_hierarchy" in body["steering_elements"]
assert body["ui_profile"]["planDefaultRoute"] == "/plan/inbox"
assert body["ui_profile"]["workDefaultRoute"] == "/work/sprint"
assert "work_cycles" in body["data_slices"]
@@ -49,6 +49,7 @@ def test_agile_iteration_composes_with_matrix():
}
)
assert "program_delivery" not in method.composes_with
assert "backlog_epic_hierarchy" in method.steering_elements
def test_list_composable_modifiers_for_linear():
@@ -0,0 +1,49 @@
"""Unit tests for backlog vocabulary resolution."""
from __future__ import annotations
from steering.backlog_vocabulary import resolve_backlog_vocabulary
def test_resolve_agile_from_steering_element():
vocab = resolve_backlog_vocabulary(
data_slices=["backlog", "actions", "work_cycles"],
method_key="continuous_product",
steering_elements=frozenset(
{"work_cycle_scope", "backlog_epic_hierarchy", "next_action_primary"}
),
)
assert vocab["profile_key"] == "agile_intake"
assert vocab["capabilities"]["epic_hierarchy"] is True
assert vocab["capabilities"]["sprint_commit"] is True
assert "epic" in vocab["kinds"]
def test_resolve_continuous_without_epic_element():
vocab = resolve_backlog_vocabulary(
data_slices=["backlog", "actions"],
method_key="continuous_product",
steering_elements=frozenset({"next_action_primary"}),
)
assert vocab["profile_key"] == "continuous_intake"
assert vocab["labels"]["story"] == "Idee"
assert vocab["capabilities"]["epic_hierarchy"] is False
def test_resolve_standard_for_generic_backlog():
vocab = resolve_backlog_vocabulary(
data_slices=["backlog", "actions"],
method_key="sequential_dependency",
steering_elements=frozenset({"critical_path", "next_action_primary"}),
)
assert vocab["profile_key"] == "standard_intake"
assert vocab["labels"]["story"] == "Story"
def test_resolve_empty_without_backlog_slice():
vocab = resolve_backlog_vocabulary(
data_slices=["actions", "roadmap"],
method_key="maturity_progression",
steering_elements=frozenset({"next_action_primary"}),
)
assert vocab["kinds"] == []
@@ -0,0 +1,34 @@
"""Unit tests for effective method contract resolution."""
from __future__ import annotations
from steering.effective_contract import resolve_effective_steering_elements
def test_product_plan_phase_includes_agile_backlog_elements():
elements = resolve_effective_steering_elements(
"continuous_product",
data_slices=["backlog", "actions", "work_cycles"],
active_composition_modifier=None,
)
assert "work_cycle_scope" in elements
assert "backlog_epic_hierarchy" in elements
def test_linear_without_work_cycles_excludes_agile_backlog():
elements = resolve_effective_steering_elements(
"sequential_dependency",
data_slices=["backlog", "actions", "roadmap"],
active_composition_modifier=None,
)
assert "critical_path" in elements
assert "backlog_epic_hierarchy" not in elements
def test_active_modifier_merges_agile_elements():
elements = resolve_effective_steering_elements(
"sequential_dependency",
data_slices=["backlog", "actions"],
active_composition_modifier="agile_iteration",
)
assert "backlog_epic_hierarchy" in elements