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.
44 lines
1.6 KiB
Python
44 lines
1.6 KiB
Python
"""HUD load-time: no market 404 poll, deferred overlays, WS backoff, nginx snippet."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parent.parent
|
|
HTML = (ROOT / "app/static/index.html").read_text()
|
|
|
|
|
|
def test_summarizer_dockerfile_copies_intel_modules():
|
|
df = (ROOT / "news/summerizer/Dockerfile").read_text()
|
|
assert "intel.py" in df
|
|
assert "nous_client.py" in df
|
|
|
|
|
|
def test_nginx_ws_snippet_has_upgrade_headers():
|
|
conf = (ROOT / "deploy/osint-ws.nginx.conf").read_text()
|
|
assert "proxy_http_version 1.1" in conf
|
|
assert "Upgrade" in conf
|
|
assert "Connection" in conf
|
|
assert "/ws/" in conf
|
|
|
|
|
|
def test_market_ticker_does_not_poll_unwired_endpoint():
|
|
assert "setInterval(probeMarket" not in HTML
|
|
assert "initMarketTicker()" not in HTML or "probeMarket();" not in HTML.split("function initMarketTicker")[1][:400]
|
|
|
|
|
|
def test_startup_defers_nonessential_overlays():
|
|
init = HTML.split("function initMap")[1].split("function readMapPrefs")[0]
|
|
# Must not fire all four DB loads + live overlays in the same tick.
|
|
assert "setTimeout" in init or "requestAnimationFrame" in init
|
|
|
|
|
|
def test_ws_reconnect_uses_backoff():
|
|
assert "setTimeout(connectLiveWs, 4000)" not in HTML
|
|
ws = HTML.split("function connectLiveWs")[1][:1200]
|
|
assert "backoff" in ws.lower() or "wsRetry" in ws or "wsDelay" in ws
|
|
|
|
|
|
def test_check_health_treats_degraded_status():
|
|
fn = HTML.split("async function checkHealth")[1].split("/* ═══════════════ NAV")[0]
|
|
assert "degraded" in fn.lower() or "d.status" in fn
|