Fix radar capture, which rc3 broke by changing what _fetch_radar returns (#184) #187
No reviewers
Labels
No labels
area:ai
area:ci-cd
area:notifications
area:observability
area:public-pages
backlog
bug
duplicate
enhancement
help wanted
invalid
question
type:decision
type:feature
type:infra
type:maintenance
type:security
v1.0.1
v1.1.0
v1.2.0
v1.3.0
v2.0.0
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
rbrooks/WeatherBot!187
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/radar-image-callers"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes a regression introduced by #185 (rc3). Targeted at v2.0.0-rc4.
What broke
#185 changed
_fetch_radarto return aRadarImageinstead of bytes, and updated the notifiers and API endpoints that consume it. It missed the two callers that write radar to disk:app/services/radar_frames.py— periodic frame capture (#130)app/services/alert_processor.py— alert-time snapshot (#85)Both hand the value straight to
storage.put()andlen(), so every capture raised:Both call sites are deliberately fail-soft, so nothing surfaced — no alert was affected, nothing propagated, and the only trace was one warning line per alert per 5-minute cycle.
Net effect: rc3 silently disabled the radar history capture that rc2 had just fixed. No frames captured means no Explorer radar loop (#140) and no alert-time snapshot (#85).
How it was caught
By pointing a temporary dev location at live convection near Jackson, MS and watching zero frames accumulate against four active alerts over 41 minutes. Confirmed in the container logs:
Three release candidates and a fully green 1001-test suite did not.
Why the suite stayed green — the actual defect
tests/conftest.py:119installs an autouse fixture that monkeypatchesapp.services.radar._fetch_radarto returnNonefor every test in the suite. Tests that assert on capture substitute their own mock, each returning whatever shape it assumed at the time.So no test anywhere ran the real
_fetch_radar, and its contract could change underneath every caller without a single failure. The.datacorrection is the trivial part; this is the part worth fixing.The fix
image.data, and passimage.content_typerather than a hardcodedimage/png— the format is no longer knowable from the filename.test_radar_frames.pyandtest_radar_snapshot.pynow return a realRadarImage, so they cannot silently drift from the real return type again.test_capture_uses_the_real_fetch_radar_return_typerestores the real_fetch_radar— captured at module import, before the autouse fixture applies — and mocks only the HTTP layer beneath it, so the caller/callee contract is genuinely exercised. It asserts the bytes on disk are the image payload, not a repr of the wrapper.Verification
radar_frames.pyfix is reverted, and pass with it — not trusted as a smoke test.ruff check app/ tests/— cleanNote for the release
rc3 should not go to production. This needs an rc4, and the dev soak restarted — the Jackson MS location has captured no frames, so #182's loop fix still has no live verification.