AP1.0: Steering Foundation — Lifecycle, Context, Signal Engine
Deploy Development / deploy (push) Successful in 44s
Test Suite / pytest-backend (push) Successful in 1m19s
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 11s
Deploy Development / deploy (push) Successful in 44s
Test Suite / pytest-backend (push) Successful in 1m19s
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 11s
Persistierter Standard Lifecycle pro Initiative, backend/steering/ Skeleton, Attention-Refactor und Hook-Dispatch als Basis für Method Registry. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
451d62ed46
commit
95feba6204
36 files changed
+2006
-724
No files matched your search
@@ -69,6 +69,7 @@ def _seed_hygiene():
|
||||
@pytest.fixture(scope="session", autouse=True)
|
||||
def _sync_rights_registry():
|
||||
import rights_registrations # noqa: F401
|
||||
import steering # noqa: F401 — bootstrap hooks & methods
|
||||
from rights_registry import sync_rights_registry_to_db
|
||||
|
||||
assert sync_rights_registry_to_db() == 0
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
"""AP1.0 — Steering Foundation tests."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from tests.factories import provision_user_in_tenant
|
||||
from tests.test_initiatives_actions import (
|
||||
_auth,
|
||||
_create_action,
|
||||
_create_initiative,
|
||||
_login,
|
||||
)
|
||||
|
||||
|
||||
def test_steering_context_on_initiative_create(client):
|
||||
user = provision_user_in_tenant(tenant_role="member")
|
||||
token = _login(client, user)
|
||||
initiative_id = _create_initiative(client, token).json()["id"]
|
||||
|
||||
res = client.get(
|
||||
f"/api/initiatives/{initiative_id}/steering-context",
|
||||
headers=_auth(token),
|
||||
)
|
||||
assert res.status_code == 200
|
||||
data = res.json()
|
||||
assert data["initiative_id"] == initiative_id
|
||||
assert data["lifecycle_state"] == "intake"
|
||||
assert data["method_key"] == "generic_operating"
|
||||
assert data["lifecycle_label"]
|
||||
|
||||
|
||||
def test_steering_snapshot_has_lifecycle(client):
|
||||
user = provision_user_in_tenant(tenant_role="member")
|
||||
token = _login(client, user)
|
||||
initiative_id = _create_initiative(client, token).json()["id"]
|
||||
_create_action(client, token, initiative_id)
|
||||
|
||||
snap = client.get(
|
||||
f"/api/initiatives/{initiative_id}/steering-snapshot",
|
||||
headers=_auth(token),
|
||||
)
|
||||
assert snap.status_code == 200
|
||||
data = snap.json()
|
||||
assert "lifecycle_state" in data
|
||||
assert data.get("operating_phase_deprecated") is True
|
||||
assert data["lifecycle_state"] in (
|
||||
"intake",
|
||||
"planning",
|
||||
"action_selection",
|
||||
"structure_setup",
|
||||
)
|
||||
|
||||
|
||||
def test_steering_context_tenant_isolation(client):
|
||||
user_a = provision_user_in_tenant(tenant_role="member")
|
||||
token_a = _login(client, user_a)
|
||||
initiative_id = _create_initiative(client, token_a).json()["id"]
|
||||
|
||||
user_b = provision_user_in_tenant(tenant_role="member")
|
||||
token_b = _login(client, user_b)
|
||||
|
||||
res = client.get(
|
||||
f"/api/initiatives/{initiative_id}/steering-context",
|
||||
headers=_auth(token_b),
|
||||
)
|
||||
assert res.status_code == 404
|
||||
|
||||
|
||||
def test_lifecycle_transition_on_blocker_resolve(client):
|
||||
user = provision_user_in_tenant(tenant_role="member")
|
||||
token = _login(client, user)
|
||||
initiative_id = _create_initiative(client, token).json()["id"]
|
||||
action = _create_action(
|
||||
client, token, initiative_id, assigned_actor_ids=[user["actor_id"]]
|
||||
).json()
|
||||
blocker = client.post(
|
||||
f"/api/initiatives/{initiative_id}/blockers",
|
||||
json={"title": "B", "action_id": action["id"], "set_action_blocked": True},
|
||||
headers=_auth(token),
|
||||
).json()
|
||||
|
||||
client.patch(
|
||||
f"/api/blockers/{blocker['id']}",
|
||||
json={"status": "resolved"},
|
||||
headers=_auth(token),
|
||||
)
|
||||
|
||||
ctx = client.get(
|
||||
f"/api/initiatives/{initiative_id}/steering-context",
|
||||
headers=_auth(token),
|
||||
).json()
|
||||
assert ctx["lifecycle_state"] == "action_selection"
|
||||
Reference in new issue
Block a user