Fetch SPC day 4–8 outlook text as the combined SWOD48 product (#161) #163

Merged
claude-bot merged 2 commits from fix/spc-swod48 into main 2026-08-01 02:50:46 +00:00
Contributor

Closes #161.

Problem

SPC issues days 4–8 as one combined text product (AWIPS SWOD48 / WMO ACUS48); the per-day SWODY4SWODY8 ids this code requested don't exist. Verified against the live NWS API: recent SWO products are SWODY1/2/3 and SWOD48 only. The five fetches failed on every 5-minute cycle (~26k consecutive failures on prod) and permanently tripped the dashboard degraded-data banner — while it displayed a seconds-old "last update" from the healthy day-1–3 keys. That's the "freshness warning despite updating a minute ago" contradiction reported after the prod migration.

Change

  • nws.py: days 4–8 route to _fetch_swod48_text() (AWIPS SWOD48, WMO ACUS48), recorded under the single freshness key spc:text_swod48. The per-day maps now cover days 1–3 only. Out-of-range days still return None.
  • api/alerts.py / spc_processor.py: the combined product is fetched once per cycle and shared across days 4–8, instead of five identical HTTP requests + five freshness writes.
  • ai_context.py: freshness-key derivation maps day ≥ 4 to spc:text_swod48.
  • Migration 0033: deletes the five dead spc:text_swody4..8 rows. Nothing writes those keys anymore, and any row with failure_count > 0 keeps the banner degraded forever, so they must be removed rather than left to age out.

Tests

New: day-4 resolves to SWOD48 via mocked NWS API and records text_swod48; days 4–8 all share the combined fetch; out-of-range days return None. Existing SWODY1 and fire-outlook tests unchanged. Test patches of fetch_spc_outlook_text keep working — the public signature is unchanged.

Note per [migration-real-db-verify]: 0033 is a pure DELETE (no constraints added), so the empty-DB CI migration run is representative; the five rows exist on prod and dev and will be removed on deploy.

🤖 Generated with Claude Code

Closes #161. ## Problem SPC issues days 4–8 as **one combined text product** (AWIPS `SWOD48` / WMO `ACUS48`); the per-day `SWODY4`–`SWODY8` ids this code requested don't exist. Verified against the live NWS API: recent `SWO` products are `SWODY1/2/3` and `SWOD48` only. The five fetches failed on every 5-minute cycle (~26k consecutive failures on prod) and permanently tripped the dashboard degraded-data banner — while it displayed a seconds-old "last update" from the healthy day-1–3 keys. That's the "freshness warning despite updating a minute ago" contradiction reported after the prod migration. ## Change - **`nws.py`**: days 4–8 route to `_fetch_swod48_text()` (AWIPS `SWOD48`, WMO `ACUS48`), recorded under the single freshness key `spc:text_swod48`. The per-day maps now cover days 1–3 only. Out-of-range days still return `None`. - **`api/alerts.py` / `spc_processor.py`**: the combined product is fetched **once** per cycle and shared across days 4–8, instead of five identical HTTP requests + five freshness writes. - **`ai_context.py`**: freshness-key derivation maps day ≥ 4 to `spc:text_swod48`. - **Migration 0033**: deletes the five dead `spc:text_swody4..8` rows. Nothing writes those keys anymore, and any row with `failure_count > 0` keeps the banner degraded forever, so they must be removed rather than left to age out. ## Tests New: day-4 resolves to SWOD48 via mocked NWS API and records `text_swod48`; days 4–8 all share the combined fetch; out-of-range days return `None`. Existing SWODY1 and fire-outlook tests unchanged. Test patches of `fetch_spc_outlook_text` keep working — the public signature is unchanged. Note per [migration-real-db-verify]: 0033 is a pure `DELETE` (no constraints added), so the empty-DB CI migration run is representative; the five rows exist on prod and dev and will be removed on deploy. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Fetch SPC day 4-8 outlook text as the combined SWOD48 product (#161)
Some checks failed
CI / test (pull_request) Failing after 5m0s
61996bc815
SPC issues days 4-8 as one combined text product (AWIPS SWOD48 / WMO
ACUS48); the per-day SWODY4-8 ids this code requested do not exist, so
those five fetches failed on every 5-minute cycle (~26k consecutive
failures) and permanently tripped the dashboard degraded-data banner —
while displaying a seconds-old "last update" from the healthy day 1-3
keys.

- nws.py: days 4-8 resolve to _fetch_swod48_text(), recorded under the
  single freshness key spc:text_swod48; per-day maps now cover 1-3 only.
- alerts.py / spc_processor.py: fetch the combined product once per cycle
  and share it across days 4-8 instead of five identical requests.
- ai_context.py: freshness key derivation maps day>=4 to spc:text_swod48.
- Migration 0033: delete the five dead spc:text_swody4-8 rows — nothing
  writes those keys anymore, and any row with failure_count > 0 keeps the
  banner degraded forever.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
ci: rerun (empty) — prior run overlapped a concurrent CI run
All checks were successful
CI / test (pull_request) Successful in 5m0s
02e8ed0eba
claude-bot deleted branch fix/spc-swod48 2026-08-01 02:50:46 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
rbrooks/WeatherBot!163
No description provided.