Kairo-Jinkendo/backend/tests/test_ap14_plan_ist.py
Lars 064779e187
Some checks failed
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
AP1.14: Plan-Snapshot und Plan/Ist-Overlay in Kontrolle.
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>
2026-07-11 08:10:15 +02:00

35 lines
1.3 KiB
Python

"""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)