fix(miner): log discovery-index query failures before failing open - #9346
Conversation
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #9346 +/- ##
==========================================
+ Coverage 75.38% 75.40% +0.02%
==========================================
Files 275 276 +1
Lines 58023 58071 +48
Branches 6181 6204 +23
==========================================
+ Hits 43739 43787 +48
Misses 14014 14014
Partials 270 270
Flags with carried forward coverage won't be shown. Click here to find out more.
|
|
Tip ✅ LoopOver review result - approve/merge recommendedReview updated: 2026-07-27 13:42:45 UTC
Review summary Nits — 2 non-blocking
Decision drivers
Context & advisory signals — never blocks the verdict
Linked issue satisfactionAddressed Review context
Contributor next steps
Signal definitions
🧪 Chat with LoopOverAsk LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.
Full command reference: https://loopover.ai/docs/loopover-commands 🧪 Experimental — new and may change. 🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by LoopOver, a quiet PR intelligence layer for OSS maintainers.
|
What
queryDiscoveryIndexinpackages/loopover-miner/lib/discovery-index-client.tshad a bare} catch { return EMPTY_QUERY_RESPONSE; }— any fetch/network/parse failure was silently droppedwith zero logging, even at
--verbose.Its sibling
submitSoftClaimin the same file — the equivalent best-effort fire-and-forget networkcall — already logs the failure before returning its fail-open result:
Change
Give
queryDiscoveryIndex's catch the same treatment: bind the error (catch (error)) andgetLogger().debug("discovery_plane_query_failed", { error: describeCliError(error) })beforereturning. The fail-open behavior and the
EMPTY_QUERY_RESPONSEreturn type are unchanged — this onlyadds visibility.
submitSoftClaimis untouched (it is the precedent). The event name mirrors itsdiscovery_plane_soft_claim_failedconvention.Validation
test/unit/miner-discovery-index-client.test.ts: when the injectedfetchImplthrows,queryDiscoveryIndexstill returns empty (candidates: []) andlogSpy.debugis called with"discovery_plane_query_failed"and{ error: "network exploded" }(describeCliErrorreturns theError's
message).npx vitest run test/unit/miner-discovery-index-client.test.ts→ 25 pass. The added lines areunconditional (no new branch) and are executed by the throw-path test.
Closes #9329