From 0a09d87b0a9b97c325507862a7ee83d16b9b9ec4 Mon Sep 17 00:00:00 2001 From: mendezr Date: Fri, 30 Oct 2026 18:54:03 +0000 Subject: [PATCH 1/3] =?UTF-8?q?=E2=9C=A8=20feature:=20show=20abandoned=20P?= =?UTF-8?q?R=20counts=20on=20contributor=20leaderboards?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Expose the persisted abandoned count without changing rankings, and append columns to the dashboard and contribute landing standings. Cover JSON values, legacy zero defaults, and both renderers. Hive-Run: hivecommons/hive#15796 Hive-Plan: issue-15796-leaderboard-columns Hive-Spec: issue-15796#acceptance Signed-off-by: mendezr --- changelog.d/added-abandoned-leaderboards.md | 1 + src/pkg/dashboard/contribute_landing.go | 19 +-- src/pkg/dashboard/contribute_leaderboard.go | 1 + .../contribute_leaderboard_abandoned_test.go | 117 ++++++++++++++++++ src/pkg/dashboard/static/index.html | 2 + 5 files changed, 133 insertions(+), 7 deletions(-) create mode 100644 changelog.d/added-abandoned-leaderboards.md create mode 100644 src/pkg/dashboard/contribute_leaderboard_abandoned_test.go diff --git a/changelog.d/added-abandoned-leaderboards.md b/changelog.d/added-abandoned-leaderboards.md new file mode 100644 index 0000000000..c7eb5e95a2 --- /dev/null +++ b/changelog.d/added-abandoned-leaderboards.md @@ -0,0 +1 @@ +- Show abandoned PR counts in the dashboard and contribute landing leaderboards without changing contributor rankings ([#15796](https://github.com/hivecommons/hive/issues/15796)). diff --git a/src/pkg/dashboard/contribute_landing.go b/src/pkg/dashboard/contribute_landing.go index 65cbf735f4..b48639a1de 100644 --- a/src/pkg/dashboard/contribute_landing.go +++ b/src/pkg/dashboard/contribute_landing.go @@ -546,7 +546,7 @@ code{background:var(--surface-0);padding:var(--sp-1) var(--sp-4);border-radius:v .effective-link{color:var(--cc-accent);text-decoration:none} .effective-link:hover{text-decoration:underline} .effective-section-title{padding:var(--sp-5) var(--sp-7) var(--sp-3);color:var(--text-muted);font-size:var(--fs-xs);text-transform:uppercase;letter-spacing:.08em;font-weight:700} -.lb-row{display:grid;grid-template-columns:56px 1fr 120px 70px 70px 80px 72px;align-items:center;gap:var(--sp-4);padding:10px 20px;border-bottom:1px solid var(--line-subtle);font-size:.85rem} +.lb-row{display:grid;grid-template-columns:56px 1fr 120px 70px 70px 80px 72px 90px;align-items:center;gap:var(--sp-4);padding:10px 20px;border-bottom:1px solid var(--line-subtle);font-size:.85rem} .lb-row:last-child{border-bottom:none} /* Subtle self-highlight for the logged-in viewer's own row: a faint tint + a left accent border, professional not loud. Readability preserved. */ @@ -1540,10 +1540,10 @@ select.admin-act{min-width:0;max-width:100%%} /* Slightly tighter card-internal gutters on the densest rows. */ .clanker-row,.lb-row,.cc-q-item,.cc-tg-item,.cc-tg-head{padding-left:14px;padding-right:14px} - /* Leaderboard: 56px/1fr/120px/70px/70px/80px/72px cannot fit, so the seven cells reflow + /* Leaderboard: the eight desktop cells reflow onto three lines — rank + contributor, then tier + the three counts, then - the sparkline — instead of scrolling sideways. Placement is by child - position because .lb-head and the body rows emit the same seven children in + the sparkline + abandoned count — instead of scrolling sideways. Placement is by child + position because .lb-head and the body rows emit the same eight children in the same order, so the header keeps sitting over the column it labels. The stat tracks stay fixed rem widths for exactly that reason: auto would size per row and the header would drift out of alignment with the numbers. */ @@ -1554,7 +1554,8 @@ select.admin-act{min-width:0;max-width:100%%} .lb-row>:nth-child(4){grid-column:3;grid-row:2} .lb-row>:nth-child(5){grid-column:4;grid-row:2} .lb-row>:nth-child(6){grid-column:5;grid-row:2} - .lb-row>:nth-child(7){grid-column:1/-1;grid-row:3;text-align:left} + .lb-row>:nth-child(7){grid-column:1/3;grid-row:3;text-align:left} + .lb-row>:nth-child(8){grid-column:3/-1;grid-row:3} /* The uppercase, letter-spaced header labels are the widest thing in the stat tracks; drop them a notch so "Findings" fits 3.4rem. */ .lb-head .lb-stat,.lb-head .lb-rank{font-size:var(--fs-2xs)} @@ -3317,6 +3318,7 @@ function lbRow(e,rank){ var tier=tierBadge(e.trust_tier,'tier-lb'); var done=(e.tasks_completed||0); var failed=(e.tasks_failed||0); + var abandoned=(e.abandoned||0); var findings=(e.findings||0); // Subtle self-highlight: the viewer's OWN row (username match, case-insensitive, // humans only — never an agent) gets .lb-row--me + a small "you" chip. Anonymous @@ -3352,6 +3354,7 @@ function lbRow(e,rank){ // per_user_done, matched on github_username via data-user. Empty until metrics // load (renders a flat baseline), never fabricated. +'
' + +'
'+abandoned+'
' +''; } function opsLeaderboardTrendValue(username){ @@ -3385,7 +3388,8 @@ function renderLeaderboard(contribs){ {key:'done',type:'number',value:function(r){return r.entry.tasks_completed;}}, {key:'failed',type:'number',value:function(r){return r.entry.tasks_failed;}}, {key:'findings',type:'number',value:function(r){return r.entry.findings;}}, - {key:'trend',type:'number',value:function(r){return opsLeaderboardTrendValue(r.entry.github_username);}} + {key:'trend',type:'number',value:function(r){return opsLeaderboardTrendValue(r.entry.github_username);}}, + {key:'abandoned',type:'number',value:function(r){return r.entry.abandoned||0;}} ]; var rankedRows=contribs.map(function(e,i){return{entry:e,rank:Number(e.rank||0)||i+1};}); var sortable=opsSortableTable('leaderboard',{rows:rankedRows,columns:lbColumns}); @@ -3396,7 +3400,8 @@ function renderLeaderboard(contribs){ '
'+sortable.header('done','Done')+'
'+ '
'+sortable.header('failed','Failed')+'
'+ '
'+sortable.header('findings','Findings')+'
'+ - '
'+sortable.header('trend','Trend')+'
'; + '
'+sortable.header('trend','Trend')+'
'+ + '
'+sortable.header('abandoned','Abandoned')+'
'; var i; for(i=0;i:nth-child(8){grid-column:3/-1;grid-row:3}"} { + if !strings.Contains(landing, want) { + t.Errorf("landing missing %q", want) + } + } + for _, want := range []string{">Abandoned", "${e.abandoned || 0}"} { + if !strings.Contains(string(dashboard), want) { + t.Errorf("dashboard missing %q", want) + } + } + node, err := exec.LookPath("node") + if err != nil { + t.Skip("node is required for rendering assertions") + } + // Run the shipped renderers with a minimal DOM, rather than a parallel + // implementation of the rendering logic. + common := ` +const assert = require('node:assert/strict'); +const panel = {innerHTML:''}; +const document = {getElementById:()=>panel}; +function esc(s){return String(s);} +function tierBadge(){return '';} +function socialShareControls(){return '';} +function ccRenderLeaderboardSparklines(){} +var ccMeUsername='', lbLastData, ccMetrics=null; +function opsSortableTable(id,opts){return {rows:opts.rows,ariaSort:()=> 'none',header:(key,label)=>label};} +const entries=[{github_username:'alice',rank:1,tasks_completed:10,tasks_failed:2,abandoned:7}, + {github_username:'bob',rank:2,tasks_completed:5}]; +` + landingJS := common + extractJSFunc(t, landing, "function lbRow(e,rank){") + "\n" + + extractJSFunc(t, landing, "function renderLeaderboard(contribs){") + ` +renderLeaderboard(entries); +assert.match(panel.innerHTML, /Abandoned/); +assert.match(lbRow(entries[0],1), /
7<\/div><\/div>$/); +assert.match(lbRow(entries[1],2), /
0<\/div><\/div>$/); +` + dashboardJS := common + ` +const CONTRIBUTOR_AVATAR_PX=32; +function linkedAvatar(){return '';} +function trustTierBadge(){return '';} +function setIfChanged(el,html){el.innerHTML=html;} +` + extractJSFunc(t, string(dashboard), "function renderLeaderboard(entries) {") + ` +renderLeaderboard(entries); +assert.match(panel.innerHTML, />Abandoned<\/th>/); +const rows=panel.innerHTML.match(/([\s\S]*)<\/tbody>/)[1].split('').filter(r=>r.trim()); +assert.equal(rows.length,2); +assert.match(rows[0], />7<\/td>\s*$/); +assert.match(rows[1], />0<\/td>\s*$/); +` + for name, script := range map[string]string{"landing": landingJS, "dashboard": dashboardJS} { + t.Run(name, func(t *testing.T) { + if out, err := exec.Command(node, "-e", script).CombinedOutput(); err != nil { + t.Fatalf("rendering failed: %v\n%s", err, out) + } + }) + } +} diff --git a/src/pkg/dashboard/static/index.html b/src/pkg/dashboard/static/index.html index f37a4a62a8..6cf6036a7e 100644 --- a/src/pkg/dashboard/static/index.html +++ b/src/pkg/dashboard/static/index.html @@ -41188,6 +41188,7 @@ ${trustTierBadge(e.trust_tier)} ${e.tasks_completed || 0} ${e.tasks_failed || 0} + ${e.abandoned || 0} `; }).join(''); setIfChanged(panel, `
@@ -41199,6 +41200,7 @@ Tier Completed Failed + Abandoned ${rows} From 6531ced869b6f4ccded71bdd125984f0c117113a Mon Sep 17 00:00:00 2001 From: mendezr Date: Fri, 30 Oct 2026 19:07:53 +0000 Subject: [PATCH 2/3] =?UTF-8?q?=F0=9F=90=9B=20fix:=20repair=20leaderboard?= =?UTF-8?q?=20fixtures=20and=20dashboard=20source=20parity?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: mendezr --- src/pkg/dashboard/contribute_leaderboard_abandoned_test.go | 5 +++-- src/pkg/dashboard/static-src/js/contributors.js | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/pkg/dashboard/contribute_leaderboard_abandoned_test.go b/src/pkg/dashboard/contribute_leaderboard_abandoned_test.go index 3ef0d8b5b4..6aeadf89fe 100644 --- a/src/pkg/dashboard/contribute_leaderboard_abandoned_test.go +++ b/src/pkg/dashboard/contribute_leaderboard_abandoned_test.go @@ -14,12 +14,13 @@ func TestLeaderboardAPIAbandoned(t *testing.T) { s := newDossierTestServer(t) // Seed persisted profiles, as written by adoption accounting. Keep this // reader test independent of the accounting writer's reconciliation rules. + // Include contributor IDs so listContributorProfiles accepts both records. if err := os.MkdirAll(getContributorsDir(), 0o755); err != nil { t.Fatal(err) } for name, profile := range map[string]string{ - "alice": `{"github_username":"alice","trust_tier":"contributor","total_tasks_completed":10,"abandoned":7}`, - "bob": `{"github_username":"bob","trust_tier":"contributor","total_tasks_completed":5}`, + "alice": `{"github_username":"alice","contributor_id":"c-alice","trust_tier":"contributor","total_tasks_completed":10,"abandoned":7}`, + "bob": `{"github_username":"bob","contributor_id":"c-bob","trust_tier":"contributor","total_tasks_completed":5}`, } { if err := os.WriteFile(filepath.Join(getContributorsDir(), name+".json"), []byte(profile), 0o600); err != nil { t.Fatal(err) diff --git a/src/pkg/dashboard/static-src/js/contributors.js b/src/pkg/dashboard/static-src/js/contributors.js index 80de8a8a7a..cbc58436f5 100644 --- a/src/pkg/dashboard/static-src/js/contributors.js +++ b/src/pkg/dashboard/static-src/js/contributors.js @@ -459,6 +459,7 @@ ${trustTierBadge(e.trust_tier)} ${e.tasks_completed || 0} ${e.tasks_failed || 0} + ${e.abandoned || 0} `; }).join(''); setIfChanged(panel, `
@@ -470,6 +471,7 @@ Tier Completed Failed + Abandoned ${rows} From 20854a82b3076c594d67457500f796b602661b61 Mon Sep 17 00:00:00 2001 From: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> Date: Fri, 30 Oct 2026 20:10:23 -0400 Subject: [PATCH 3/3] =?UTF-8?q?=F0=9F=90=9B=20fix:=20move=20leaderboard=20?= =?UTF-8?q?cell=20styling=20into=20classes=20to=20keep=20the=20style=20rat?= =?UTF-8?q?chet?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The new Abandoned column added two inline style= attributes to the operator index.html, pushing TestStyleRatchet over its 1425 baseline. Give the leaderboard table its own classes instead, which also retires the repeated padding on every existing cell, and lower the baseline to the new count. Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> --- .../static-src/css/sparklines-indicators.css | 7 ++++ .../dashboard/static-src/js/contributors.js | 30 +++++++-------- src/pkg/dashboard/static/index.html | 37 +++++++++++-------- .../dashboard/webstatic/style_ratchet_test.go | 2 +- 4 files changed, 45 insertions(+), 31 deletions(-) diff --git a/src/pkg/dashboard/static-src/css/sparklines-indicators.css b/src/pkg/dashboard/static-src/css/sparklines-indicators.css index b0cf8ce0d0..dbf0dda4e6 100644 --- a/src/pkg/dashboard/static-src/css/sparklines-indicators.css +++ b/src/pkg/dashboard/static-src/css/sparklines-indicators.css @@ -27,6 +27,13 @@ .contrib-status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; background: var(--status-neutral); } .contrib-status-dot.online { background: var(--status-ok); } .contrib-abandoned { color: var(--status-error); font-weight: 600; } + /* Contributor leaderboard table cells (renderLeaderboard in contributors.js). */ + .contrib-lb-table th, .contrib-lb-table td { padding: var(--sp-4) var(--sp-5); text-align: left; } + .contrib-lb-table th { color: var(--muted); font-weight: 600; } + .contrib-lb-table .contrib-lb-rank { font-weight: 600; color: var(--muted); } + .contrib-lb-table .contrib-lb-num { text-align: right; } + .contrib-lb-table .contrib-lb-failed { color: var(--muted); } + .contrib-lb-table .contrib-lb-failed.has-failures { color: var(--red); } .contrib-card { --contrib-accent: #5aa7ff; --contrib-accent-2: #74df9a; diff --git a/src/pkg/dashboard/static-src/js/contributors.js b/src/pkg/dashboard/static-src/js/contributors.js index cbc58436f5..f08f576d9c 100644 --- a/src/pkg/dashboard/static-src/js/contributors.js +++ b/src/pkg/dashboard/static-src/js/contributors.js @@ -453,25 +453,25 @@ ? linkedAvatar(e.github_username, CONTRIBUTOR_AVATAR_PX, `@${e.github_username}`, e.avatar_url) : ``; return ` - ${e.rank} - ${avatarHtml} - @${esc(e.github_username)} - ${trustTierBadge(e.trust_tier)} - ${e.tasks_completed || 0} - ${e.tasks_failed || 0} - ${e.abandoned || 0} + ${e.rank} + ${avatarHtml} + @${esc(e.github_username)} + ${trustTierBadge(e.trust_tier)} + ${e.tasks_completed || 0} + ${e.tasks_failed || 0} + ${e.abandoned || 0} `; }).join(''); setIfChanged(panel, `
- +
- - - - - - - + + + + + + + ${rows}
#UserTierCompletedFailedAbandoned#UserTierCompletedFailedAbandoned
diff --git a/src/pkg/dashboard/static/index.html b/src/pkg/dashboard/static/index.html index 6cf6036a7e..16d6833fe3 100644 --- a/src/pkg/dashboard/static/index.html +++ b/src/pkg/dashboard/static/index.html @@ -3285,6 +3285,13 @@ .contrib-status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; background: var(--status-neutral); } .contrib-status-dot.online { background: var(--status-ok); } .contrib-abandoned { color: var(--status-error); font-weight: 600; } + /* Contributor leaderboard table cells (renderLeaderboard in contributors.js). */ + .contrib-lb-table th, .contrib-lb-table td { padding: var(--sp-4) var(--sp-5); text-align: left; } + .contrib-lb-table th { color: var(--muted); font-weight: 600; } + .contrib-lb-table .contrib-lb-rank { font-weight: 600; color: var(--muted); } + .contrib-lb-table .contrib-lb-num { text-align: right; } + .contrib-lb-table .contrib-lb-failed { color: var(--muted); } + .contrib-lb-table .contrib-lb-failed.has-failures { color: var(--red); } .contrib-card { --contrib-accent: #5aa7ff; --contrib-accent-2: #74df9a; @@ -41182,25 +41189,25 @@ ? linkedAvatar(e.github_username, CONTRIBUTOR_AVATAR_PX, `@${e.github_username}`, e.avatar_url) : ``; return ` - ${e.rank} - ${avatarHtml} - @${esc(e.github_username)} - ${trustTierBadge(e.trust_tier)} - ${e.tasks_completed || 0} - ${e.tasks_failed || 0} - ${e.abandoned || 0} + ${e.rank} + ${avatarHtml} + @${esc(e.github_username)} + ${trustTierBadge(e.trust_tier)} + ${e.tasks_completed || 0} + ${e.tasks_failed || 0} + ${e.abandoned || 0} `; }).join(''); setIfChanged(panel, `
- +
- - - - - - - + + + + + + + ${rows}
#UserTierCompletedFailedAbandoned#UserTierCompletedFailedAbandoned
diff --git a/src/pkg/dashboard/webstatic/style_ratchet_test.go b/src/pkg/dashboard/webstatic/style_ratchet_test.go index 34a5b7ff10..1a8cb2d5cc 100644 --- a/src/pkg/dashboard/webstatic/style_ratchet_test.go +++ b/src/pkg/dashboard/webstatic/style_ratchet_test.go @@ -26,7 +26,7 @@ type styleRatchetCounts struct { // removes raw styling — but they must not go UP. var styleRatchetBaselines = map[string]styleRatchetCounts{ "operator static/index.html": { - inlineStyles: 1425, + inlineStyles: 1413, rawColors: 135, rawFontSizes: 601, rawPadding: 204,