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.
Python ai-toolsai-watchanthropicclaudecybersecuritydashboardgeofencinggeopoliticalgeospatialintelligencemarketsmcpmigrationmilitarymodel-context-protocolnuclearosintreal-timespace-weatherthreat-intelligence
News signals: GDELT floor in the fetcher, dossier news, end-to-end cluster test
Phoenix Agent (mac-studio)3c0ebffffb7e
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 6ab8223..c8eac17 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -14,9 +14,8 @@15-minute buckets for 3 days and hourly buckets for 7) are flagged`partial`, judged from the first category series that answered when thebase call failed, and today's unfinished UTC day is flagged- `in_progress`. The- module spaces its own GDELT calls 5.5 s apart and retries a failed call- once.+ `in_progress`. A+ failed call is retried once.- `intel_situations`: country pairs ("between": a headline naming two ormore countries) and single countries ("inside": a headline naming one)ranked over a recent RSS window by most covered, most hostile (headline@@ -43,6 +42,12 @@(4 of 4 sources ok, 9.8 s). Each caller still gets its own limit andits own item copies, and a caller's timeout does not cancel the readthe others are waiting on.+- Live GDELT calls are spaced at least 5 s apart by the fetcher+ (`_SOURCE_RATE_LIMITS["gdelt"]`), for every GDELT caller: GDELT's 429+ body asks for "one every 5 seconds" (measured 2026-10-17). Cache hits are+ not delayed. The limiter is per process, so the MCP server and the+ collector do not share it, and the fetcher's own retries inside one call+ are not spaced by it.### Fixed- RSS outage read as a slow news day (ROADMAP Phase 24.5):@@ -70,7 +75,25 @@`intel_world_brief` top-story sources).- RSS `published` times were shifted by the host's UTC offset:`_parse_published` read feedparser's UTC struct with `time.mktime`- (local time). On a UTC-4 host every stamp was four hours in the future.+ (local time) instead of `calendar.timegm`. The struct carries+ `tm_isdst=0`, so the shift is the zone's standard offset: on mac-studio+ (US Eastern) an item published 14:43:52 UTC came out `19:43:52Z`, five+ hours ahead (measured 2026-10-17). The amount depends on the host zone+ (none on a UTC host). It skewed every RSS-based time window and any+ ordering against non-RSS times. The regression test sets its own zone,+ so it fails on the old code on a UTC CI runner too.+- Country dossier news was always empty, with no marker (ROADMAP Phase+ 24.5), for three reasons: it asked `fetch_news_feed` for+ `category="all"`, which is not a category (the feed answered with an+ error dict); it read `articles` and `source`, while the feed emits+ `items` and `feed_name`; and it checked only its own `_error`, never the+ feed's `error`. It now reads every feed, passes a feed error or outage+ through as `error` / `degraded` / `reason` with `mention_count: null`+ and a `data_gaps` entry, and names failed or stale feeds. A fourth+ quiet zero: 28 of the 50 accepted country codes (GB, DE, JP and others)+ have no headline keywords, so the search could never match; the section+ now says "mentions not searched" instead of reporting zero.+ `intel dossier` prints `News: not measured` and the gaps in that case.## 0.11.0 - 2026-10-12diff --git a/ROADMAP.md b/ROADMAP.mdindex 8b637cf..1b53c90 100644--- a/ROADMAP.md+++ b/ROADMAP.md@@ -575,7 +575,7 @@ dashboard.| 1 | Capture history and revisions | Earlier saved copies of a source, and values a later copy revised | :red_circle: || 1 | Collection health | Per-source expected cadence; overdue / failing / never-run per source, measured from the run log, not inferred from cache freshness. Says what it cannot prove | :red_circle: || 1 | Research guide over MCP | MCP resources (guide generated from the live registry and source health, measures glossary, "what this server will not do") and MCP prompts (worked research questions, each naming the tools it needs and the limit to respect). Server exposed no prompts or resources before | :red_circle: |-| 1 | Hostility timeline | Per country pair or country, daily counts of threat / sanction / force / criticism coverage plus tone; sortable by most covered, most hostile, biggest change | :white_check_mark: Built 2026-10-17, unreleased: `intel_hostility_timeline` (GDELT DOC 2.0 `timelinevolraw` + `timelinetone`, one call per category, failed calls and missing days null) and `intel_situations` (RSS headlines, ranked by covered / hostile / change, change defined over feeds whose history spans both windows). Measured 2026-10-17: timeline modes answer (HTTP 200, `date_resolution` `hour` for `timespan=7d` and `15m` for `3d`, explicit zero buckets, `norm` = all monitored articles), but a `timespan=7d` request returned 54 hours (2026-10-15T10Z onward), and about half of calls drew 429 even 30 s apart (later probes, 16:51 to 16:53Z, 4 of 4 drew 429, so the resolution for 14 and 30 days and coverage before 2026-10-15 are unmeasured; a live MCP run at 17:00Z got 4 of 6 columns after the retry pass, one at 17:20Z got 1 of 6, consistent with the server's breaker opening after 3 failed calls, which also skips the retry pass). Artlist was not used for daily counts: 250 records sorted by date covered 15 minutes. Situations see only the 22-country entity table |+| 1 | Hostility timeline | Per country pair or country, daily counts of threat / sanction / force / criticism coverage plus tone; sortable by most covered, most hostile, biggest change | :white_check_mark: Built 2026-10-17, unreleased: `intel_hostility_timeline` (GDELT DOC 2.0 `timelinevolraw` + `timelinetone`, one call per category, failed calls and missing days null) and `intel_situations` (RSS headlines, ranked by covered / hostile / change, change defined over feeds whose history spans both windows). Measured 2026-10-17: timeline modes answer (HTTP 200, `date_resolution` `hour` for `timespan=7d` and `15m` for `3d`, explicit zero buckets, `norm` = all monitored articles), but a `timespan=7d` request returned 54 hours (2026-10-15T10Z onward), and about half of calls drew 429 even 30 s apart (later probes, 16:51 to 16:53Z, 4 of 4 drew 429, so the resolution for 14 days and coverage before 2026-10-15T10Z are unmeasured; 30 days was not probed; a live MCP run at 17:00Z got 4 of 6 columns after the retry pass, one at 17:20Z got 1 of 6, consistent with the server's breaker opening after 3 failed calls, which also skips the retry pass). The fetcher now spaces every live GDELT call at least 5 s apart, per process. Artlist was not used for daily counts: 250 records sorted by date covered 15 minutes. Situations see only the 22-country entity table || 1 | Story breadth | News clusters carry a distinct-outlet count; a top-stories view ranks by how many outlets carry a story | :white_check_mark: Built 2026-10-17, unreleased: clusters gain `outlets` / `outlet_count` (sister feeds of one publisher count once); `intel_top_stories` ranks by outlet count with an attention list (countries and organizations by mention growth). Found on the way: cluster `sources` was empty in every live cluster (key mismatch, `feed_name` vs `source_name`) and RSS times were shifted by the host UTC offset; both fixed. Concurrent RSS reads now share one request per feed (a live collector news-group cycle: 119 requests for 119 feeds) || 1 | Liquidity and flows | Fed balance sheet, Treasury General Account, reverse repo and net liquidity (FRED keyless CSV), money supply (US M2, euro area M1/M2/M3, never summed), ECB, ICI fund flows and ETF net issuance, FINRA margin statistics, BLS series; amounts kept separate from flows | :red_circle: || 1 | Kalshi + cross-venue markets | Kalshi public market data next to Polymarket; same-event comparison with an explicit match confidence; settled markets scored against pre-settlement prices (Brier) | :red_circle: |@@ -638,6 +638,7 @@ fail-quietly bugs below were fixed in the same-day follow-up| Country/company/leader entity matching was substring-based ("usa" inside "thousand", "hamas" inside "Bahamas") | `analysis/entities.py` | false positives | :white_check_mark: Fixed in 0.5.0 (word-boundary alternations, measured faster) || Category keywords matched substrings ("airstrike" bumped severity via "strike"; "denied" fired "ied") | `analysis/classifier.py` | false positives | :white_check_mark: Fixed in 0.5.0 (boundary-anchored stems, per-keyword overrides) || Silent-empty degradation without a marker on RSS/API failure | `sources/prediction.py` (documented as intended), `sources/maritime.py`, `sources/news.py` RSS path, `sources/fleet.py` `_safe` wrapper | silent degradation | :yellow_circle: `sources/news.py` RSS path fixed 2026-10-17 (every call reports `feeds_attempted` / `feeds_ok` / `feeds_failed` / `feeds_stale`; no feed answering live is `error` + `degraded` + `reason: all_feeds_failed`, including the warm-cache case where failed feeds came back as expired copies and counted as healthy; failing-first regression tests). prediction, maritime and fleet still open. The fetcher's stale fallback marks only dict payloads, so other text and XML sources can serve expired copies unmarked |+| Country dossier news was always empty with no marker, for every country: it asked the feed for `category="all"` (not a category, so `fetch_news_feed` answered with an error dict), read `articles` / `source` while the feed emits `items` / `feed_name`, and checked only its own `_error`, never the feed's `error`. Also, 28 of the 50 accepted codes have no headline keywords, so their search could never match | `analysis/dossier.py` news section | fail-reads-as-success | :white_check_mark: Fixed 2026-10-17, unreleased (reads every feed; a feed error or outage passes through as `error` / `degraded` / `reason` with `mention_count: null` and a data gap; failed and stale feeds named; keywordless countries report "mentions not searched"; `intel dossier` prints `News: not measured`; failing-first tests drive the real `fetch_news_feed` output) || 33 CLI commands rendered upstream errors as healthy empty states | `cli.py` | fail-reads-as-success | :white_check_mark: Fixed in 0.6.0 (shared bail-on-error path; 43 failing-first tests) || Rich markup swallowed lowercase bracketed values and let remote titles inject markup | `cli.py` | output corruption | :white_check_mark: Fixed in 0.6.0 (per-site escaping; injection test) || Remote data inside Rich TABLE cells was not markup-escaped | `cli.py` | output corruption | :white_check_mark: Fixed in 0.6.0 (`_cell` Text-wrapping convention, 11 injection tests; error styles unified across all 53 commands) |diff --git a/src/world_intel_mcp/analysis/dossier.py b/src/world_intel_mcp/analysis/dossier.pyindex f00976a..4bf2937 100644--- a/src/world_intel_mcp/analysis/dossier.py+++ b/src/world_intel_mcp/analysis/dossier.py@@ -112,7 +112,7 @@ async def fetch_country_dossier(_safe(fetch_country_stocks(fetcher, country=iso3), "country_stocks"),_safe(fetch_election_calendar(fetcher, country=iso3), "elections"),_safe(fetch_sanctions_search(fetcher, query=iso3, limit=10), "sanctions"),- _safe(fetch_news_feed(fetcher, category="all", limit=200), "news_feed"),+ _safe(fetch_news_feed(fetcher, category=None, limit=200), "news_feed"),)# --- Section 1: Overview ---@@ -175,21 +175,57 @@ async def fetch_country_dossier(sanctions = {"_error": sanctions_data["_error"]}# --- Section 6: News ---+ # Every RSS feed (category=None), headlines matched on the country's+ # keywords. Until 2026-10-17 this asked for category="all" (not a+ # category, so the feed answered with an error dict), read "articles"+ # and "source" (the producer emits "items" and "feed_name") and checked+ # only "_error": the section was always empty, with no marker. A failed+ # feed is now a gap with mention_count None, never zero mentions.news_mentions = []- if "_error" not in news_data:- country_keywords = country_config.get("keywords", [country_name.lower()])- for article in news_data.get("articles", []):+ news_gaps: list[str] = []+ news_marker: dict = {}+ country_keywords = country_config.get("keywords")+ if "_error" in news_data:+ news_gaps.append(f"news feed failed: {news_data['_error']}; mentions not measured")+ news_marker = {+ "error": news_data["_error"],+ "degraded": True,+ "reason": "news_feed_exception",+ }+ elif news_data.get("error"):+ news_gaps.append(f"news feed: {news_data['error']}; mentions not measured")+ news_marker = {k: news_data[k] for k in ("error", "degraded", "reason") if k in news_data}+ elif not country_keywords:+ news_gaps.append(+ f"no headline keywords for {iso3} (only the {len(TIER1_COUNTRIES)} tier-1 "+ "countries have them); mentions not searched"+ )+ else:+ for article in news_data.get("items", []):title = (article.get("title") or "").lower()if any(kw in title for kw in country_keywords):news_mentions.append({"title": article.get("title"),- "source": article.get("source"),+ "source": article.get("feed_name"),"published": article.get("published"),"link": article.get("link"),"category": article.get("category"),})if len(news_mentions) >= 15:break+ failed_feeds = news_data.get("feeds_failed") or []+ if failed_feeds:+ news_gaps.append(+ f"{len(failed_feeds)} of {news_data.get('feeds_attempted')} RSS feeds failed "+ f"or timed out; their items are missing: {', '.join(failed_feeds)}"+ )+ stale_feeds = news_data.get("feeds_stale") or []+ if stale_feeds:+ news_gaps.append(+ f"{len(stale_feeds)} RSS feeds were served from an expired cache copy: "+ f"{', '.join(stale_feeds)}"+ )+ news_measured = not news_marker and bool(country_keywords)# --- Section 7: Security (hotspots + conflict zones) ---associated_hotspots = []@@ -223,7 +259,9 @@ async def fetch_country_dossier("sanctions": sanctions,"news": {"mentions": news_mentions,- "mention_count": len(news_mentions),+ "mention_count": len(news_mentions) if news_measured else None,+ **news_marker,+ "data_gaps": news_gaps,},"security": security,"sections": ["overview", "economy", "markets", "elections", "sanctions", "news", "security"],diff --git a/src/world_intel_mcp/analysis/news_signals.py b/src/world_intel_mcp/analysis/news_signals.pyindex fe9f978..6772644 100644--- a/src/world_intel_mcp/analysis/news_signals.py+++ b/src/world_intel_mcp/analysis/news_signals.py@@ -39,7 +39,6 @@ from __future__ import annotationsimport asyncioimport hashlibimport logging-import timefrom collections import defaultdictfrom datetime import datetime, timedelta, timezonefrom itertools import combinations@@ -291,12 +290,11 @@ GDELT_HOSTILITY_TERMS: dict[str, list[str]] = {],}-# GDELT asks for at most one request per 5 s per client (its 429 body,-# measured 2026-10-17). The shared Fetcher has no GDELT floor, so this-# module spaces its own live calls; cache hits are not delayed.-_GDELT_SPACING_S = 5.5+# GDELT asks for at most one request per 5 s (its 429 body, measured+# 2026-10-17). The fetcher enforces that floor for every source="gdelt"+# call (fetcher._SOURCE_RATE_LIMITS; cache hits are not delayed). This is+# the extra pause before the one retry pass over failed calls._GDELT_RETRY_WAIT_S = 10.0-_gdelt_last_call = 0.0# The DOC API serves roughly the last three months._MAX_DAYS = 90@@ -327,16 +325,9 @@ def _resolve_country(value: str) -> tuple[str, str | None]:async def _gdelt_timeline(fetcher, query: str, mode: str, days: int) -> dict | None:- """One GDELT timeline call, spaced from this module's previous one."""- global _gdelt_last_call+ """One GDELT timeline call (the fetcher spaces live GDELT calls)."""digest = hashlib.sha1(f"{mode}|{days}|{query}".encode()).hexdigest()[:16]cache_key = f"news_signals:gdelt:{mode}:{days}:{digest}"- live_call = fetcher.cache.get(cache_key) is None and fetcher.breaker.is_available("gdelt")- if live_call:- wait = _GDELT_SPACING_S - (time.monotonic() - _gdelt_last_call)- if wait > 0:- await asyncio.sleep(wait)- _gdelt_last_call = time.monotonic()data = await fetcher.get_json(news._GDELT_DOC_URL,source="gdelt",@@ -549,7 +540,13 @@ async def fetch_hostility_timeline("whom, negation, or quotation, and one article can count in several ""categories. 'all_monitored_articles' is GDELT's per-bucket total ""('norm'). tone is GDELT timelinetone average tone, weighted by "- "the day's per-bucket article counts when those are available."+ "the day's per-bucket article counts when those are available. "+ "Unmeasured: the bucket resolution GDELT uses for spans over 7 "+ "days, and whether it holds buckets before 2026-10-15T10Z (a 7-day "+ "call returned none earlier). Every probe of either drew HTTP 429 "+ "on 2026-10-17 (timespan=14d at 16:42Z, 16:51:16Z and 16:51:55Z; "+ "Oct 11 to 13 by start and end date at 16:52:15Z and 16:52:53Z); "+ "30 days was not probed."),"definitions": {"partial": (diff --git a/src/world_intel_mcp/cli.py b/src/world_intel_mcp/cli.pyindex e5bd837..8e1fb20 100644--- a/src/world_intel_mcp/cli.py+++ b/src/world_intel_mcp/cli.py@@ -1518,9 +1518,14 @@ def dossier(ctx: click.Context, country: str) -> None:# Newsnews = data.get("news", {})- console.print(f"[blue]News:[/blue] {news.get('mention_count', 0)} recent mentions")+ if "mention_count" in news and news["mention_count"] is None:+ # A failed feed (or a country without keywords) is not zero mentions.+ console.print("[blue]News:[/blue] not measured")+ else:+ console.print(f"[blue]News:[/blue] {news.get('mention_count', 0)} recent mentions")for art in news.get("mentions", [])[:3]:console.print(f" - {escape(art.get('title', 'N/A')[:80])}")+ _print_data_gaps(news)# Securitysec = data.get("security", {})diff --git a/src/world_intel_mcp/fetcher.py b/src/world_intel_mcp/fetcher.pyindex 5b3afad..fbbcc11 100644--- a/src/world_intel_mcp/fetcher.py+++ b/src/world_intel_mcp/fetcher.py@@ -44,6 +44,9 @@ _SOURCE_RATE_LIMITS: dict[str, float] = {# adsb.lol globe_history heatmaps are ~14 MB each; one at a time,# spaced, so a cold baseline never bursts the community server."adsblol-history": 2.0,+ # GDELT DOC API 429 body (2026-10-17): "Please limit requests to one+ # every 5 seconds". Every GDELT caller passes source="gdelt".+ "gdelt": 5.0,}diff --git a/src/world_intel_mcp/sources/news.py b/src/world_intel_mcp/sources/news.pyindex f3d42ea..b1a4ff7 100644--- a/src/world_intel_mcp/sources/news.py+++ b/src/world_intel_mcp/sources/news.py@@ -512,7 +512,8 @@ def _parse_published(entry: dict) -> str | None:feedparser stores the parsed time struct in ``published_parsed``, inUTC. ``calendar.timegm`` reads it as UTC; ``time.mktime`` (used before2026-10-17) read it as local time and shifted every stamp by the host's- UTC offset. Falls back to the raw ``published`` string if parsing fails.+ standard UTC offset (the struct carries tm_isdst=0). Falls back to the+ raw ``published`` string if parsing fails."""from calendar import timegmdiff --git a/src/world_intel_mcp/tests/test_clustering.py b/src/world_intel_mcp/tests/test_clustering.pyindex 30b17ab..1a20528 100644--- a/src/world_intel_mcp/tests/test_clustering.py+++ b/src/world_intel_mcp/tests/test_clustering.py@@ -4,7 +4,9 @@ Similarity values in comments are hand-computed from the token sets afterstopword removal (e.g. "new" is a stopword and must not count)."""+import httpximport pytest+import respxfrom world_intel_mcp.analysis.clustering import (cluster_articles,@@ -177,6 +179,33 @@ async def test_fetch_news_clusters_reads_the_real_producer_outlet_key()+async def test_fetch_news_clusters_through_the_real_feed_parser(fetcher) -> None:+ # No hand-made items: every multilingual feed serves the same RSS+ # document through the real fetch_news_feed, so a producer key the+ # clusterer does not read (feed_name vs source_name) fails here.+ rss = """<?xml version="1.0" encoding="UTF-8"?>+<rss version="2.0"><channel><title>Feed</title>+<item><title>Pope Leo leaves hospital after lung cancer surgery</title>+<link>https://news.example/pope</link><pubDate>Sat, 17 Oct 2026 16:47:52 GMT</pubDate></item>+</channel></rss>"""+ respx.route().mock(return_value=httpx.Response(200, text=rss))++ result = await fetch_news_clusters(fetcher, category="multilingual")+ assert result["cluster_count"] == 1+ cluster = result["clusters"][0]+ assert cluster["size"] == 7+ assert sorted(cluster["sources"]) == [+ "BBC Mundo", "DW Deutsch", "DW Español", "France24 Français",+ "RFI Français", "UN News Español", "UN News Français",+ ]+ # Seven feeds, five publishers: the two DW feeds and the two UN News+ # feeds each count once; BBC Mundo and France24 Français report as+ # their publishers.+ assert cluster["outlets"] == ["BBC", "DW", "France 24", "RFI Français", "UN News"]+ assert cluster["outlet_count"] == 5++async def test_fetch_news_clusters_marks_an_rss_outage(fetcher, monkeypatch: pytest.MonkeyPatch) -> None:diff --git a/src/world_intel_mcp/tests/test_dossier_news.py b/src/world_intel_mcp/tests/test_dossier_news.pynew file mode 100644index 0000000..b7787a5--- /dev/null+++ b/src/world_intel_mcp/tests/test_dossier_news.py@@ -0,0 +1,181 @@+"""Tests for the country dossier's news section (analysis/dossier.py).++The section is driven through the real ``sources.news.fetch_news_feed``+(RSS XML served by respx), so the items it reads carry the producer's real+keys. Headlines were captured live 2026-10-17; links and publish times are+fixture values.++Until 2026-10-17 the section was always empty with no marker: it asked for+category="all" (not a category, so fetch_news_feed answered with an error+dict), read "articles" (the producer emits "items") and "source" (items+carry "feed_name"), and checked only its own "_error", never the+producer's "error".++Gaps / not covered: headline matching is a substring test on the tier-1+keyword lists ("american" also matches "Latin American", "iran" matches+"Tirana"); only the 200 newest items are searched; real feed depth.+"""++import asyncio as asyncio_mod++import httpx+import pytest+import respx++from world_intel_mcp.analysis import dossier+from world_intel_mcp.sources import elections, intelligence, markets, news, sanctions+from world_intel_mcp.sources.news import _RSS_FEEDS++_FEED_NAMES = {name for feeds in _RSS_FEEDS.values() for name, _ in feeds}+_N_FEEDS = len(_FEED_NAMES)+_RUSSIA = "Trump’s pause on Russia sanctions is ‘reward’ for Putin, Zelenskyy says"+_POPE = "Pope Leo leaves hospital after lung cancer surgery"+_RSS = f"""<?xml version="1.0" encoding="UTF-8"?>+<rss version="2.0"><channel><title>Feed</title>+<item>+ <title>{_POPE}</title>+ <link>https://news.example/pope</link>+ <pubDate>Sat, 17 Oct 2026 16:47:52 GMT</pubDate>+</item>+<item>+ <title>{_RUSSIA}</title>+ <link>https://news.example/russia-sanctions</link>+ <pubDate>Sat, 17 Oct 2026 14:43:52 GMT</pubDate>+</item>+</channel></rss>"""+++def _other_sections(monkeypatch: pytest.MonkeyPatch) -> None:+ """The four non-news sources, answered locally: only news is under test."""++ async def _brief(*args, **kwargs) -> dict:+ return {"supporting_data": {}, "brief": ""}++ async def _stocks(*args, **kwargs) -> dict:+ return {"error": "not under test"}++ async def _elections(*args, **kwargs) -> dict:+ return {"elections": []}++ async def _sanctions(*args, **kwargs) -> dict:+ return {"results": [], "count": 0}++ monkeypatch.setattr(intelligence, "fetch_country_brief", _brief)+ monkeypatch.setattr(markets, "fetch_country_stocks", _stocks)+ monkeypatch.setattr(elections, "fetch_election_calendar", _elections)+ monkeypatch.setattr(sanctions, "fetch_sanctions_search", _sanctions)+++def _no_sleep(monkeypatch: pytest.MonkeyPatch) -> None:+ async def _skip(*args, **kwargs) -> None:+ return None++ monkeypatch.setattr(asyncio_mod, "sleep", _skip)+++async def test_dossier_news_reads_the_real_feed_shape(fetcher, _other_sections) -> None:+ respx.route().mock(return_value=httpx.Response(200, text=_RSS))++ r = await dossier.fetch_country_dossier(fetcher, country="RU")+ section = r["news"]+ # Every feed serves both items; the Russia headline matches, the pope+ # one does not, and the dossier keeps 15.+ assert section["mention_count"] == 15+ assert {m["title"] for m in section["mentions"]} == {_RUSSIA}+ assert all(m["source"] in _FEED_NAMES for m in section["mentions"])+ assert section["mentions"][0]["published"] == "2026-10-17T14:43:52Z"+ assert section["mentions"][0]["link"] == "https://news.example/russia-sanctions"+ assert section["data_gaps"] == []+ assert "error" not in section+++async def test_dossier_news_outage_is_a_gap_not_zero_mentions(+ fetcher, _other_sections, _no_sleep+) -> None:+ respx.route().mock(return_value=httpx.Response(503))++ r = await dossier.fetch_country_dossier(fetcher, country="RU")+ section = r["news"]+ assert section["mention_count"] is None+ assert section["mentions"] == []+ assert section["degraded"] is True+ assert section["reason"] == "all_feeds_failed"+ assert section["error"] == f"All {_N_FEEDS} RSS feeds failed or timed out"+ assert section["data_gaps"] == [+ f"news feed: All {_N_FEEDS} RSS feeds failed or timed out; mentions not measured"+ ]+++async def test_dossier_news_names_failed_feeds(fetcher, _other_sections, _no_sleep) -> None:+ dead_name, dead_url = _RSS_FEEDS["geopolitics"][0]+ respx.get(dead_url).mock(return_value=httpx.Response(503))+ respx.route().mock(return_value=httpx.Response(200, text=_RSS))++ r = await dossier.fetch_country_dossier(fetcher, country="RUS")+ section = r["news"]+ assert section["mention_count"] == 15+ assert dead_name not in {m["source"] for m in section["mentions"]}+ assert section["data_gaps"] == [+ f"1 of {_N_FEEDS} RSS feeds failed or timed out; their items are missing: {dead_name}"+ ]+++async def test_dossier_news_exception_is_a_gap(+ fetcher, _other_sections, monkeypatch: pytest.MonkeyPatch+) -> None:+ async def _boom(*args, **kwargs) -> dict:+ raise RuntimeError("feed parser crashed")++ monkeypatch.setattr(news, "fetch_news_feed", _boom)++ r = await dossier.fetch_country_dossier(fetcher, country="RU")+ section = r["news"]+ assert section["mention_count"] is None+ assert section["error"] == "feed parser crashed"+ assert section["data_gaps"] == ["news feed failed: feed parser crashed; mentions not measured"]+++async def test_dossier_news_without_keywords_is_not_searched(fetcher, _other_sections) -> None:+ # GB is accepted but has no tier-1 keyword list; searching headlines+ # for "gbr" used to return a quiet zero.+ respx.route().mock(return_value=httpx.Response(200, text=_RSS))++ r = await dossier.fetch_country_dossier(fetcher, country="GB")+ section = r["news"]+ assert section["mention_count"] is None+ assert section["mentions"] == []+ assert section["data_gaps"] == [+ "no headline keywords for GBR (only the 22 tier-1 countries have them); "+ "mentions not searched"+ ]+++def test_cli_dossier_prints_a_news_outage_as_not_measured(+ tmp_path, monkeypatch: pytest.MonkeyPatch+) -> None:+ from click.testing import CliRunner++ from world_intel_mcp import cli++ monkeypatch.setenv("WORLD_INTEL_CACHE_DB", str(tmp_path / "cli-cache.db"))+ monkeypatch.setattr(cli, "_fetcher", None)+ gap = f"news feed: All {_N_FEEDS} RSS feeds failed or timed out; mentions not measured"++ async def _dossier(*args, **kwargs) -> dict:+ return {+ "overview": {"country": "Russia", "iso2": "RU", "iso3": "RUS"},+ "news": {"mentions": [], "mention_count": None, "degraded": True, "data_gaps": [gap]},+ }++ monkeypatch.setattr(dossier, "fetch_country_dossier", _dossier)+ result = CliRunner().invoke(cli.main, ["dossier", "-c", "RU"], env={"COLUMNS": "200"})+ assert result.exit_code == 0+ assert "News: not measured" in result.output+ assert f"Gap: {gap}" in result.output+ assert "recent mentions" not in result.outputdiff --git a/src/world_intel_mcp/tests/test_news_signals.py b/src/world_intel_mcp/tests/test_news_signals.pyindex e3cc2e5..f787ad8 100644--- a/src/world_intel_mcp/tests/test_news_signals.py+++ b/src/world_intel_mcp/tests/test_news_signals.py@@ -25,6 +25,7 @@ import httpximport pytestimport respx+from world_intel_mcp import fetcher as fetcher_modfrom world_intel_mcp.analysis import news_signals as nsfrom world_intel_mcp.analysis.classifier import classify_hostilityfrom world_intel_mcp.sources import news@@ -126,8 +127,9 @@ def _fast(monkeypatch: pytest.MonkeyPatch) -> None:async def _no_sleep(*args, **kwargs) -> None:return None+ # Also silences the fetcher's per-source GDELT floor, which sleeps+ # through asyncio.sleep.monkeypatch.setattr(asyncio_mod, "sleep", _no_sleep)- monkeypatch.setattr(ns, "_GDELT_SPACING_S", 0.0)monkeypatch.setattr(ns, "_GDELT_RETRY_WAIT_S", 0.0)@@ -437,7 +439,6 @@ async def test_hostility_timeline_spaces_live_calls_and_not_cache_hits(waits.append(delay)monkeypatch.setattr(asyncio_mod, "sleep", _record)- monkeypatch.setattr(ns, "_gdelt_last_call", 0.0)route, calls = _gdelt_router()respx.get(url__regex=r".*api\.gdeltproject\.org.*").mock(side_effect=route)@@ -446,13 +447,39 @@ async def test_hostility_timeline_spaces_live_calls_and_not_cache_hits(# GDELT's one-per-5-s floor.assert len(calls) == 6assert len(waits) == 5- assert all(5.0 < w <= ns._GDELT_SPACING_S for w in waits)+ assert all(4.5 < w <= fetcher_mod._SOURCE_RATE_LIMITS["gdelt"] for w in waits)again = await ns.fetch_hostility_timeline(fetcher, "Iran", "Israel", days=3, now=_NOW_GDELT)assert len(calls) == 6 and len(waits) == 5assert again["days"][1]["articles"] == _DAY_ARTICLES["2026-10-16"]+async def test_gdelt_search_and_timeline_share_one_rate_limit(+ fetcher, monkeypatch: pytest.MonkeyPatch+) -> None:+ # Every GDELT caller goes through the fetcher's per-source floor, so an+ # intel_gdelt_search call and the timeline's calls cannot burst+ # together (GDELT's 429 text: "one every 5 seconds").+ waits: list[float] = []++ async def _record(delay, *args, **kwargs) -> None:+ waits.append(delay)++ monkeypatch.setattr(asyncio_mod, "sleep", _record)+ route, _ = _gdelt_router()+ respx.get(url__regex=r".*api\.gdeltproject\.org.*").mock(side_effect=route)++ assert fetcher_mod._SOURCE_RATE_LIMITS["gdelt"] == 5.0+ await news.fetch_gdelt_search(fetcher, "Iran")+ assert waits == []+ await ns.fetch_hostility_timeline(fetcher, "Iran", days=3, now=_NOW_GDELT)+ # All six timeline calls wait, the first one included: it follows the+ # search.+ assert len(waits) == 6+ assert all(4.5 < w <= 5.0 for w in waits)++def test_parse_ts_rejects_naive_and_garbage() -> None:assert ns._parse_ts("2026-10-17T10:00:00+02:00") == datetime(2026, 10, 17, 8, tzinfo=timezone.utc)assert ns._parse_ts("2026-10-17T10:00:00Z") == datetime(2026, 10, 17, 10, tzinfo=timezone.utc)diff --git a/src/world_intel_mcp/tests/test_sources_news.py b/src/world_intel_mcp/tests/test_sources_news.pyindex 73da97c..2713bd3 100644--- a/src/world_intel_mcp/tests/test_sources_news.py+++ b/src/world_intel_mcp/tests/test_sources_news.py@@ -462,10 +462,12 @@ def test_parse_published_fallbacks() -> None:def test_parse_published_is_utc_on_a_non_utc_host(monkeypatch: pytest.MonkeyPatch,) -> None:- """feedparser's *_parsed structs are UTC. time.mktime read them as- local time, so on mac-studio (EDT) every published stamp came out- four hours in the future (measured live 2026-10-17: a feed's newest- item stamped 20:18Z at 16:20Z)."""+ """feedparser's *_parsed structs are UTC with tm_isdst=0. time.mktime+ read them as local standard time, so on mac-studio (US Eastern) every+ published stamp came out five hours ahead, daylight time or not+ (measured 2026-10-17: an item published 14:43:52 UTC was emitted as+ 19:43:52Z). The test sets its own zone, so it fails on the old code+ on a UTC host too."""import time as time_modmonkeypatch.setenv("TZ", "America/New_York")