feat(investigations): add event impact and work-order feedback flows

Add isolated burst and pollution impact evidence, parallel work-order workflows, persisted notifications and graph updates.

Checkpoint current code. Known follow-ups remain for large pollution result previews and graceful geometry failure.
This commit is contained in:
2026-11-14 15:14:02 +08:00
parent 471ad92a47
commit 2e4f6cb93b
49 changed files with 1826 additions and 93 deletions
+19
View File
@@ -22,6 +22,25 @@ def observations():
return rows
def test_pollution_field_feedback_resumes_review_without_pressure_recovery():
task = {"workflow": "water_pollution"}
for order_id in ("sampling", "flush"):
assert track_work_order(task, {"kind": "create_work_order", "action_id": str(uuid4()),
"execution_status": "succeeded", "receipt": {"adapter": "peripheral_sample", "receipt_id": order_id}})
feedback = {"source_event_id": "peripheral_sample:sampling", "status": "completed", "source_revision": 2,
"occurred_at": RETURNED.isoformat(), "evidence": {"evidence_id": "sampling:2"}}
accept_completion(task, feedback)
assert task["handling_context"]["phase"] == "waiting_work_order"
accept_completion(task, {**feedback, "source_event_id": "peripheral_sample:flush", "evidence": {"evidence_id": "flush:2"}})
assert task["handling_context"]["phase"] == "field_review"
assert "verification_evidence_id" not in task["handling_context"]
assert task["handling_context"]["work_orders"]["sampling"]["feedback_evidence_id"] == "sampling:2"
task["handling_context"]["phase"] = "completed"
accept_completion(task, {**feedback, "source_revision": 3, "evidence": {"evidence_id": "sampling:3"}})
assert task["handling_context"]["phase"] == "field_review"
assert task["handling_context"]["work_orders"]["sampling"]["feedback_evidence_id"] == "sampling:3"
def evaluate(rows):
return evaluate_recovery(rows, device_ids=["P1", "F1"], returned_at=RETURNED,
incident_at=INCIDENT, interval_seconds=900)