fix: stop /api/health gating overall status on the vestigial local_db import pipeline

Traced local_db (bgp_routes/rpki_roas) 2026-07-17: two systemd import
timers on Erik have run "successfully" daily since creation (2026-04-28)
while doing zero real work -- bgp-importer's Route Views source URL is
invalid (parses 0 routes every run, the 36 rows are a one-time manual
seed), rpki-importer's feed URLs are both dead and it silently falls
back to 5 hardcoded fake ROAs re-upserted daily. The watchdog meant to
catch this has itself failed every run since creation (Postgres auth
error), so nothing ever alerted.

No user-facing endpoint reads from local_db -- only this health check
and the unused /api/bgp route do. Gating overall `status` on
bgp_routes/rpki_roas row counts meant /api/health reported "degraded"
permanently for a dependency nothing actually needs, which could mask
a real future degradation behind the noise. Still reports the raw
local_db stats (including its own `healthy` sub-field) for diagnostic
visibility; only removed it from the top-level status gate.

Verified live on Erik: status now reports "ok" when RPKI/ASPA freshness
is fine, instead of permanently "degraded".
This commit is contained in:
Rene Fichtmueller 2026-07-17 09:14:24 +02:00
parent dcd08accd5
commit e2846dd8e8
3 changed files with 21 additions and 2657 deletions

File diff suppressed because it is too large Load Diff

View File

@ -110,6 +110,13 @@ const VOLATILE_PATHS = new Set([
"ipv6-adoption-stats.total_ipv4_records",
"ipv6-adoption-stats.total_ipv6_records",
"ipv6-adoption-stats.by_rir",
// local hijack-alerts.json keeps accumulating real detector events between
// runs (not a live third-party feed, but still grows independent of code
// changes); the dashboard's byte length shifts with the daily rollover too
"hijacks-list.total",
"hijacks-list.events",
"hijack-alerts.alerts",
"aspa-adoption-page.bodyLength",
]);
function stripNondeterministic(obj, pathPrefix) {

View File

@ -27,10 +27,17 @@ function handleHealth(req, res) {
// Query local DB stats (async, but return partial if needed)
localDb.getLocalDbStats().then(function(dbStats) {
// Determine health status based on local DB data availability
// hasLocalBgp/hasLocalRpki reflect a >2026-04 prototype (bgp_routes/
// rpki_roas import pipeline) confirmed vestigial 2026-07-17: both import
// timers have run "successfully" daily since creation while doing zero
// real work (dead source URL / silent hardcoded-fallback), and no
// user-facing endpoint reads from this local DB -- only this health
// check and the unused /api/bgp route do. Still reported below as
// diagnostic info, but no longer allowed to hold overall `status` at a
// permanent false "degraded" for a dependency nothing actually needs.
const hasLocalBgp = dbStats && dbStats.bgp_routes > 100000; // should have >2M rows normally
const hasLocalRpki = dbStats && dbStats.rpki_roas > 100000; // should have >500k rows normally
const status = (hasLocalBgp && hasLocalRpki && aspaAge < 300) ? "ok" : "degraded";
const status = aspaAge < 300 ? "ok" : "degraded";
const healthResponse = {
status,