Skip to content

fix(miner): honor --json on manage status and queue dashboard runtime failures - #6140

Closed
RealDiligent wants to merge 1 commit into
JSONbored:mainfrom
RealDiligent:fix/critical-issue-manage-status-json-errors
Closed

fix(miner): honor --json on manage status and queue dashboard runtime failures#6140
RealDiligent wants to merge 1 commit into
JSONbored:mainfrom
RealDiligent:fix/critical-issue-manage-status-json-errors

Conversation

@RealDiligent

Copy link
Copy Markdown
Contributor

Summary

  • runManageStatus and runPortfolioDashboard now wrap store init + collection in try/catch and route failures through reportCliFailure, matching the Make CLI error paths respect --json #4836 CLI contract used by sibling commands (calibration, plan list, queue list).
  • Store opens moved inside try; finally uses optional chaining so partial init still closes opened stores.

Problem (proposed upstream issue)

loopover-miner manage status --json and queue dashboard --json handled parse errors via reportCliFailure, but SQLite open/read/runtime failures escaped as uncaught stack traces — breaking cron/automation and MCP consumers (loopover_miner_get_manage_status, #5822).

Fork tracking issue: RealDiligent#7

Test plan

  • npx vitest run test/unit/miner-manage-status.test.ts test/unit/miner-portfolio-dashboard.test.ts (23/23 pass)
  • CI validate-tests + codecov patch

@RealDiligent
RealDiligent requested a review from JSONbored as a code owner July 15, 2026 14:30
@superagent-security

Copy link
Copy Markdown
Contributor

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

@codecov

codecov Bot commented Jul 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.33%. Comparing base (4a5bd94) to head (51931da).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6140   +/-   ##
=======================================
  Coverage   95.33%   95.33%           
=======================================
  Files         599      599           
  Lines       47186    47188    +2     
  Branches    15032    15032           
=======================================
+ Hits        44983    44985    +2     
  Misses       1477     1477           
  Partials      726      726           
Flag Coverage Δ
shard-1 43.93% <0.00%> (-0.02%) ⬇️
shard-2 36.68% <0.00%> (+0.01%) ⬆️
shard-3 32.12% <30.00%> (+0.01%) ⬆️
shard-4 32.22% <0.00%> (-1.78%) ⬇️
shard-5 32.64% <70.00%> (+1.15%) ⬆️
shard-6 45.23% <0.00%> (+0.03%) ⬆️

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

Files with missing lines Coverage Δ
packages/loopover-miner/lib/manage-status.js 97.89% <100.00%> (+0.02%) ⬆️
packages/loopover-miner/lib/portfolio-dashboard.js 100.00% <100.00%> (ø)

… failures

Wrap store init/collection in try/catch and route errors through
reportCliFailure so automation and MCP consumers get parseable
{ ok: false, error } output instead of uncaught stack traces.

Tracking: #7
Co-authored-by: Cursor <cursoragent@cursor.com>
@loopover-orb loopover-orb Bot added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jul 15, 2026
@loopover-orb

loopover-orb Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Caution

🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥

🛑 LoopOver review result - reject/close recommended

Review updated: 2026-07-15 14:36:37 UTC

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

🛑 Suggested Action - Reject/Close

Review summary
This PR wraps store init and collection in try/catch for runManageStatus and runPortfolioDashboard, routing thrown errors through reportCliFailure/describeCliError so SQLite open/runtime failures produce a parseable {ok:false,error} JSON object instead of an uncaught stack trace, matching the existing dry-run pattern already used in manage-poll.js. Store handles are correctly hoisted to let-declared vars assigned inside try, and finally uses optional chaining so a failure during any one store's init doesn't throw a secondary error closing an undefined store. The change is narrow, follows the established CLI contract, and is exercised by new tests for both --json and plain-text failure paths in manage-status.

Nits — 4 non-blocking
  • test/unit/miner-portfolio-dashboard.test.ts only adds a --json failure test; unlike miner-manage-status.test.ts it doesn't also cover the non-JSON console.error branch for symmetry/coverage.
  • Verify describeCliError (packages/loopover-miner/lib/cli-error.js) actually differs from using error.message directly, since manage-poll.js's existing dry-run failure path just passes the raw Error to console.error/reportCliFailure.
  • Add a plain-text (non --json) failure test for runPortfolioDashboard mirroring the one added for runManageStatus, to keep coverage symmetric between the two commands.
  • Consider a short comment or shared helper documenting the store-init-inside-try + optional-chaining-close pattern so future CLI commands (per the Make CLI error paths respect --json #4836 contract) follow it consistently.

Why this is blocked

  • No linked issue detected — If this PR is intended to solve an issue, link it explicitly in the PR body.
  • Maintainer requires a linked issue — Link the relevant issue (for example Closes #123) before opening the PR.
📋 Copy for AI agents — paste into your coding agent
Fix the following blocker(s) from this PR review:

1. No linked issue detected — If this PR is intended to solve an issue, link it explicitly in the PR body.

2. Maintainer requires a linked issue — Link the relevant issue (for example `Closes #123`) before opening the PR.
Signal Result Evidence
Code review ❌ 2 blockers 1 reviewer
Linked issue ⚠️ Missing No linked issue or no-issue rationale found.
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 (no linked issue context).
Validation posture ✅ 25/25 PR body includes validation/test evidence.
Contributor workload ✅ 10/10 Author activity: 363 registered-repo PR(s), 180 merged, 30 issue(s).
Contributor context ✅ Confirmed Gittensor contributor RealDiligent; Gittensor profile; 363 PR(s), 30 issue(s).
Gate result ❌ Blocking Repo-configured hard blocker found.
Improvement ✅ Minor risk: clean · value: minor · LLM: moderate
Review context
  • Author: RealDiligent
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: Python, TypeScript, JavaScript, Ruby, Svelte, Markdown, MDX
  • Official Gittensor activity: 363 PR(s), 30 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Start here: Explain no-issue PR.
  • Then work through the remaining 1 step in the Signals table above.
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 &lt;question&gt; answers contribution-quality Q&A with source citations and freshness.
  • @loopover chat &lt;question&gt; 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://gittensory.aethereal.dev/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

@loopover-orb

loopover-orb Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

LoopOver is closing this pull request on the maintainer's behalf (No linked issue detected; Maintainer requires a linked issue). This is an automated maintenance action — to pursue this change, please open a new pull request with the issues resolved. Closed PRs may be analyzed later to improve review accuracy, but they are not automatically reopened or re-reviewed.

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.

1 participant