v0.10.2: monitoring-area bbox enforced at supervisor publish (was archive-only) (#PR_NUMBER_PLACEHOLDER)

Closes #86

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
malice 2026-06-05 20:34:10 -06:00 committed by GitHub
commit 1bebf2570b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 590 additions and 145 deletions

View file

@ -17,7 +17,7 @@ import pytest
from central.adapter import SourceAdapter
from central.adapters.tomtom_flow import TomTomFlowAdapter
from central.archive import _build_geom_sql
from central.monitoring_area import build_geom_json
from central.config_models import AdapterConfig
from central.tomtom_flow_parse import (
_local_to_lonlat,
@ -83,10 +83,10 @@ def test_subject_for():
def test_archive_prefers_geo_geometry():
line = {"type": "LineString", "coordinates": [[-116.2, 43.6], [-116.1, 43.7]]}
# geometry present -> returned verbatim (not bbox/centroid)
out = _build_geom_sql({"geometry": line, "centroid": [-116.2, 43.6], "bbox": [-116.3, 43.5, -116.0, 43.8]})
out = build_geom_json({"geometry": line, "centroid": [-116.2, 43.6], "bbox": [-116.3, 43.5, -116.0, 43.8]})
assert json.loads(out) == line
# no geometry -> falls back to centroid Point (regression guard)
out2 = _build_geom_sql({"centroid": [-116.2, 43.6]})
out2 = build_geom_json({"centroid": [-116.2, 43.6]})
assert json.loads(out2)["type"] == "Point"