Skip to content

feat(ui): confidence-calibration curve card on the analytics dashboard (#2192) - #4818

Merged
JSONbored merged 4 commits into
JSONbored:mainfrom
andriypolanski:feat/ui-calibration-card-2192
Jul 11, 2026
Merged

feat(ui): confidence-calibration curve card on the analytics dashboard (#2192)#4818
JSONbored merged 4 commits into
JSONbored:mainfrom
andriypolanski:feat/ui-calibration-card-2192

Conversation

@andriypolanski

@andriypolanski andriypolanski commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a read-only Confidence calibration card to /app/analytics visualizing predicted merge-confidence bands vs realized kept-rate from computeCalibration, plus the recommended confidence floor. Extends Calibration with per-bin aggregates and surfaces the payload on the operator dashboard.

Closes #2192, Part of #1967.

Changes

Area Change
src/review/ops.ts CalibrationBin + buildCalibrationBins(); bins on Calibration
src/services/operator-dashboard.ts Surface calibration via computeCalibration
apps/gittensory-ui/src/components/site/app-panels/calibration-card-model.ts UI types + trend/status helpers
apps/gittensory-ui/src/components/site/app-panels/calibration-card.tsx TrendChart curve, per-bin rows, recommended-floor Stat + BoundaryBadge
apps/gittensory-ui/src/routes/app.analytics.tsx Wire card after cycle time
Tests calibration-card.test.tsx, ops.test.ts, operator-dashboard.test.ts

UI Evidence

Required before opening the PR — upload screenshots via GitHub drag-and-drop (do not commit images):

Page / Feature Before After
/app/analytics image image

Test plan

  • CalibrationCard — empty bins
  • CalibrationCard — single populated bin
  • CalibrationCard — full multi-bin curve + recommended floor
  • buildCalibrationBins — empty / single / full-curve cases
  • computeCalibration — bins folded from merged + reverted samples
  • Operator dashboard payload includes empty calibration.bins
  • npm run ui:testcalibration-card.test.tsx (8/8)
  • npm run ui:typecheck
  • npm run test:unit -- test/unit/ops.test.ts test/unit/operator-dashboard.test.ts (44/44)
  • Manual: seed + refresh /app/analytics
  • Before/after screenshots uploaded to PR (required — issue is visual)

Notes

  • Issue is labeled visual (owner-led). Confirm eligibility before opening a contributor PR.
  • Recommended floor Stat includes BoundaryBadge boundary="private-api" — operator-only tuning signal.
  • Bins use fixed 10-point bands from 50% through 100% confidence.

@andriypolanski
andriypolanski marked this pull request as draft July 11, 2026 00:53
@superagent-security

Copy link
Copy Markdown
Contributor

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

@codecov

codecov Bot commented Jul 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.23%. Comparing base (2dbfc46) to head (da33d6e).
⚠️ Report is 13 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4818   +/-   ##
=======================================
  Coverage   94.23%   94.23%           
=======================================
  Files         441      441           
  Lines       38793    38809   +16     
  Branches    14129    14131    +2     
=======================================
+ Hits        36556    36572   +16     
  Misses       1577     1577           
  Partials      660      660           
Flag Coverage Δ
shard-1 55.33% <70.58%> (?)
shard-2 41.28% <100.00%> (?)
shard-3 38.38% <5.88%> (?)
shard-4 48.55% <70.58%> (?)

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

Files with missing lines Coverage Δ
src/review/ops.ts 99.24% <100.00%> (+0.10%) ⬆️
src/services/operator-dashboard.ts 100.00% <ø> (ø)
🚀 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 the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jul 11, 2026
@loopover-orb

loopover-orb Bot commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Warning

🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨

⏸️ Gittensory review result - manual review recommended

Review updated: 2026-07-11 02:26:11 UTC

8 files · 1 AI reviewer · no blockers · readiness 100/100 · CI green · clean

⏸️ Suggested Action - Manual Review

  • Touches a guarded path — held for manual review: This PR changes guardrail-protected path(s): src/services/operator-dashboard.ts (matched src/services/**).

Review summary
This PR adds a read-only confidence-calibration card to the analytics dashboard, extending `Calibration`/`computeCalibration` with `buildCalibrationBins()` (5 fixed confidence-band buckets folded from the same kept/reverted samples already computed for the existing avg/recommendedFloor logic) and threading `calibration` through `operator-dashboard.ts` and the new `CalibrationCard`/`calibration-card-model.ts` into `app.analytics.tsx`. The binning logic is correct (half-open bins except the last, which is inclusive of 1.0) and is derived from the same `isKept` boolean used for the existing kept/rev arrays, so there's no risk of the two calculations diverging. Tests cover empty/single/full-curve cases for both the pure bin-builder and the component, and wiring is complete end-to-end (ops.ts → operator-dashboard.ts → route → card) with no schema/migration change needed since this is a computed, non-persisted field.

Nits — 6 non-blocking
  • src/review/ops.ts:96-119 `buildCalibrationBins` silently drops any sample with `confidence < 0.5` (it never lands in a bin), so `bins` sample-size totals don't reconcile with `mergedCount`/`keptAvgConfidence` — worth a one-line comment noting the curve intentionally only covers the >=50% band, or the card copy should say so.
  • apps/gittensory-ui/.../calibration-card-model.ts:35-37 `calibrationTrendValues` maps a `null` keptRate (empty bin) to `0`, which is visually indistinguishable on the `TrendChart` from a real 0% kept-rate bin with samples — consider a distinct sentinel or gap in the series.
  • test/unit/operator-dashboard.test.ts has a stray blank line with trailing whitespace right after the new `calibration` assertion block — minor cleanup.
  • apps/gittensory-ui/.../calibration-card.tsx:74 the `96` chart height and src/review/ops.ts:114 the `.toFixed(3)` precision are unexplained magic numbers; naming them (or reusing an existing constant if one exists for other cards) would help future readers.
  • `CalibrationCard` is a ~100-line single component (per-bin rows, curve, stats all inline) — consider extracting a `CalibrationBinRow` subcomponent for consistency with how other analytics cards in this dir are typically decomposed.
  • Touches a guarded path — held for manual review — A maintainer must review and merge this change.
Signal Result Evidence
Code review ✅ No blockers 1 reviewer
Linked issue ✅ Linked #2192
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: 143 registered-repo PR(s), 96 merged, 25 issue(s).
Contributor context ✅ Confirmed Gittensor contributor andriypolanski; Gittensor profile; 143 PR(s), 25 issue(s).
Gate result ⚠️ Not blocking Advisory; not blocking this PR.
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, JavaScript, Rust, Cuda, Kotlin, MDX, Scala
  • Official Gittensor activity: 143 PR(s), 25 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.
Visual preview
Route Viewport Before (production) After (this PR's preview) Diff
/app/analytics desktop before /app/analytics after /app/analytics
/app/analytics mobile before /app/analytics (mobile) after /app/analytics (mobile)

Click any thumbnail to open the full-size screenshot. Before = production · After = this PR's preview deploy.

🟩 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 added gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier. and removed gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. labels Jul 11, 2026
@andriypolanski
andriypolanski marked this pull request as ready for review July 11, 2026 01:33
@loopover-orb loopover-orb Bot added the manual-review Gittensor contributor context label Jul 11, 2026
@JSONbored
JSONbored merged commit 680753f into JSONbored:main Jul 11, 2026
15 checks passed
@loopover-orb loopover-orb Bot added gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. and removed gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier. labels Jul 11, 2026
@JSONbored JSONbored removed the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jul 11, 2026
@JSONbored JSONbored added the gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier. label Jul 11, 2026
JSONbored added a commit that referenced this pull request Jul 11, 2026
… before downgrading a label (#4818) (#4980)

A pull_request_review/_comment/_thread webhook's embedded PR snapshot can predate an
imminent merge by a few ms; if that pass then gets delayed behind other queued work
long enough for the real merge (and the linked issue's consequent auto-close) to land
first, isLinkedIssueTrustworthy saw a closed issue with a null prMergedAt and silently
treated it as a confirmed negative, downgrading a correctly-propagated
gittensor:feature/priority label to gittensor:bug. Resolve that one ambiguous case with
a fresh live check of the PR's own merge state instead of trusting whichever webhook
happened to trigger the pass.

Closes #4975
JSONbored added a commit that referenced this pull request Jul 11, 2026
#4987)

pull_request_review/_comment/_thread events can never change a PR's title or
its linked-issue list -- the only two inputs the type-label decision depends
on -- yet each was still reaching the recompute with its own independently
stale embedded PR snapshot, which is exactly the mechanism #4818 exploited.
Exclude all three event families from the type-label block entirely rather
than continuing to patch individually-discovered staleness paths; a genuine
change is still caught by the next pull_request-native event or the sweep.

Closes #4986
@andriypolanski
andriypolanski deleted the feat/ui-calibration-card-2192 branch July 16, 2026 15:10
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. manual-review Gittensor contributor context

Development

Successfully merging this pull request may close these issues.

feat(ui): confidence-calibration curve card on the analytics dashboard

2 participants