Skip to content

160-tool MCP server for real-time global intelligence from free public APIs: markets, liquidity, prediction markets, SEC filings, conflict, military, aircraft-cohort early warning, migration and border flows, cyber, climate, news and more. Dated observation history, 29 research prompts, cited briefs, geofences, SSE dashboard. MIT, no paid API keys.

Dashboard: stream the conflict-zone fallback; UCDP map clicks open the UCDP panel

Phoenix Agent (mac-studio)eb2f4fee199c
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7441841..6311734 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -77,8 +77,16 @@ displacement summary and the dashboard AOI detail panel. Tools 132 -> 139.
of the first 12 keys under a JSON title. UCDP rows now show both sides,
violence type, deaths (best and low-high), dates, coordinates, headline,
source and UCDP id; conflict-zone rows use the map's conflict renderer.
+- UCDP events on the map's conflict layer opened the ACLED-shaped panel:
+ "Conflict Event", 0 fatalities, no dates. They now open the UCDP panel.
+- The conflict-zone hotspot fallback (used when ACLED and UCDP both have no
+ events) was built only by `/api/overview`, which the page never calls,
+ so with no conflict feed the map layer and the drawer's "Active Conflict
+ Zones" section stayed empty. `/api/stream` now sends it from the same
+ builder once both feeds report, or `null` when one has events.
- `test_dashboard_detail_routing.py` fails if any dispatched type lacks a
- branch in the renderer it reaches.
+ branch in the renderer it reaches, or if UCDP map clicks miss the UCDP
+ renderer; `test_dashboard_stream_conflict.py` drives one stream tick.
### Docs
- README's per-tool reference listed 126 of the 135 tools while every
diff --git a/README.md b/README.md
index 426c7d8..77f7474 100644
--- a/README.md
+++ b/README.md
@@ -665,7 +665,7 @@ Everything else uses free, unauthenticated public APIs.
```bash
pip install -e ".[dev]"
-pytest # 969 tests (987 total, 18 live-network smoke tests deselected by default)
+pytest # 973 tests (991 total, 18 live-network smoke tests deselected by default)
pytest --cov=world_intel_mcp # with coverage
pytest tests/test_forex.py -v # single module
```
diff --git a/ROADMAP.md b/ROADMAP.md
index bcf8b8b..4f03400 100644
--- a/ROADMAP.md
+++ b/ROADMAP.md
@@ -639,8 +639,8 @@ suite, and a live MCP stdio session.
| Tool parity | 139 / 139 | `TOOLS` and handlers are aligned at import time; README's per-tool reference is pinned to the registry by `test_readme_documents_every_registered_tool` |
| Static datasets | 18 | Bases, ports, pipelines, nuclear, cables, datacenters, spaceports, minerals, exchanges, trade routes, cloud regions, financial centers |
| RSS feeds | 119 | 24 categories |
-| Tests in repo | 987 | 969 non-smoke tests + 18 live smoke tests (measured 2026-10-12: `pytest -m 'not smoke'` -> 969 passed, 18 deselected); full suite requires `.[dev]` |
-| Statement coverage | 92% | Measured 2026-10-12 full-suite `--cov` (91.81%); 91.65% on 2026-10-11; 91.18% on 2026-09-01, 59% the morning before. CI ratchet at 89 |
+| Tests in repo | 991 | 973 non-smoke tests + 18 live smoke tests (measured 2026-10-12: `pytest -m 'not smoke'` -> 973 passed, 18 deselected); full suite requires `.[dev]` |
+| Statement coverage | 92% | Measured 2026-10-12 full-suite `--cov` (92.02%); 91.65% on 2026-10-11; 91.18% on 2026-09-01, 59% the morning before. CI ratchet at 89 |
| Primary remaining gaps | `cli.py` tests, coverage gate, `server.py` refactor | See Planned Phases 23-26 |
**Bottom line (2026-10-11)**: 139 tools across 30+ domains; Phases 27-28 added aircraft-cohort early warning and cross-border migration. **Earlier (2026-09-02)**: 122 tools across 30+ domains, with the roadmap aligned to the live MCP registry and, for the first time, a forward-looking plan (Phases 23-26): geofence depth, the coverage gate, missing domains, and `server.py` modularization.
diff --git a/src/world_intel_mcp/dashboard/app.py b/src/world_intel_mcp/dashboard/app.py
index d1ea96a..3f3e7c5 100644
--- a/src/world_intel_mcp/dashboard/app.py
+++ b/src/world_intel_mcp/dashboard/app.py
@@ -122,6 +122,62 @@ def _open_aoi_store() -> AOIStore:
# ---------------------------------------------------------------------------
+def _conflict_zones_fallback(acled: dict | None, ucdp: dict | None) -> dict | None:
+ """Static hotspot events for the conflict layer when neither ACLED nor
+ UCDP has data (error or zero events), else ``None``.
+
+ Shared by ``/api/overview`` and ``/api/stream`` so both deliver the
+ same fallback; before it was shared, the stream never sent one and the
+ page's conflict layer and drawer section stayed empty."""
+ acled = acled or {}
+ ucdp = ucdp or {}
+ acled_ok = not acled.get("error") and (acled.get("count") or 0) > 0
+ ucdp_ok = not ucdp.get("error") and (ucdp.get("count") or 0) > 0
+ if acled_ok or ucdp_ok:
+ return None
+ escalation_labels = {
+ 1: "low",
+ 2: "low",
+ 3: "moderate",
+ 4: "high",
+ 5: "critical",
+ }
+ # Map ISO codes to country names for richer display
+ _iso_names = {c: info["name"] for c, info in TIER1_COUNTRIES.items()}
+ hotspot_events = []
+ for name, h in INTEL_HOTSPOTS.items():
+ assoc = h.get("associated_countries", [])
+ country_name = _iso_names.get(assoc[0], "") if assoc else ""
+ actors = [_iso_names.get(c, c) for c in assoc]
+ esc = h["baseline_escalation"]
+ hotspot_events.append(
+ {
+ "latitude": h["lat"],
+ "longitude": h["lon"],
+ "country": country_name or name.replace("_", " ").title(),
+ "location": name.replace("_", " ").title(),
+ "event_type": "Active Hotspot",
+ "type_of_violence_label": "active hotspot",
+ "fatalities": 0,
+ "best": 0,
+ "escalation": esc,
+ "severity": escalation_labels.get(esc, "unknown"),
+ "event_date": datetime.now(timezone.utc).strftime("%Y-%m-%d"),
+ "actor1": actors[0] if len(actors) > 0 else "\u2014",
+ "actor2": actors[1] if len(actors) > 1 else "\u2014",
+ "source": "Intel Hotspot Database",
+ "notes": f"Escalation level {esc}/5 ({escalation_labels.get(esc, 'unknown')}). "
+ f"Monitored hotspot involving {', '.join(actors)}.",
+ "associated_countries": assoc,
+ }
+ )
+ return {
+ "events": hotspot_events,
+ "count": len(hotspot_events),
+ "source": "intel-hotspots",
+ }
+
+
async def _fetch_overview() -> dict:
"""Fetch all dashboard domains in parallel, return unified dict."""
fetcher = _ensure_fetcher()
@@ -209,52 +265,11 @@ async def _fetch_overview() -> dict:
# Conflict zone fallback: when both ACLED and UCDP fail, provide
# static hotspot data so the conflict layer is never empty.
- acled = result.get("acled_events", {})
- ucdp = result.get("ucdp_events", {})
- acled_ok = not acled.get("error") and (acled.get("count") or 0) > 0
- ucdp_ok = not ucdp.get("error") and (ucdp.get("count") or 0) > 0
- if not acled_ok and not ucdp_ok:
- escalation_labels = {
- 1: "low",
- 2: "low",
- 3: "moderate",
- 4: "high",
- 5: "critical",
- }
- # Map ISO codes to country names for richer display
- _iso_names = {c: info["name"] for c, info in TIER1_COUNTRIES.items()}
- hotspot_events = []
- for name, h in INTEL_HOTSPOTS.items():
- assoc = h.get("associated_countries", [])
- country_name = _iso_names.get(assoc[0], "") if assoc else ""
- actors = [_iso_names.get(c, c) for c in assoc]
- esc = h["baseline_escalation"]
- hotspot_events.append(
- {
- "latitude": h["lat"],
- "longitude": h["lon"],
- "country": country_name or name.replace("_", " ").title(),
- "location": name.replace("_", " ").title(),
- "event_type": "Active Hotspot",
- "type_of_violence_label": "active hotspot",
- "fatalities": 0,
- "best": 0,
- "escalation": esc,
- "severity": escalation_labels.get(esc, "unknown"),
- "event_date": datetime.now(timezone.utc).strftime("%Y-%m-%d"),
- "actor1": actors[0] if len(actors) > 0 else "\u2014",
- "actor2": actors[1] if len(actors) > 1 else "\u2014",
- "source": "Intel Hotspot Database",
- "notes": f"Escalation level {esc}/5 ({escalation_labels.get(esc, 'unknown')}). "
- f"Monitored hotspot involving {', '.join(actors)}.",
- "associated_countries": assoc,
- }
- )
- result["conflict_zones"] = {
- "events": hotspot_events,
- "count": len(hotspot_events),
- "source": "intel-hotspots",
- }
+ zones = _conflict_zones_fallback(
+ result.get("acled_events", {}), result.get("ucdp_events", {})
+ )
+ if zones is not None:
+ result["conflict_zones"] = zones
# Static geospatial datasets (no API calls)
result["military_bases"] = {"bases": MILITARY_BASES, "count": len(MILITARY_BASES)}
@@ -326,6 +341,90 @@ async def api_overview(request):
return JSONResponse(data, headers={"Access-Control-Allow-Origin": "*"})
+_CONFLICT_FEEDS = ("acled_events", "ucdp_events")
+
+
+def _stream_source_defs(fetcher: Fetcher) -> dict:
+ """Source name -> zero-arg coroutine factory for one /api/stream tick."""
+ return {
+ "market_quotes": lambda: markets.fetch_market_quotes(fetcher),
+ "crypto_quotes": lambda: markets.fetch_crypto_quotes(fetcher),
+ "macro_signals": lambda: markets.fetch_macro_signals(fetcher),
+ "sector_heatmap": lambda: markets.fetch_sector_heatmap(fetcher),
+ "earthquakes": lambda: seismology.fetch_earthquakes(fetcher),
+ "military_flights": lambda: military.fetch_military_flights(
+ fetcher
+ ),
+ "cyber_threats": lambda: cyber.fetch_cyber_threats(fetcher),
+ "news_feed": lambda: news.fetch_news_feed(fetcher),
+ "trending_keywords": lambda: news.fetch_trending_keywords(fetcher),
+ "nav_warnings": lambda: maritime.fetch_nav_warnings(fetcher),
+ "internet_outages": lambda: infrastructure.fetch_internet_outages(
+ fetcher
+ ),
+ "cable_health": lambda: infrastructure.fetch_cable_health(fetcher),
+ "wildfires": lambda: wildfire.fetch_wildfires(fetcher),
+ "prediction_markets": lambda: prediction.fetch_prediction_markets(
+ fetcher
+ ),
+ "airport_delays": lambda: aviation.fetch_airport_delays(fetcher),
+ "climate_anomalies": lambda: climate.fetch_climate_anomalies(
+ fetcher
+ ),
+ "energy_prices": lambda: economic.fetch_energy_prices(fetcher),
+ "gas_prices": lambda: economic.fetch_gas_prices(fetcher),
+ "residential_natgas": lambda: economic.fetch_residential_natgas_prices(
+ fetcher
+ ),
+ "electricity_rates": lambda: economic.fetch_electricity_rates(
+ fetcher
+ ),
+ "stablecoin_status": lambda: markets.fetch_stablecoin_status(
+ fetcher
+ ),
+ "etf_flows": lambda: markets.fetch_etf_flows(fetcher),
+ "acled_events": lambda: conflict.fetch_acled_events(fetcher),
+ "ucdp_events": lambda: conflict.fetch_ucdp_events(fetcher),
+ "displacement": lambda: displacement.fetch_displacement_summary(
+ fetcher
+ ),
+ "risk_scores": lambda: intelligence.fetch_risk_scores(fetcher),
+ "signal_convergence": lambda: intelligence.fetch_signal_convergence(
+ fetcher
+ ),
+ "space_weather": lambda: space_weather.fetch_space_weather(fetcher),
+ "ai_watch": lambda: ai_watch.fetch_ai_watch(fetcher),
+ "disease_outbreaks": lambda: health.fetch_disease_outbreaks(
+ fetcher
+ ),
+ "election_calendar": lambda: elections.fetch_election_calendar(
+ fetcher
+ ),
+ "shipping_index": lambda: shipping.fetch_shipping_index(fetcher),
+ "social_signals": lambda: social.fetch_social_signals(fetcher),
+ "nuclear_monitor": lambda: nuclear.fetch_nuclear_monitor(fetcher),
+ "alert_digest": lambda: fetch_alert_digest(fetcher),
+ "weekly_trends": lambda: fetch_weekly_trends(fetcher),
+ "service_status": lambda: service_status.fetch_service_status(
+ fetcher
+ ),
+ "strategic_posture": lambda: fetch_strategic_posture(fetcher),
+ "fleet_report": lambda: fetch_fleet_report(fetcher),
+ "usni_fleet": lambda: fetch_usni_fleet(fetcher),
+ "population_exposure": lambda: fetch_population_exposure(fetcher),
+ "domestic_flights": lambda: aviation.fetch_domestic_flights(
+ fetcher
+ ),
+ "traffic_flow": lambda: traffic.fetch_traffic_flow(fetcher),
+ "traffic_incidents": lambda: traffic.fetch_traffic_incidents(
+ fetcher
+ ),
+ "webcams": lambda: webcams.fetch_webcams(fetcher),
+ "btc_technicals": lambda: markets.fetch_btc_technicals(fetcher),
+ "central_bank_rates": lambda: fetch_central_bank_rates(fetcher),
+ }
+
+
async def api_stream(request):
"""SSE endpoint — progressive: emits each source as it completes."""
@@ -335,83 +434,7 @@ async def api_stream(request):
fetcher = _ensure_fetcher()
# Sources to fetch, grouped so fast ones arrive first
- source_defs = {
- "market_quotes": lambda: markets.fetch_market_quotes(fetcher),
- "crypto_quotes": lambda: markets.fetch_crypto_quotes(fetcher),
- "macro_signals": lambda: markets.fetch_macro_signals(fetcher),
- "sector_heatmap": lambda: markets.fetch_sector_heatmap(fetcher),
- "earthquakes": lambda: seismology.fetch_earthquakes(fetcher),
- "military_flights": lambda: military.fetch_military_flights(
- fetcher
- ),
- "cyber_threats": lambda: cyber.fetch_cyber_threats(fetcher),
- "news_feed": lambda: news.fetch_news_feed(fetcher),
- "trending_keywords": lambda: news.fetch_trending_keywords(fetcher),
- "nav_warnings": lambda: maritime.fetch_nav_warnings(fetcher),
- "internet_outages": lambda: infrastructure.fetch_internet_outages(
- fetcher
- ),
- "cable_health": lambda: infrastructure.fetch_cable_health(fetcher),
- "wildfires": lambda: wildfire.fetch_wildfires(fetcher),
- "prediction_markets": lambda: prediction.fetch_prediction_markets(
- fetcher
- ),
- "airport_delays": lambda: aviation.fetch_airport_delays(fetcher),
- "climate_anomalies": lambda: climate.fetch_climate_anomalies(
- fetcher
- ),
- "energy_prices": lambda: economic.fetch_energy_prices(fetcher),
- "gas_prices": lambda: economic.fetch_gas_prices(fetcher),
- "residential_natgas": lambda: economic.fetch_residential_natgas_prices(
- fetcher
- ),
- "electricity_rates": lambda: economic.fetch_electricity_rates(
- fetcher
- ),
- "stablecoin_status": lambda: markets.fetch_stablecoin_status(
- fetcher
- ),
- "etf_flows": lambda: markets.fetch_etf_flows(fetcher),
- "acled_events": lambda: conflict.fetch_acled_events(fetcher),
- "ucdp_events": lambda: conflict.fetch_ucdp_events(fetcher),
- "displacement": lambda: displacement.fetch_displacement_summary(
- fetcher
- ),
- "risk_scores": lambda: intelligence.fetch_risk_scores(fetcher),
- "signal_convergence": lambda: intelligence.fetch_signal_convergence(
- fetcher
- ),
- "space_weather": lambda: space_weather.fetch_space_weather(fetcher),
- "ai_watch": lambda: ai_watch.fetch_ai_watch(fetcher),
- "disease_outbreaks": lambda: health.fetch_disease_outbreaks(
- fetcher
- ),
- "election_calendar": lambda: elections.fetch_election_calendar(
- fetcher
- ),
- "shipping_index": lambda: shipping.fetch_shipping_index(fetcher),
- "social_signals": lambda: social.fetch_social_signals(fetcher),
- "nuclear_monitor": lambda: nuclear.fetch_nuclear_monitor(fetcher),
- "alert_digest": lambda: fetch_alert_digest(fetcher),
- "weekly_trends": lambda: fetch_weekly_trends(fetcher),
- "service_status": lambda: service_status.fetch_service_status(
- fetcher
- ),
- "strategic_posture": lambda: fetch_strategic_posture(fetcher),
- "fleet_report": lambda: fetch_fleet_report(fetcher),
- "usni_fleet": lambda: fetch_usni_fleet(fetcher),
- "population_exposure": lambda: fetch_population_exposure(fetcher),
- "domestic_flights": lambda: aviation.fetch_domestic_flights(
- fetcher
- ),
- "traffic_flow": lambda: traffic.fetch_traffic_flow(fetcher),
- "traffic_incidents": lambda: traffic.fetch_traffic_incidents(
- fetcher
- ),
- "webcams": lambda: webcams.fetch_webcams(fetcher),
- "btc_technicals": lambda: markets.fetch_btc_technicals(fetcher),
- "central_bank_rates": lambda: fetch_central_bank_rates(fetcher),
- }
+ source_defs = _stream_source_defs(fetcher)
_SLOW = {
"news_feed",
@@ -439,6 +462,7 @@ async def api_stream(request):
]
total = len(tasks)
completed = 0
+ conflict_seen: dict = {}
# Yield each result as it arrives
while completed < total:
@@ -459,6 +483,26 @@ async def api_stream(request):
default=str,
)
yield f"data: {payload}\n\n"
+ # Once both conflict feeds are in, send the same fallback
+ # /api/overview builds (or null, so a recovered feed clears
+ # a stale fallback in the page's accumulated state).
+ if name in _CONFLICT_FEEDS:
+ conflict_seen[name] = data
+ if len(conflict_seen) == len(_CONFLICT_FEEDS):
+ zones = _conflict_zones_fallback(
+ conflict_seen["acled_events"],
+ conflict_seen["ucdp_events"],
+ )
+ payload = json.dumps(
+ {
+ "_progressive": True,
+ "_done": completed,
+ "_total": total,
+ "conflict_zones": zones,
+ },
+ default=str,
+ )
+ yield f"data: {payload}\n\n"
# Final event with metadata
meta = {
diff --git a/src/world_intel_mcp/dashboard/index.html b/src/world_intel_mcp/dashboard/index.html
index 7945b3e..02dfa72 100644
--- a/src/world_intel_mcp/dashboard/index.html
+++ b/src/world_intel_mcp/dashboard/index.html
@@ -1719,7 +1719,11 @@ function updateMapConflict(data) {
if (fat > 0) tip += ' (' + fat + ' fatal)';
else if (e.severity) tip += ' [' + e.severity + ']';
mk.bindTooltip(tip, { className: 'mk-tip', direction: 'top', offset: [0, -size/2] });
- mk.on('click', function() { showDetail('conflict', e); });
+ // UCDP events carry best/low/high and side_a/side_b, not the ACLED/hotspot shape showDetail reads.
+ mk.on('click', function() {
+ if (data.source === 'ucdp') showDrawerDetail(_storeItem('ucdp_event', e));
+ else showDetail('conflict', e);
+ });
mk.addTo(mapLayers.conflict);
});
}
diff --git a/src/world_intel_mcp/tests/test_dashboard_detail_routing.py b/src/world_intel_mcp/tests/test_dashboard_detail_routing.py
index bebc671..56c0ae2 100644
--- a/src/world_intel_mcp/tests/test_dashboard_detail_routing.py
+++ b/src/world_intel_mcp/tests/test_dashboard_detail_routing.py
@@ -58,3 +58,19 @@ def test_every_drawer_item_type_has_a_show_drawer_detail_branch() -> None:
handled = _branch_types(_function_body(src, "function showDrawerDetail(id) {"))
assert stored, "no drawer items found; the extraction regex is stale"
assert stored - handled == set()
+
+
+def test_map_conflict_click_routes_ucdp_events_to_the_ucdp_renderer() -> None:
+ """The map's conflict layer draws ACLED, UCDP or hotspot events, but
+ showDetail's conflict branch reads the ACLED/hotspot shape (fatalities,
+ event_type, actor1/2); a UCDP event there showed 0 deaths under a
+ generic title. UCDP (``source: 'ucdp'``) must reach ``ucdp_event``."""
+ src = _INDEX.read_text()
+ body = _function_body(src, "function updateMapConflict(data) {")
+ assert re.search(
+ r"if \(data\.source === 'ucdp'\) showDrawerDetail\(_storeItem\('ucdp_event', e\)\);"
+ r"\s*else showDetail\('conflict', e\);",
+ body,
+ ), "map conflict click does not route UCDP events to the ucdp_event renderer"
+ drawer = _function_body(src, "function showDrawerDetail(id) {")
+ assert "type === 'ucdp_event'" in drawer
diff --git a/src/world_intel_mcp/tests/test_dashboard_stream_conflict.py b/src/world_intel_mcp/tests/test_dashboard_stream_conflict.py
new file mode 100644
index 0000000..78665bb
--- /dev/null
+++ b/src/world_intel_mcp/tests/test_dashboard_stream_conflict.py
@@ -0,0 +1,106 @@
+"""The /api/stream conflict-zone fallback.
+
+The page reads only /api/stream. The hotspot fallback for the conflict
+layer (used when ACLED and UCDP both have nothing) used to be built only
+in /api/overview, so with no conflict feed the map layer and the drawer's
+"Active Conflict Zones" section stayed empty. Both endpoints now share
+``_conflict_zones_fallback``; these tests drive one real stream tick with
+stubbed sources and read the SSE events it yields.
+
+Gaps / not covered: only one tick of the generator is consumed (the
+30 s re-tick loop is not exercised); the page-side rendering of the
+payload is verified in headless Chromium, not here.
+"""
+
+import json
+
+import pytest
+
+from world_intel_mcp.dashboard import app as dashboard_app
+
+
+async def _one_tick(monkeypatch: pytest.MonkeyPatch, sources: dict) -> list[dict]:
+ """Run one stream tick over ``sources`` (name -> payload) and return
+ the decoded SSE events up to and including the _complete event."""
+
+ def _defs(_fetcher):
+ def _factory(payload):
+ async def _coro():
+ return payload
+
+ return _coro
+
+ return {name: _factory(payload) for name, payload in sources.items()}
+
+ monkeypatch.setattr(dashboard_app, "_ensure_fetcher", lambda: None)
+ monkeypatch.setattr(dashboard_app, "_stream_source_defs", _defs)
+ resp = await dashboard_app.api_stream(None)
+ events = []
+ it = resp.body_iterator
+ try:
+ while True:
+ chunk = await it.__anext__()
+ text = chunk if isinstance(chunk, str) else chunk.decode()
+ assert text.startswith("data: ")
+ ev = json.loads(text[len("data: "):])
+ events.append(ev)
+ if ev.get("_complete"):
+ break
+ finally:
+ await it.aclose()
+ return events
+
+
+def _zones_events(events: list[dict]) -> list[dict]:
+ return [e for e in events if "conflict_zones" in e]
+
+
+async def test_stream_sends_hotspot_fallback_when_no_conflict_feed(
+ monkeypatch: pytest.MonkeyPatch,
+) -> None:
+ events = await _one_tick(
+ monkeypatch,
+ {
+ "earthquakes": {"earthquakes": [], "count": 0},
+ "acled_events": {"error": "ACLED credentials not configured"},
+ "ucdp_events": {"events": [], "count": 0, "source": "ucdp"},
+ },
+ )
+ zones = _zones_events(events)
+ assert len(zones) == 1, "exactly one conflict_zones event per tick"
+ cz = zones[0]["conflict_zones"]
+ expected = dashboard_app._conflict_zones_fallback(
+ {"error": "ACLED credentials not configured"}, {"events": [], "count": 0}
+ )
+ assert cz["source"] == "intel-hotspots"
+ assert cz["count"] == expected["count"] == len(dashboard_app.INTEL_HOTSPOTS) > 0
+ assert [e["location"] for e in cz["events"]] == [
+ e["location"] for e in expected["events"]
+ ]
+ # The extra event is not a source: progress counters stay on the source count.
+ assert zones[0]["_progressive"] is True
+ assert zones[0]["_total"] == 3
+ assert max(e.get("_done", 0) for e in events) == 3
+
+
+async def test_stream_clears_fallback_when_a_conflict_feed_has_events(
+ monkeypatch: pytest.MonkeyPatch,
+) -> None:
+ events = await _one_tick(
+ monkeypatch,
+ {
+ "acled_events": {"error": "ACLED credentials not configured"},
+ "ucdp_events": {"events": [{"id": 1}], "count": 1, "source": "ucdp"},
+ },
+ )
+ zones = _zones_events(events)
+ assert len(zones) == 1
+ assert zones[0]["conflict_zones"] is None
+
+
+def test_fallback_builder_returns_none_when_acled_has_events() -> None:
+ assert (
+ dashboard_app._conflict_zones_fallback({"events": [{}], "count": 1}, None)
+ is None
+ )
+ assert dashboard_app._conflict_zones_fallback(None, None)["count"] > 0