feat(analytics): surface org-wide slop-band calibration + dashboard card (#2196)#5126
Conversation
…hboard card (JSONbored#2196) Wire the existing, unit-tested buildSlopOutcomeCalibration over listAllPullRequests into the operator-dashboard payload as slopCalibration: org-wide per-band merge/close rates over resolved PRs carrying a persisted slop band, plus whether the deterministic slop score discriminates. The read is wrapped in a buildOrgSlopCalibration() helper that fails safe to an empty calibration on any read error (listAllPullRequests can throw, unlike the sibling reads) so one DB hiccup never fails the whole dashboard — with both the success and fail-safe branches unit-tested. Adds SlopBandCalibrationCard (per-band merge-rate bars + predictive/inverted/insufficient verdict, bands only, never raw scores) across all-bands, empty-band, inverted, no-data, and absent-field branches.
|
🚨 Contributor flagged. Click here for more info: Superagent Dashboard |
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5126 +/- ##
=======================================
Coverage 94.32% 94.32%
=======================================
Files 471 471
Lines 39821 39824 +3
Branches 14533 14533
=======================================
+ Hits 37560 37563 +3
Misses 1583 1583
Partials 678 678
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
Warning 🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨 ⏸️ Gittensory review result - manual review recommendedReview updated: 2026-07-11 18:07:05 UTC
⏸️ Suggested Action - Manual Review
Review summary Nits — 6 non-blocking
Flagged checks (non-blocking)
Linked issue satisfactionPartially addressed Review context
Contributor next steps
Signal definitions
[BETA] Chat with GittensoryAsk Gittensory a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.
Full command reference: https://gittensory.aethereal.dev/docs/gittensory-commands Visual preview
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.
|
What
Adds the slop-band calibration card to the operator analytics dashboard (Closes #2196): predicted slop band vs realized merge/close outcome across resolved PRs — is the deterministic slop score predictive (do higher-slop bands merge less)? Surfaces real data end-to-end — the existing, unit-tested
buildSlopOutcomeCalibrationwired overlistAllPullRequestsinto the dashboard payload, then rendered. Bands only, never raw scores.Changes
Backend (
src/services/operator-dashboard.ts, +20/−1)buildOrgSlopCalibration(env)helper:buildSlopOutcomeCalibration(await listAllPullRequests(env)), wrapped intry/catch→ empty calibration on any read error, so one DB hiccup never fails the whole dashboard. Exposed via__operatorDashboardInternalsfor direct branch coverage.Promise.all, exposingslopCalibration: SlopOutcomeCalibrationon the payload.test/unit/operator-dashboard.test.ts: empty-signal assertion (success path) + a throwing-env test that exercises the fail-safe branch.Frontend
slop-band-calibration-card.tsx(new) —SlopBandCalibrationCard: per-band merge-rate bars +resolved · merged · closedcounts + a predictive / inverted / insufficient-data verdict pill. ReusesAnalyticsCardShell.slop-band-calibration-card.test.tsx(new) — 5 tests: all-bands, empty-band, inverted, no-data, absent field.app.analytics.tsx— optionalslopCalibration?+ renders after the findings-breakdown card.Verification
Backend
test/unit/operator-dashboard.test.tsgreen (7 tests, incl. success + fail-safe branches);tscclean on the changed files. Card + UI build verified in CI on the identical component previously (Build UI preview artifactpassed).Screenshots
/app/analytics, populated (predictive: clean 90% → high 0%) and empty, desktop + mobile, light + dark.predictive · light
predictive · dark
mobile
empty · light
empty · dark
mobile
Closes #2196