Skip to content

feat(miner-selfimprove): calibration accuracy-trend view over a snapshot series - #4630

Closed
davion-knight wants to merge 1 commit into
JSONbored:mainfrom
davion-knight:feat-calibration-trend
Closed

feat(miner-selfimprove): calibration accuracy-trend view over a snapshot series#4630
davion-knight wants to merge 1 commit into
JSONbored:mainfrom
davion-knight:feat-calibration-trend

Conversation

@davion-knight

Copy link
Copy Markdown
Contributor

Extends the single-snapshot calibration dashboard (#4261 / merged #4504, buildCalibrationDashboardView) into an accuracy trend over a series of accumulated snapshots — the trend-over-time view #4268 asks for, now that both prerequisites have landed (the browser-extension scaffold #4557 and the prediction-ledger #4263).

What this adds

A pure, read-only engine module packages/gittensory-engine/src/calibration-trend.ts (mirrors the sibling calibration-dashboard.ts):

  • buildCalibrationTrendView(snapshots){ direction, headline, sparkline, points, latestAccuracy, changeOverWindow, sampleCount, baselineAccuracy }
  • direction: improving / degrading / flat / insufficient
  • sparkline: a ▁▂▃▄▅▆▇█ line normalized across the window (no divide-by-zero on a flat window)
  • per-point deltaFromBaseline (whole percentage points) + aboveBaseline
  • calibrationSnapshotFromResult(result, observedAt) bridges a computed Phase7CalibrationLoopResult into a trend snapshot

Deliverables from the issue

  • ✅ Trend of combined accuracy vs the documented baseline (DOCUMENTED_CALIBRATION_BASELINE) over a rolling window, sourced from accumulated snapshots (a series input, not a single live call).
  • ✅ Read-only — surfaces only accuracies, baseline, and timestamps; no weights/thresholds/autonomy controls, no scores/rewards.
  • ✅ Graceful empty/sparse-history state — zero snapshots → "No calibration history yet"; a single point → explicit "insufficient history" rather than a broken chart; warming-up snapshots (null accuracy) are dropped from the line.

Validation

  • New suite test/unit/calibration-trend.test.ts covers the issue's required fixture series (empty, single-point, improving, degrading) plus flat, null-filtering, baseline-from-latest, and the result-bridge — every branch exercised.
  • npm run engine-parity:drift-check → ok.
  • Typechecks clean (no new errors); pure/deterministic, no I/O.

Closes #4268

…hot series

Extend the single-snapshot calibration dashboard (JSONbored#4261/JSONbored#4504) into an accuracy
*trend* over accumulated snapshots (JSONbored#4268): direction (improving/degrading/flat),
a normalized sparkline, per-point delta vs baseline, and latest/change-over-window.
Read-only and pure. A brand-new install has no snapshots and warming-up snapshots
carry a null accuracy, so empty/single-point history renders an explicit
insufficient-history state instead of a broken chart.

Closes JSONbored#4268
@davion-knight
davion-knight requested a review from JSONbored as a code owner July 10, 2026 08:16
@superagent-security

Copy link
Copy Markdown
Contributor

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

@codecov

codecov Bot commented Jul 10, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.29630% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 94.12%. Comparing base (63d5a0f) to head (606c3e1).
⚠️ Report is 15 commits behind head on main.

Files with missing lines Patch % Lines
...ackages/gittensory-engine/src/calibration-trend.ts 96.29% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4630   +/-   ##
=======================================
  Coverage   94.12%   94.12%           
=======================================
  Files         430      431    +1     
  Lines       38181    38208   +27     
  Branches    13922    13932   +10     
=======================================
+ Hits        35939    35965   +26     
  Misses       1585     1585           
- Partials      657      658    +1     
Files with missing lines Coverage Δ
...ackages/gittensory-engine/src/calibration-trend.ts 96.29% <96.29%> (ø)
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@loopover-orb loopover-orb Bot added gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier. gittensor:priority Maintainer-selected Gittensor priority — scores a 1.5x multiplier. labels Jul 10, 2026
@loopover-orb

loopover-orb Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Caution

🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥

🛑 Gittensory review result - fixes required

Review updated: 2026-07-10 08:30:28 UTC

3 files · 1 AI reviewer · no blockers · readiness 100/100 · CI failing · unstable

🛑 Suggested Action - Fix Blockers

Review summary
This adds a pure, read-only calibration-trend projection (calibration-trend.ts) that mirrors the existing single-snapshot calibration-dashboard.ts pattern, correctly handles empty/single-point/flat/null-filtered series without divide-by-zero, and is barrel-exported cleanly through index.ts. The logic is correct and every direction/headline branch is exercised by the new test suite; the only real gap is that formatPercent's null-value arm is dead code given its two call sites never pass null, which is almost certainly the source of the 96.29%-vs-99% patch coverage miss flagged by CI. No correctness, security, or wiring defects on the reachable path.

Nits — 5 non-blocking
  • calibration-trend.ts's formatPercent has a `value === null` branch that is unreachable from either of its two call sites (the sampleCount===1 headline and the sampleCount>=2 headline both only pass non-null values, and the sampleCount===0 case short-circuits before calling formatPercent at all) — this is almost certainly the codecov/patch shortfall; either delete the dead arm or route the sampleCount===0 headline through formatPercent so the branch is real and covered.
  • No test in calibration-trend.test.ts exercises the aboveBaseline equality boundary (combinedAccuracy === baselineAccuracy); worth adding one snapshot where they're equal to lock in the intended >= semantics.
  • sparkline() uses Math.min(...values)/Math.max(...values), fine at typical snapshot-window sizes but could blow the call stack on a pathologically large series — matches the sibling dashboard module's style, so just a minor awareness note.
  • Delete or actually exercise formatPercent's null arm in calibration-trend.ts to close the patch-coverage gap at its source rather than padding coverage elsewhere.
  • Add an equality-boundary test case (combinedAccuracy === baselineAccuracy) alongside the existing baseline-from-latest test.

CI checks failing

  • codecov/patch — 96.29% of diff hit (target 99.00%)
Signal Result Evidence
Code review ✅ No blockers 1 reviewer
Linked issue ✅ Linked #4268
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: 96 registered-repo PR(s), 58 merged, 3 issue(s).
Contributor context ✅ Confirmed Gittensor contributor davion-knight; Gittensor profile; 96 PR(s), 3 issue(s).
Gate result ✅ Passing No configured blocker found.
Linked issue satisfaction

Partially addressed
The PR delivers a well-tested, read-only trend-computation module (buildCalibrationTrendView) that correctly sources from a snapshot series, handles empty/single/multi-point fixtures, and stays free of any calibration-control surface, matching most of the issue's engine-side deliverables. However, the issue's core ask is a panel rendered inside the miner's browser-extension surface (dependent on t

Review context
  • Author: davion-knight
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: not available
  • Official Gittensor activity: 96 PR(s), 3 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Keep the PR focused and include validation evidence before maintainer review.
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.

🟩 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.

  • Re-run Gittensory review

@loopover-orb

loopover-orb Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Gittensory 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.

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. gittensor:priority Maintainer-selected Gittensor priority — scores a 1.5x multiplier.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(miner-selfimprove): calibration dashboard extension panel — accuracy trend view

1 participant