feat(steering): Kernel Spine v0.1.1 als zentraler Initiative-Einstieg
Deploy Development / deploy (push) Successful in 48s
Test Suite / pytest-backend (push) Failing after 3m33s
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 2s
Test Suite / compose-smoke (push) Has been skipped
Deploy Development / deploy (push) Successful in 48s
Test Suite / pytest-backend (push) Failing after 3m33s
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 2s
Test Suite / compose-smoke (push) Has been skipped
evaluate_steering() vereinheitlicht Horizon, Next Work und Attention; Snapshot und Signal Engine delegieren dorthin; slot_map deklarativ fuer sequential_dependency und generic_operating. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
753f178b0c
commit
75a6a63665
20 files changed
+923
-51
No files matched your search
@@ -0,0 +1,111 @@
|
||||
"""Steering Kernel Spine v0.1 — unit and integration tests."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from steering.kernel import apply_steering_event, evaluate_steering
|
||||
from steering.kernel.binding import resolve_steering_binding
|
||||
from tests.factories import provision_user_in_tenant
|
||||
from tests.test_initiatives_actions import _auth, _create_initiative, _login
|
||||
|
||||
|
||||
def test_evaluate_steering_linear_binding(client):
|
||||
user = provision_user_in_tenant(tenant_role="member")
|
||||
token = _login(client, user)
|
||||
|
||||
created = _create_initiative(
|
||||
client,
|
||||
token,
|
||||
title="Kernel Binding",
|
||||
archetype_key="initiative.linear_project",
|
||||
)
|
||||
initiative_id = created.json()["id"]
|
||||
|
||||
from tenant_context import TenantContext
|
||||
|
||||
ctx = TenantContext(tenant_id=user["tenant_id"], user_id=user["id"])
|
||||
binding = resolve_steering_binding(ctx, initiative_id)
|
||||
assert binding.primary_method_key == "sequential_dependency"
|
||||
assert binding.composition_modifier is None
|
||||
assert binding.next_work_strategy_key == "sequential_dependency"
|
||||
|
||||
|
||||
def test_evaluate_steering_returns_horizon_and_next(client):
|
||||
user = provision_user_in_tenant(tenant_role="admin")
|
||||
token = _login(client, user)
|
||||
|
||||
created = _create_initiative(
|
||||
client,
|
||||
token,
|
||||
title="Kernel Eval",
|
||||
archetype_key="initiative.linear_project",
|
||||
)
|
||||
initiative_id = created.json()["id"]
|
||||
|
||||
from tenant_context import TenantContext
|
||||
|
||||
ctx = TenantContext(tenant_id=user["tenant_id"], user_id=user["id"])
|
||||
evaluation = evaluate_steering(ctx, initiative_id=initiative_id)
|
||||
assert evaluation.data_source == "steering_kernel_v0.1.1"
|
||||
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"
|
||||
assert evaluation.horizon.kind in ("gate", "none", "work_cycle")
|
||||
if evaluation.horizon.kind == "gate":
|
||||
assert evaluation.horizon.gate_roadmap_item_id
|
||||
|
||||
snap = client.get(
|
||||
f"/api/initiatives/{initiative_id}/steering-snapshot",
|
||||
headers=_auth(token),
|
||||
)
|
||||
assert snap.status_code == 200
|
||||
body = snap.json()
|
||||
assert body.get("steering_kernel")
|
||||
assert body["steering_kernel"]["primary_method_key"] == "sequential_dependency"
|
||||
assert body["next_actions"] == evaluation.next_work
|
||||
|
||||
|
||||
def test_snapshot_routes_through_kernel_not_side_path(client):
|
||||
user = provision_user_in_tenant(tenant_role="admin")
|
||||
token = _login(client, user)
|
||||
|
||||
created = _create_initiative(
|
||||
client,
|
||||
token,
|
||||
title="Kernel Path",
|
||||
archetype_key="initiative.linear_project",
|
||||
)
|
||||
initiative_id = created.json()["id"]
|
||||
|
||||
snap = client.get(
|
||||
f"/api/initiatives/{initiative_id}/steering-snapshot",
|
||||
headers=_auth(token),
|
||||
)
|
||||
assert snap.json()["steering_kernel"]["data_source"] == "steering_kernel_v0.1.1"
|
||||
assert "lifecycle" in snap.json()["steering_kernel"]
|
||||
assert snap.json()["steering_kernel"]["lifecycle"]["slot_map"]["closure"] == "active"
|
||||
|
||||
|
||||
def test_apply_steering_event_stub(client):
|
||||
user = provision_user_in_tenant(tenant_role="member")
|
||||
token = _login(client, user)
|
||||
|
||||
created = _create_initiative(
|
||||
client,
|
||||
token,
|
||||
title="Event Stub",
|
||||
archetype_key="initiative.linear_project",
|
||||
)
|
||||
initiative_id = created.json()["id"]
|
||||
|
||||
from tenant_context import TenantContext
|
||||
|
||||
ctx = TenantContext(tenant_id=user["tenant_id"], user_id=user["id"])
|
||||
result = apply_steering_event(
|
||||
ctx,
|
||||
initiative_id=initiative_id,
|
||||
event_kind="actor_result",
|
||||
payload={"action_id": "test"},
|
||||
)
|
||||
assert result["accepted"] is True
|
||||
assert result["handled"] is False
|
||||
assert result["evaluation"]["data_source"] == "steering_kernel_v0.1.1"
|
||||
Reference in new issue
Block a user