mirror of
https://github.com/zvx-echo6/meshai.git
synced 2026-08-26 17:31:34 +00:00
feat(reminders): route fire reminders through per-region fire routing (#106)
Fire (wfigs) reminders previously dispatched via the generic scheduled path, which hardcoded the rf_propagation toggle (Meshtastic ch4 / MeshCore #aida) and ignored the fire's region. They now route through a new dispatch_scheduled_fire_broadcast() that builds a synthetic fire event from the fire's lat/lon, derives its region the same way the live fire event path does, and routes per region_routes.cells['fire'] (per-region MT/MC channels), falling back to the fire toggle's own defaults when a transport isn't matrix-owned -- never rf_propagation. rf_propagation and 511 reminders are unchanged. Reminders remain disabled (reminders_wfigs.enabled stays false); this only fixes routing for when they are enabled. 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
fed63b2344
commit
af826319c8
4 changed files with 597 additions and 5 deletions
|
|
@ -71,6 +71,11 @@ def _enable_wfigs_reminders():
|
|||
def mock_dispatcher():
|
||||
d = MagicMock()
|
||||
d.dispatch_scheduled_broadcast = AsyncMock(return_value=True)
|
||||
# wfigs reminders route through the region-aware fire path (see
|
||||
# dispatch_scheduled_fire_broadcast); make it awaitable too so the
|
||||
# non-fire path tests (rf/511 via dispatch_scheduled_broadcast) and the
|
||||
# fire path tests share one fixture.
|
||||
d.dispatch_scheduled_fire_broadcast = AsyncMock(return_value=True)
|
||||
return d
|
||||
|
||||
|
||||
|
|
@ -89,10 +94,12 @@ def test_wfigs_reminder_fires_past_cadence(mock_dispatcher):
|
|||
sch = ReminderScheduler(mock_dispatcher, clock=lambda: now)
|
||||
fired = asyncio.run(sch.tick_once())
|
||||
assert fired == 1
|
||||
mock_dispatcher.dispatch_scheduled_broadcast.assert_called_once()
|
||||
args = mock_dispatcher.dispatch_scheduled_broadcast.call_args.kwargs
|
||||
# wfigs now routes through the region-aware fire path, NOT the hardcoded
|
||||
# rf_propagation dispatch_scheduled_broadcast.
|
||||
mock_dispatcher.dispatch_scheduled_broadcast.assert_not_called()
|
||||
mock_dispatcher.dispatch_scheduled_fire_broadcast.assert_called_once()
|
||||
args = mock_dispatcher.dispatch_scheduled_fire_broadcast.call_args.kwargs
|
||||
assert "Active" in args["text"]
|
||||
assert args["source_event_table"] == "fires"
|
||||
assert args["source_event_pk"] == "F1"
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue