feat(investigations): refine report authoring and replay flushing
Generic Container CI/CD / test-build-publish (push) Successful in 4m31s
Server CI/CD v2 / build-test-publish-and-deploy (push) Successful in 4m31s

This commit is contained in:
2026-11-14 23:00:15 +08:00
parent 2e4f6cb93b
commit b45c5c6f46
27 changed files with 1125 additions and 94 deletions
+12 -5
View File
@@ -603,15 +603,20 @@ def test_suspected_monitoring_creates_burst_report_with_frozen_replay_context(mo
command = create_task.await_args.args[0]
assert command.workflow == "scada_anomaly"
assert command.title == "SCADA 异常调查 · 2026-10-08 08:15"
assert "2 个压力测点下降" in command.summary
assert "1 个出厂边界流量测点增加" in command.summary
assert "爆管嫌疑" in command.summary
assert command.source.replay_context.batch_sequence == 8
assert command.source.replay_context.knowledge_cutoff == START + timedelta(minutes=15)
assert monitoring["task_id"] == str(create_task.return_value.task_id)
assert document["monitoring_incident"]["alert"]["condition_id"] == f"operational-task:{monitoring['task_id']}"
assert document["monitoring_incident"]["alert"]["description"] == "已启动调查,详细诊断见调查报告。"
if weighted:
assert "-0.0843" in command.summary
assert "综合评分 0.90" in command.summary
assert "流量 10%" in command.summary
assert "-0.0843" not in command.summary
assert "综合评分" not in command.summary
assert "10%" not in command.summary
assert monitoring["weighted"]["score"] == 0.9
def test_monitoring_summary_counts_signals_without_copying_reading_details(monkeypatch):
@@ -916,8 +921,10 @@ def test_any_single_measurement_anomaly_enters_diagnosis_below_burst_threshold(m
command = create_task.await_args.args[0]
assert command.workflow == "scada_anomaly"
assert command.source.event_kind == "scada_anomaly"
assert "任一指标异常即启动调查" in command.summary
assert "爆管嫌疑门槛 0.80" in command.summary
assert "已启动调查" in command.summary
assert "异常原因及影响范围待核查" in command.summary
assert "爆管嫌疑门槛" not in command.summary
assert monitoring["weighted"]["score"] == 0.1
assert monitoring["task_id"] == str(create_task.return_value.task_id)
assert monitoring["incident"]["action"] == "raised"