From ceb95fb80ebd2b5ef2f41c93f52fcbb7fd630ef4 Mon Sep 17 00:00:00 2001 From: malice Date: Tue, 7 Jul 2026 11:26:05 -0600 Subject: [PATCH] fix(fires): detect acreage/containment growth, not just the fire-name set (#86) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The WFIGS adapter computed changed = (old event_id set != new event_id set), so growth of an already-known fire produced changed=False. The store only runs _ingest_fires (and the Phase-3 fire decider) when tick() reports a change, so growth/update broadcasts for stable fires never fired — only brand-new or dropped fire NAMES woke the path. Include acres + containment in the change signature. The decider stays the broadcast gate (forward-only + cooldown), so no backlog is dumped. Co-authored-by: Matt Johnson Co-authored-by: Claude Opus 4.8 (1M context) --- work/meshai/env/fires.py | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/work/meshai/env/fires.py b/work/meshai/env/fires.py index e8e4665..b92102e 100644 --- a/work/meshai/env/fires.py +++ b/work/meshai/env/fires.py @@ -206,9 +206,26 @@ class NICFFiresAdapter: new_events.append(event) - # Check if data changed - old_ids = {e["event_id"] for e in self._events} - new_ids = {e["event_id"] for e in new_events} + # Change detection must reflect each fire's GROWTH, not just the set of + # fire names. Comparing event_id sets alone made acreage/containment growth + # of an already-known fire invisible: tick() returned False, so the store + # never re-ran _ingest_fires and the Phase-3 fire decider never saw the + # growth. Include acres + containment in the signature so a growing fire + # flips changed=True; the decider (forward-only + cooldown) stays the + # broadcast gate, so no backlog is dumped. + def _change_sig(e): + try: + acres = int(round(float(e.get("acres") or 0))) + except (TypeError, ValueError): + acres = 0 + try: + pct = int(float(e.get("pct_contained") or 0)) + except (TypeError, ValueError): + pct = 0 + return (e["event_id"], acres, pct) + + old_ids = {_change_sig(e) for e in self._events} + new_ids = {_change_sig(e) for e in new_events} changed = old_ids != new_ids self._events = new_events