Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion packages/loopover-miner/lib/discovery-index-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
14 changes: 14 additions & 0 deletions test/unit/miner-discovery-index-client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)", () => {
Expand Down