fix: bogon check didn't recognize local-db-client status:error as unavailable
Follow-up from live testing the 2026-07-16 deploy: bogonDataUnavailable
only checked '!prefixData'/'!neighbourData' (falsy/null), but
local-db-client.js's DB-error signal is a truthy {status:'error', ...}
object, not null (server.js's own fabricated-success fix from earlier
today). So when the Postgres-backed prefix/neighbour source is what's
actually degraded, this check showed status:'pass' at 0 checked prefixes
instead of the more honest 'info' -- data wasn't fabricated (0 was
visible), just the status label didn't reflect it. Fixed with an explicit
isSourceUnavailable() check for both falsy and status:'error'.
This commit is contained in:
parent
a3ed032687
commit
46f96755ac
15
server.js
15
server.js
@ -4187,15 +4187,22 @@ const server = http.createServer(async (req, res) => {
|
||||
var asnInPaths = neighbours.map(function(n) { return n.asn; });
|
||||
var bogonAsns = asnInPaths.filter(checkBogonAsn);
|
||||
// "pass" must mean prefixes/neighbours were actually fetched and checked clean --
|
||||
// not that the upstream RIPE Stat calls failed and left nothing to check.
|
||||
var bogonDataUnavailable = !prefixData && !neighbourData;
|
||||
// not that the upstream source failed and left nothing to check. A source is
|
||||
// unavailable if it's falsy (fetchRipeStatCached network failure) OR if it's a
|
||||
// truthy object with status:"error" (local-db-client.js's DB-error signal --
|
||||
// see the 2026-07-16 audit; that object is NOT null, so a plain `!x` check
|
||||
// alone misses this case and would show "pass" on 0 checked prefixes).
|
||||
function isSourceUnavailable(x) { return !x || x.status === "error"; }
|
||||
var prefixesUnavailable = isSourceUnavailable(prefixData);
|
||||
var neighboursUnavailable = isSourceUnavailable(neighbourData);
|
||||
var bogonDataUnavailable = prefixesUnavailable && neighboursUnavailable;
|
||||
var bogonResult = {
|
||||
status: bogonDataUnavailable ? "info" : (bogonPrefixes.length === 0 && bogonAsns.length === 0 ? "pass" : "fail"),
|
||||
bogon_prefixes: bogonPrefixes,
|
||||
bogon_asns_in_paths: bogonAsns,
|
||||
total_prefixes_checked: allPrefixes.length,
|
||||
prefixes_source_unavailable: !prefixData,
|
||||
neighbours_source_unavailable: !neighbourData,
|
||||
prefixes_source_unavailable: prefixesUnavailable,
|
||||
neighbours_source_unavailable: neighboursUnavailable,
|
||||
};
|
||||
|
||||
// Phase 2: All API-dependent validations in parallel
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user