mirror of
https://github.com/zvx-echo6/meshai.git
synced 2026-08-26 17:31:34 +00:00
fix(ipaws): route county-only CAP alerts + auto-refresh toggles live (#159)
County-only civil CAP alerts (SAME geocode, no <polygon>) had no geometry, so the geometry-based region tagger could not place them: no region -> no region_routes match -> silently not broadcast. Many CEMs / 911 outages / some AMBER alerts are county-only. - Bundle work/meshai/county_centroids.py: Census 2023 national county gazetteer internal points (3,222 counties + DC/territories), FIPS->(lat,lon), with SAME PSSCCC -> 5-digit FIPS helpers. - env/ipaws.py: when a CAP alert has SAME geocode(s) but NO polygon, set a Point (single county) or MultiPoint (multi-county) geometry from the county centroid(s) so the EXISTING coverage/region tagger locates it and tags ALL matching regions. Real polygon geometry always wins (never overridden). - dashboard/server.py: call register_config_routes_hooks(app) in create_app so the toggle auto-refresh middleware is actually wired in prod (was test-only); saving a family toggle now takes effect live without POST /api/notifications/refresh-toggles. Tests: county-only alert tags SW Idaho + matches emergency route cell; multi-county tags all regions; polygon path unchanged; create_app wires the refresh middleware; panhandle coverage-gap documented. Co-authored-by: Matt Johnson <mj@k7zvx.com> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
e244405230
commit
8460ab50e0
5 changed files with 3574 additions and 2 deletions
|
|
@ -71,6 +71,24 @@ def test_auto_refresh_does_not_fire_on_other_section():
|
|||
assert refreshed["n"] == 0
|
||||
|
||||
|
||||
def test_create_app_registers_auto_refresh_middleware():
|
||||
"""Regression: create_app() must actually WIRE the auto-refresh middleware.
|
||||
It was defined in register_config_routes_hooks() but never called from
|
||||
create_app(), so in prod a saved toggle never refreshed the live filter and
|
||||
had to be poked with POST /api/notifications/refresh-toggles by hand."""
|
||||
from meshai.dashboard.server import create_app
|
||||
|
||||
app = create_app()
|
||||
dispatches = []
|
||||
for mw in app.user_middleware:
|
||||
fn = (getattr(mw, "kwargs", {}) or {}).get("dispatch")
|
||||
if fn is not None:
|
||||
dispatches.append(getattr(fn, "__qualname__", ""))
|
||||
assert any("_auto_refresh_toggle_filter" in q for q in dispatches), (
|
||||
"create_app() did not register the toggle auto-refresh middleware"
|
||||
)
|
||||
|
||||
|
||||
# ============================================================================
|
||||
# Item 2 -- env_reporter cap from adapter_config
|
||||
# ============================================================================
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue