mirror of
https://github.com/koala73/worldmonitor.git
synced 2026-05-12 10:06:23 +02:00
* feat(health): restore seed-meta tracking for riskScores, serviceStatuses, cableHealth, chokepoints These 4 keys were reporting STALE_SEED / going untracked because their warm-ping loops never wrote seed-meta. PR #1649 removed seed-meta from cachedFetchJson but no replacement tracking was added, so health.js lost visibility into their freshness. Changes: - ais-relay.cjs: seedCiiWarmPing() writes seed-meta:intelligence:risk-scores after success - ais-relay.cjs: seedServiceStatuses() writes seed-meta:infra:service-statuses after success - ais-relay.cjs: new startChokepointWarmPingLoop() — 30 min warm-ping for supply_chain:chokepoints:v4 - ais-relay.cjs: new startCableHealthWarmPingLoop() — 30 min warm-ping + seed-meta:cable-health write - get-cable-health.ts: switch to cachedFetchJsonWithMeta, write seed-meta:cable-health on fresh fetch - api/health.js: re-add SEED_META entries for serviceStatuses (30 min), cableHealth (60 min), riskScores (15 min) - api/health.js: remove riskScores, serviceStatuses, cableHealth from ON_DEMAND_KEYS — they now have proper freshness tracking * fix(health): only write seed-meta on genuinely fresh data (P1 review fixes) Fixes two P1 issues from PR review: 1. seedCableHealthWarmPing() was writing seed-meta:cable-health after any 200 response, defeating the source==='fresh' guard already present in getCableHealth(). Removed the relay write — the handler owns it. 2. seedServiceStatuses() was writing seed-meta:infra:service-statuses after any 200, but listServiceStatuses() can return in-memory fallback statuses on upstream scrape failures with a 200. The relay write was advancing fetchedAt even when stale fallback data was returned. Fix: switch handler to cachedFetchJsonWithMeta and only write seed-meta when source==='fresh' (i.e. upstream status pages were actually scraped). Removed the relay write entirely. * fix(health): only write risk-scores seed-meta when data is present The CII warm-ping wrote seed-meta after any 200 response, but the RPC can return cached/stale fallback data with 0 scores during upstream outages. This masked staleness in health checks. Now only writes seed-meta when count > 0 (meaningful data received).