feat(miner): respect --json on CLI error paths - #5541
Conversation
Add shared cli-error helper and wire parse/runtime failure paths across miner subcommands so --json callers always receive parseable { ok: false, error } on stdout.
Co-authored-by: Cursor <cursoragent@cursor.com>
…ored#4836) Co-authored-by: Cursor <cursoragent@cursor.com>
…4836) Extend unit tests for JSON error output across queue, plan, state, claim, ledger, governor, loop, manage-poll, and calibration. Wrap calibration ledger open in try/catch so --json callers get structured errors. Co-authored-by: Cursor <cursoragent@cursor.com>
|
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 #5541 +/- ##
==========================================
+ Coverage 94.79% 94.87% +0.07%
==========================================
Files 567 568 +1
Lines 45090 45033 -57
Branches 14675 14675
==========================================
- Hits 42743 42724 -19
+ Misses 1613 1575 -38
Partials 734 734
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
…red#4836) Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
…#4836) Co-authored-by: Cursor <cursoragent@cursor.com>
|
Caution 🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥 🛑 Gittensory review result - reject/close recommendedReview updated: 2026-07-13 03:36:10 UTC
🛑 Suggested Action - Reject/Close Review summary Blockers
Nits — 5 non-blocking
Why this is blocked
📋 Copy for AI agents — paste into your coding agent
Review context
Contributor next steps
Signal definitions
[BETA] Chat with GittensoryAsk Gittensory 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://gittensory.aethereal.dev/docs/gittensory-commands 🟩 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 Gittensory, a quiet PR intelligence layer for OSS maintainers.
|
|
Gittensory is closing this pull request on the maintainer's behalf (AI reviewers agree on a likely critical defect: packages/gittensory-miner/lib/discover-cli.js:165 opens the required portfolio queue before the try/catch, so `gittensory-miner discover ... --json` still throws directly instead of emitting `{ ok: false, error }` when `initPortfolioQueueStore()` fails; move that open into the existing try and keep the close in `finally`.). 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. |
Summary
cli-errorhelper (reportCliFailure,argsWantJson,describeCliError) so miner CLI failure paths emit{ ok: false, error }on stdout when--jsonis set.--jsonfailures.--jsonfailure paths, and a dedicated coverage test for parse/runtime error branches (codecov patch).Closes #4836
Test plan
npx vitest run test/unit/miner-cli-error.test.ts test/unit/miner-cli-json-error-coverage.test.tsnpx vitest run test/unit/miner-portfolio-queue-cli.test.ts test/unit/miner-plan-store-cli.test.ts test/unit/miner-cli-run-state.test.ts test/unit/miner-claim-ledger-cli.test.ts test/unit/miner-governor-ledger-cli.test.ts test/unit/miner-loop-cli.test.ts test/unit/miner-manage-poll.test.ts test/unit/miner-calibration-cli.test.ts