feat(ui): add gate-precision analytics card (#2191) - #4314
Conversation
Closes JSONbored#2191. Adds a self-host maintainer analytics card that renders gate merge-precision and the TP/FP/FN/TN confusion matrix already computed by computeGateEval, read-only on the operator analytics page. - Surface the eval on the existing operator-dashboard fetch: add a `gateEval` field to OperatorDashboardPayload populated by the existing computeGateEval (no new compute; fails safe to an empty report when there is no review_audit signal). The response schema is an untyped record, so OpenAPI is unaffected. - GatePrecisionCard reuses Stat + StatusPill from control-primitives, aggregates the per-project GateEvalReport rows into one confusion matrix via a pure helper, shows merge precision as a percentage, and flags below-floor sample size via the StatusPill. Rendered on app.analytics.tsx alongside the weekly-value section. - Tests: pure aggregation (populated + empty/null-precision arms) and the card (populated, null-precision, below-floor, and empty→renders nothing) states; the backend payload test asserts the fail-safe empty report. Public-safe counts only — no actor, PR content, or scoring internals.
|
Warning 🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨 ⏸️ Gittensory review result - manual review recommendedReview updated: 2026-07-09 17:33:36 UTC
⏸️ Suggested Action - Manual Review
Review summary Nits — 6 non-blocking
Review context
Contributor next steps
Signal definitions
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.
|
|
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 #4314 +/- ##
=======================================
Coverage 93.96% 93.96%
=======================================
Files 401 401
Lines 36863 36863
Branches 13478 13478
=======================================
Hits 34638 34638
Misses 1569 1569
Partials 656 656
🚀 New features to boost your workflow:
|


Summary
Closes #2191. Adds a self-host maintainer gate-precision analytics card to the operator analytics page. It renders the gate's merge precision and the TP/FP/FN/TN confusion matrix already computed by
computeGateEval(src/review/parity.ts), read-only — no new gate/eval computation.gateEvalfield toOperatorDashboardPayload, populated by the existingcomputeGateEval. It fails safe to an empty report ({ rows: [], hasSignal: false }) when there is noreview_auditsignal. The/v1/app/operator-dashboardresponse schema is an untyped record, so the OpenAPI spec is unaffected.GatePrecisionCardreusesStat+StatusPillfromcontrol-primitives.tsx, folds the per-projectGateEvalReportrows into one confusion matrix via a pure helper (aggregateGateEval), shows merge precision as a percentage, and flags below-floor sample size via theStatusPill(documented 10-decided floor, matching parity's signal threshold). Rendered onapp.analytics.tsxalongside the weekly-value section; renders nothing until the gate has produced eval rows.Scope
type(scope): short summaryConventional Commit format.CONTRIBUTING.mdand does not reintroduce GitHub Pages, VitePress,site/, orCNAME.Closes #2191).Validation
git diff --checknpm run actionlintnpm run typechecknpm run test:coverage— the only changedsrc/**line (thegateEvalfield on the operator-dashboard payload) is covered 100% bytest/unit/operator-dashboard.test.ts. The UI (apps/**, Codecov-exempt) is covered bygate-precision-card.test.tsx: the pure aggregation (populated + empty/null-precision arms) and the card (populated, null-precision, below-floor, empty→renders-nothing) states.npm run ui:openapi:check(unaffected — untyped record response)npm run ui:lintnpm run ui:typechecknpm run ui:testnpm run ui:buildIf any required check was skipped, explain why:
build:mcp/test:mcp-pack/build:miner/test:miner-pack/test:workersare unaffected by this UI + operator-dashboard-field change and run in CI.npm auditis unchanged (no dependency changes).Safety
/v1/app/operator-dashboard; no auth surface added.dashboard.data.gateEval) with a real empty state (renders nothing when there are no eval rows).UI Evidencebelow.UI Evidence
/app/analyticsbefore: analytics page without the gate-precision card
after: gate-precision card with precision + confusion matrix
Notes