3 review notes blocked on this PR · '), 'one muted line on the PR row: ' + prRow);
+for (const n of [101, 102, 103]) assert.ok(prRow.includes('href="https://x/i' + n + '"'), 'note #' + n + ' stays reachable');
+const leadRow = stageTrackerRowHtml(n104, stages, ctx2);
+assert.ok(leadRow.includes('data-ham-review-notes="1">+1 more review note blocked on PR #200 · '), 'the lead note names the rest of its group: ' + leadRow);
+assert.ok(leadRow.includes('href="https://x/i105"'));
+assert.ok(!stageTrackerRowHtml(plain(106), stages, ctx2).includes('ham-review-notes'), 'a plain issue has no notes line');
+assert.ok(!stageTrackerRowHtml(pr(300, []), stages, ctx2).includes('ham-review-notes'), 'a PR without notes has no notes line');
+
+const folded = stageTrackerFoldedCount(items, ctx2);
+assert.strictEqual(folded, 4, 'four of six issues are folded');
+const counts = stageTrackerCountsText({ total: 3, from: 1, to: 3 }, 3, 0, { issues: 6, prs: 1 }, 0, folded);
+assert.strictEqual(counts.badge, 3);
+assert.ok(counts.badgeTitle.includes('3 rows (6 issues + 1 PR on its own row)'), counts.badgeTitle);
+assert.ok(counts.badgeTitle.includes('4 review notes folded under their PR'), counts.badgeTitle);
+assert.ok(!counts.badgeTitle.includes("issue's row"), 'no PR shares an issue row here: ' + counts.badgeTitle);
+assert.deepStrictEqual(stageTrackerRowBreakdown(7, { issues: 6, prs: 1 }), { known: true, rows: 7, issues: 6, prs: 1, standalonePRs: 1, shared: 0, folded: 0 }, 'without folding the breakdown is as before');
+`)
+}
diff --git a/src/pkg/dashboard/stage_tracker_sentinel_lane_test.go b/src/pkg/dashboard/stage_tracker_sentinel_lane_test.go
index fa8146f4b6..65ac4a34dd 100644
--- a/src/pkg/dashboard/stage_tracker_sentinel_lane_test.go
+++ b/src/pkg/dashboard/stage_tracker_sentinel_lane_test.go
@@ -512,7 +512,7 @@ r = stageTrackerReconcile(el, [row(P('o/r', 109, 85))], opts);
assert.deepStrictEqual(r, { kept: 0, replaced: 1, entered: 0, exited: 0, deferred: 0 }, 'flag off → swapped back');
assert.ok(!el.children[0].html.includes('entinel'));
`
- if out, err := exec.Command(node, "-e", script).CombinedOutput(); err != nil {
+ if out, err := runNodeStdin(node, script); err != nil {
t.Fatalf("node sentinel lane fixture failed: %v\n%s", err, out)
}
}
diff --git a/src/pkg/dashboard/stage_tracker_ui_test.go b/src/pkg/dashboard/stage_tracker_ui_test.go
index a8c7850482..b3c53270c4 100644
--- a/src/pkg/dashboard/stage_tracker_ui_test.go
+++ b/src/pkg/dashboard/stage_tracker_ui_test.go
@@ -232,6 +232,10 @@ func stageTrackerRowsPreludeJS(t *testing.T, html string) string {
jsFunc(t, html, "stageTrackerMoveAttrs"),
jsFunc(t, html, "stageTrackerNeedsAttention"),
jsFunc(t, html, "stageTrackerVisible"),
+ jsFunc(t, html, "stageTrackerIsReviewNote"),
+ jsFunc(t, html, "stageTrackerFoldedReviewNotes"),
+ jsFunc(t, html, "stageTrackerReviewNotesHtml"),
+ jsFunc(t, html, "stageTrackerFoldedCount"),
stageTrackerCuesJS(t, html),
}, "\n")
}
@@ -980,6 +984,10 @@ func TestStageTrackerFilterSortPage(t *testing.T) {
jsFunc(t, html, "stageTrackerFilterActive"),
jsFunc(t, html, "stageTrackerMatches"),
jsFunc(t, html, "stageTrackerVisible"),
+ jsFunc(t, html, "stageTrackerIsReviewNote"),
+ jsFunc(t, html, "stageTrackerFoldedReviewNotes"),
+ jsFunc(t, html, "stageTrackerReviewNotesHtml"),
+ jsFunc(t, html, "stageTrackerFoldedCount"),
jsFunc(t, html, "stageTrackerRowCount"),
jsFunc(t, html, "stageTrackerSort"),
jsFunc(t, html, "stageTrackerPage"),
@@ -1111,8 +1119,8 @@ assert.strictEqual(c.breakdown, '100 issues + 50 PRs on their own 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 · 9 PRs shown on their issue's row");
assert.strictEqual(c.badgeTitle, "37 rows (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.deepStrictEqual(stageTrackerRowBreakdown(37, { issues: 33, prs: 13 }), { known: true, rows: 37, issues: 33, prs: 13, standalonePRs: 4, shared: 9, folded: 0 });
+assert.deepStrictEqual(stageTrackerRowBreakdown(34, { issues: 33, prs: 1 }), { known: true, rows: 34, issues: 33, prs: 1, standalonePRs: 1, shared: 0, folded: 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);
diff --git a/src/pkg/dashboard/static-src/css/tracker.css b/src/pkg/dashboard/static-src/css/tracker.css
index 7130a4da6a..46086f9a8d 100644
--- a/src/pkg/dashboard/static-src/css/tracker.css
+++ b/src/pkg/dashboard/static-src/css/tracker.css
@@ -389,6 +389,8 @@
.ham-sub-superseded { opacity: .55; }
.ham-sub-superseded .ham-row-head { min-height: 0; }
.ham-superseded-note { color: var(--muted); font-size: var(--fs-xs); flex: 0 0 auto; white-space: nowrap; }
+ .ham-review-notes { color: var(--muted); font-size: var(--fs-xs); margin-top: var(--sp-1); }
+ .ham-review-notes a { color: inherit; }
.ham-adopted-from { color: var(--muted); text-decoration: none; }
/* The Let hive decide preview. One decision, readable in three seconds
(operator feedback on the dialog, issue 15397): subject line,
diff --git a/src/pkg/dashboard/static-src/js/tracker-filter.js b/src/pkg/dashboard/static-src/js/tracker-filter.js
index 9f8a2e0ba9..d273f1f53a 100644
--- a/src/pkg/dashboard/static-src/js/tracker-filter.js
+++ b/src/pkg/dashboard/static-src/js/tracker-filter.js
@@ -206,12 +206,57 @@
// Rows for the current filter. Outside the Pull requests view a PR that
// is nested under a listed issue is drawn as that issue's sub-row only.
+ // A `blocked` review-backlog issue (review_note_of = its source PR) is
+ // never a row of its own while that PR is open: it folds under the PR's
+ // row (one muted "N review notes blocked on this PR" line), or, when the
+ // PR is not drawn in this view, into the lowest-numbered note of its
+ // group, so a PR with eight notes costs the count one row, not eight.
function stageTrackerVisible(items, filter, ctx) {
const f = stageTrackerNormalizeFilter(filter || _stageTrackerFilter);
const rows = (items || []).filter(it => stageTrackerMatches(it, f, ctx));
if (f.kind === 'pr') return rows;
const issues = new Set(rows.filter(it => it.kind === 'issue').map(it => it.repo + '#' + it.number));
- return rows.filter(it => !(it.kind === 'pr' && it.nested_under && issues.has(it.repo + '#' + it.nested_under)));
+ const out = rows.filter(it => !(it.kind === 'pr' && it.nested_under && issues.has(it.repo + '#' + it.nested_under)));
+ const drawnPRs = new Set(rows.filter(it => it.kind === 'pr').map(it => it.repo + '#' + it.number));
+ const lead = {};
+ for (const it of out) {
+ if (!stageTrackerIsReviewNote(it)) continue;
+ const k = it.repo + '#' + it.review_note_of;
+ if (!(k in lead) || Number(it.number) < lead[k]) lead[k] = Number(it.number);
+ }
+ return out.filter(it => {
+ if (!stageTrackerIsReviewNote(it)) return true;
+ const k = it.repo + '#' + it.review_note_of;
+ return !drawnPRs.has(k) && lead[k] === Number(it.number);
+ });
+ }
+
+ // Pure: an issue the tracker folds as a review note (see stageTrackerVisible).
+ function stageTrackerIsReviewNote(it) {
+ return !!(it && it.kind === 'issue' && Number(it.review_note_of) > 0);
+ }
+
+ // Pure: the review notes folded into this row. On a PR row, its
+ // review_notes; on the lead note of a group whose PR is not drawn, the
+ // other open notes of that group (from the full item list).
+ function stageTrackerFoldedReviewNotes(item, items) {
+ if (!item) return [];
+ if (item.kind === 'pr') return Array.isArray(item.review_notes) ? item.review_notes : [];
+ if (!stageTrackerIsReviewNote(item)) return [];
+ return (items || []).filter(it => stageTrackerIsReviewNote(it) && it.repo === item.repo && it.review_note_of === item.review_note_of && it.number !== item.number)
+ .sort((a, b) => a.number - b.number);
+ }
+
+ // The muted one-line summary of a row's folded review notes, with each
+ // note's number as a link so nothing becomes unreachable.
+ function stageTrackerReviewNotesHtml(item, ctx) {
+ const notes = stageTrackerFoldedReviewNotes(item, ctx && ctx.items);
+ if (!notes.length) return '';
+ const links = notes.map(n => n.url ? `
#${Number(n.number)}` : `
#${Number(n.number)}`).join(', ');
+ const lead = item.kind === 'pr'
+ ? `${notes.length} review note${notes.length === 1 ? '' : 's'} blocked on this PR`
+ : `+${notes.length} more review note${notes.length === 1 ? '' : 's'} blocked on PR #${Number(item.review_note_of)}`;
+ return `
${esc(lead)} · ${links}
`;
}
// The canonical tracker count (owner): rows of the default view — every
@@ -303,15 +348,18 @@
// 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) {
+ function stageTrackerCountsText(page, allCount, attention, open, attentionAll, folded) {
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';
- 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 parts = stageTrackerRowBreakdown(allCount, open, folded);
+ const noteBits = [];
+ if (parts.shared) noteBits.push(`${parts.shared} ${parts.shared === 1 ? 'PR' : 'PRs'} shown on ${parts.shared === 1 ? 'its' : 'their'} issue's row`);
+ if (parts.folded) noteBits.push(`${parts.folded} review ${parts.folded === 1 ? 'note' : 'notes'} folded under ${parts.folded === 1 ? 'its' : 'their'} PR`);
+ const note = noteBits.join(' · ');
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)` : ''),
@@ -324,15 +372,28 @@
}
// 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) {
+ // item totals. Every open issue is a row except a review note folded
+ // under its PR (`folded`, see stageTrackerVisible); a PR is a row only
+ // when it is not drawn under a listed issue, so standalonePRs = rows −
+ // (issues − folded) and shared = (issues − folded + PRs) − rows. `known`
+ // is false without totals. `issues` stays the open-issue total so the
+ // breakdown still adds up to the Overview tile.
+ function stageTrackerRowBreakdown(rowCount, open, folded) {
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 };
+ if (!open || !Number.isFinite(Number(open.issues)) || !Number.isFinite(Number(open.prs))) return { known: false, rows, issues: 0, prs: 0, standalonePRs: 0, shared: 0, folded: 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) };
+ const fold = Math.min(issues, Math.max(0, Number(folded) || 0));
+ const standalonePRs = Math.min(prs, Math.max(0, rows - (issues - fold)));
+ return { known: true, rows, issues, prs, standalonePRs, shared: Math.max(0, issues - fold + prs - rows), folded: fold };
+ }
+
+ // Pure: how many issues of the default view are folded review notes
+ // rather than rows (stageTrackerVisible drops them; the count line
+ // explains the difference).
+ function stageTrackerFoldedCount(items, ctx) {
+ const f = stageTrackerDefaultFilter();
+ const shown = new Set(stageTrackerVisible(items, f, ctx).map(it => it.repo + '#' + it.number));
+ return (items || []).filter(it => stageTrackerIsReviewNote(it) && stageTrackerMatches(it, f, ctx) && !shown.has(it.repo + '#' + it.number)).length;
}
// The tracker's open issue / PR counts: the payload's open_issues/open_prs
@@ -631,6 +692,7 @@
ctx.events = _stageTrackerEvents;
ctx.noteTuck = stageTrackerNoteTuckSetting();
ctx.sharedPRs = stageTrackerSharedPRs(d.items);
+ ctx.items = d.items;
// Repo chips ride the setting against how many repos the payload spans.
if (stageTrackerRepoChipOn(stageTrackerRepoChipSetting(), repos.length)) ctx.repoChips = { primary: stageTrackerPrimaryRepo(), active: f.repo };
const visible = stageTrackerVisible(d.items, f, ctx);
@@ -655,7 +717,7 @@
// is the warn-coloured header suffix and the pill's tooltip, counted
// over every item regardless of filter.
const attentionAll = d.items.filter(stageTrackerNeedsAttention).length;
- const counts = stageTrackerCountsText(page, allRows, attention, stageTrackerOpenCounts(d), attentionAll);
+ const counts = stageTrackerCountsText(page, allRows, attention, stageTrackerOpenCounts(d), attentionAll, stageTrackerFoldedCount(d.items, ctx));
setSectionSummary('activity-monitor-section', counts.header.replace(/(\d+) needs? attention/, m => `
${m}`));
const badge = document.getElementById('activity-monitor-sidebar-badge');
if (badge) { badge.textContent = String(counts.badge); badge.title = counts.badgeTitle; if (counts.badge) badge.removeAttribute('data-zero'); else badge.setAttribute('data-zero', ''); }
diff --git a/src/pkg/dashboard/static-src/js/tracker-row.js b/src/pkg/dashboard/static-src/js/tracker-row.js
index b4592e36af..510ec7c30e 100644
--- a/src/pkg/dashboard/static-src/js/tracker-row.js
+++ b/src/pkg/dashboard/static-src/js/tracker-row.js
@@ -1352,7 +1352,7 @@
${stageTrackerStripItems(shown, stages, range, nowMs, ctx)}
${stageTrackerSinceHtml(shown, nowMs)}
-
${stageTrackerCurrentStageHtml(shown, stages, range, nowMs)}${typeof stageTrackerEventHtml === 'function' ? stageTrackerEventHtml(stageTrackerItemKey(item), ctx) : ''}${subs}
+
${stageTrackerCurrentStageHtml(shown, stages, range, nowMs)}${typeof stageTrackerEventHtml === 'function' ? stageTrackerEventHtml(stageTrackerItemKey(item), ctx) : ''}${typeof stageTrackerReviewNotesHtml === 'function' ? stageTrackerReviewNotesHtml(item, ctx) : ''}${subs}
`;
}
diff --git a/src/pkg/dashboard/static/index.html b/src/pkg/dashboard/static/index.html
index dac2b4f48c..50b70b39e5 100644
--- a/src/pkg/dashboard/static/index.html
+++ b/src/pkg/dashboard/static/index.html
@@ -1718,6 +1718,8 @@
.ham-sub-superseded { opacity: .55; }
.ham-sub-superseded .ham-row-head { min-height: 0; }
.ham-superseded-note { color: var(--muted); font-size: var(--fs-xs); flex: 0 0 auto; white-space: nowrap; }
+ .ham-review-notes { color: var(--muted); font-size: var(--fs-xs); margin-top: var(--sp-1); }
+ .ham-review-notes a { color: inherit; }
.ham-adopted-from { color: var(--muted); text-decoration: none; }
/* The Let hive decide preview. One decision, readable in three seconds
(operator feedback on the dialog, issue 15397): subject line,
@@ -17441,7 +17443,7 @@