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
@@ -39,6 +39,28 @@ def test_dynamic_investigation_routes_are_in_the_public_contract():
assert any(item["name"] == "report_revision" and item["in"] == "query" for item in context_params)
@pytest.mark.anyio
async def test_progress_route_accepts_partial_node_updates_without_weakening_saved_diagrams(monkeypatch):
from app.domain.schemas.operational_task import AgentArtifactsCommand
schemas = app.openapi()["components"]["schemas"]
assert "label" not in schemas["InvestigationGraphNodeUpdate"]["required"]
assert "label" in schemas["InvestigationDiagramNodeRef"]["required"]
service = SimpleNamespace(publish_artifacts=AsyncMock(return_value={"progress_revision": 2}))
monkeypatch.setattr(endpoints, "_service", lambda _ctx, _conn: service)
task_id = uuid4()
command = AgentArtifactsCommand.model_validate({
"request_id": str(uuid4()), "source_session_id": "session-1", "run_id": str(uuid4()),
"progress": {"summary": "已核对补充资料", "graph_update": {
"nodes": [{"node_id": "review", "status": "recorded"}],
}},
})
await endpoints.publish_operational_task_artifacts(task_id, command, ctx=_service_context(), conn=object())
forwarded = service.publish_artifacts.await_args.args[1].progress.graph_update.nodes[0]
assert forwarded.node_id == "review" and forwarded.status == "recorded"
assert "label" not in forwarded.model_fields_set
@pytest.mark.anyio
async def test_presentation_routes_preserve_domain_rejections_and_do_not_create_runs(monkeypatch):
from app.domain.domain_errors import DomainError