Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/fixed-sidebar-counts-explain-populations.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Dashboard sidebar: the Overview counter (`33/13`, open issues / open PRs) and the Hive activity monitor counter (`37`, rows) count the same open set two ways — every open issue is a row, a PR is its own row only when not drawn under a listed issue. Both tooltips and the activity-monitor header now say so (`37 rows (33 issues + 4 PRs on their own row) · 9 PRs shown on their issue's row`), so the numbers read as one population, not a disagreement.
5 changes: 4 additions & 1 deletion src/docs/dashboard-sections.md

Large diffs are not rendered by default.

10 changes: 7 additions & 3 deletions src/pkg/dashboard/open_items_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ func TestOpenItemsPillAndTrackerHeaderDerivation(t *testing.T) {
}
script := overviewKPIRenderPrelude(t, html) + `
` + jsFunc(t, html, "stageTrackerCountsText") + `
` + jsFunc(t, html, "stageTrackerRowBreakdown") + `
` + jsFunc(t, html, "stageTrackerOpenCounts") + `
const status = ` + string(statusJSON) + `;
const tracker = ` + string(trackerJSON) + `;
Expand All @@ -300,10 +301,12 @@ const page = { total: tracker.items.length, from: 1, to: tracker.items.length };
const counts = stageTrackerCountsText(page, tracker.items.length, 2, open, 3);
// Owner: the tracker counts ROWS. With every item on its own row the pill,
// the header lead and the tile agree on the same number.
assert.strictEqual(counts.header, tracker.items.length + ' rows · 2 need attention');
const issuesN = tile.issues.forge, prsN = tile.prs.forge;
const breakdown = issuesN + ' issues + ' + prsN + ' PRs on their own row';
assert.strictEqual(counts.header, tracker.items.length + ' rows (' + breakdown + ') · 2 need attention');
assert.strictEqual(counts.badge, tracker.items.length, 'activity-monitor pill is the row count of the default view');
assert.strictEqual(counts.badge, tile.issues.forge + tile.prs.forge, 'no PR shares an issue row here, so rows = the tile total');
assert.strictEqual(counts.badgeTitle, tracker.items.length + ' rows open · 3 need attention', 'attention moves to the pill tooltip');
assert.strictEqual(counts.badgeTitle, tracker.items.length + ' rows open: ' + breakdown + ' · 3 need attention', 'attention moves to the pill tooltip; the row make-up is named');
assert.strictEqual(counts.note, '', 'nothing to footnote when rows = items');
// A PR drawn on its issue's row shrinks the row count; the pill follows the
// rows and the gap to the item total is a footnote, never a second total.
Expand All @@ -312,9 +315,10 @@ const nested = stageTrackerCountsText({ total: rows, from: 1, to: rows }, rows,
assert.strictEqual(nested.badge, rows, 'pill = rows, not items');
assert.strictEqual(nested.showing, 'showing 1–' + rows + ' of ' + rows, 'no filter → no "filtered out", no items total');
assert.strictEqual(nested.note, "1 PR shown on its issue's row");
assert.strictEqual(nested.breakdown, issuesN + ' issues + ' + (prsN - 1) + ' PRs on their own row', 'rows − issues = PRs on their own row');
assert.ok(nested.badgeTitle.endsWith(" · 1 PR shown on its issue's row"), nested.badgeTitle);
const filtered = stageTrackerCountsText({ total: 4, from: 1, to: 4 }, tracker.items.length, 0, open).header;
assert.strictEqual(filtered, '4 of ' + tracker.items.length + ' rows · nothing needs attention');
assert.strictEqual(filtered, '4 of ' + tracker.items.length + ' rows (' + breakdown + ') · nothing needs attention');
assert.deepStrictEqual(stageTrackerOpenCounts({ items: [{ kind: 'issue' }, { kind: 'pr' }, { kind: 'issue' }] }), { issues: 2, prs: 1 }, 'falls back to counting items');
console.log('ok');
`
Expand Down
2 changes: 1 addition & 1 deletion src/pkg/dashboard/overview_kpi_sparklines_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ function repoItemNeedsHuman(item){ return ((item && item.labels) || []).some(l =
"overviewCoverageInfo", "overviewCoverageState", "overviewCoverageColor", "overviewCoverageInfoHTML", "overviewCoverageBar", "overviewCoverageCard", "renderOverviewCoverageKPI",
"overviewProjectFilterSpec", "overviewRepoTrackedIssueEntries", "overviewRepoTrackedPREntries", "overviewProjectBucketCount",
"overviewProjectOutsideIssueCount", "overviewProjectOutsidePRCount", "overviewProjectFilterMatchesEntry", "overviewProjectFilterRepoMatches",
"overviewProjectFilterSummary", "overviewSidebarPill", "overviewUnlistedCounts", "overviewUnlistedNote", "overviewSyncingNote", "sidebarPairBadgeText", "setSidebarPairBadge", "renderOverviewKPIs",
"overviewProjectFilterSummary", "overviewSidebarPill", "overviewSidebarPillLead", "overviewUnlistedCounts", "overviewUnlistedNote", "overviewSyncingNote", "sidebarPairBadgeText", "setSidebarPairBadge", "renderOverviewKPIs",
} {
source.WriteString(jsFunc(t, html, name))
source.WriteByte('\n')
Expand Down
1 change: 1 addition & 0 deletions src/pkg/dashboard/overview_kpi_values_10139_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ const OVERVIEW_PR_BREAKDOWN_LABELS = { hold: 'held', draft: 'draft', filtered: '
` + jsFunc(t, html, "renderOverviewKPIs") + `
const document = { _els: {}, getElementById(id) { if (!this._els[id]) this._els[id] = { id, hidden: true, textContent: '0/0', title: '', attrs: { 'data-zero': '' }, setAttribute(k, v) { this.attrs[k] = v; }, removeAttribute(k) { delete this.attrs[k]; } }; return this._els[id]; } };
` + jsFunc(t, html, "overviewSidebarPill") + `
` + jsFunc(t, html, "overviewSidebarPillLead") + `
` + jsFunc(t, html, "overviewUnlistedCounts") + `
` + jsFunc(t, html, "overviewUnlistedNote") + `
` + jsFunc(t, html, "overviewSyncingNote") + `
Expand Down
2 changes: 1 addition & 1 deletion src/pkg/dashboard/overview_sidebar_pill_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ assert.equal(pillEl().hidden, false);
assert.equal(pillEl().textContent, '31/18', 'pill must print the tile totals, not the tracked working set');
assert.equal(pillEl().textContent, kpi['open-issues'] + '/' + kpi['open-prs']);
assert.ok(!('data-zero' in pillEl().attrs));
assert.match(pillEl().title, /^31 total open issues \+ 18 total open PRs = 3 actionable now \+ /, 'pill title carries the tile equation breakdown');
assert.match(pillEl().title, /^31 open issues \/ 18 open PRs — the Hive activity monitor pill counts rows of this same set \(every issue, plus each PR not shown under a listed issue\), so it can read differently · 31 total open issues \+ 18 total open PRs = 3 actionable now \+ /, 'pill title names each half, says how the activity-monitor pill differs, then carries the tile equation');
assert.doesNotMatch(pillEl().title, /stale/);

// 2. Stale / last-good: GitHub refused the enumeration, the tiles show the
Expand Down
19 changes: 17 additions & 2 deletions src/pkg/dashboard/stage_tracker_ui_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ func stageTrackerRowsPreludeJS(t *testing.T, html string) string {
jsFunc(t, html, "stageTrackerPage"),
jsFunc(t, html, "stageTrackerLabelFacets"),
jsFunc(t, html, "stageTrackerCountsText"),
jsFunc(t, html, "stageTrackerRowBreakdown"),
jsFunc(t, html, "stageTrackerIcon"),
jsFunc(t, html, "stageTrackerPRRef"),
jsConstLine(t, html, "STAGE_TRACKER_ACTOR_NONE"),
Expand Down Expand Up @@ -912,6 +913,7 @@ func TestStageTrackerFilterSortPage(t *testing.T) {
jsFunc(t, html, "stageTrackerPage"),
jsFunc(t, html, "stageTrackerLabelFacets"),
jsFunc(t, html, "stageTrackerCountsText"),
jsFunc(t, html, "stageTrackerRowBreakdown"),
}, "\n") + `
const assert = require('assert');
const now = Date.parse('2026-01-01T12:00:00Z');
Expand Down Expand Up @@ -1023,13 +1025,26 @@ assert.strictEqual(c.badgeTitle, '150 rows open · 7 need attention');
// Owner: rows are canonical. Open-item totals only footnote PRs that share
// their issue's row; they never become a second total or change the pill.
c = stageTrackerCountsText(stageTrackerPage(many, F({ size: 50, page: 2 })), 150, 7, { issues: 100, prs: 52 }, 9);
assert.strictEqual(c.header, '120 of 150 rows · 7 need attention');
assert.strictEqual(c.header, '120 of 150 rows (100 issues + 50 PRs on their own row) · 7 need attention', 'header spells out how the default view\'s rows are made');
assert.strictEqual(c.badge, 150);
assert.strictEqual(c.note, "2 PRs shown on their issue's row");
assert.strictEqual(c.badgeTitle, "150 rows open · 9 need attention · 2 PRs shown on their issue's row", 'pill tooltip counts attention over every item and footnotes shared rows');
assert.strictEqual(c.breakdown, '100 issues + 50 PRs on their own row');
assert.strictEqual(c.badgeTitle, "150 rows open: 100 issues + 50 PRs on their own row · 9 need attention · 2 PRs shown on their issue's row", 'pill tooltip counts attention over every item, names the row make-up and footnotes shared rows');
assert.strictEqual(c.showing, 'showing 51–100 of 120 (30 filtered out)', 'the showing line never prints an items total');
c = stageTrackerCountsText(stageTrackerPage(many, F({ size: 50, page: 2 })), 150, 7, { issues: 100, prs: 50 }, 9);
assert.strictEqual(c.note, '', 'rows = items → no footnote');
assert.strictEqual(c.breakdown, '100 issues + 50 PRs on their own row');
// Owner (2026-10-29): Overview 33/13 beside activity monitor 37 — rows are
// 33 issues + 4 PRs that have no listed issue; 9 PRs sit on their issue's row.
c = stageTrackerCountsText(stageTrackerPage(many.slice(0, 37), F({ size: 50 })), 37, 3, { issues: 33, prs: 13 }, 3);
assert.strictEqual(c.header, '37 rows (33 issues + 4 PRs on their own row) · 3 need attention');
assert.strictEqual(c.badgeTitle, "37 rows open: 33 issues + 4 PRs on their own row · 3 need attention · 9 PRs shown on their issue's row");
assert.deepStrictEqual(stageTrackerRowBreakdown(37, { issues: 33, prs: 13 }), { known: true, rows: 37, issues: 33, prs: 13, standalonePRs: 4, shared: 9 });
assert.deepStrictEqual(stageTrackerRowBreakdown(34, { issues: 33, prs: 1 }), { known: true, rows: 34, issues: 33, prs: 1, standalonePRs: 1, shared: 0 });
assert.strictEqual(stageTrackerCountsText(stageTrackerPage(many.slice(0, 34), F({ size: 50 })), 34, 0, { issues: 33, prs: 1 }).breakdown, '33 issues + 1 PR on its own row', 'singular PR');
assert.strictEqual(stageTrackerRowBreakdown(40, { issues: 33, prs: 5 }).standalonePRs, 5, 'standalone PRs never exceed open PRs');
assert.strictEqual(stageTrackerRowBreakdown(10, null).known, false);
assert.strictEqual(stageTrackerCountsText(stageTrackerPage(many.slice(0, 10), F({ size: 50 })), 10, 0).breakdown, '', 'no totals → no breakdown, header unchanged');
c = stageTrackerCountsText(stageTrackerPage(many.slice(0, 1), F()), 1, 1);
assert.strictEqual(c.showing, 'showing 1–1 of 1');
assert.strictEqual(c.header, '1 row · 1 needs attention');
Expand Down
42 changes: 34 additions & 8 deletions src/pkg/dashboard/static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -17156,27 +17156,43 @@ <h3 class="faq-group-title">Where to get help</h3>
// issue's row rather than its own, so rows can sit below the payload's
// open items; `open` ({issues, prs}) lets the line footnote that gap
// ("2 PRs shown on their issue's row") instead of printing two totals.
// Because the sidebar Overview pill prints the same open set as
// issues/PRs (33/13) while this pill prints rows (37), `breakdown`
// spells out how the row count is made ("33 issues + 4 PRs on their
// own row") in the header and the pill tooltip, so the two pills read
// as different views of one population rather than a disagreement.
function stageTrackerCountsText(page, allCount, attention, open, attentionAll) {
const filteredOut = Math.max(0, allCount - page.total);
const showing = page.total ? `showing ${page.from}–${page.to} of ${page.total}` : 'showing 0 of 0';
const attnText = n => n ? n + ' need' + (n === 1 ? 's' : '') + ' attention' : 'nothing needs attention';
const attn = attnText(attention);
const attnAll = attnText(Number.isFinite(Number(attentionAll)) ? Number(attentionAll) : attention);
const rowsWord = n => n === 1 ? 'row' : 'rows';
let note = '';
if (open && Number.isFinite(Number(open.issues)) && Number.isFinite(Number(open.prs))) {
const shared = Math.max(0, Number(open.issues) + Number(open.prs) - allCount);
if (shared) note = `${shared} ${shared === 1 ? 'PR' : 'PRs'} shown on ${shared === 1 ? 'its' : 'their'} issue's row`;
}
const parts = stageTrackerRowBreakdown(allCount, open);
const note = parts.shared ? `${parts.shared} ${parts.shared === 1 ? 'PR' : 'PRs'} shown on ${parts.shared === 1 ? 'its' : 'their'} issue's row` : '';
const breakdown = parts.known ? `${parts.issues} ${parts.issues === 1 ? 'issue' : 'issues'} + ${parts.standalonePRs} ${parts.standalonePRs === 1 ? 'PR' : 'PRs'} on ${parts.standalonePRs === 1 ? 'its' : 'their'} own row` : '';
return {
showing: showing + (filteredOut ? ` (${filteredOut} filtered out)` : ''),
header: `${page.total}${filteredOut ? ' of ' + allCount : ''} ${rowsWord(page.total)} · ${attn}`,
header: `${page.total}${filteredOut ? ' of ' + allCount : ''} ${rowsWord(page.total)}${breakdown ? ` (${breakdown})` : ''} · ${attn}`,
badge: allCount,
badgeTitle: `${allCount} ${rowsWord(allCount)} open · ${attnAll}` + (note ? ` · ${note}` : ''),
badgeTitle: `${allCount} ${rowsWord(allCount)} open` + (breakdown ? `: ${breakdown}` : '') + ` · ${attnAll}` + (note ? ` · ${note}` : ''),
note,
breakdown,
};
}

// Pure: how the default view's row count decomposes against the open
// item totals. Every open issue is a row; a PR is a row only when it is
// not drawn under a listed issue, so standalonePRs = rows − issues and
// shared = (issues + PRs) − rows. `known` is false without totals.
function stageTrackerRowBreakdown(rowCount, open) {
const rows = Math.max(0, Number(rowCount) || 0);
if (!open || !Number.isFinite(Number(open.issues)) || !Number.isFinite(Number(open.prs))) return { known: false, rows, issues: 0, prs: 0, standalonePRs: 0, shared: 0 };
const issues = Math.max(0, Number(open.issues)), prs = Math.max(0, Number(open.prs));
const standalonePRs = Math.min(prs, Math.max(0, rows - issues));
return { known: true, rows, issues, prs, standalonePRs, shared: Math.max(0, issues + prs - rows) };
}

// The tracker's open issue / PR counts: the payload's open_issues/open_prs
// when present, else counted from the items. Items is the canonical
// open-items set, so this equals the Overview tile's totals.
Expand Down Expand Up @@ -26002,17 +26018,27 @@ <h2 class="config-title" id="activity-monitor-labels-title">All labels</h2>
"Total open PRs" tiles exactly; the title carries the tile equation
and the last-good "stale" note. overview_sidebar_pill_test.go runs
it under node. */
// Pure: the sidebar Overview pill. The text is the open-item totals the
// tiles print (issues/PRs); the tooltip names each half and says that
// the Hive activity monitor pill counts rows of the same set — every
// issue plus each PR not drawn under a listed issue — so 33/13 beside
// Overview and 37 beside the activity monitor are one population, not
// two disagreeing counts (overviewSidebarPillLead).
function overviewSidebarPill(openIssues, openPRs, equationLabel, staleSince, unlisted) {
const issues = Number(openIssues) || 0;
const prs = Number(openPRs) || 0;
let title = equationLabel || `${issues} total open issues + ${prs} total open PRs`;
let title = overviewSidebarPillLead(issues, prs) + ' · ' + (equationLabel || `${issues} total open issues + ${prs} total open PRs`);
if (staleSince) title += ` (${overviewStaleBadgeText(staleSince, overviewRestartRefresh()).text})`;
const syncing = overviewSyncingNote(unlisted);
if (syncing) title += ` · ${syncing}`;
const note = overviewUnlistedNote(unlisted);
if (note) title += ` · ${note}`;
return { issues, prs, title };
}
function overviewSidebarPillLead(issues, prs) {
const i = Number(issues) || 0, p = Number(prs) || 0;
return `${i} open ${i === 1 ? 'issue' : 'issues'} / ${p} open ${p === 1 ? 'PR' : 'PRs'} — the Hive activity monitor pill counts rows of this same set (every issue, plus each PR not shown under a listed issue), so it can read differently`;
}

/* Pure: open items the enumeration or forgestate cache reported in its
totals without an item row behind them (repos[].unlistedIssues /
Expand Down
Loading