refactor(db)!: clean up business SQL access

- make realtime replacement and analysis result writes transactional\n- consolidate SCADA repositories and remove process-global project state\n- validate SCADA batches and use indexed GIS-backed business queries\n\nBREAKING CHANGE: remove the public analysis result writer and the pipeline-health network_name query parameter.
This commit is contained in:
2026-08-28 11:37:36 +08:00
parent b74799a39d
commit 9b095c7439
34 changed files with 859 additions and 921 deletions
+14
View File
@@ -7,6 +7,18 @@ from uuid import uuid4
import pytest
def _empty_scada_mappings(simulation):
return simulation.ScadaElementMappings(
reservoirs={},
tanks={},
fixed_pumps={},
variable_pumps={},
pressure={},
demand={},
quality={},
)
def test_run_simulation_exposes_explicit_valve_control():
from app.services import simulation
@@ -174,6 +186,7 @@ def test_extended_simulation_stores_results_by_run_id(monkeypatch):
modify_total_duration=900,
scheme_type="burst_analysis",
scheme_name="case",
scada_mappings=_empty_scada_mappings(simulation),
)
args, kwargs = storage_calls[0]
@@ -250,6 +263,7 @@ def test_extended_simulation_marks_run_failed_when_result_storage_fails(monkeypa
modify_total_duration=900,
scheme_type="burst_analysis",
scheme_name="case",
scada_mappings=_empty_scada_mappings(simulation),
)
assert [call[1]["status"] for call in lifecycle_calls] == ["failed"]