Skip to content

feat(miner): wire Phase 7 calibration runner into calibration snapshot CLI#8464

Closed
andriypolanski wants to merge 3 commits into
JSONbored:mainfrom
andriypolanski:feat/8317-wire-phase7-calibration-snapshot-cli
Closed

feat(miner): wire Phase 7 calibration runner into calibration snapshot CLI#8464
andriypolanski wants to merge 3 commits into
JSONbored:mainfrom
andriypolanski:feat/8317-wire-phase7-calibration-snapshot-cli

Conversation

@andriypolanski

Copy link
Copy Markdown
Contributor

Summary

Scope

  • The PR title follows type(scope): short summary Conventional Commit format, for example fix(api): restore profile access checks.
  • 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 (e.g. Closes #123) — a linked open issue is required for every contributor PR.

Validation

  • git diff --check
  • npm run actionlint
  • npm run typecheck
  • npx vitest run test/unit/miner-calibration-cli.test.ts test/unit/miner-calibration-run.test.ts — 49 passed
  • npm run build --workspace @loopover/miner
  • npm run test:coverage
  • npm run test:workers
  • npm run build:mcp
  • npm run test:mcp-pack
  • npm run ui:openapi:check
  • npm run ui:lint
  • npm run ui:typecheck
  • npm run ui:build
  • npm audit --audit-level=moderate
  • New or changed behavior has unit/integration tests for new branches, fallback paths, and sanitizer boundaries

If any required check was skipped, explain why:

  • Miner package is not Codecov-gated (packages/loopover-miner/**). Untouched CI surfaces left to CI. Local miner build regenerated ignored lib/*.js for tests.

Safety

  • No secrets, wallet details, hotkeys, coldkeys, user PATs, private keys, raw trust scores, private rankings, or private maintainer evidence are exposed.
  • Public GitHub text stays sanitized, low-noise, and does not imply compensation guarantees or optimization tactics.
  • Auth, cookie, CORS, GitHub App, Cloudflare, or session changes include negative-path tests.
  • API/OpenAPI/MCP behavior is updated and tested where needed.
  • UI changes use live API data or real empty/error/loading states, not production mock/demo fallbacks.
  • Visible UI changes include a UI Evidence section below with JPG/JPEG or PNG screenshots arranged as organized, captioned, clickable thumbnails. SVG screenshots are not used as review evidence. Review-only screenshots or recordings are not committed to the repository.
  • Public docs/changelogs are updated where needed; changelogs are only edited for release-prep PRs.

UI Evidence

Not applicable — miner CLI calibration wiring only.

Notes

  • Example: loopover-miner calibration snapshot --json
  • Text form: one line per project + a persisted-count footer; empty report prints the no-decided-predictions message and writes nothing.

andriy-polanski and others added 3 commits July 24, 2026 13:09
…t CLI (JSONbored#8317)

Add `calibration snapshot [--json]` so real prediction/outcome data
persists per-project calibration_snapshot ledger events, including the
AMS backtest track record when runs exist.

Co-authored-by: Cursor <cursoragent@cursor.com>
@superagent-security

Copy link
Copy Markdown
Contributor

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

@codecov

codecov Bot commented Jul 24, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 37 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.65%. Comparing base (1dba0ec) to head (09fea0c).
⚠️ Report is 17 commits behind head on main.

Files with missing lines Patch % Lines
packages/loopover-miner/lib/calibration-cli.ts 0.00% 36 Missing ⚠️
packages/loopover-miner/lib/calibration-run.ts 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8464      +/-   ##
==========================================
- Coverage   92.43%   88.65%   -3.78%     
==========================================
  Files         791       99     -692     
  Lines       79320    22943   -56377     
  Branches    23952     3966   -19986     
==========================================
- Hits        73317    20341   -52976     
+ Misses       4866     2424    -2442     
+ Partials     1137      178     -959     
Flag Coverage Δ
shard-1 0.00% <0.00%> (-57.77%) ⬇️
shard-2 0.00% <0.00%> (-47.67%) ⬇️
shard-3 ?

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
packages/loopover-miner/lib/calibration-run.ts 0.00% <0.00%> (-100.00%) ⬇️
packages/loopover-miner/lib/calibration-cli.ts 0.00% <0.00%> (-95.54%) ⬇️

... and 692 files with indirect coverage changes

@loopover-orb loopover-orb Bot added the gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier. label Jul 24, 2026
@loopover-orb

loopover-orb Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Caution

🛑 LoopOver review result - fixes required

Review updated: 2026-07-24 14:36:55 UTC

4 files · 1 AI reviewer · no blockers · CI failing · unstable

🛑 Suggested Action - Fix Blockers

Review summary
This PR adds a `calibration snapshot [--json]` subcommand that, for each per-project row from `buildCalibrationReport`, maps `prOutcome` fields via `prOutcomeFromCalibrationRow` and calls `runHistoricalReplayCalibrationCycle`, forwarding a shared, ledger-wide AMS backtest track record (or `null` when no backtest runs exist) into every persisted snapshot event. The field mapping in `prOutcomeFromCalibrationRow` (packages/loopover-miner/lib/calibration-cli.ts:132) matches the `CalibrationRow` shape used elsewhere in this file (renderReportText already reads `mergeConfirmed`/`mergeFalse`/etc.), the no-signal / error / finally paths mirror the existing `runBacktestThreshold` pattern, and the accompanying tests exercise the multi-project, null/populated-track-record, error, and text-rendering branches thoroughly. The command is CLI-only (no scheduler wires it up automatically), so it fulfills the PR's stated 'wire the runner into the CLI' scope but is still an operator-triggered, not automatic, connection.

Nits — 5 non-blocking
  • packages/loopover-miner/lib/calibration-cli.ts:201 — the `depth 5` nesting flagged by static analysis is just the for-loop + ternaries inside the non-JSON print branch; readable as-is but could be flattened into a helper if it grows further.
  • The `calibration snapshot` subcommand currently has no automated caller (cron/scheduler) — worth confirming with the issue author whether feat(miner): wire the Phase 7 calibration runner (calibration-run.ts) into calibration-cli.ts — it has zero real callers #8317 expects only the CLI wiring (as delivered) or also a scheduled invocation, since the linked-issue coverage brief flags this as partial.
  • packages/loopover-miner/lib/calibration-cli.ts:161-163 — the shared `backtestTrackRecord` is computed once and attached identically to every project's snapshot; that's consistent with the track record being ledger-wide rather than per-project, but a one-line comment noting it's intentionally global (not per-project) would preempt confusion later.
  • Consider documenting in the CLI help/usage text or docs/miner-selfimprove-calibration.md that `calibration snapshot` must be invoked manually/periodically rather than being wired into an existing scheduled job, so operators know it doesn't run itself.
  • packages/loopover-miner/lib/calibration-cli.ts: the JSON-mode output structure (`{ snapshots: [...] }`) differs from the bare-mode report's flat shape used by the top-level `calibration --json`; a brief doc comment cross-referencing the two JSON contracts would help downstream consumers (e.g. MCP tool, feat(mcp): expose the miner-local calibration report as a read-only MCP tool (loopover_miner_get_calibration_report) #5821) avoid confusing the two.

CI checks failing

  • codecov/patch — 0.00% of diff hit (target 99.00%)

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 #8317
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: 222 registered-repo PR(s), 135 merged, 22 issue(s).
Contributor context ✅ Confirmed Gittensor contributor andriypolanski; Gittensor profile; 222 PR(s), 22 issue(s).
Improvement ✅ Minor risk: clean · value: minor · LLM: moderate
Linked issue satisfaction

Addressed
The PR adds a `calibration snapshot [--json]` subcommand mirroring the required backtest-threshold shape, maps each CalibrationRow to PrOutcomeCalibrationInput and calls runHistoricalReplayCalibrationCycle once per project (not aggregated), and threads backtestTrackRecord from computeAmsBacktestTrackRecord into the snapshot payload so it's no longer permanently null, with corresponding unit tests

Review context
  • Author: andriypolanski
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: Python, TypeScript, Rust, Cuda, JavaScript, Kotlin, MDX, Scala
  • Official Gittensor activity: 222 PR(s), 22 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Start here: Triage stale or unlinked PRs.
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 commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

LoopOver is closing this pull request on the maintainer's behalf (CI is failing (codecov/patch)). 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.

@loopover-orb loopover-orb Bot closed this Jul 24, 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.

feat(miner): wire the Phase 7 calibration runner (calibration-run.ts) into calibration-cli.ts — it has zero real callers

2 participants