Skip to content

feat(miner): add a metrics command for the prediction Prometheus renderer - #5473

Closed
real-venus wants to merge 1 commit into
JSONbored:mainfrom
real-venus:feat/gittensory-miner-metrics-command
Closed

feat(miner): add a metrics command for the prediction Prometheus renderer#5473
real-venus wants to merge 1 commit into
JSONbored:mainfrom
real-venus:feat/gittensory-miner-metrics-command

Conversation

@real-venus

Copy link
Copy Markdown
Contributor

Summary

  • A fully-built, pure Prometheus text-exposition renderer for the miner's own prediction accuracy (renderMinerPredictionMetrics in packages/gittensory-engine/src/miner-prediction-metrics.ts) already existed, explicitly designed for cron/scrape use — but nothing in the CLI ever called it (Wire the existing miner-prediction Prometheus renderer into a real command #4838).
  • Adds a gittensory-miner metrics subcommand that reads the local prediction ledger, pairs each prediction with its realized PR outcome (event-ledger pr_outcome events, latest per PR) to mark it correct/incorrect, maps the rows to the renderer's shape, and writes the renderer's Prometheus output to stdout — suitable for a scrape wrapper or a cron redirect.
  • Per the issue's boundary, the renderer itself is unchanged — this only wires it into a command. The subcommand is read-only (opens both local stores read-only and closes them).
  • Predictions without a realized outcome still count toward gittensory_miner_predictions_total (by conclusion) but not toward correct/incorrect, so the surface is meaningful before outcome-pairing exists and grows once it does.

Scope

  • The PR title follows type(scope): short summary Conventional Commit format.
  • This PR is focused and does not mix unrelated backend, UI, MCP, docs, dependency, and deploy changes.
  • This follows CONTRIBUTING.md and does not reintroduce GitHub Pages, VitePress, site/, or CNAME.
  • I linked a currently open issue this PR resolves — Closes Wire the existing miner-prediction Prometheus renderer into a real command #4838.

Validation

  • git diff --check
  • npm run typecheck
  • npm run test:coverage — verified the new prediction-metrics-cli.js at 100% line + branch coverage locally via the v8 JSON report; 4 unit tests cover the prediction→outcome pairing (correct/incorrect/unresolved), the latest-outcome-per-PR dedup, skipping non-outcome and malformed events, the well-formed empty-ledger surface, and the unknown-option path.
  • npm run command-reference:check (green — the added help line does not desync the generated command reference).

If any required check was skipped, explain why:

  • actionlint, test:workers, build:mcp / test:mcp-pack, ui:openapi:check, ui:lint / ui:typecheck / ui:build, and npm audit were not run because this change touches only packages/gittensory-miner/** and test/** — no workflow, worker, MCP, OpenAPI/API, UI, or dependency surface for those jobs. The full npm run test:ci runs all of them on CI.

Safety

  • No secrets, wallet details, hotkeys, coldkeys, user PATs, private keys, raw trust scores, private rankings, or private maintainer evidence are exposed. The output aggregates the operator's own local prediction/outcome tallies into standard Prometheus counters.
  • Public GitHub text stays sanitized, low-noise, and does not imply compensation guarantees or optimization tactics.
  • Public docs/changelogs are updated where needed; no changelog is edited (this is not a release-prep PR).

Auth/CORS/session, API/OpenAPI/MCP, and UI safety boxes are not applicable — this PR changes none of those surfaces.

…erer

A pure Prometheus text-exposition renderer for miner prediction accuracy
(gittensory-engine renderMinerPredictionMetrics) already existed, explicitly
designed for cron/scrape use, but nothing ever called it. Add a
'gittensory-miner metrics' subcommand that reads the local prediction ledger,
pairs each prediction with its realized PR outcome (event-ledger pr_outcome
events) to mark it correct/incorrect, and writes the renderer's output to
stdout for a scrape wrapper or cron redirect. Read-only; the renderer itself is
unchanged.

Closes JSONbored#4838
@real-venus
real-venus requested a review from JSONbored as a code owner July 12, 2026 22:02
@superagent-security

Copy link
Copy Markdown
Contributor

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

@real-venus

Copy link
Copy Markdown
Contributor Author

Closing as a duplicate — #4838 was already resolved by #5470, which merged first. Thanks!

@real-venus real-venus closed this Jul 12, 2026
@loopover-orb loopover-orb Bot added the gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier. label Jul 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Wire the existing miner-prediction Prometheus renderer into a real command

1 participant