fix(relay): classify an empty region catalog as catalog-incomplete, not all-unreachable

This commit is contained in:
Jinwoo-H
2026-09-07 15:37:13 -04:00
parent 27e685a8d4
commit 2c2fa3d25c
2 changed files with 16 additions and 1 deletions
@@ -185,6 +185,16 @@ describe('Relay region probe log', () => {
expect(probeEvents(events)[0]!.reason).toBe('all-unreachable')
})
it('reports an empty catalog as catalog-incomplete, since nothing was probed', async () => {
const { resolver, events } = resolverWithLog({
path: userDataPath(),
fetch: catalogFetch([]),
probe: sampledProbe({})
})
await expect(resolver.resolve()).resolves.toBeUndefined()
expect(probeEvents(events)[0]).toMatchObject({ reason: 'catalog-incomplete', regions: [] })
})
it('reports a lone flapping region as all-rejected, and a lone healthy one as catalog-incomplete', async () => {
const path = userDataPath()
const flapping = resolverWithLog({
@@ -131,7 +131,12 @@ function refreshReason(
return best && selected.region !== best.region ? 'held-previous' : 'measured'
}
// Reachability first: a support census counting all-unreachable to spot
// client-side network breakage must not lose those runs to a roll wave.
// client-side network breakage must not lose those runs to a roll wave. An
// empty catalog (every region drained at once) probed nothing, so it is the
// catalog that is incomplete, not the network.
if (reports.length === 0) {
return 'catalog-incomplete'
}
if (reports.every((report) => report.verdict === 'unreachable')) {
return 'all-unreachable'
}