Context
Same bug class as the discover-cli.js --dry-run --json gap and the two just-fixed commands (#5914/#6034, #6033): this repo's established JSON error-contract convention (packages/loopover-miner/lib/cli-error.js's reportCliFailure) requires every --json failure path to emit a parseable { ok: false, error } object on stdout instead of plain text on stderr.
packages/loopover-miner/lib/manage-poll.js's runManagePoll has the same gap in its --dry-run branch. The real (non-dry-run) failure path correctly calls reportCliFailure(parsed.json, ...), but the --dry-run branch's own catch block does a raw, unconditional:
} catch (error) {
console.error(error instanceof Error ? error.message : String(error));
return 2;
}
So loopover-miner manage-poll --dry-run --json on a failure prints plain text to stderr instead of parseable JSON. test/unit/miner-manage-poll.test.ts's "--dry-run reports poll failures" test only exercises the non---json case, so this combination is untested today.
Requirements
- The
--dry-run branch's catch block in runManagePoll (packages/loopover-miner/lib/manage-poll.js) must call reportCliFailure(parsed.json, describeCliError(error)) (or the equivalent this file's non-dry-run path already uses) instead of the raw console.error/return 2.
- Behavior for the non-
--json case must be unchanged.
- Scoped to
manage-poll.js only — do not touch other commands in this PR.
Deliverables
Test Coverage Requirements
99%+ patch coverage (branch-counted) on the changed branch in manage-poll.js.
Expected Outcome
loopover-miner manage-poll --dry-run --json on any failure prints valid, parseable {ok:false,error} JSON on stdout — matching every other command's --json error contract in this package.
Links & Resources
Context
Same bug class as the
discover-cli.js --dry-run --jsongap and the two just-fixed commands (#5914/#6034,#6033): this repo's established JSON error-contract convention (packages/loopover-miner/lib/cli-error.js'sreportCliFailure) requires every--jsonfailure path to emit a parseable{ ok: false, error }object on stdout instead of plain text on stderr.packages/loopover-miner/lib/manage-poll.js'srunManagePollhas the same gap in its--dry-runbranch. The real (non-dry-run) failure path correctly callsreportCliFailure(parsed.json, ...), but the--dry-runbranch's owncatchblock does a raw, unconditional:So
loopover-miner manage-poll --dry-run --jsonon a failure prints plain text to stderr instead of parseable JSON.test/unit/miner-manage-poll.test.ts's "--dry-runreports poll failures" test only exercises the non---jsoncase, so this combination is untested today.Requirements
--dry-runbranch'scatchblock inrunManagePoll(packages/loopover-miner/lib/manage-poll.js) must callreportCliFailure(parsed.json, describeCliError(error))(or the equivalent this file's non-dry-run path already uses) instead of the rawconsole.error/return 2.--jsoncase must be unchanged.manage-poll.jsonly — do not touch other commands in this PR.Deliverables
runManagePoll's--dry-runcatch block honors--jsonthe same way the non-dry-run path already doesloopover-miner manage-poll --dry-run --jsonon a failure emits{ok:false,error}parseable JSON on stdout, exit code unchanged--json--dry-runfailure test still passes unmodifiedTest Coverage Requirements
99%+ patch coverage (branch-counted) on the changed branch in
manage-poll.js.Expected Outcome
loopover-miner manage-poll --dry-run --jsonon any failure prints valid, parseable{ok:false,error}JSON on stdout — matching every other command's--jsonerror contract in this package.Links & Resources
packages/loopover-miner/lib/manage-poll.js(runManagePoll,--dry-runcatch block)packages/loopover-miner/lib/cli-error.js(reportCliFailure, the established contract)test/unit/miner-manage-poll.test.ts(existing--dry-runfailure test to extend)