fix: pipeline reliability — WS, summarizer, ingest, health
Stop the live HUD reconnect storm (nginx WS snippet + backoff), copy intel/nous_client into the summarizer image, and make event ingest idempotent on URL. GDELT uses the DOC API; NWS no longer sends bbox; FIRMS is one ON CONFLICT batch; GET /api/aircraft serves last-known. Health reports freshness without 503ing docker. EONET + CISA KEV added.
This commit is contained in:
parent
c6bfc50705
commit
d81ea68dec
26 changed files with 1164 additions and 110 deletions
66
tests/test_new_sources.py
Normal file
66
tests/test_new_sources.py
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
"""NASA EONET + CISA KEV parsers (no network)."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
def test_parse_eonet_keeps_stable_ids_and_points():
|
||||
from sources import parse_eonet_events
|
||||
|
||||
payload = {
|
||||
"events": [
|
||||
{
|
||||
"id": "EONET_6363",
|
||||
"title": "Etna Volcano",
|
||||
"categories": [{"id": "volcanoes", "title": "Volcanoes"}],
|
||||
"geometry": [
|
||||
{"date": "2024-01-01T00:00:00Z", "type": "Point", "coordinates": [15.0, 37.7]},
|
||||
],
|
||||
"link": "https://eonet.gsfc.nasa.gov/api/v3/events/EONET_6363",
|
||||
},
|
||||
{
|
||||
"id": "EONET_skip",
|
||||
"title": "No geometry",
|
||||
"categories": [],
|
||||
"geometry": [],
|
||||
"link": "https://eonet.gsfc.nasa.gov/api/v3/events/EONET_skip",
|
||||
},
|
||||
]
|
||||
}
|
||||
events = parse_eonet_events(payload)
|
||||
assert len(events) == 1
|
||||
ev = events[0]
|
||||
assert ev["url"] == "https://eonet.gsfc.nasa.gov/api/v3/events/EONET_6363"
|
||||
assert ev["source_type"] == "disaster"
|
||||
assert ev["location_lat"] == 37.7
|
||||
assert ev["location_lon"] == 15.0
|
||||
assert ev["raw"]["eonet_id"] == "EONET_6363"
|
||||
assert "volcanoes" in ev["tags"]
|
||||
|
||||
|
||||
def test_parse_cisa_kev_emits_cve_url_no_coords():
|
||||
from sources import parse_cisa_kev
|
||||
|
||||
payload = {
|
||||
"vulnerabilities": [
|
||||
{
|
||||
"cveID": "CVE-2024-1234",
|
||||
"vendorProject": "Acme",
|
||||
"product": "Widget",
|
||||
"vulnerabilityName": "RCE",
|
||||
"dateAdded": "2024-06-01",
|
||||
"shortDescription": "Remote code execution",
|
||||
"requiredAction": "Apply updates",
|
||||
"dueDate": "2024-06-22",
|
||||
"knownRansomwareCampaignUse": "Known",
|
||||
}
|
||||
]
|
||||
}
|
||||
events = parse_cisa_kev(payload)
|
||||
assert len(events) == 1
|
||||
ev = events[0]
|
||||
assert ev["url"] == "https://nvd.nist.gov/vuln/detail/CVE-2024-1234"
|
||||
assert ev["location_lat"] is None
|
||||
assert ev["location_lon"] is None
|
||||
assert "cisa-kev" in ev["tags"]
|
||||
assert "CVE-2024-1234" in ev["tags"]
|
||||
assert ev["raw"]["cveID"] == "CVE-2024-1234"
|
||||
Loading…
Reference in a new issue