Skip to content

feat!: carry MeteoAlarm's awareness type and level on Alert - #77

Merged
crenshawdev merged 1 commit into
crenshawdev:mainfrom
nwxnw:feat/meteoalarm-awareness
Nov 6, 2026
Merged

crenshawdev merged 1 commit into
crenshawdev:mainfrom
nwxnw:feat/meteoalarm-awareness

Conversation

@nwxnw

@nwxnw nwxnw commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

The field from #59, built the way you described there: the atom feed stays the source of alerts, the v1 JSON feed is fetched beside it on every call (the two requests run concurrently), and the warnings are paired to the atom entries by CAP identifier. The same JSON body feeds the stage 3 local-name match, so a refresh is still two MeteoAlarm requests.

Alert gains awareness: Option<MeteoAlarmAwareness>, a kind (AwarenessType, MeteoAlarm's 1-13 with 11 unassigned) and a level (AwarenessLevel, green to red), both #[non_exhaustive] with an Unknown for a number the crate doesn't know. None for NWS, ECCC and BOM, and for MeteoAlarm when the JSON request fails or no warning carries the alert's identifier; the alerts are returned either way, as the field's doc says.

Checked against five live feeds (DE, FR, IT, ES, PL, 2,130 info blocks): both parameters are on every block, the pair is the same across a warning's language blocks, and every atom identifier in the Germany feed has its JSON counterpart. Worth knowing: the level is not the atom cap:severity. A DWD frost warning is Minor in the atom feed and 2; yellow; Moderate in the JSON, which is why both ride along.

On the wire awareness is a new always-present key, null outside MeteoAlarm, so the alert snapshots change (that's the breaking part) and there's a new alert_meteoalarm snapshot plus two enum canaries, all quoted in CONTRACT.md. API.md covers the field, the types and the changed stage 3 wording; the fuzz target for the JSON feed runs the pairing too.

One thing testing from the US turned up: the Germany JSON feed is 1.8 MB served uncompressed, and feeds.meteoalarm.org delivered it at roughly 100 KB/s here, so it ran past the 15 s client timeout on most fetches and the alerts came back without awareness. The JSON request now carries its own 45 s timeout (RequestBuilder::timeout overrides the client's for that one call); the atom feed and everything else stay on 15 s. Happy to change the number: the join means a stalled JSON transfer delays the alerts by up to that long before they return without awareness, so I kept it short of a minute.

Closes #59.

@crenshawdev
crenshawdev merged commit 0433744 into crenshawdev:main Nov 6, 2026
3 checks passed
@nwxnw
nwxnw deleted the feat/meteoalarm-awareness branch November 6, 2026 01:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MeteoAlarm: expose awareness type and level on Alert (breaking, rides #33)

2 participants