Repository navigation
feat!: carry MeteoAlarm's awareness type and level on Alert - #77
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
Alertgainsawareness: Option<MeteoAlarmAwareness>, akind(AwarenessType, MeteoAlarm's 1-13 with 11 unassigned) and alevel(AwarenessLevel, green to red), both#[non_exhaustive]with anUnknownfor a number the crate doesn't know.Nonefor 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 isMinorin the atom feed and2; yellow; Moderatein the JSON, which is why both ride along.On the wire
awarenessis a new always-present key,nulloutside MeteoAlarm, so the alert snapshots change (that's the breaking part) and there's a newalert_meteoalarmsnapshot 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::timeoutoverrides 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.