Skip to content

fix(selfhost): export-miner-prometheus-textfile.sh defaults to a nonexistent gittensory-miner binary #5934

Description

@JSONbored

Context

scripts/export-miner-prometheus-textfile.sh (#4839) bridges the AMS miner's four one-shot CLI metrics
commands into a node_exporter textfile-collector .prom file. Its binary-invocation default is stale:

MINER_BIN="${LOOPOVER_MINER_BIN:-gittensory-miner}"

gittensory-miner is not an installable binary. packages/loopover-miner/package.json's bin field only
exposes:

"bin": {
  "loopover-miner": "bin/loopover-miner.js",
  "loopover-miner-mcp": "bin/loopover-miner-mcp.js"
},

confirmed as a deliberate, final cutover (no alias) by packages/loopover-mcp/CHANGELOG.md: "gittensory-miner,
gittensory-miner-mcp, and gittensory-mcp no longer exist as installed binaries; use loopover-miner,
loopover-miner-mcp, and loopover-mcp. No dual-read/alias... A global npm install/link of the old package
names must be reinstalled."

Practical effect: the script's own header comment says it's meant to be wired into "your own cron/systemd
timer alongside node_exporter" with zero other configuration implied. An operator who does exactly that —
runs the script with no LOOPOVER_MINER_BIN override, the documented/expected path — gets command not found: gittensory-miner (exit 127) on the very first export_family call. Because export_family is
fail-open per family (mirroring export-ams-reporting-db.sh's philosophy, per this script's own comment),
all four metric families silently fail on every run rather than the export erroring loudly once, so the
.prom file is simply never populated and the failure is easy to miss in a cron/systemd journal.

Requirements

  • Change the default MINER_BIN fallback from gittensory-miner to loopover-miner, matching the package's
    real bin entry.
  • Leave the LOOPOVER_MINER_BIN override mechanism itself unchanged — this only fixes the default value an
    operator gets when they don't set it.
  • Do not change OUT_FILE's default filename (gittensory_miner.prom) as part of this fix unless doing so
    cleanly — that's a cosmetic naming choice, not a functional break like the binary name; note in the PR
    description whether it was touched or deliberately left alone.

Deliverables

  • scripts/export-miner-prometheus-textfile.sh: default MINER_BIN fixed to loopover-miner.
  • A regression test (e.g. under test/unit/) asserting the script's default MINER_BIN fallback string
    is loopover-miner, not gittensory-miner.

Test Coverage Requirements

scripts/** is outside src/** / Codecov's coverage.include, so patch coverage does not gate this
directly. Add a real Vitest test (same pattern as test/unit/miner-docker-compose.test.ts: readFileSync the
script and assert on its content) so the correct default is enforced going forward.

Expected Outcome

Running sh scripts/export-miner-prometheus-textfile.sh with no LOOPOVER_MINER_BIN override successfully
invokes the real loopover-miner binary for all four metric families and produces a populated .prom file,
matching the zero-extra-configuration promise in the script's own header comment.

Links & Resources

Metadata

Metadata

Assignees

No one assigned

    Labels

    gittensor:bugGittensor-scored bug fix — scores a 0.05x multiplier.help wantedExtra attention is needed

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions