Repository navigation
feat(alerts): add fetch_alerts_detailed with area_desc and region_filtered - #16
Conversation
|
This is good work. The sibling-function shape is right, and the 28 existing snapshots coming back byte-identical is the part I checked first. One thing to sort out before this goes in. France doesn't tag its entries with EMMA_IDs. I pulled the live feed a few minutes ago and all 9 entries carry The dropping predates your PR, that mismatch was already there and it's probably one of the four reasons in #13. The flag is what makes it load-bearing, and I'd rather have no flag at all than one that reports Gating on On the untagged drop itself, I checked Germany, Poland and Portugal alongside France. All EMMA_ID, 242 entries across the four feeds, not one of them untagged. That change is safe. |
|
Confirmed on the live feed: all nine French entries carry Gating on Two things I looked at and left out. The EMMA_ID in the first Revision coming with the fixture from your comment as a test. |
Closes #10. The shape agreed there, plus the untagged-entry fix.
fetch_alertsreturns a list that may be local or national with nothing to tell a consumer which, and no field distinguishes two regional alerts for the same event. This adds a sibling that reports both, and leavesfetch_alertsandAlertexactly as they were.What changed
fetch_alerts_detailedreturnsAlertReport { alerts: Vec<AlertEntry>, region_filtered: bool }, withAlertEntry { alert: Alert, area_desc: String }.fetch_alertsis now a thin wrapper over it.area_desccomes from MeteoAlarmcap:areaDesc, NWSareaDesc, and the containing ECCC polygon'sareaDesc(already parsed for the dedup key). BOM sends none, so it is"", per the missing-strings rule.region_filteredisfalseonly when a MeteoAlarm national feed was returned without an EMMA_ID for the location. NWS, ECCC and BOM filter by point, polygon and geohash, and an empty result is trivially filtered, so those aretrue.region_filteredis alsofalsewhen the feed carries no EMMA_ID geocodes at all (France tags entries with NUTS3, the review finding), in which case the feed renders unfiltered with a warning naming the scheme found, rather than being emptied by a filter that cannot apply. A geocode counts as an EMMA_ID only when itsvalueNamesays so.tests/wire_contract.rswith their own snapshots.Alert's snapshot and the other 28 are byte-identical.CONTRACT.mdandAPI.mddocument the new shapes.Verified against live feeds
region_filteredarea_desctruefalseFaro,Leiria,Coimbra,Beja,Évora,Portalegre, ... one per entryfalse,FR101resolved but the feed is NUTS3-taggedDrôme,Hérault,Gard,Aude, ... one per entryTests and gates
fmt,clippy --workspace --all-targets -- -D warnings,test --workspacegreen; coverage 86.20% total lines (85.91% before). New tests:area_descdecode for each provider, the untagged-entry drop with and without a filter, the NUTS3 cases (entry is not an EMMA_ID, all-NUTS3 feed renders unfiltered, mixed feed stays filtered, empty feed), the Unknown-region report, and the two wire-contract snapshots. No change to any existing wire shape, no CHANGELOG entry.