central/sql/migrations
malice 6cbb9378d6
v0.10.9: widen monitoring-area default to cover all of Idaho (49.0N) (#97)
v0.10.2's migration 030 set monitor_north=44.5 as the schema default.
Idaho extends to 49.0N -- the original default cut off the entire northern
panhandle (Coeur d'Alene, Lewiston, Sandpoint, Moscow, McCall). Tonight's
investigation caught the impact at scale: supervisor's publish-time bbox
filter was dropping ~56 itd_511 events per 60-second poll (~5,376/day),
the entire north half of Idaho's roadwork, closures, and incidents. NWS
Idaho UGC-zone alerts in the panhandle were similarly dropped (closes
the v0.10.7 PR #95 followup-ticket-(b)).

Three changes:
1. sql/migrations/034: ALTER COLUMN SET DEFAULT 49.0 for fresh installs,
   plus an idempotent UPDATE ... WHERE monitor_north = 44.5 that bumps
   existing deployments still at the dev value. The WHERE 44.5 guard
   preserves any operator who deliberately narrowed -- those rows are
   untouched.
2. src/central/gui/routes.py: _DEFAULT_MONITOR["north"] 44.5 -> 49.0
   for the Python-level fallback when no system row exists.
3. tests/test_monitoring_area.py: new TestDefaultMonitoringAreaCoversIdaho
   class with 9 Idaho sentinel cities spread panhandle-to-south,
   west-to-east. Three tests: (a) every sentinel is in-bounds against
   the current default; (b) belt-and-suspenders corner-value assertions;
   (c) anti-regression test using the OLD v0.10.2 narrow bbox documenting
   that it would reject the panhandle.

Phase 1 (immediate, no-PR): the production row was UPDATEd from 44.5 to
49.0 directly via psql before this PR. Drop counter verified to stop
incrementing for itd_511 within one refresh cycle; first post-fix
panhandle publish landed at seq 80741 (Coeur d'Alene closure at
lat=47.7N) at 07:35:33 UTC. published_ids count went from 145 to 201
per poll, no longer dropping the 56-event panhandle batch. This PR
ensures the new code's default is consistent with the live config row
and that future fresh installs don't reintroduce the narrow bound.

Existing IDAHO test fixtures (test_archive_bbox_filter, test_supervisor_
publish_filter, test_fire_fused, test_monitoring_area) still use the
narrow 44.5 value; those are testing bbox behavior with arbitrary inputs
not the production default, so leaving them alone keeps this PR focused
on the production default fix. A separate cosmetic cleanup could update
the IDAHO fixtures if desired.

Full sweep: 1031 passed (+3 from this PR), ruff clean.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-08 01:42:59 -06:00
..
001_create_config_schema.sql chore: normalize line endings to LF 2026-05-16 22:26:12 +00:00
002_add_updated_at_trigger_and_index.sql feat(db): add migration 002 for updated_at trigger and enabled index 2026-05-16 01:36:30 +00:00
003_add_streams_table.sql chore: normalize line endings to LF 2026-05-16 22:26:12 +00:00
004_nws_states_to_bbox.sql chore: normalize line endings to LF 2026-05-16 22:26:12 +00:00
005_add_firms_adapter.sql feat(schema): add FIRMS adapter and CENTRAL_FIRE stream 2026-05-16 19:58:20 +00:00
006_add_usgs_quake_adapter.sql feat(schema): add USGS quake adapter and CENTRAL_QUAKE stream 2026-05-16 20:51:28 +00:00
007_add_config_system.sql feat(gui): add auth core, setup gate, and first-run operator creation 2026-05-17 05:30:49 +00:00
008_add_operators.sql feat(gui): add auth core, setup gate, and first-run operator creation 2026-05-17 05:30:49 +00:00
009_add_sessions.sql feat(gui): add auth core, setup gate, and first-run operator creation 2026-05-17 05:30:49 +00:00
010_add_audit_log.sql feat(gui): add auth core, setup gate, and first-run operator creation 2026-05-17 05:30:49 +00:00
011_events_add_adapter_column.sql feat(schema): add adapter column to events, drop source 2026-05-17 16:09:59 +00:00
013_add_session_csrf_token.sql feat(gui): implement first-run setup wizard (1b-8) (#24) 2026-05-17 22:06:22 -06:00
014_events_time_id_index.sql feat(api): add paginated events feed JSON endpoint (#25) 2026-05-17 22:31:00 -06:00
015_add_adapters_last_error.sql refactor(gui): clean up flagged issues before merge 2026-05-18 23:55:34 +00:00
016_add_wfigs_adapters.sql feat(2-B): add NIFC WFIGS adapters for incidents and perimeters 2026-05-19 02:47:26 +00:00
017_add_inciweb_adapter.sql feat(2-C): add NIFC InciWeb wildfire narrative adapter 2026-05-19 03:19:25 +00:00
018_add_swpc_adapters.sql feat(2-D): add NOAA SWPC space weather adapters (alerts, kindex, protons) 2026-05-19 05:55:29 +00:00
019_add_central_space_stream.sql feat(2-D): add NOAA SWPC space weather adapters (alerts, kindex, protons) 2026-05-19 05:55:29 +00:00
020_add_gdacs_adapter.sql feat(2-E): GDACS disaster adapter 2026-05-19 06:58:52 +00:00
021_add_central_disaster_stream.sql feat(2-E): GDACS disaster adapter 2026-05-19 06:58:52 +00:00
022_add_eonet_adapter.sql feat(2-F): NASA EONET disaster adapter 2026-05-19 15:35:25 +00:00
023_add_nwis_adapter_and_hydro_stream.sql feat(2-G): USGS NWIS adapter (OGC API) + CENTRAL_HYDRO stream 2026-05-19 16:50:21 +00:00
024_add_config_enrichment.sql feat(3-K.5): operator-settable EnrichmentConfig (config plumbing) 2026-05-20 18:52:22 +00:00
025_add_wzdx_adapter_and_traffic_stream.sql feat(wzdx): WZDx adapter + CENTRAL_TRAFFIC family bootstrap (v0.9.0) 2026-05-25 20:35:08 +00:00
026_add_state_511_atis_adapter.sql feat(state_511_atis): Castle Rock 511 adapter — Idaho incidents/closures/road work (v0.9.2) 2026-05-25 22:01:11 +00:00
027_add_tomtom_flow_adapter_and_flow_stream.sql feat(tomtom_flow): TomTom Orbis vector flow-tile telemetry adapter + CENTRAL_TRAFFIC_FLOW (v0.9.3) 2026-05-25 23:25:44 +00:00
028_add_tomtom_incidents_adapter.sql feat(tomtom_incidents): TomTom real-time traffic incidents adapter (v0.9.5) 2026-05-26 00:25:27 +00:00
029_add_state_511_atis_cameras_adapter.sql feat(state_511_atis_cameras): Castle Rock 511 traffic cameras telemetry (v0.9.6) 2026-05-26 01:33:21 +00:00
030_add_monitoring_area.sql v0.9.12: archive-level monitoring-area bbox filter 2026-05-26 23:40:17 +00:00
031_add_itd_511_adapters.sql v0.10.0: ITD 511 official API adapter (events + advisories + cameras) (#85) 2026-06-03 22:36:26 -06:00
032_remove_state_511_atis_adapters.sql v0.10.3.1: soft-disable state_511_atis* adapters instead of DELETE (FK blocked v0.10.3 migration) (#90) 2026-06-06 18:39:33 -06:00
033_soft_disable_state_511_atis_adapters.sql v0.10.3.1: soft-disable state_511_atis* adapters instead of DELETE (FK blocked v0.10.3 migration) (#90) 2026-06-06 18:39:33 -06:00
034_widen_monitoring_area_default_to_full_idaho.sql v0.10.9: widen monitoring-area default to cover all of Idaho (49.0N) (#97) 2026-06-08 01:42:59 -06:00