fix(miner): give queue dashboard the same store-failure handling as its siblings (#9690) - #9901
Conversation
|
Tip ✅ LoopOver review result - approve/merge recommendedReview updated: 2026-07-29 20:22:09 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.
|
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
… its siblings (JSONbored#9690) `queue dashboard` was the only `queue` subcommand that let a store failure escape `runQueueCli`. `runPortfolioDashboard` opened the portfolio-queue store OUTSIDE its `try` and had only a `finally`, so an opener failure (a corrupt portfolio-queue.sqlite3, an unreadable state dir, an invalid LOOPOVER_MINER_PORTFOLIO_QUEUE_DB) propagated out of the CLI as a raw Node stack trace and exit 1 -- where every sibling subcommand prints `{ "ok": false, "error": ... }` under --json and exits 2. Mirror `runQueueClaimBatch` (portfolio-queue-cli.ts:520-541): open the store inside the `try`, `catch` into `reportCliFailure(parsed.json, describeCliError(error))`, and close with `?.` in `finally` (the initializer may throw before assigning). Import `describeCliError`. The success path, parse-error path, and `ownsQueue` ownership rule are unchanged. Four named regression tests cover both `parsed.json` arms of the new catch, the owned-store mid-run-throw close, and the `?.` opener-failure guard; all four fail against the current code. Closes JSONbored#9690 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #9901 +/- ##
==========================================
+ Coverage 79.29% 79.31% +0.02%
==========================================
Files 281 282 +1
Lines 58566 58625 +59
Branches 6785 6808 +23
==========================================
+ Hits 46440 46499 +59
Misses 11843 11843
Partials 283 283
Flags with carried forward coverage won't be shown. Click here to find out more.
|
What
queue dashboardwas the onlyqueuesubcommand that let a store failure escaperunQueueCli.runPortfolioDashboardopened the portfolio-queue store outside itstryand had only afinally, so an opener failure — a corruptportfolio-queue.sqlite3, an unreadable state dir, an invalidLOOPOVER_MINER_PORTFOLIO_QUEUE_DB— propagated out of the CLI as a raw Node stack trace with exit1, where every sibling subcommand prints{ "ok": false, "error": ... }under--jsonand exits2.How
Mirror
runQueueClaimBatch(portfolio-queue-cli.ts:520-541) exactly:try.catch (error) { return reportCliFailure(parsed.json, describeCliError(error)); }.describeCliErrorfrom./cli-error.js.finallyclose with?.(the initializer may throw before assigning).The success path, the parse-error path, and the
ownsQueueownership rule are unchanged.Tests
Four named regression tests in
test/unit/miner-portfolio-dashboard.test.ts, each failing against the current code:2(was: threw out ofrunQueueCli).--jsonemits{ ok: false, error }on stdout and returns2.listQueuethrows mid-run still closes the owned store and returns2.2with nothing to close (the?.guard short-circuits).Together they cover both
parsed.jsonarms of the newcatchand both arms of theownsQueue/?.close.Closes #9690