Skip to content

fix(miner): give queue dashboard the same store-failure handling as its siblings (#9690) - #9901

Merged
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
kai392:fix/9690-dashboard-error-handling
Jul 29, 2026
Merged

fix(miner): give queue dashboard the same store-failure handling as its siblings (#9690)#9901
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
kai392:fix/9690-dashboard-error-handling

Conversation

@kai392

@kai392 kai392 commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

What

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 with exit 1, where every sibling subcommand prints { "ok": false, "error": ... } under --json and exits 2.

How

Mirror runQueueClaimBatch (portfolio-queue-cli.ts:520-541) exactly:

  • Open the store inside the try.
  • catch (error) { return reportCliFailure(parsed.json, describeCliError(error)); }.
  • Import describeCliError from ./cli-error.js.
  • Guard the finally close with ?. (the initializer may throw before assigning).

The success path, the parse-error path, and the ownsQueue ownership rule are unchanged.

Tests

Four named regression tests in test/unit/miner-portfolio-dashboard.test.ts, each failing against the current code:

  1. An injected opener failure returns 2 (was: threw out of runQueueCli).
  2. The same under --json emits { ok: false, error } on stdout and returns 2.
  3. A store whose listQueue throws mid-run still closes the owned store and returns 2.
  4. An owned-store opener failure returns 2 with nothing to close (the ?. guard short-circuits).

Together they cover both parsed.json arms of the new catch and both arms of the ownsQueue / ?. close.

Closes #9690

@kai392
kai392 requested a review from JSONbored as a code owner July 29, 2026 20:13
@loopover-orb

loopover-orb Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Tip

✅ LoopOver review result - approve/merge recommended

Review updated: 2026-07-29 20:22:09 UTC

2 files · 1 AI reviewer · no blockers · readiness 100/100 · CI green · clean

✅ Suggested Action - Approve/Merge

  • safe to merge

Review summary
The PR correctly aligns the `queue dashboard` subcommand with its siblings by handling store failures within a `try/catch` block, using `describeCliError` for consistent error formatting, and safely closing the store with `?.` in the `finally` clause. The tests validate all failure scenarios, including opener failures and mid-run errors, ensuring the CLI now exits with `2` and structured error output under `--json`.

Nits — 2 non-blocking
  • The comment in the `try` block is lengthy; consider splitting it into a docblock for better readability.
  • Ensure `describeCliError` is consistently used across all subcommands for uniform error formatting.

Decision drivers

  • ✅ Code review — No blockers (1 reviewer)
  • ✅ Gate result — Passing (No configured blocker found.)
Context & advisory signals — never blocks the verdict
Signal Result Evidence
Linked issue ✅ Linked #9690
Related work ✅ No active overlap found No same-issue or scoped active PR overlap found.
Change scope ✅ 20/20 Low review scope from cached public metadata (1 linked issue).
Validation posture ✅ 25/25 PR body includes validation/test evidence.
Contributor workload ✅ 10/10 Author activity: 89 registered-repo PR(s), 43 merged, 7 issue(s).
Contributor context ✅ Confirmed Gittensor contributor kai392; Gittensor profile; 89 PR(s), 7 issue(s).
Improvement ✅ Minor risk: clean · value: minor · LLM: significant
Linked issue satisfaction

Addressed
The diff moves store construction inside the try, adds a catch returning reportCliFailure(parsed.json, describeCliError(error)), imports describeCliError, and guards the finally close with `?.`, exactly mirroring runQueueClaimBatch as required. It also adds four named regression tests covering opener failure (plain and --json), mid-run listQueue failure with owned-store close, and the `?.` short-c

Review context
  • Author: kai392
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: Python, Cuda, JavaScript, Kotlin, MDX, Perl, Ruby, TypeScript
  • Official Gittensor activity: 89 PR(s), 7 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Keep the PR focused and include validation evidence before maintainer review.
Signal definitions
  • Related work = same linked issue, overlapping active PRs, or title/path similarity.
  • Change scope = cached public metadata such as size labels, draft state, and review-burden hints.
  • Validation posture = whether the PR provides enough public validation/test evidence for maintainer review.
  • Contributor workload = public contributor activity and cleanup pressure, not a repo-wide quality failure.
  • Contributor context = public GitHub/Gittensor identity context; non-Gittensor status is not a blocker.
🧪 Chat with LoopOver

Ask 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.

  • @loopover ask <question> answers contribution-quality Q&A with source citations and freshness.
  • @loopover chat <question> answers in natural prose from cached decision-pack facts via local inference (maintainer/collaborator; read-only).
  • A plain-language @loopover mention with a real question is routed to the closest matching read-only command automatically — no exact syntax required.

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.

  • Re-run LoopOver review

@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@loopover-orb loopover-orb Bot added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jul 29, 2026
… 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

codecov Bot commented Jul 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.31%. Comparing base (49a3b17) to head (1877b64).
⚠️ Report is 1 commits behind head on main.

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              
Flag Coverage Δ
backend 100.00% <100.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
packages/loopover-miner/lib/portfolio-dashboard.ts 100.00% <100.00%> (ø)

@loopover-orb loopover-orb Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LoopOver approves — the gate is satisfied and CI is green.

@loopover-orb
loopover-orb Bot merged commit 133ff83 into JSONbored:main Jul 29, 2026
8 checks passed
@github-actions github-actions Bot mentioned this pull request Jul 30, 2026
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

miner(queue): queue dashboard is the only queue subcommand with no error handling

2 participants