feat(steering): K-Ext-5 Portfolio-Kernel-Aggregation ueber Initiativen
Deploy Development / deploy (push) Successful in 48s
Test Suite / pytest-backend (push) Successful in 4m14s
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 18s
Test Suite / playwright-smoke (push) Successful in 12s

GET /api/workspace/steering; Portfolio-Widget nutzt Kernel-Attention, Vorschlaege und Agent-Slots.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
LarsandCursor committed 2026-07-27 13:13:36 +02:00
1 parent 390161e224
commit b6434bcc50
11 files changed
+312 -7

No files matched your search

@@ -0,0 +1,24 @@
"""Integration tests for portfolio steering API — K-Ext-5."""
from __future__ import annotations
from tests.factories import provision_user_in_tenant
from tests.test_initiatives_actions import _auth, _create_initiative, _login
def test_workspace_steering_aggregates_kernel(client):
user = provision_user_in_tenant(tenant_role="member")
token = _login(client, user)
created = _create_initiative(client, token, title="Portfolio Kernel")
initiative_id = created.json()["id"]
res = client.get("/api/workspace/steering", headers=_auth(token))
assert res.status_code == 200
body = res.json()
assert body["data_source"] == "steering_kernel_portfolio_v0.1"
assert body["initiative_count"] >= 1
assert isinstance(body["attention"], list)
assert isinstance(body["next_work"], list)
assert isinstance(body["proposals_summary"], list)
assert isinstance(body["agent_slots"], list)
assert initiative_id in body["attention_by_initiative"]
@@ -0,0 +1,29 @@
"""Unit tests for portfolio steering aggregation."""
from __future__ import annotations
from steering.portfolio.aggregate import _sort_attention, _sort_next_work
def test_sort_attention_by_severity_then_portfolio_rank():
items = [
{"severity": "info", "portfolio_rank": 0, "title": "B"},
{"severity": "critical", "portfolio_rank": 2, "title": "A"},
{"severity": "warning", "portfolio_rank": 1, "title": "C"},
]
sorted_items = _sort_attention(items)
assert sorted_items[0]["severity"] == "critical"
assert sorted_items[1]["severity"] == "warning"
assert sorted_items[2]["severity"] == "info"
def test_sort_next_work_by_portfolio_rank():
items = [
{"portfolio_rank": 2, "title": "Late"},
{"portfolio_rank": 0, "title": "First"},
{"portfolio_rank": None, "title": "Unranked"},
]
sorted_items = _sort_next_work(items)
assert sorted_items[0]["title"] == "First"
assert sorted_items[1]["title"] == "Late"
assert sorted_items[2]["title"] == "Unranked"