feat(steering): Kernel Spine v0.2 — Events, Slot-Provider, continuous_product
Deploy Development / deploy (push) Successful in 50s
Test Suite / pytest-backend (push) Successful in 3m49s
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 12s
Deploy Development / deploy (push) Successful in 50s
Test Suite / pytest-backend (push) Successful in 3m49s
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 12s
apply_steering_event an Action done, Gate verify/reopen und Blocker resolve; lifecycle-Ketten methodenaware via slot_map; continuous_product slot_map; pytest v0.2. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
606dd960b8
commit
fe1edb84f8
18 files changed
+595
-34
No files matched your search
@@ -2,7 +2,8 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from steering.kernel import apply_steering_event, evaluate_steering
|
||||
from steering.kernel.events import apply_steering_event
|
||||
from steering.kernel.evaluate import evaluate_steering
|
||||
from steering.kernel.binding import resolve_steering_binding
|
||||
from tests.factories import provision_user_in_tenant, tenant_context_from_user
|
||||
from tests.test_initiatives_actions import _auth, _create_initiative, _login
|
||||
@@ -41,7 +42,7 @@ def test_evaluate_steering_returns_horizon_and_next(client):
|
||||
|
||||
ctx = tenant_context_from_user(user)
|
||||
evaluation = evaluate_steering(ctx, initiative_id=initiative_id)
|
||||
assert evaluation.data_source == "steering_kernel_v0.1.1"
|
||||
assert evaluation.data_source == "steering_kernel_v0.2"
|
||||
assert evaluation.lifecycle.slot_map.get("action_selection") == "active"
|
||||
assert evaluation.lifecycle.slot_map.get("validation") == "active"
|
||||
assert evaluation.lifecycle.slot_map.get("review") == "optional"
|
||||
@@ -76,7 +77,7 @@ def test_snapshot_routes_through_kernel_not_side_path(client):
|
||||
f"/api/initiatives/{initiative_id}/steering-snapshot",
|
||||
headers=_auth(token),
|
||||
)
|
||||
assert snap.json()["steering_kernel"]["data_source"] == "steering_kernel_v0.1.1"
|
||||
assert snap.json()["steering_kernel"]["data_source"] == "steering_kernel_v0.2"
|
||||
assert "lifecycle" in snap.json()["steering_kernel"]
|
||||
assert snap.json()["steering_kernel"]["lifecycle"]["slot_map"]["closure"] == "active"
|
||||
|
||||
@@ -98,8 +99,8 @@ def test_apply_steering_event_stub(client):
|
||||
ctx,
|
||||
initiative_id=initiative_id,
|
||||
event_kind="actor_result",
|
||||
payload={"action_id": "test"},
|
||||
payload={"action_id": "test", "to_status": "done"},
|
||||
)
|
||||
assert result["accepted"] is True
|
||||
assert result["handled"] is False
|
||||
assert result["evaluation"]["data_source"] == "steering_kernel_v0.1.1"
|
||||
assert result["handled"] is True
|
||||
assert result["evaluation"]["data_source"] == "steering_kernel_v0.2"
|
||||
@@ -0,0 +1,165 @@
|
||||
"""Steering Kernel Spine v0.2 — events + continuous_product."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from tests.factories import provision_user_in_tenant
|
||||
from tests.test_initiatives_actions import _auth, _create_initiative, _login
|
||||
|
||||
|
||||
def test_action_done_emits_lifecycle_via_kernel(client):
|
||||
user = provision_user_in_tenant(tenant_role="admin")
|
||||
token = _login(client, user)
|
||||
|
||||
created = _create_initiative(
|
||||
client,
|
||||
token,
|
||||
title="Event Action Done",
|
||||
archetype_key="initiative.linear_project",
|
||||
apply_starter_kit=False,
|
||||
)
|
||||
initiative_id = created.json()["id"]
|
||||
|
||||
action = client.post(
|
||||
f"/api/initiatives/{initiative_id}/actions",
|
||||
json={"title": "Erledigen", "status": "open"},
|
||||
headers=_auth(token),
|
||||
)
|
||||
assert action.status_code == 201
|
||||
|
||||
done = client.patch(
|
||||
f"/api/actions/{action.json()['id']}",
|
||||
json={"status": "done"},
|
||||
headers=_auth(token),
|
||||
)
|
||||
assert done.status_code == 200
|
||||
|
||||
ctx = client.get(
|
||||
f"/api/initiatives/{initiative_id}/steering-context",
|
||||
headers=_auth(token),
|
||||
)
|
||||
assert ctx.status_code == 200
|
||||
assert ctx.json()["lifecycle_state"] == "action_selection"
|
||||
|
||||
|
||||
def test_gate_verify_emits_lifecycle_via_kernel(client):
|
||||
user = provision_user_in_tenant(tenant_role="admin")
|
||||
token = _login(client, user)
|
||||
|
||||
created = _create_initiative(
|
||||
client,
|
||||
token,
|
||||
title="Event Gate",
|
||||
archetype_key="initiative.linear_project",
|
||||
)
|
||||
initiative_id = created.json()["id"]
|
||||
|
||||
roadmap = client.get(
|
||||
f"/api/initiatives/{initiative_id}/roadmap/items",
|
||||
headers=_auth(token),
|
||||
)
|
||||
active_gate = next(i for i in roadmap.json() if i.get("status") == "active")
|
||||
|
||||
evidence = client.post(
|
||||
f"/api/initiatives/{initiative_id}/evidence",
|
||||
json={
|
||||
"title": "Gate-Nachweis",
|
||||
"roadmap_item_id": active_gate["id"],
|
||||
"status": "accepted",
|
||||
},
|
||||
headers=_auth(token),
|
||||
)
|
||||
assert evidence.status_code == 201
|
||||
|
||||
verified = client.post(
|
||||
f"/api/roadmap-items/{active_gate['id']}/verify-reached",
|
||||
headers=_auth(token),
|
||||
)
|
||||
assert verified.status_code == 200
|
||||
body = verified.json()
|
||||
assert body.get("steering_event", {}).get("handled") is True
|
||||
assert "validation" in (body.get("steering_event", {}).get("lifecycle_chain") or [])
|
||||
|
||||
ctx = client.get(
|
||||
f"/api/initiatives/{initiative_id}/steering-context",
|
||||
headers=_auth(token),
|
||||
)
|
||||
assert ctx.json()["lifecycle_state"] == "action_selection"
|
||||
|
||||
|
||||
def test_continuous_product_routes_through_spine(client):
|
||||
user = provision_user_in_tenant(tenant_role="admin")
|
||||
token = _login(client, user)
|
||||
|
||||
created = _create_initiative(
|
||||
client,
|
||||
token,
|
||||
title="Product Spine",
|
||||
archetype_key="initiative.product",
|
||||
)
|
||||
initiative_id = created.json()["id"]
|
||||
|
||||
snap = client.get(
|
||||
f"/api/initiatives/{initiative_id}/steering-snapshot",
|
||||
headers=_auth(token),
|
||||
)
|
||||
assert snap.status_code == 200
|
||||
body = snap.json()
|
||||
kernel = body["steering_kernel"]
|
||||
assert kernel["primary_method_key"] == "continuous_product"
|
||||
assert kernel["data_source"] == "steering_kernel_v0.2"
|
||||
assert kernel["lifecycle"]["slot_map"]["closure"] == "n/a"
|
||||
assert kernel["lifecycle"]["slot_map"]["planning"] == "active"
|
||||
assert body.get("next_actions") is not None
|
||||
|
||||
|
||||
def test_product_action_done_lifecycle_chain(client):
|
||||
user = provision_user_in_tenant(tenant_role="member")
|
||||
token = _login(client, user)
|
||||
|
||||
created = _create_initiative(
|
||||
client,
|
||||
token,
|
||||
title="Product Event",
|
||||
archetype_key="initiative.product",
|
||||
)
|
||||
initiative_id = created.json()["id"]
|
||||
|
||||
action = client.post(
|
||||
f"/api/initiatives/{initiative_id}/actions",
|
||||
json={"title": "Fix Bug", "status": "open"},
|
||||
headers=_auth(token),
|
||||
)
|
||||
assert action.status_code == 201
|
||||
|
||||
client.patch(
|
||||
f"/api/actions/{action.json()['id']}",
|
||||
json={"status": "done"},
|
||||
headers=_auth(token),
|
||||
)
|
||||
|
||||
ctx = client.get(
|
||||
f"/api/initiatives/{initiative_id}/steering-context",
|
||||
headers=_auth(token),
|
||||
)
|
||||
assert ctx.json()["lifecycle_state"] == "action_selection"
|
||||
|
||||
|
||||
def test_slot_providers_registered():
|
||||
from steering.lifecycle.slot_providers import list_slot_provider_registrations
|
||||
|
||||
keys = {r.slot_key for r in list_slot_provider_registrations()}
|
||||
assert "result_intake" in keys
|
||||
assert "validation" in keys
|
||||
assert "adaptation" in keys
|
||||
|
||||
|
||||
def test_resolve_lifecycle_chain_respects_slot_map():
|
||||
from steering.lifecycle.event_transitions import resolve_lifecycle_chain
|
||||
|
||||
chain = resolve_lifecycle_chain(
|
||||
primary_method_key="generic_operating",
|
||||
event_kind="gate_verified",
|
||||
payload={},
|
||||
)
|
||||
assert "validation" not in chain
|
||||
assert chain == ("adaptation", "action_selection")
|
||||
Reference in new issue
Block a user