All checks were successful
Deploy Development / deploy (push) Successful in 47s
Test Suite / pytest-backend (push) Successful in 4m11s
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 15s
Erweitert evaluate_steering um read_models und proposals, migriert epic_rollup auf Registry, liefert sprint_commit-Vorschlaege und UI auf Plan-Sprint. Co-authored-by: Cursor <cursoragent@cursor.com>
87 lines
2.9 KiB
Python
87 lines
2.9 KiB
Python
"""Unit tests — sprint commit proposal (P6)."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from steering.eval_context import SteeringEvalContext
|
|
from steering.kernel.models import HorizonMarker, LifecycleContext, SteeringBinding
|
|
from steering.proposals.sprint_commit import propose_sprint_commit
|
|
from tenant_context import TenantContext
|
|
|
|
|
|
def _ctx(
|
|
*,
|
|
backlog_items: list,
|
|
work_cycles: list,
|
|
vocabulary: dict | None = None,
|
|
) -> SteeringEvalContext:
|
|
binding = SteeringBinding(
|
|
primary_method_key="continuous_product",
|
|
composition_modifier="agile_iteration",
|
|
next_work_strategy_key="agile_iteration",
|
|
)
|
|
lifecycle = LifecycleContext(
|
|
current_state="execution",
|
|
current_state_label="Ausführung",
|
|
slot_map={},
|
|
active_slots=(),
|
|
operational_slots=(),
|
|
)
|
|
horizon = HorizonMarker(kind="work_cycle", work_cycle_id="wc-1", work_cycle_title="S1")
|
|
eval_ctx = SteeringEvalContext(
|
|
tenant_ctx=TenantContext(
|
|
user_id="u1",
|
|
email="t@example.com",
|
|
display_name="Test",
|
|
portal_role="user",
|
|
tenant_id="t1",
|
|
tenant_slug="t",
|
|
tenant_name="T",
|
|
tenant_role="admin",
|
|
actor_id=None,
|
|
actor_type=None,
|
|
session_token="test",
|
|
capabilities=frozenset(),
|
|
),
|
|
initiative_id="init-1",
|
|
binding=binding,
|
|
horizon=horizon,
|
|
lifecycle=lifecycle,
|
|
operating_context={
|
|
"steering_elements": ["work_cycle_scope", "backlog_epic_hierarchy"],
|
|
"data_slices": ["backlog", "work_cycles"],
|
|
"backlog_vocabulary": vocabulary
|
|
or {"convertible_kinds": ["story", "bug", "issue"]},
|
|
},
|
|
)
|
|
eval_ctx._backlog_items = backlog_items
|
|
eval_ctx._work_cycles = work_cycles
|
|
return eval_ctx
|
|
|
|
|
|
def test_sprint_commit_ranks_bugs_before_stories():
|
|
proposals = propose_sprint_commit(
|
|
_ctx(
|
|
work_cycles=[{"id": "wc-1", "title": "Sprint 1", "status": "planned", "sort_order": 0}],
|
|
backlog_items=[
|
|
{"id": "s1", "title": "Story", "item_kind": "story", "status": "accepted", "priority": "normal", "sort_order": 0},
|
|
{"id": "b1", "title": "Bug", "item_kind": "bug", "status": "accepted", "priority": "normal", "sort_order": 1},
|
|
],
|
|
)
|
|
)
|
|
assert len(proposals) == 2
|
|
assert proposals[0]["scope_id"] == "b1"
|
|
assert proposals[0]["reason_code"] == "bug_default"
|
|
assert proposals[0]["work_cycle_id"] == "wc-1"
|
|
|
|
|
|
def test_sprint_commit_empty_without_planable_cycle():
|
|
proposals = propose_sprint_commit(
|
|
_ctx(
|
|
work_cycles=[],
|
|
backlog_items=[
|
|
{"id": "s1", "title": "Story", "item_kind": "story", "status": "accepted", "priority": "normal", "sort_order": 0},
|
|
],
|
|
)
|
|
)
|
|
assert proposals == []
|