mirror of
https://github.com/zvx-echo6/central.git
synced 2026-06-10 11:54:37 +02:00
SAME format (FCC standard) is PSSCCC: P=area-type indicator, SS=state FIPS,
CCC=county FIPS. Pre-v0.10.7 _build_regions read code[:2] (PS) as the state,
so the leading P=0 collapsed every SAME code to state 01 = Alabama. The
dumped CAP envelope from CENTRAL_WX#968 showed Bannock County Idaho alerts
flagged as US-AL-FIPS016005 + primary_region=US-AL-FIPS016005, which then
routed to central.wx.alert.us.al.county.fips016005 instead of
central.wx.alert.us.id.county.fips16005.
Fix:
- Slice code[1:3] for the state FIPS, code[1:] for the 5-digit ANSI county
FIPS (SSCCC -- standard interoperable form). Drops the P padding from
emitted region/subject; P stays preserved verbatim in data.geocode.SAME
for any power user that needs it.
- Length guard tightened: ==6 + isdigit + isinstance str (was >= 2). Now
malformed entries (too short, too long, non-digit, None) are silently
skipped with no crash.
- Deleted dead _extract_states_from_codes (defined but never called; same
bug, removed rather than fixed).
Tests:
- New TestSameStateParse parametrized over 4 distinct-state cases per spec:
016005 -> US-ID-FIPS16005 (Bannock area), 001005 -> US-AL-FIPS01005
(Autauga area), 056005 -> US-WY-FIPS56005 (Carbon area), 049005 ->
US-UT-FIPS49005 (Cache UT).
- Area-subset (P>=1) and unknown-state-FIPS coverage.
- Malformed-input parametrize: empty, too short (2 forms), too long (7
digits), non-digit char, all-alpha, None -- each silently skipped.
- Existing SAMPLE_FEATURE_* fixtures updated from constructed-to-match-bug
values (160001/410051/060037/530033) to proper 0SSCCC format
(016001/041051/006037/053033); existing TestBuildRegions assertions
updated to expect 5-digit ANSI form.
Followup ticket (NOT v0.10.7 scope, recorded in PR body):
(a) Null-geometry alerts with valid Idaho UGC zones are silently dropped
by _geometry_intersects_region (line 297-298): needs UGC-fallback or
geometry-or-UGC check. NWS issues many Special Weather Statements
without GeoJSON polygons but with UGC IDZ* zones that should pass.
(b) Configured monitoring bbox north=44.5 only covers the southern third
of Idaho; Idaho extends to 49.0N, so Coeur d'Alene / Lewiston / etc.
are out of scope. Verify whether the narrow bbox was an intentional
dev limit or accidental.
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
||
|---|---|---|
| .. | ||
| fixtures | ||
| __init__.py | ||
| conftest.py | ||
| README.md | ||
| test_adapters.py | ||
| test_api_key_resolver.py | ||
| test_api_keys.py | ||
| test_apply_enrichment_coordless.py | ||
| test_archive_bbox_filter.py | ||
| test_archive_multi_stream.py | ||
| test_audit.py | ||
| test_auth.py | ||
| test_backend_settings_schema.py | ||
| test_bootstrap_config.py | ||
| test_config_source.py | ||
| test_config_store.py | ||
| test_consumer_doc.py | ||
| test_crypto.py | ||
| test_csrf_handler.py | ||
| test_csrf_race_condition.py | ||
| test_dashboard.py | ||
| test_dedup_mixin.py | ||
| test_enrichment_config_plumbing.py | ||
| test_enrichment_framework.py | ||
| test_enrichment_locations_coverage.py | ||
| test_enrichment_mile_marker.py | ||
| test_eonet.py | ||
| test_events_adapter_column.py | ||
| test_events_bbox_guard.py | ||
| test_events_feed.py | ||
| test_events_feed_frontend.py | ||
| test_events_filtering.py | ||
| test_events_pagination.py | ||
| test_events_retention.py | ||
| test_fire_fused.py | ||
| test_firms.py | ||
| test_form_descriptors.py | ||
| test_gdacs.py | ||
| test_geocoder_enricher.py | ||
| test_gui_adapter_edit.py | ||
| test_gui_scaffold.py | ||
| test_inciweb.py | ||
| test_itd_511.py | ||
| test_itd_511_cameras.py | ||
| test_migrate.py | ||
| test_models.py | ||
| test_monitoring_area.py | ||
| test_navi_backend.py | ||
| test_nominatim_backend.py | ||
| test_nwis.py | ||
| test_nwis_enrichment.py | ||
| test_nws_normalization.py | ||
| test_photon_backend.py | ||
| test_preview_hook.py | ||
| test_producer_doc.py | ||
| test_region_picker.py | ||
| test_requires_api_key.py | ||
| test_resend.py | ||
| test_session_auth.py | ||
| test_setup_gate.py | ||
| test_stream_registry.py | ||
| test_streams.py | ||
| test_subject_helpers.py | ||
| test_supervisor_hotreload.py | ||
| test_supervisor_integration.py | ||
| test_supervisor_publish_filter.py | ||
| test_swpc.py | ||
| test_telemetry_separation.py | ||
| test_tomtom_flow.py | ||
| test_tomtom_flow_passthrough.py | ||
| test_tomtom_incidents.py | ||
| test_usgs_quake.py | ||
| test_wfigs.py | ||
| test_wizard.py | ||
| test_wzdx.py | ||
Central Tests
Test Database
Some tests (notably test_config_store.py) require a real PostgreSQL database.
By default, tests connect to:
postgresql://central_test:testpass@localhost/central_test
If your test database uses different credentials, set the CENTRAL_TEST_DB_DSN
environment variable:
export CENTRAL_TEST_DB_DSN="postgresql://myuser:mypass@localhost/mydb"
uv run pytest tests/test_config_store.py