feat(workbench): add dynamic task approval lifecycle
This commit is contained in:
@@ -185,28 +185,7 @@ def test_sensor_location_projection_uses_latest_result_order_and_known_nodes():
|
||||
|
||||
|
||||
@pytest.mark.anyio
|
||||
async def test_snapshot_projects_persisted_work_orders_and_alerts():
|
||||
work_order = {
|
||||
"id": "wo-1",
|
||||
"code": "WO-20260917-001",
|
||||
"scheduled_at": NOW.replace(hour=3),
|
||||
"title": "北区阀门现场复核",
|
||||
"summary": "复核阀门开度并回传。",
|
||||
"status": "running",
|
||||
"risk_level": "attention",
|
||||
"updated_at": NOW,
|
||||
"detail": "来自正式工单同步适配器。",
|
||||
"recommendation": "完成后复核压力。",
|
||||
"duration_minutes": 45,
|
||||
"source": "生产工单系统",
|
||||
"dispatcher": "调度中心",
|
||||
"priority": "urgent",
|
||||
"location": "北区阀门 V-1",
|
||||
"assignee": "北区班组",
|
||||
"feedback_requirements": ["回传阀门开度", "复核压力"],
|
||||
"activity": [{"sequence": 1, "occurred_at": NOW, "actor": "调度中心",
|
||||
"kind": "created", "title": "工单创建", "detail": "等待现场复核。"}],
|
||||
}
|
||||
async def test_snapshot_projects_persisted_alerts_without_legacy_work_orders():
|
||||
persisted_alert = {
|
||||
"alert_id": "alarm-1",
|
||||
"condition_id": None,
|
||||
@@ -223,8 +202,6 @@ async def test_snapshot_projects_persisted_work_orders_and_alerts():
|
||||
}
|
||||
|
||||
snapshot = await build_workbench_runtime_snapshot(
|
||||
work_order_storage_configured=True,
|
||||
work_orders=[work_order],
|
||||
alert_storage_configured=True,
|
||||
persisted_alerts=[persisted_alert],
|
||||
clock=lambda: NOW,
|
||||
@@ -233,7 +210,7 @@ async def test_snapshot_projects_persisted_work_orders_and_alerts():
|
||||
assert snapshot["availability"] == "ready"
|
||||
assert snapshot["source"] == "none"
|
||||
assert snapshot["schedule_availability"] == "not_configured"
|
||||
assert snapshot["work_order_availability"] == "ready"
|
||||
assert snapshot["work_order_availability"] == "not_configured"
|
||||
assert snapshot["alert_availability"] == "ready"
|
||||
assert snapshot["conditions"] == []
|
||||
assert snapshot["alerts"] == [{
|
||||
@@ -245,6 +222,4 @@ async def test_snapshot_projects_persisted_work_orders_and_alerts():
|
||||
"occurred_at": NOW.replace(minute=29),
|
||||
"severity": "warning",
|
||||
}]
|
||||
assert snapshot["work_orders"][0]["code"] == "WO-20260917-001"
|
||||
assert snapshot["work_orders"][0]["activity"][0]["title"] == "工单创建"
|
||||
assert "subtasks" not in snapshot["work_orders"][0]
|
||||
assert snapshot["work_orders"] == []
|
||||
|
||||
Reference in New Issue
Block a user