Skip to content

fix(miner): report a clean CLI failure when manage status collection throws (#7236) - #7266

Merged
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
xfodev:fix/manage-status-catch-7236
Jul 19, 2026
Merged

fix(miner): report a clean CLI failure when manage status collection throws (#7236)#7266
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
xfodev:fix/manage-status-catch-7236

Conversation

@xfodev

@xfodev xfodev commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Summary

manage-status.js's runManageStatus opened three local SQLite stores and ran collectManageStatus /
collectRunPortfolio + the console.log inside a try { ... } finally { ...close... } with no catch.
A read/render failure therefore propagated as an unhandled throw out of the CLI command — inconsistent
with every other store-touching command, which fail cleanly through reportCliFailure (honoring --json).

This adds the missing catch between the existing try body and finally, matching the exact pattern
runOrbExportCli (orb-export.js) and runQueueList (portfolio-queue-cli.js) already use:
catch (error) { return reportCliFailure(parsed.json, describeCliError(error)); }. The store-opening lines
stay outside the try, and the finally's store-closing logic is untouched. describeCliError is now
imported alongside the existing argsWantJson, reportCliFailure.

Closes #7236

Scope

  • Conventional Commit title; focused (one module + its test); no site//CNAME/lovable; no new dependency.
  • Linked a currently open issue (Closes #7236).

Validation

  • git diff --check
  • npm run typecheck (root — clean)
  • npm run test:coverage100% of the changed line covered. New regression: when collectManageStatus
    throws, runManageStatus returns a clean exit code (2) and surfaces the message via console.error (text)
    or a { ok: false, error } JSON object (--json), never an unhandled throw. Existing tests pass unchanged.
  • npm run build:miner (node --check passes).

If any required check was skipped, explain why:

  • Backend change confined to packages/loopover-miner/lib/**; CI runs the full suite.

Safety

  • No secrets, wallets, hotkeys, coldkeys, PATs, trust scores, or private data exposed.
  • Public GitHub text stays sanitized and low-noise — the surfaced error is describeCliError's message string, same as the sibling commands.
  • No auth/CORS/session/API/OpenAPI/MCP surface change — error-handling only; success-path output is byte-identical.
  • No UI change — no UI Evidence needed.

@xfodev
xfodev requested a review from JSONbored as a code owner July 19, 2026 11:18
@superagent-security

Copy link
Copy Markdown
Contributor

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

@codecov

codecov Bot commented Jul 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.81%. Comparing base (4d80214) to head (ff32ca6).
⚠️ Report is 5 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7266   +/-   ##
=======================================
  Coverage   93.81%   93.81%           
=======================================
  Files         704      704           
  Lines       69448    69451    +3     
  Branches    18897    18897           
=======================================
+ Hits        65152    65155    +3     
  Misses       3302     3302           
  Partials      994      994           
Flag Coverage Δ
shard-1 43.21% <0.00%> (-0.40%) ⬇️
shard-2 37.34% <0.00%> (+0.12%) ⬆️
shard-3 32.98% <0.00%> (-0.14%) ⬇️
shard-4 32.75% <0.00%> (-1.58%) ⬇️
shard-5 32.78% <100.00%> (+0.59%) ⬆️
shard-6 46.05% <0.00%> (+0.27%) ⬆️

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%) ⬆️

@loopover-orb loopover-orb Bot added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jul 19, 2026
@loopover-orb

loopover-orb Bot commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Tip

✅ LoopOver review result - approve/merge recommended

Review updated: 2026-07-19 11:26:26 UTC

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

✅ Suggested Action - Approve/Merge

  • safe to merge

Review summary
This adds a missing `catch` block between the existing `try` and `finally` in `runManageStatus` so that a throw from `collectManageStatus`/`collectRunPortfolio` is reported via `reportCliFailure(parsed.json, describeCliError(error))` instead of propagating unhandled, matching the sibling pattern in `runOrbExportCli`/`runQueueList`. The `finally` block's store-closing logic is untouched, so the fix is additive and correctly scoped. The new test directly exercises the real path by injecting a throwing `listQueue` and asserts both the text (`console.error`) and `--json` (`{ok:false,error}`) failure shapes, which is a genuine regression test, not a fabricated one.

Nits — 2 non-blocking
  • The inline comment at manage-status.js:236-238 repeats the PR description almost verbatim; could be trimmed to a single line referencing the sibling pattern.
  • None needed — the change is minimal, correctly scoped, and covered by a real test of the new catch path.

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 #7236
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: 19 registered-repo PR(s), 9 merged, 0 issue(s).
Contributor context ✅ Confirmed Gittensor contributor xfodev; Gittensor profile; 19 PR(s), 0 issue(s).
Improvement ✅ Minor risk: clean · value: minor · LLM: minor
Linked issue satisfaction

Addressed
The diff adds the missing catch block between the existing try and finally in runManageStatus, imports describeCliError, and calls reportCliFailure(parsed.json, describeCliError(error)) exactly as required, plus adds a regression test covering both --json and plain-text failure paths returning exit code 2.

Review context
  • Author: xfodev
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: JavaScript, TypeScript
  • Official Gittensor activity: 19 PR(s), 0 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 &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://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

@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 86d5d31 into JSONbored:main Jul 19, 2026
16 checks passed
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.

fix(miner): manage-status.js's runManageStatus has no catch, unlike every sibling CLI command

1 participant