Improve handling of alerts when no active alerts are present

This commit is contained in:
2026-05-29 19:34:23 -05:00
parent 26e6f33cde
commit 3e93a97d10
10 changed files with 126 additions and 11 deletions

View File

@@ -28,9 +28,14 @@ Every response used by the adapter must be JSON with a top-level `data` field:
}
```
`data: null` is treated as a missing source. Missing optional sources follow the
configured missing-source policy. Missing hourly forecast data fails bundle
fetching because hourly periods are required for report generation.
For most sources, `data: null` is treated as a missing source. Missing optional
sources follow the configured missing-source policy. Missing hourly forecast
data fails bundle fetching because hourly periods are required for report
generation.
`/alerts/active` is the exception: a successful response with `data: null`
means the endpoint was checked and there are no current active alerts. The
adapter records a non-missing alerts source and an empty alert run.
Malformed JSON envelopes, non-2xx statuses, and response read failures include
endpoint context in returned errors. Decode errors include source context when
@@ -92,9 +97,14 @@ Policy behavior:
- `warn`: omit the source data, add a warning, and continue
- `none`: omit the source data and continue without a warning
For `/alerts/active`, an HTTP error or missing `data` field still fails or
follows the relevant error path, but explicit `data: null` is not a
missing-source condition.
## Source Identity
For non-null source payloads, the adapter records:
For source payloads accepted into the bundle, including the explicit `null`
alerts payload, the adapter records:
- source name
- endpoint path