AP1.14: Plan-Snapshot und Plan/Ist-Overlay in Kontrolle.
Deploy Development / deploy (push) Successful in 47s
Test Suite / pytest-backend (push) Failing after 2m18s
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

Revisionen mit Audit, getrennte Soll/Ist/Diff-Ansicht unter Kontrolle/Plan-Ist; API plan-ist-view und plan-snapshots.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
LarsandCursor committed 2026-07-11 08:10:15 +02:00
1 parent 1fa61b2dac
commit 064779e187
14 files changed
+987

No files matched your search

+34
View File
@@ -0,0 +1,34 @@
"""Unit tests for plan/ist overlay (AP1.14)."""
from steering.graph.plan_ist import _ist_deviation_diff, _structural_diff
def test_structural_diff_detects_added_gate():
baseline = {"items": [{"id": "a", "title": "A", "goal_description": "", "sort_order": 0}], "dependencies": [], "criteria": []}
current = {
"items": [
{"id": "a", "title": "A", "goal_description": "", "sort_order": 0},
{"id": "b", "title": "B", "goal_description": "", "sort_order": 1},
],
"dependencies": [],
"criteria": [],
}
diffs = _structural_diff(baseline, current)
assert any(d["kind"] == "gate_added" and d["item_id"] == "b" for d in diffs)
def test_ist_deviation_detects_reached_gate():
items = [{"id": "g1", "title": "Gate", "status": "reached"}]
diffs = _ist_deviation_diff(items=items, criteria_by_item={"g1": []})
assert any(d["kind"] == "ist_gate_status" for d in diffs)
def test_ist_deviation_detects_waived_criterion():
items = [{"id": "g1", "title": "Gate", "status": "active"}]
criteria = {
"g1": [
{"id": "c1", "title": "Kriterium", "status": "waived", "criterion_kind": "manual"}
]
}
diffs = _ist_deviation_diff(items=items, criteria_by_item=criteria)
assert any(d["kind"] == "ist_criterion_waived" for d in diffs)
+48
View File
@@ -269,3 +269,51 @@ def test_graph_blocked_attention_for_gate_enforcing_method(client):
i["kind"] == "gate_graph_blocked" and i["milestone_id"] == gate_a["id"]
for i in attention.json()
)
def test_plan_ist_view_and_snapshot(client):
user = provision_user_in_tenant(tenant_role="member")
token = _login(client, user)
initiative_id = _create_initiative(client, token).json()["id"]
gate = _create_roadmap_item(client, token, initiative_id, title="Gate Plan").json()
view = client.get(
f"/api/initiatives/{initiative_id}/roadmap/plan-ist-view",
headers=_auth(token),
)
assert view.status_code == 200
body = view.json()
assert body["plan_source"] == "live"
assert len(body["plan"]["items"]) >= 1
assert body["latest_snapshot"] is None
snap = client.post(
f"/api/initiatives/{initiative_id}/roadmap/plan-snapshots",
json={"reason": "Baseline vor Umsetzung"},
headers=_auth(token),
)
assert snap.status_code == 201
assert snap.json()["revision_number"] == 1
view2 = client.get(
f"/api/initiatives/{initiative_id}/roadmap/plan-ist-view",
headers=_auth(token),
)
assert view2.status_code == 200
body2 = view2.json()
assert body2["plan_source"] == "snapshot"
assert body2["latest_snapshot"]["revision_number"] == 1
patched = client.patch(
f"/api/roadmap-items/{gate['id']}",
json={"title": "Gate umbenannt"},
headers=_auth(token),
)
assert patched.status_code == 200
view3 = client.get(
f"/api/initiatives/{initiative_id}/roadmap/plan-ist-view",
headers=_auth(token),
)
diff_kinds = {d["kind"] for d in view3.json()["diff"]}
assert "gate_modified" in diff_kinds