Skip to content

feat(ui): add gate-precision analytics card (#2191) - #4314

Merged
JSONbored merged 2 commits into
JSONbored:mainfrom
peter-minion:feat/gate-precision-card-2191
Jul 9, 2026
Merged

feat(ui): add gate-precision analytics card (#2191)#4314
JSONbored merged 2 commits into
JSONbored:mainfrom
peter-minion:feat/gate-precision-card-2191

Conversation

@peter-minion

Copy link
Copy Markdown
Contributor

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.

  • Backend (reuse existing compute): surface the eval on the existing operator-dashboard fetch by adding a gateEval field to OperatorDashboardPayload, populated by the existing computeGateEval. It fails safe to an empty report ({ rows: [], hasSignal: false }) when there is no review_audit signal. The /v1/app/operator-dashboard response schema is an untyped record, so the OpenAPI spec is unaffected.
  • Frontend: GatePrecisionCard reuses Stat + StatusPill from control-primitives.tsx, folds the per-project GateEvalReport rows into one confusion matrix via a pure helper (aggregateGateEval), shows merge precision as a percentage, and flags below-floor sample size via the StatusPill (documented 10-decided floor, matching parity's signal threshold). Rendered on app.analytics.tsx alongside the weekly-value section; renders nothing until the gate has produced eval rows.
  • Privacy: public-safe counts only — no actor logins, PR content, trust/reward internals. The backend payload test asserts no forbidden terms.

Scope

  • The PR title follows type(scope): short summary Conventional Commit format.
  • 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 (Closes #2191).

Validation

  • git diff --check
  • npm run actionlint
  • npm run typecheck
  • npm run test:coverage — the only changed src/** line (the gateEval field on the operator-dashboard payload) is covered 100% by test/unit/operator-dashboard.test.ts. The UI (apps/**, Codecov-exempt) is covered by gate-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:lint
  • npm run ui:typecheck
  • npm run ui:test
  • npm run ui:build
  • New/changed behavior has tests for new branches and the empty/fail-safe paths.

If any required check was skipped, explain why:

  • build:mcp / test:mcp-pack / build:miner / test:miner-pack / test:workers are unaffected by this UI + operator-dashboard-field change and run in CI. npm audit is unchanged (no dependency changes).

Safety

  • No secrets, wallet details, hotkeys, coldkeys, PATs, private keys, raw trust scores, private rankings, or private maintainer evidence are exposed — public-safe counts only, asserted by the payload test.
  • Public GitHub text stays sanitized and low-noise.
  • Auth/CORS/session: unchanged — the card reads the existing operator-role-gated /v1/app/operator-dashboard; no auth surface added.
  • API/OpenAPI: no change (untyped record response schema).
  • UI uses live API data (dashboard.data.gateEval) with a real empty state (renders nothing when there are no eval rows).
  • Visible UI change → UI Evidence below.
  • No changelog edit.

UI Evidence

Page / Feature Before After
/app/analytics
before: analytics page without the gate-precision card

after: gate-precision card with precision + confusion matrix

Notes

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.
@loopover-orb loopover-orb Bot added the gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier. label Jul 8, 2026
@loopover-orb

loopover-orb Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Warning

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

⏸️ Gittensory review result - manual review recommended

Review updated: 2026-07-09 17:33:36 UTC

6 files · 1 AI reviewer · no blockers · readiness 82/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 is a low-risk, read-only wiring PR: it surfaces the existing `computeGateEval` output (already computed elsewhere) as a new `gateEval` field on `OperatorDashboardPayload`, fails safe to an empty report, and renders it via a pure `aggregateGateEval` fold plus a presentational `GatePrecisionCard`. No new gate/eval computation, no schema/migration changes, and tests cover the null-precision, below-floor, and empty-rows branches. The card correctly renders nothing until rows exist and the privacy assertion on the payload test still holds.

Nits — 6 non-blocking
  • apps/gittensory-ui/src/components/site/app-panels/gate-precision-card-model.ts:1-24 — the file's header comment calls this a 'mirror' of src/review/parity.ts's GateEvalRow, but parity.ts's actual current interface also has weightedMergeConfirmed/weightedCloseConfirmed/weightedMergePrecision/weightedClosePrecision (from the maintainer: value-weighted gate-prediction calibration — optimize for merged-net-positive, not raw volume #2348 reversal-discount work) that this UI type omits entirely; harmless today since REVERSAL_DISCOUNT_WEIGHT is 0 and structural typing lets the extra backend fields pass through unused, but the comment will mislead the next person who bumps that weight and expects the UI to reflect it.
  • apps/gittensory-ui/src/components/site/app-panels/gate-precision-card.tsx:7 — MIN_DECIDED_FLOOR = 10 is a hand-duplicated copy of parity.ts's MIN_DECIDED_FOR_SIGNAL rather than a shared/imported constant, so the two can silently drift if the backend threshold ever changes.
  • apps/gittensory-ui/src/components/site/app-panels/gate-precision-card.tsx:12-71 — GatePrecisionCard's body is close to 62 lines in one component; consider extracting the header/StatusPill block or the confusion-matrix grid into a small helper for readability.
  • Export MIN_DECIDED_FOR_SIGNAL from src/review/parity.ts (or thread it through the payload) and import it in gate-precision-card.tsx instead of re-declaring MIN_DECIDED_FLOOR, closing the drift risk noted above.
  • Either extend the UI GateEvalRow type to mirror all of parity.ts's current fields (including the weighted ones) or rename/re-comment it as an intentionally-narrowed view, so the 'mirror' claim stays accurate as parity.ts evolves.
  • 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 #2191
Related work ⚠️ 3 scoped overlaps Top overlaps are listed below; lower-confidence bulk is hidden.
Change scope ❌ 8/20 High 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: 0 registered-repo PR(s), 0 merged, 0 issue(s).
Contributor context ❌ No public Gittensor match peter-minion; not a blocker.
Gate result ⚠️ Not blocking Advisory; not blocking this PR.
Review context
  • Author: peter-minion
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: not available
  • Contributor context: Public profile only; not a blocker.
  • Related work: Titles/paths share 6 meaningful terms. (issue #2191, issue #2203)
  • Related work: Titles/paths share 6 meaningful terms. (issue #2191, issue #2196)
  • Related work: Titles/paths share 6 meaningful terms. (issue #2195, issue #2203)
  • Additional title-only matches omitted; title-only overlap does not block.
Contributor next steps
  • Review top overlaps.
  • Add a concise scope and risk note.
  • Check active issues and PRs before submitting.
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 after /app/analytics
/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

@JSONbored
JSONbored marked this pull request as ready for review July 9, 2026 17:17
@JSONbored
JSONbored self-requested a review as a code owner July 9, 2026 17:17
@superagent-security

Copy link
Copy Markdown
Contributor

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

@codecov

codecov Bot commented Jul 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.96%. Comparing base (89e6394) to head (1293892).
⚠️ Report is 56 commits behind head on main.

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           
Files with missing lines Coverage Δ
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 manual-review Gittensor contributor context label Jul 9, 2026
@JSONbored
JSONbored merged commit 075f31d into JSONbored:main Jul 9, 2026
10 checks passed
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): gate-precision analytics card (precision + confusion matrix)

2 participants