Commit f1ef047
fix(noaa): severe weather always reported zero — /alerts/active rejects
`getActiveAlerts()` always sent `limit` to `api.weather.gov/alerts/active`,
which the endpoint does not accept. The upstream reply is explicit:
HTTP 400
{"parameter": "query.limit",
"message": "Query parameter \"limit\" is not recognized"}
`safeFetch` resolves to `{ error }` rather than throwing, so `alerts?.features
|| []` collapsed to an empty array and the source reported a confident
all-clear on every sweep since the parameter was added:
"totalSevereAlerts": 0,
"summary": { "hurricanes": 0, "tornadoes": 0, "floods": 0,
"winterStorms": 0, "wildfires": 0, "other": 0 }
with no error field anywhere in the payload. At the time of this commit the
same query without `limit` returns 33 active severe alerts, including a live
Severe Thunderstorm Warning and 26 Extreme Heat Warnings.
Drop the parameter. `/alerts/active` only ever returns currently-active
alerts, so the response is naturally bounded and no client-side cap is
needed — capping would under-report `totalSevereAlerts` during exactly the
severe-weather outbreaks this source exists to catch.
Also pass through `alerts.error` so a future upstream failure is visible in
the payload instead of silently rendering as "no severe weather anywhere in
the US". Same bug class, four lines; happy to split it out if preferred.
Verified: 0 -> 33 alerts against the live API; forced-failure path now
surfaces the error; `node --test test/*.test.mjs` 45 pass / 1 skipped.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>limit
1 parent 3db7068 commit f1ef047
1 file changed
Lines changed: 8 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
15 | 14 | | |
16 | 15 | | |
17 | | - | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
18 | 20 | | |
19 | 21 | | |
20 | 22 | | |
| |||
48 | 50 | | |
49 | 51 | | |
50 | 52 | | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
51 | 57 | | |
52 | 58 | | |
53 | 59 | | |
| |||
0 commit comments