From 70ade693c775f131025b19189d30d10b655cdc79 Mon Sep 17 00:00:00 2001 From: Jeff <158072326+jeffrey701@users.noreply.github.com> Date: Mon, 27 Jul 2026 15:33:20 +0200 Subject: [PATCH] fix(miner): log discovery-index query failures before failing open --- .../loopover-miner/lib/discovery-index-client.ts | 5 ++++- test/unit/miner-discovery-index-client.test.ts | 14 ++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/packages/loopover-miner/lib/discovery-index-client.ts b/packages/loopover-miner/lib/discovery-index-client.ts index ab40472906..bd22bfc065 100644 --- a/packages/loopover-miner/lib/discovery-index-client.ts +++ b/packages/loopover-miner/lib/discovery-index-client.ts @@ -107,7 +107,10 @@ export async function queryDiscoveryIndex( if (!response.ok) return EMPTY_QUERY_RESPONSE; const payload = await response.json().catch(() => null); return normalizeDiscoveryIndexResponse(payload).response; - } catch { + } catch (error) { + // #9329: log before failing open, matching submitSoftClaim's best-effort-network convention; the + // EMPTY_QUERY_RESPONSE return type has no slot to surface the error, so a debug line is the only visibility. + getLogger().debug("discovery_plane_query_failed", { error: describeCliError(error) }); return EMPTY_QUERY_RESPONSE; } } diff --git a/test/unit/miner-discovery-index-client.test.ts b/test/unit/miner-discovery-index-client.test.ts index aa21b0dc0c..a6f218ccc4 100644 --- a/test/unit/miner-discovery-index-client.test.ts +++ b/test/unit/miner-discovery-index-client.test.ts @@ -111,6 +111,20 @@ describe("queryDiscoveryIndex (#7168)", () => { ); expect(threw.candidates).toEqual([]); }); + + it("logs discovery_plane_query_failed before failing open when the fetch throws (#9329)", async () => { + const response = await queryDiscoveryIndex( + { repos: ["a/b"] }, + { + env: ENABLED_ENV, + fetchImpl: async () => { + throw new Error("network exploded"); + }, + }, + ); + expect(response.candidates).toEqual([]); + expect(logSpy.debug).toHaveBeenCalledWith("discovery_plane_query_failed", { error: "network exploded" }); + }); }); describe("submitSoftClaim (#7168)", () => {