feat(leaderboard): rebuild and restore the network leaderboard#1290
Open
Dexterity104 wants to merge 1 commit into
Open
feat(leaderboard): rebuild and restore the network leaderboard#1290Dexterity104 wants to merge 1 commit into
Dexterity104 wants to merge 1 commit into
Conversation
Contributor
Author
|
@e35ventura @anderdc |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Complete tear down and rebuild of the network Leaderboard, brought back at
/leaderboardafter the original page was deleted in #1220. The new surface feels like a control room rather than a long card list. The top of the page frames the entire network at a glance with a four zone insights card (daily pool, 90/10 split, eligibility mix, top scorers, hottest repos). The dense table below presents nine sortable columns, seven behavior driven status badges, dual track eligibility pills with per repo counts, a stacked OSS vs Discovery sparkline that opens into a 1D/7D/30D analytics modal, an open PR risk pill that mirrors the validator's slot formula, and rank movement captured locally on a UTC rotation. Every cell traces back to a concrete validator field, every tooltip carries a title, a body, and a green action hint, and every piece of UI state (cohort, repo, view mode, page) round trips through the URL.The page is held to the bar set by #95 and grounded in the policy that has shipped since the old page came down: repository scoped emissions (gittensor#1235), per repo eligibility (gittensor#1293), per repo scoring config (gittensor#1300), the maintainer carve out and the penalized miner skip (gittensor#1292, gittensor#1329), collateral inside repo allocation (gittensor#1272), and per repo
min_token_scoreon the PR scoring path (gittensor#1330).Related Issues
Closes #1289
Refs #95
Type of Change
Design Rationale
Information Architecture
The page is structured around three stages of attention. Glance, scan, drill. Each stage owns one component, and the components are wired so a click in one collapses the next.
Glance —
LeaderboardInsights. A single hero card with four zones, no chrome, no headers above it.DailyPoolZoneshows the combined emissions pool in USD with live TAO and α74 spot prices, and a 90/10 split bar (miners vs issues treasury) driven byOSS_EMISSION_SHAREandISSUES_TREASURY_EMISSION_SHARE.CompositionZoneslices the network into five cohorts viacohortOf, with both the bar segments and the legend rows acting as filters into the table below.PodiumZoneranks the top three bytotal_score + issue_discovery_score, with avatar rails tinted inRANK_COLORS.HotRepoZonecarries the hero repo plus three runners up over a rolling 30 day window, where the hero and runners up filter the table to that repo. The card is the entire "what is the network doing right now" answer.Scan —
MinersLeaderTable. Dense table, list and card view modes. Nine sortable fields (score, USD/day, credibility, volume, recent activity, rank movement, review hits, open PR risk, watchlist). Debounced search, cohort and eligibility chip filters, URL backed pagination, page index reset on filter change so the user never lands on an empty page. Every row carries an accent rail in the cohort color, a status badge driven by validator state, dual track eligibility pills with per repo counts, a stacked OSS + Discovery sparkline, an open PR risk pill, and a watchlist toggle.Drill —
SparklineDetailModal. Clicking a sparkline opens an ECharts modal in 1D, 7D, or 30D ranges, in stacked, bar, or line modes. 1D buckets hourly, 7D and 30D bucket daily. The modal reuses the same/commitsquery, so opening it costs nothing on the network.Why This Beats A Simpler Approach
OSS_EMISSION_SHAREandISSUES_TREASURY_EMISSION_SHARE. The cohorts are not invented, they are the cross product ofis_eligibleandis_issue_eligible. The open PR risk pill computes its ceiling with the same formula the validator uses (min(base + floor(token_score / per_slot), max)). The page never invents a number it cannot trace.useMinerActivityIndexbuilds the per miner activity map and the network roll up in a single pass over/commits. The insights card, the table, and theNetworkPulsePillshare one round trip via React Query deduping. Adding a future consumer costs nothing.eligibilityCohort.tsis the single source of truth for "currently earning". Every component reads fromisOssEligibleNow,isDiscoveryEligibleNow,isAnyEligibleNow, orcohortOf. There is no second helper that could disagree.useRankSnapshotrotatestoday → prevon each new UTC day, gated oncurrentRanks.size > 0so an empty load does not erase the next day's signal. Day over day deltas appear after the first 24 hours without any validator side change.MinerEvaluationandMinerActivity. Tooltip carries the rule verbatim, so a miner who seesClimbingcan read the threshold that put them there.12 / 24 / 48, list view rows are10 / 25 / 50. Every grid row at every breakpoint is full so the last row is never partial.Screenshots
Video:
1.webm
2.webm
Desktop 1:

Desktop 2:

Desktop 3:

Desktop 4:

Desktop 5:

Mobile 1:

Mobile 2:

Mobile 3:

Mobile 4:

Validator Policy Mapping
Every field on screen has a concrete source. The page never invents a number it cannot trace.
parseNumber(m.usdPerDay)summed acrossEARNING_COHORTSOSS_EMISSION_SHARE,ISSUES_TREASURY_EMISSION_SHAREusePrices()cohortOf(m)overis_eligible,is_issue_eligible,eligible_repo_count,issue_eligible_repo_countparseNumber(m.totalScore) + parseNumber(m.issueDiscoveryScore)/commitsgrouped bycommit.repository, sorted by countm.failedReason(verbatim in tooltip)is_eligible,is_issue_eligible,eligible_repo_count,issue_eligible_repo_count/commits+isDiscoveryCommit(mirrorsisIssueDiscoveryContributionPr)min(openPrSlotBase + floor(tokenScore / openPrSlotTokenScore), maxOpenPrSlots), defaults fromELIGIBILITY_FIELD_DEFSsplitEarningsmirrors the validator OSS/Discovery share splitN = round((1 − review_quality_multiplier) / 0.15),REVIEW_PENALTY_RATE = 0.15useRankSnapshot,localStorage[gittensor.rank-snapshot.v1]rotated per UTC dayuseMinerActivityIndexStatus Taxonomy
Seven status kinds plus
STATUS_NONE. Order of resolution matchesderiveMinerStatusinMinerStatus.tsx.failed_reasonnon emptyMINER_STATUS_COLORS.penalized≥ 3merged in last 3dMINER_STATUS_COLORS.hot≥ 3since the last UTC snapshotMINER_STATUS_COLORS.climbing≥ 3merged and≥ 1.5 ×prior 7dMINER_STATUS_COLORS.risingMINER_STATUS_COLORS.dormant≤ 2unique repos and≥ 5mergesMINER_STATUS_COLORS.specialistMINER_STATUS_COLORS.dualMINER_STATUS_COLORS.coolingURL Contract
?repo=<full_name>?page=on change?cohort=<dual|ossOnly|discoveryOnly|activeOnly|inactive>parseCohortParam, clears?page=?view=<list|cards>localStorage[leaderboard:viewMode]?page=<n>?sort=<field>:<dir>useDataTableParamshookTesting
failed_reasonverbatim)?cohort=, repo filter through?repo=, view mode through?view=, pagination through?page=WatchlistButtonfocus-visibleoutline)xs(Network Pulse pill on a 320px wide screen)npm run buildpassesnpm run lint:fixandnpm run formatcleanChecklist
TOOLTIP_TONE_COLORS,LEADERBOARD_TRACK_COLORS,MINER_STATUS_COLORS,STATUS_COLORS,RANK_COLORS, no hardcoded colors)xsstacked hero card,smtwo by two zones,lgfour across, card view rows divide evenly by 1/2/3 so the last grid row is never partial)npm run formatandnpm run lint:fixhave been runnpm run buildpassesChanges
New Pages
src/pages/LeaderboardPage.tsx). Hosts the insights card and the table. Pipes?repo=and?cohort=intouseSearchParams. Resets?page=whenever a filter changes so the user never lands on an empty page after narrowing the view.New Components
src/components/leaderboard/LeaderboardInsights.tsx). Four zone hero card.DailyPoolZonecarries the USD pool, the TAO/α74 ticker, the 90/10 emission split bar, and the top earners avatar stack.CompositionZoneis the cohort bar plus an interactive legend that doubles as a filter.PodiumZoneis the top three by combined score with rank tinted avatar rails.HotRepoZoneis the hero repo plus three runners up, all clickable into the table filter.src/components/leaderboard/MinersLeaderTable.tsx). List and card view modes, nine sortable fields, cohort and eligibility chip filters, debounced search, URL backed pagination. Row accent rail in the cohort color, identity cell with status badge, dual track eligibility pills with repo counts, OSS and Discovery stat rows with a stacked sparkline trend, open PR risk pill, review hits cell, USD/day cell with a track split tooltip, watchlist toggle.src/components/leaderboard/MinerStatus.tsx). Seven status kinds plusSTATUS_NONE.deriveMinerStatusresolves them in priority order againstMinerEvaluationandMinerActivity.StatusBadgerenders the pill in the tone palette fromMINER_STATUS_COLORS.src/components/leaderboard/Sparkline.tsx). Stacked bar sparkline (OSS bottom, Discovery on top), built from raw SVG to avoid pulling a chart library into the row hot path. Empty state collapses to a single dash so the row height stays stable.src/components/leaderboard/SparklineDetailModal.tsx). ECharts modal with 1D, 7D, 30D ranges and stacked / bar / line modes. Hourly bucketing on 1D, daily bucketing on 7D and 30D. Uses the shared gittensor ECharts theme so the modal matches the rest of the app.src/components/leaderboard/NetworkPulsePill.tsx). 7d vs prior 7d PR velocity. Low sample mode (prior7 < 5) renders raw counts instead of a misleading percentage.src/components/leaderboard/GhIcons.tsx). Inline GitHub PR and Issue SVG icons, sized for the dense row layout.New Modules
src/components/leaderboard/eligibilityCohort.ts). Single source of truth for "currently earning". ExportsisOssEligibleNow,isDiscoveryEligibleNow,isAnyEligibleNow,isPenalized,cohortOf, the cohort palette, labels, descriptions, and theparseCohortParamURL guard.src/components/leaderboard/scoring.ts). Mirrorsgittensor/constants.pyandvalidator/oss_contributions/scoring.py.resolveRepoThresholdsoverlaysELIGIBILITY_FIELD_DEFSdefaults.openPrSlotsAllowedmirrorscalculate_open_pr_threshold.splitEarningsmirrors the OSS / Discovery share split.src/components/leaderboard/useMinerActivityIndex.ts). One pass over/commitsbuilds the per miner activity map and the network roll up. Per miner:dailyMerged,dailyOss,dailyDiscovery,topRepos,lastActiveAt,reviewHits. Network:dailyMerged,dailyOss,dailyDiscovery,last7,prior7,topRepos.src/components/leaderboard/useRankSnapshot.ts). Rotates yesterday's ranks intoprevon each new UTC day, gated oncurrentRanks.size > 0so an empty load does not erase tomorrow's signal. Stored underlocalStorage[gittensor.rank-snapshot.v1].src/components/leaderboard/leaderboardViewMode.ts). List and card view modes, persisted tolocalStorage[leaderboard:viewMode], reflected in?view=. List rows are10 / 25 / 50, card rows are12 / 24 / 48so every grid row at every breakpoint is full.Refactored Components
src/components/common/WatchlistButton.tsx). Picks up afocus-visibleoutline in the primary color so keyboard navigation has parity with hover. No regression on existing call sites.Modified Wiring
/leaderboardregistered./top-minersredirect repointed from/repositoriesto/leaderboardso existing external links land in the right place.leaderboardnav item with the MUILeaderboardIcon, sandwiched betweendashboardandrepositories.useRecentCommits(limit = 500)thin wrapper around the existing dashboard query helper, hits/commits?page=1&limit=500. React Query dedupes the request so the insights card and the table share one round trip.TOOLTIP_TONE_COLORS,LEADERBOARD_TRACK_COLORS,MINER_STATUS_COLORS) move the cohort, status, and tooltip tones to one place.tooltipSlotPropspicks up apreventOverflowpopper modifier so long tooltip bodies clamp to the viewport on narrow screens, andmaxWidthbecomes responsive (calc(100vw − 24px)onxs,280pxfromsm).LeaderboardInsightsandMinersLeaderTable..verifyso local verification scratch directories do not get committed.Removed Components
None. The old
TopMinersPageand its sidecars were already removed in #1220 and are not resurrected.Bug Fixes
Known Gaps (Documented, Not Fixed Here)
/commitsrepresents OSS merges only. Discovery only activity is undercounted in the sparkline and in the Dormant / Cooling derivation until the activity feed includes solved issues. Cohort assignment itself is correct because it readsis_eligibleandis_issue_eligiblestraight offMinerEvaluation.$/daysplit and the structural vs leaf score breakdown are not surfaced yet. Both are blocked on validator data that is not on the public API. The combinedusdPerDayis used everywhere a per row earning is shown.