mirror of
https://github.com/zvx-echo6/meshai.git
synced 2026-08-26 17:31:34 +00:00
refactor(phase2): migrate nws + incident/roads to formatter+decider (tier-a) (#30)
Behavior-preserving relocation (byte-identical goldens), behind the staged-
cutover gate.
- formatters/nws.py + gating/nws.py: move _render + all CAP parsing (HTML-strip,
_parse_nws_description, motion/hail/wind, county scoping, short-expiry) and the
gating (3h re-alert window, Update/Cancel/Expire tombstone, first-sighting,
warning->immediate severity). Native env/nws.py stops truncating description +
carries parameters/eventCode/certainty/msgType/references/geocoder. Registers
weather_warning + weather_statement.
- formatters/incident.py + gating/incident.py: absorb the incident _render AND
the work_zone renderer, reconciling the two sub_type vocabularies; traffic_events
change-detection gating. Native env/{traffic,roads511}.py emit canonical data.
Registers work_zone/road_incident/road_closure/traffic_congestion.
- formatters/_anchor.py: shared town/distance/bearing resolver (consolidates WFIGS
_location_anchor + incident nearest_town; WFIGS fire reuses in Phase 3).
- Fixtures captured: nws x37, traffic x46.
Tier-a byte-identical goldens for all fixtures. Tests: +~150; 0 new failures
(34 baseline, 1539 passed).
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
4e23fc737d
commit
bdc42aa341
99 changed files with 15848 additions and 28 deletions
|
|
@ -15,16 +15,15 @@ from meshai.notifications.renderers.composer import compose_mesh_message
|
|||
# ── (a) empty registry returns None for known categories ──────────────────────
|
||||
|
||||
@pytest.mark.parametrize("category", [
|
||||
"weather_warning",
|
||||
# earthquake_event removed: Phase-1 registers formatters.quake for it.
|
||||
# weather_warning/weather_statement removed: Phase-2 registers formatters.nws.
|
||||
# road_closure/work_zone/road_incident/traffic_congestion removed: Phase-2 registers formatters.incident.
|
||||
"wildfire_incident",
|
||||
"road_closure",
|
||||
"battery_critical",
|
||||
])
|
||||
def test_get_formatter_returns_none_while_registry_empty(category):
|
||||
"""Un-migrated categories must still return None from get_formatter."""
|
||||
# earthquake_event is now migrated (Phase 1); the remaining categories
|
||||
# here have no formatter yet and must still fall through to Mode-B.
|
||||
# Only categories not yet migrated to the formatter+gater architecture.
|
||||
assert category not in FORMATTERS, (
|
||||
f"Category {category!r} should not be in FORMATTERS yet (not migrated)"
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue