diff --git a/changelog.d/changed-shared-pr-group.md b/changelog.d/changed-shared-pr-group.md
new file mode 100644
index 0000000000..8bd42049fb
--- /dev/null
+++ b/changelog.d/changed-shared-pr-group.md
@@ -0,0 +1 @@
+- Activity Monitor: the issues one PR closes together are now one group of the list — the secondary rows sit right after their primary (indented on a rail), render from the primary's own PR snapshot, and fold under a caret on the primary's "also closes" pill (remembered in localStorage).
diff --git a/src/docs/dashboard-sections/activity-monitor.md b/src/docs/dashboard-sections/activity-monitor.md
index 97da5e0bc8..a2f36fe588 100644
--- a/src/docs/dashboard-sections/activity-monitor.md
+++ b/src/docs/dashboard-sections/activity-monitor.md
@@ -536,6 +536,8 @@ Payloads without `drawn_under` draw as before.
The link reads both ways (hivecommons/hive#15806): the entry drawn under #A carries `also_closes` — the other listed open issues the PR closes (number, title, url) — and the PR's line wears a gray **also closes #B** pill beside the PR link, in the lineage-pill style (comma-separated for several, three numbers then **+N**, every number linking to its issue; tooltip: *this PR also resolves #B (title)*). The "↳ … under …" listing never carries it.
+The issues one PR closes are one group of the list. A secondary issue's row always sits right after its primary (#A, then #B — whatever the lead sort or a merge train would have put between them; the group takes the primary's place in the order, several secondaries keep their lead order among themselves), indented as a child on a thin rail from the primary's pill to the last child's elbow. Both rows are built from the primary's own listing of the PR — the secondary's copy is replaced by that object before the rows render — so the two chevron strips can never light different stages. The **also closes** pill on the primary carries a caret (▾/▸) that folds and unfolds the secondaries' rows (the folded pill reads **+N**; folded rows still count in the total), remembered per primary in `localStorage` under `hive.tracker.shared.collapsed`. A secondary whose primary is not a row of the current list (filtered out, or on another page) stands alone exactly as before, with its **↳ #N · under #M** chip.
+
#### Merged (the chip, the ledger, the flight)
A thin bar at the top of the tracker — it stays pinned under the card header while the list scrolls, with the stage column header strip pinned just below it — carries the dashboard's bee glyph (the version card's bee, in a 28 px hit area; the pill is no taller than the chips beside it) with **Merged** and the all-time count drawn as a **quiet odometer at rest, always** — one shallow inset track with a hairline border and faint dividers, a wheel per digit, tabular semibold digits at the chip's own type size, no thousands separator (#15543: the first drum's 18 px bevelled cells were "too big of font … the animation is perfect though" — the roll is unchanged) — every pull request the hive tracked that reached merged, *all time*, with *N today · N this week* beside it at the bar's usual size. The number is the server's, not the tab's: the hive keeps a **merged ledger** at `/data/merged-ledger.json` (entries for 90 days, an all-time total that only grows, atomic writes, seeded on first boot from the audit log's `pr_merged` history with the PR throughput counter as the floor, then backfilled by the first closed sweep, which on such a boot asks GitHub for every PR closed in the last 30 days — merges by people and other bots the audit log never saw — instead of its usual one day; so the ledger counts every merged PR in a configured repository, and its all-time number is expected to run above the hive-observed PR throughput counter it was seeded from) fed by the audit log's `pr_merged` lines — the hive's own merges on every path and the poller's observations of merges by people or other bots — and by webhook / closed-sweep snapshots of a PR GitHub reports merged, which carry the title and the merger's login within seconds.
diff --git a/src/pkg/dashboard/stage_tracker_shared_pr_group_test.go b/src/pkg/dashboard/stage_tracker_shared_pr_group_test.go
new file mode 100644
index 0000000000..13bf513d8f
--- /dev/null
+++ b/src/pkg/dashboard/stage_tracker_shared_pr_group_test.go
@@ -0,0 +1,170 @@
+package dashboard
+
+import (
+ "strings"
+ "testing"
+)
+
+// TestStageTrackerSharedPRGroupJS: the rows of issues one PR closes together
+// are one unit of the list — the secondary sits right after its primary
+// whatever the lead sort put between them, draws as its child, is built from
+// the primary's own PR snapshot, and folds under the primary's "also closes"
+// pill (remembered in localStorage). A secondary whose primary is not a row
+// of this list stays standalone, as before.
+func TestStageTrackerSharedPRGroupJS(t *testing.T) {
+ html := indexHTML(t)
+ runStageTrackerRowActionsScript(t, stageTrackerRowsPreludeJS(t, html)+"\n"+strings.Join([]string{
+ jsFunc(t, html, "stageTrackerLinkedSupersededText"),
+ jsFunc(t, html, "stageTrackerSharedPRParent"),
+ jsFunc(t, html, "stageTrackerSharedPRGroups"),
+ jsFunc(t, html, "stageTrackerSharedPRRebind"),
+ jsFunc(t, html, "stageTrackerSharedPRContiguous"),
+ jsConstLine(t, html, "STAGE_TRACKER_SHARED_COLLAPSED_KEY"),
+ jsFunc(t, html, "stageTrackerLoadSharedCollapsed"),
+ jsFunc(t, html, "stageTrackerSaveSharedCollapsed"),
+ jsFunc(t, html, "stageTrackerToggleCollapsed"),
+ }, "\n")+"\n"+stageTrackerActorIconJS(t, html)+stageTrackerRowsFixtureJS+`
+const since = new Date(now - 3600000).toISOString();
+const lit = (html) => (/
]*title="([^"]*)"/.exec(strip(html)) || [])[1] || '';
+const li = (n) => ({ number: n, title: 'Issue ' + n, url: 'https://x/issues/' + n });
+const pr = (n, under, extra) => Object.assign({ number: n, title: 'fix', url: 'https://x/' + n, author: 'hive-bot', author_kind: 'hive', stage: 95, stage_since: since, drawn_under: under, merge_gate: { state: 'soaking' } }, extra || {});
+const issue = (n, prs, extra) => Object.assign({ repo: 'hivecommons/hive', number: n, kind: 'issue', title: 'Issue ' + n, url: 'https://x/issues/' + n, stage: 40, stage_since: since, linked_prs: prs || [] }, extra || {});
+const nums = (rows) => rows.map(r => r.number);
+
+// The live board: #17292 (primary, PR #17308 also closes #17302) at the top,
+// an unrelated #17329 between, #17302 (secondary) third.
+const primary = issue(17292, [pr(17308, 17292, { also_closes: [li(17302)] })]);
+const between = issue(17329, [], { stage: 30 });
+// The secondary's copy of the PR is a different object from an older tick.
+const secondary = issue(17302, [pr(17308, 17292, { stage: 50, merge_gate: null, stage_since: new Date(now - 7200000).toISOString() })]);
+
+// Groups: the secondary belongs to the primary, by row key.
+let g = stageTrackerSharedPRGroups([primary, between, secondary], stages);
+assert.deepStrictEqual(g.parentOf, { 'hivecommons/hive/issue#17302': 'hivecommons/hive/issue#17292' });
+assert.deepStrictEqual(g.children, { 'hivecommons/hive/issue#17292': ['hivecommons/hive/issue#17302'] });
+assert.deepStrictEqual(g.prs, { 'hivecommons/hive/issue#17292': { 17308: true } });
+
+// Adjacency: the secondary follows its primary; the unrelated row moves down.
+let rows = stageTrackerSharedPRContiguous([primary, between, secondary], stages, {});
+assert.deepStrictEqual(nums(rows), [17292, 17302, 17329], 'secondary right after its primary');
+// The group sorts by the primary: a secondary ahead of its primary comes down to it.
+rows = stageTrackerSharedPRContiguous([secondary, between, primary], stages, {});
+assert.deepStrictEqual(nums(rows), [17329, 17292, 17302], 'group takes the primary\'s place');
+// Several secondaries keep their lead order among themselves.
+const third = issue(17310, [pr(17308, 17292, { stage: 50 })]);
+const wide = issue(17292, [pr(17308, 17292, { also_closes: [li(17302), li(17310)] })]);
+rows = stageTrackerSharedPRContiguous([third, between, wide, secondary], stages, {});
+assert.deepStrictEqual(nums(rows), [17329, 17292, 17310, 17302]);
+// Nothing to group → the very same array.
+const plain = [between, issue(1, [pr(2, 1)])];
+assert.strictEqual(stageTrackerSharedPRContiguous(plain, stages, {}), plain);
+
+// Same snapshot: the secondary's listing of the PR becomes the primary's own
+// entry (drawn_under kept, also_closes dropped) — stage 95 soaking, not the
+// stale 50 — so both chevron strips light the same segment.
+let sec = rows[3];
+assert.strictEqual(sec.number, 17302);
+assert.strictEqual(sec.linked_prs[0].stage, 95, 'rebound to the primary\'s PR snapshot');
+assert.deepStrictEqual(sec.linked_prs[0].merge_gate, { state: 'soaking' });
+assert.strictEqual(sec.linked_prs[0].drawn_under, 17292);
+assert.strictEqual(sec.linked_prs[0].also_closes, null, 'the pill stays on the primary alone');
+assert.strictEqual(secondary.linked_prs[0].stage, 50, 'the server payload is not mutated');
+assert.notStrictEqual(sec, secondary, 'the row is a copy');
+g = stageTrackerSharedPRGroups(rows, stages);
+const ctxG = Object.assign({}, ctx, { shared: Object.assign(g, { collapsed: {} }) });
+const headRow = stageTrackerRowHtml(rows[1], stages, ctxG);
+const childRow = stageTrackerRowHtml(sec, stages, ctxG);
+assert.strictEqual(lit(childRow), lit(headRow), 'both strips light from the same PR state: ' + lit(headRow) + ' vs ' + lit(childRow));
+assert.notStrictEqual(lit(childRow), lit(stageTrackerRowHtml(secondary, stages, ctx)), 'the stale copy would have lit elsewhere');
+
+// Visual: the primary heads the group, each secondary is a child; the last wears ham-shared-last.
+assert.ok(/
= 0, 'the primary wears the group pill: ' + headRow);
+const pill = headRow.slice(pi, headRow.indexOf('', pi) + ''.length);
+const pillTitle = (/ title="([^"]*)"/.exec(pill) || [])[1] || '';
+assert.ok(pill.includes('data-action="hamSharedToggle" data-arg0="hivecommons/hive/issue#17292" data-stop="1" aria-expanded="true"'), pill);
+assert.ok(pill.includes('aria-label="Fold 2 issue rows this PR also closes"'), pill);
+assert.ok(pill.includes('▾') && text(pill).includes('also closes #17302, #17310'), text(pill));
+assert.ok(pillTitle.includes('2 issue rows drawn under this row'), pillTitle);
+assert.ok(!pill.slice(0, pill.indexOf('')).includes('+2'), foldedRow);
+assert.ok(!/
also closes #17302');
+assert.strictEqual(stageTrackerAlsoClosesChipHtml(pr(17308, 17292, { also_closes: [li(17302)] }), { key: 'k', count: 0 }), stageTrackerAlsoClosesChipHtml(pr(17308, 17292, { also_closes: [li(17302)] })), 'an empty group is no group');
+const one = stageTrackerAlsoClosesChipHtml(pr(17308, 17292, { also_closes: [li(17302)] }), { key: 'k', count: 1, collapsed: true });
+assert.ok(one.includes('aria-label="Show 1 issue row this PR also closes"'), one);
+
+// The fold persists under hive.tracker.shared.collapsed, like the repo groups.
+const store = {};
+global.localStorage = { getItem: k => (k in store ? store[k] : null), setItem(k, v) { store[k] = String(v); } };
+assert.deepStrictEqual(stageTrackerLoadSharedCollapsed(), {});
+let c = stageTrackerToggleCollapsed({}, 'hivecommons/hive/issue#17292');
+stageTrackerSaveSharedCollapsed(c);
+assert.strictEqual(store[STAGE_TRACKER_SHARED_COLLAPSED_KEY], '{"hivecommons/hive/issue#17292":true}');
+assert.strictEqual(STAGE_TRACKER_SHARED_COLLAPSED_KEY, 'hive.tracker.shared.collapsed');
+assert.deepStrictEqual(stageTrackerLoadSharedCollapsed(), { 'hivecommons/hive/issue#17292': true }, 'round-trips');
+store[STAGE_TRACKER_SHARED_COLLAPSED_KEY] = '[1]';
+assert.deepStrictEqual(stageTrackerLoadSharedCollapsed(), {}, 'a malformed value is empty');
+`)
+}
+
+// TestStageTrackerSharedPRGroupWiring: the render applies the grouping after
+// the lead sort, hands the groups to the rows, counts folded rows in the
+// total, the caret's handler and CSS are in the page, and the CSS is tokens only.
+func TestStageTrackerSharedPRGroupWiring(t *testing.T) {
+ html := indexHTML(t)
+ for _, want := range []string{
+ `ctx.shared = sharing ? Object.assign(stageTrackerSharedPRGroups(prepared, stages), { collapsed: _stageTrackerSharedCollapsed }) : null;`,
+ `const ordered = sharing ? stageTrackerSharedPRContiguous(prepared, stages, _stageTrackerSharedCollapsed) : prepared;`,
+ `if (foldedShared > 0) page.total += foldedShared;`,
+ `if (typeof stageTrackerLoadSharedCollapsed === 'function') _stageTrackerSharedCollapsed = stageTrackerLoadSharedCollapsed();`,
+ `function hamSharedToggle(key) {`,
+ `.ham-row.ham-shared-child {`, `.ham-row.ham-shared-head::before {`, `.ham-shared-toggle {`,
+ } {
+ if !strings.Contains(html, want) {
+ t.Errorf("index.html lacks %q", want)
+ }
+ }
+ start := strings.Index(html, ".ham-row.ham-shared-child {")
+ end := strings.Index(html[start:], ".ham-shared-count {")
+ if start < 0 || end < 0 {
+ t.Fatal("shared-PR group CSS block not found")
+ }
+ block := html[start : start+end]
+ for _, bad := range []string{"#", "rgb(", "hsl("} {
+ if strings.Contains(block, bad) {
+ t.Errorf("shared-PR group CSS uses a literal colour (%q); tokens only", bad)
+ }
+ }
+}
diff --git a/src/pkg/dashboard/static-src/css/tracker.css b/src/pkg/dashboard/static-src/css/tracker.css
index 144ba91f3f..a3090109ea 100644
--- a/src/pkg/dashboard/static-src/css/tracker.css
+++ b/src/pkg/dashboard/static-src/css/tracker.css
@@ -615,6 +615,22 @@
.ham-also-closes { color: var(--muted); }
.ham-also-closes a { color: inherit; text-decoration: none; }
.ham-also-closes a:hover { color: var(--text); text-decoration: underline; }
+ /* Shared-PR group (one PR closing several listed issues): the secondary
+ issues a PR also closes sit right under their primary, indented, on
+ a rail that runs from the primary's pill to the last child's elbow.
+ The primary's "also closes" pill carries the fold caret. Tokens only. */
+ .ham-row.ham-shared-child { position: relative; padding-left: var(--sp-6); }
+ .ham-row.ham-shared-child::before { content: ''; position: absolute; left: var(--sp-3); top: 0; bottom: 0; border-left: var(--line-width) solid var(--line-strong); pointer-events: none; }
+ .ham-row.ham-shared-child.ham-shared-last::before { bottom: 50%; }
+ .ham-row.ham-shared-child::after { content: ''; position: absolute; left: var(--sp-3); top: 50%; width: var(--sp-3); border-top: var(--line-width) solid var(--line-strong); pointer-events: none; }
+ .ham-row.ham-shared-child + .ham-row.ham-shared-child { border-top-color: transparent; }
+ .ham-row.ham-shared-head + .ham-row.ham-shared-child { border-top-color: transparent; }
+ .ham-row.ham-shared-head { position: relative; }
+ .ham-row.ham-shared-head::before { content: ''; position: absolute; left: var(--sp-3); top: 50%; bottom: 0; border-left: var(--line-width) solid var(--line-strong); pointer-events: none; }
+ .ham-shared-toggle { appearance: none; background: none; border: 0; padding: 0 var(--sp-1) 0 0; margin: 0; font: inherit; color: inherit; cursor: pointer; line-height: 1; vertical-align: baseline; }
+ .ham-shared-toggle:hover .ham-group-caret, .ham-shared-toggle:focus-visible .ham-group-caret { color: var(--text); }
+ .ham-shared-toggle:focus-visible { outline: var(--line-width) solid var(--line-strong); outline-offset: 1px; border-radius: var(--r-sm); }
+ .ham-shared-count { color: var(--text); }
.ham-plan-body, .ham-plan-note { white-space: pre-wrap; }
.ham-plan-note { color: var(--muted); font-size: var(--fs-xs); }
.ham-seg.active .cue-acting-cap { margin-left: var(--sp-2); }
diff --git a/src/pkg/dashboard/static-src/js/tracker-filter-render.js b/src/pkg/dashboard/static-src/js/tracker-filter-render.js
index e506479ba8..fee4a2adfc 100644
--- a/src/pkg/dashboard/static-src/js/tracker-filter-render.js
+++ b/src/pkg/dashboard/static-src/js/tracker-filter-render.js
@@ -96,7 +96,15 @@
if (stageTrackerRepoChipOn(stageTrackerRepoChipSetting(), repos.length)) ctx.repoChips = { primary: stageTrackerPrimaryRepo(), active: f.repo };
const visible = stageTrackerVisible(d.items, f, ctx);
const sorted = stageTrackerTrainContiguous(stageTrackerSort(visible, stages, f, { phone: stageTrackerPhone() }));
- const ordered = typeof stageTrackerPreparationOrderRows === 'function' ? stageTrackerPreparationOrderRows(d, sorted, stages) : sorted;
+ const prepared = typeof stageTrackerPreparationOrderRows === 'function' ? stageTrackerPreparationOrderRows(d, sorted, stages) : sorted;
+ // Shared-PR groups last, so a secondary issue always sits right after
+ // its primary whatever the lead sort or train put between them; the
+ // groups a viewer folded leave their secondaries out of the list.
+ // Guarded: test harnesses lift renderStageTracker without tracker-words-core.
+ const sharing = typeof stageTrackerSharedPRContiguous === 'function';
+ ctx.shared = sharing ? Object.assign(stageTrackerSharedPRGroups(prepared, stages), { collapsed: _stageTrackerSharedCollapsed }) : null;
+ const ordered = sharing ? stageTrackerSharedPRContiguous(prepared, stages, _stageTrackerSharedCollapsed) : prepared;
+ const foldedShared = prepared.length - ordered.length;
// A TV display (display=1&density=tv) shows the rows that fit the
// screen, ungrouped, with "+N more" in place of the pager.
const tv = typeof stageTrackerDisplayTv === 'function' && stageTrackerDisplayTv();
@@ -107,6 +115,8 @@
? stageTrackerGroupPage(stageTrackerGroups(ordered, { primary: stageTrackerPrimaryRepo(), collapsed: _stageTrackerCollapsed, stages }), f)
: stageTrackerPage(ordered, f);
if (!tv && page.page !== f.page) f.page = page.page;
+ // A folded secondary is not filtered out: it counts toward the total.
+ if (foldedShared > 0) page.total += foldedShared;
// The rows this render draws (this page, group headers aside), for
// stageTrackerPRListedOwnRow: a covered issue defers to its PR's row
// only when that row is actually on screen. Kept beside the payload,
diff --git a/src/pkg/dashboard/static-src/js/tracker-filter-state.js b/src/pkg/dashboard/static-src/js/tracker-filter-state.js
index 71f5622b39..778ebba2fe 100644
--- a/src/pkg/dashboard/static-src/js/tracker-filter-state.js
+++ b/src/pkg/dashboard/static-src/js/tracker-filter-state.js
@@ -171,9 +171,26 @@
if (out[repo]) delete out[repo]; else out[repo] = true;
return out;
}
+ // The shared-PR groups a viewer folded (hive.tracker.shared.collapsed):
+ // { 'owner/repo/issue#M': true } by the primary row's key, same shape
+ // and lifecycle as the per-repo collapsed set.
+ function stageTrackerLoadSharedCollapsed() {
+ try {
+ const o = JSON.parse(localStorage.getItem(STAGE_TRACKER_SHARED_COLLAPSED_KEY) || '{}');
+ if (!o || typeof o !== 'object' || Array.isArray(o)) return {};
+ const out = {};
+ for (const k of Object.keys(o)) if (o[k]) out[k] = true;
+ return out;
+ } catch { return {}; }
+ }
+ function stageTrackerSaveSharedCollapsed(c) {
+ try { localStorage.setItem(STAGE_TRACKER_SHARED_COLLAPSED_KEY, JSON.stringify(c || {})); } catch {}
+ }
function stageTrackerLoadGrouping() {
_stageTrackerGroup = stageTrackerGroupSetting();
_stageTrackerCollapsed = stageTrackerLoadCollapsed();
+ // Guarded: harnesses lift this function without the shared-PR fold.
+ if (typeof stageTrackerLoadSharedCollapsed === 'function') _stageTrackerSharedCollapsed = stageTrackerLoadSharedCollapsed();
}
function stageTrackerPrimaryRepo() { return (typeof window !== 'undefined' && window._primaryRepo) || ''; }
function hamGroup(value) {
@@ -187,6 +204,13 @@
stageTrackerSaveCollapsed(_stageTrackerCollapsed);
renderStageTracker();
}
+ // The caret on a primary row's "also closes #N" pill: fold or unfold
+ // the secondary issues' rows drawn under it (key = the primary's row key).
+ function hamSharedToggle(key) {
+ _stageTrackerSharedCollapsed = stageTrackerToggleCollapsed(_stageTrackerSharedCollapsed, key);
+ stageTrackerSaveSharedCollapsed(_stageTrackerSharedCollapsed);
+ renderStageTracker();
+ }
// A row's repo chip: filter to that repo, or back to all when it already is.
function hamRepoChip(repo) { hamFilter('repo', _stageTrackerFilter.repo === repo ? '' : repo); }
function stageTrackerRepoChipChange(value) {
diff --git a/src/pkg/dashboard/static-src/js/tracker-row-layout.js b/src/pkg/dashboard/static-src/js/tracker-row-layout.js
index 094fc8bdd7..b373f9add8 100644
--- a/src/pkg/dashboard/static-src/js/tracker-row-layout.js
+++ b/src/pkg/dashboard/static-src/js/tracker-row-layout.js
@@ -188,19 +188,30 @@
// hive#15806) — on the PR drawn here, "also closes #A, #B" naming the
// other listed open issues it resolves, every number a link; past
// three it reads "#A, #B, #C +N" and the hover names every title.
- function stageTrackerAlsoClosesChipHtml(lp) {
+ // With `group` ({ key, count, collapsed }: the primary row's key and how
+ // many secondary rows this list draws right under it), the pill is also
+ // the group's fold: a caret button ahead of the words (▾ expanded, ▸
+ // folded; hamSharedToggle(key), remembered in localStorage) — the
+ // secondaries' rows follow this one (stageTrackerSharedPRContiguous).
+ function stageTrackerAlsoClosesChipHtml(lp, group) {
const list = Array.isArray(lp && lp.also_closes) ? lp.also_closes.filter(li => li && Number(li.number) > 0) : [];
if (!list.length) return '';
const shown = list.slice(0, 3);
const links = shown.map(li => `#${Number(li.number)}`).join(', ');
const more = list.length > shown.length ? ' +' + (list.length - shown.length) : '';
- const tip = 'this PR also resolves ' + list.map(li => '#' + Number(li.number) + (li.title ? ' (' + li.title + ')' : '')).join(', ');
- return `also closes ${links}${more}`;
+ let tip = 'this PR also resolves ' + list.map(li => '#' + Number(li.number) + (li.title ? ' (' + li.title + ')' : '')).join(', ');
+ if (!group || !(Number(group.count) > 0)) return `also closes ${links}${more}`;
+ const n = Number(group.count);
+ const rows = n + (n === 1 ? ' issue row' : ' issue rows');
+ tip += group.collapsed ? ' · ' + rows + ' folded under this row; click the caret to show' : ' · ' + rows + ' drawn under this row; click the caret to fold';
+ const label = (group.collapsed ? 'Show ' : 'Fold ') + rows + ' this PR also closes';
+ return `also closes ${links}${more}${group.collapsed ? ` +${n}` : ''}`;
}
// Pure: the lineage-style chips of a covering PR drawn under an issue —
// its lineage / adopted-from chip, then the also-closes chip; null = none.
- function stageTrackerLinkedChipsHtml(lp, lineage) {
- const also = typeof stageTrackerAlsoClosesChipHtml === 'function' ? stageTrackerAlsoClosesChipHtml(lp) : '';
+ // `group`: see stageTrackerAlsoClosesChipHtml.
+ function stageTrackerLinkedChipsHtml(lp, lineage, group) {
+ const also = typeof stageTrackerAlsoClosesChipHtml === 'function' ? stageTrackerAlsoClosesChipHtml(lp, group) : '';
const out = [lineage || '', also].filter(Boolean).join(' ');
return out || null;
}
diff --git a/src/pkg/dashboard/static-src/js/tracker-row-render.js b/src/pkg/dashboard/static-src/js/tracker-row-render.js
index 848be5a9e4..1148d03d86 100644
--- a/src/pkg/dashboard/static-src/js/tracker-row-render.js
+++ b/src/pkg/dashboard/static-src/js/tracker-row-render.js
@@ -94,6 +94,26 @@
const isIssue = item.kind === 'issue';
const title = item.title || '';
let prRefs = [], shown = item, range = null, subs = '', subRows = null, prTargetKey = '', basePill = '';
+ // Shared-PR group (stageTrackerSharedPRGroups in ctx.shared): the row
+ // heads a group when secondaries are drawn right under it; it is a
+ // child when it rides a PR drawn under a row of this list.
+ let sharedCls = '', sharedUnder = 0, sharedGroup = null;
+ if (isIssue && ctx.shared) {
+ const key = stageTrackerItemKey(item);
+ const kids = ctx.shared.children && ctx.shared.children[key];
+ const folded = !!(ctx.shared.collapsed && ctx.shared.collapsed[key]);
+ if (kids && kids.length) {
+ sharedGroup = { key, count: kids.length, collapsed: folded };
+ if (!folded) sharedCls += ' ham-shared-head';
+ }
+ const parentKey = ctx.shared.parentOf && ctx.shared.parentOf[key];
+ if (parentKey) {
+ sharedCls += ' ham-shared-child';
+ const sib = ctx.shared.children[parentKey] || [];
+ if (sib[sib.length - 1] === key) sharedCls += ' ham-shared-last';
+ sharedUnder = Number(String(parentKey).split('#').pop()) || 0;
+ }
+ }
if (isIssue) {
const linked = stageTrackerLinkedSorted(item, stages);
// The primary (first-sorted) PR's base; an issue with no PR shows none.
@@ -112,7 +132,7 @@
prTargetKey = stageTrackerItemKey(pr);
const who = (lp.author_kind || 'hive') + (lp.author ? ' · @' + lp.author : '');
const lineage = (lp.lineage && typeof stageTrackerLineageChipHtml === 'function' ? stageTrackerLineageChipHtml(lp, nowMs) : '') || (typeof stageTrackerAdoptedFromChipHtml === 'function' ? stageTrackerAdoptedFromChipHtml(lp, nowMs) : '');
- prRefs = [STAGE_TRACKER_LINKED_GLYPH + stageTrackerPRPillsHtml(stageTrackerPRRef(lp.number, lp.url, lp.author_kind || '', lp.author, lp.title, (lp.title ? lp.title + '\n' : '') + 'Author: ' + who + ' · ' + stageTrackerLinkedTip(item, lp.number, ctx)), typeof stageTrackerLinkedChipsHtml === 'function' ? stageTrackerLinkedChipsHtml(lp, lineage) : (lineage || null))];
+ prRefs = [STAGE_TRACKER_LINKED_GLYPH + stageTrackerPRPillsHtml(stageTrackerPRRef(lp.number, lp.url, lp.author_kind || '', lp.author, lp.title, (lp.title ? lp.title + '\n' : '') + 'Author: ' + who + ' · ' + stageTrackerLinkedTip(item, lp.number, ctx)), typeof stageTrackerLinkedChipsHtml === 'function' ? stageTrackerLinkedChipsHtml(lp, lineage, sharedGroup && ctx.shared.prs && ctx.shared.prs[sharedGroup.key] && ctx.shared.prs[sharedGroup.key][Number(lp.number)] ? sharedGroup : null) : (lineage || null))];
}
shown = Object.assign({}, item, { via_pr: true, stage: stageTrackerLeadStage(lp), stage_since: lp.stage_since || item.stage_since, modifiers: lp.modifiers || item.modifiers, deferred_modifiers: lp.deferred_modifiers || item.deferred_modifiers || [], caption: lp.caption || item.caption, reason: lp.reason || item.reason, preparation: lp.preparation || null,
ci_activity: lp.ci_activity || null, review_activity: lp.review_activity || null, code_activity: lp.code_activity || null, display_column: lp.display_column || 0,
@@ -176,7 +196,7 @@
const rowKey = stageTrackerItemKey(item);
const humanNote = typeof stageTrackerHumanContextHtml === 'function' ? stageTrackerHumanContextHtml(item, stages, nowMs, subRows, ctx, rowKey) : '';
const noteCtx = humanNote && typeof stageTrackerNoteTakenCtx === 'function' ? stageTrackerNoteTakenCtx(ctx, rowKey) : ctx;
- return `
+ return `
${stageTrackerRowToolsHtml(item)}
${stageTrackerHeadColsHtml(prRefs, leadHtml, stageTrackerActedBadgeHtml(item, nowMs) + stageTrackerChipsHtml(shown) + (typeof stageTrackerLeadButtonHtml === 'function' ? stageTrackerLeadButtonHtml(item, nowMs, subRows) : '') + (typeof stageTrackerNotesButtonHtml === 'function' ? stageTrackerNotesButtonHtml(item, hamNotesCtx(item)) : ''), prTargetKey)}
diff --git a/src/pkg/dashboard/static-src/js/tracker-words-core.js b/src/pkg/dashboard/static-src/js/tracker-words-core.js
index a0389c60ac..49f64ece3e 100644
--- a/src/pkg/dashboard/static-src/js/tracker-words-core.js
+++ b/src/pkg/dashboard/static-src/js/tracker-words-core.js
@@ -698,6 +698,89 @@
});
return out;
}
+ /* ---- Shared-PR groups (pure; run under node by
+ stage_tracker_shared_pr_group_test.go) ------------------------------
+ A PR that closes several listed issues is drawn once, under its
+ primary (drawn_under); the other issues ride it from their own rows
+ (stageTrackerLinkedRiding, hivecommons/hive#17324). Those rows belong
+ together: #17292 (primary), #17302 (secondary) and PR #17308 are one
+ flow, yet the lead sort scattered them with an unrelated row between.
+ The group is one unit of the list — the secondaries sit right after
+ their primary, in the lead order among themselves, and the group sorts
+ by the primary — and shares ONE PR snapshot: a secondary's listing of
+ the PR is replaced by the primary's own entry, so both strips light
+ from the same object of the same payload tick. A secondary whose
+ primary is not a row of this list (filtered out, other page) stays a
+ standalone row exactly as before. */
+ // Pure: the primary row a secondary follows — { key, pr } — or null.
+ // Guarded: harnesses lift this file without stageTrackerLinkedRiding.
+ function stageTrackerSharedPRParent(it, stages, keys) {
+ if (!it || it.kind !== 'issue' || typeof stageTrackerLinkedRiding !== 'function') return null;
+ const lp = stageTrackerLinkedRiding(it, stages);
+ const under = Number(lp && lp.drawn_under) || 0;
+ if (!under) return null;
+ const key = stageTrackerItemKey({ repo: it.repo, kind: 'issue', number: under });
+ return keys[key] ? { key, pr: Number(lp.number) || 0 } : null;
+ }
+ // Pure: the groups of a row list — { parentOf: { childKey: parentKey },
+ // children: { parentKey: [childKey…] }, prs: { parentKey: { prNumber:
+ // true } } } — children in list order. Only rows of the list count.
+ function stageTrackerSharedPRGroups(rows, stages) {
+ rows = Array.isArray(rows) ? rows.filter(Boolean) : [];
+ const keys = {};
+ rows.forEach(it => { if (it.kind === 'issue' && Number(it.number) > 0) keys[stageTrackerItemKey(it)] = it; });
+ const out = { parentOf: {}, children: {}, prs: {} };
+ rows.forEach(it => {
+ const p = stageTrackerSharedPRParent(it, stages, keys);
+ if (!p) return;
+ const k = stageTrackerItemKey(it);
+ if (k === p.key) return;
+ out.parentOf[k] = p.key;
+ (out.children[p.key] = out.children[p.key] || []).push(k);
+ (out.prs[p.key] = out.prs[p.key] || {})[p.pr] = true;
+ });
+ return out;
+ }
+ // Pure: a secondary row rebound to its primary's listing of the shared
+ // PR — the same object, drawn_under kept — so the two strips cannot
+ // disagree. The row itself is copied; the payload stays the server's.
+ function stageTrackerSharedPRRebind(child, parent, prNumber) {
+ const own = Array.isArray(parent && parent.linked_prs) ? parent.linked_prs.find(lp => lp && Number(lp.number) === prNumber) : null;
+ if (!own || !Array.isArray(child.linked_prs)) return child;
+ const shared = Object.assign({}, own, { drawn_under: Number(parent.number) || 0, also_closes: null });
+ return Object.assign({}, child, { linked_prs: child.linked_prs.map(lp => lp && Number(lp.number) === prNumber ? shared : lp) });
+ }
+ // Pure: the list with every shared-PR group contiguous — primary, then
+ // its secondaries (rebound) — in the primary's place; a group whose
+ // primary is folded (collapsed[parentKey]) is its primary alone.
+ function stageTrackerSharedPRContiguous(rows, stages, collapsed) {
+ rows = Array.isArray(rows) ? rows : [];
+ const groups = stageTrackerSharedPRGroups(rows, stages);
+ if (!Object.keys(groups.parentOf).length) return rows;
+ const byKey = {};
+ rows.forEach(it => { if (it) byKey[stageTrackerItemKey(it)] = it; });
+ const emitted = {};
+ const out = [];
+ const emit = (it) => {
+ if (!it) { out.push(it); return; }
+ const k = stageTrackerItemKey(it);
+ if (emitted[k]) return;
+ emitted[k] = true;
+ out.push(it);
+ if (collapsed && collapsed[k]) { (groups.children[k] || []).forEach(ck => { emitted[ck] = true; }); return; }
+ (groups.children[k] || []).forEach(ck => {
+ const child = byKey[ck];
+ if (!child || emitted[ck]) return;
+ const pr = Number(Object.keys(groups.prs[k] || {}).find(n => Array.isArray(child.linked_prs) && child.linked_prs.some(lp => lp && Number(lp.number) === Number(n) && Number(lp.drawn_under) === Number(it.number)))) || 0;
+ emit(pr ? stageTrackerSharedPRRebind(child, it, pr) : child);
+ });
+ };
+ rows.forEach(it => { if (it && groups.parentOf[stageTrackerItemKey(it)]) return; emit(it); });
+ // A secondary whose primary never emitted (a cycle) keeps its own place.
+ rows.forEach(it => { if (it && !emitted[stageTrackerItemKey(it)]) emit(it); });
+ return out;
+ }
+
// Pure: the member numbers of a train the page does not show, given the
// train's record (ahead + size on the last member tells the whole
// queue when the view carries it) and the numbers shown under the
diff --git a/src/pkg/dashboard/static-src/js/tracker-words-stage.js b/src/pkg/dashboard/static-src/js/tracker-words-stage.js
index 12e3f7f41c..b139ee477a 100644
--- a/src/pkg/dashboard/static-src/js/tracker-words-stage.js
+++ b/src/pkg/dashboard/static-src/js/tracker-words-stage.js
@@ -99,6 +99,10 @@
const STAGE_TRACKER_GROUP_DIST_STEPS = 4;
var _stageTrackerGroup = STAGE_TRACKER_GROUP_DEFAULT;
var _stageTrackerCollapsed = {};
+ // Shared-PR groups (a PR closing several listed issues): the secondary
+ // issues' rows collapsed under their primary, by the primary's row key.
+ const STAGE_TRACKER_SHARED_COLLAPSED_KEY = 'hive.tracker.shared.collapsed';
+ var _stageTrackerSharedCollapsed = {};
function stageTrackerDefaultFilter() {
return { kind: 'all', repo: '', q: '', labels: [], needsHuman: false, onHold: false, waitingOnYou: false, attentionFirst: true, age: 'any', author: 'any', attention: false, acted: 'any', sort: 'furthest', dir: 'desc', size: STAGE_TRACKER_DEFAULT_PAGE_SIZE, page: 1 };
}
diff --git a/src/pkg/dashboard/static/index.html b/src/pkg/dashboard/static/index.html
index c9784af7c8..c2e2f4bd2f 100644
--- a/src/pkg/dashboard/static/index.html
+++ b/src/pkg/dashboard/static/index.html
@@ -1958,6 +1958,22 @@
.ham-also-closes { color: var(--muted); }
.ham-also-closes a { color: inherit; text-decoration: none; }
.ham-also-closes a:hover { color: var(--text); text-decoration: underline; }
+ /* Shared-PR group (one PR closing several listed issues): the secondary
+ issues a PR also closes sit right under their primary, indented, on
+ a rail that runs from the primary's pill to the last child's elbow.
+ The primary's "also closes" pill carries the fold caret. Tokens only. */
+ .ham-row.ham-shared-child { position: relative; padding-left: var(--sp-6); }
+ .ham-row.ham-shared-child::before { content: ''; position: absolute; left: var(--sp-3); top: 0; bottom: 0; border-left: var(--line-width) solid var(--line-strong); pointer-events: none; }
+ .ham-row.ham-shared-child.ham-shared-last::before { bottom: 50%; }
+ .ham-row.ham-shared-child::after { content: ''; position: absolute; left: var(--sp-3); top: 50%; width: var(--sp-3); border-top: var(--line-width) solid var(--line-strong); pointer-events: none; }
+ .ham-row.ham-shared-child + .ham-row.ham-shared-child { border-top-color: transparent; }
+ .ham-row.ham-shared-head + .ham-row.ham-shared-child { border-top-color: transparent; }
+ .ham-row.ham-shared-head { position: relative; }
+ .ham-row.ham-shared-head::before { content: ''; position: absolute; left: var(--sp-3); top: 50%; bottom: 0; border-left: var(--line-width) solid var(--line-strong); pointer-events: none; }
+ .ham-shared-toggle { appearance: none; background: none; border: 0; padding: 0 var(--sp-1) 0 0; margin: 0; font: inherit; color: inherit; cursor: pointer; line-height: 1; vertical-align: baseline; }
+ .ham-shared-toggle:hover .ham-group-caret, .ham-shared-toggle:focus-visible .ham-group-caret { color: var(--text); }
+ .ham-shared-toggle:focus-visible { outline: var(--line-width) solid var(--line-strong); outline-offset: 1px; border-radius: var(--r-sm); }
+ .ham-shared-count { color: var(--text); }
.ham-plan-body, .ham-plan-note { white-space: pre-wrap; }
.ham-plan-note { color: var(--muted); font-size: var(--fs-xs); }
.ham-seg.active .cue-acting-cap { margin-left: var(--sp-2); }
@@ -16396,6 +16412,89 @@
Where to get help
});
return out;
}
+ /* ---- Shared-PR groups (pure; run under node by
+ stage_tracker_shared_pr_group_test.go) ------------------------------
+ A PR that closes several listed issues is drawn once, under its
+ primary (drawn_under); the other issues ride it from their own rows
+ (stageTrackerLinkedRiding, hivecommons/hive#17324). Those rows belong
+ together: #17292 (primary), #17302 (secondary) and PR #17308 are one
+ flow, yet the lead sort scattered them with an unrelated row between.
+ The group is one unit of the list — the secondaries sit right after
+ their primary, in the lead order among themselves, and the group sorts
+ by the primary — and shares ONE PR snapshot: a secondary's listing of
+ the PR is replaced by the primary's own entry, so both strips light
+ from the same object of the same payload tick. A secondary whose
+ primary is not a row of this list (filtered out, other page) stays a
+ standalone row exactly as before. */
+ // Pure: the primary row a secondary follows — { key, pr } — or null.
+ // Guarded: harnesses lift this file without stageTrackerLinkedRiding.
+ function stageTrackerSharedPRParent(it, stages, keys) {
+ if (!it || it.kind !== 'issue' || typeof stageTrackerLinkedRiding !== 'function') return null;
+ const lp = stageTrackerLinkedRiding(it, stages);
+ const under = Number(lp && lp.drawn_under) || 0;
+ if (!under) return null;
+ const key = stageTrackerItemKey({ repo: it.repo, kind: 'issue', number: under });
+ return keys[key] ? { key, pr: Number(lp.number) || 0 } : null;
+ }
+ // Pure: the groups of a row list — { parentOf: { childKey: parentKey },
+ // children: { parentKey: [childKey…] }, prs: { parentKey: { prNumber:
+ // true } } } — children in list order. Only rows of the list count.
+ function stageTrackerSharedPRGroups(rows, stages) {
+ rows = Array.isArray(rows) ? rows.filter(Boolean) : [];
+ const keys = {};
+ rows.forEach(it => { if (it.kind === 'issue' && Number(it.number) > 0) keys[stageTrackerItemKey(it)] = it; });
+ const out = { parentOf: {}, children: {}, prs: {} };
+ rows.forEach(it => {
+ const p = stageTrackerSharedPRParent(it, stages, keys);
+ if (!p) return;
+ const k = stageTrackerItemKey(it);
+ if (k === p.key) return;
+ out.parentOf[k] = p.key;
+ (out.children[p.key] = out.children[p.key] || []).push(k);
+ (out.prs[p.key] = out.prs[p.key] || {})[p.pr] = true;
+ });
+ return out;
+ }
+ // Pure: a secondary row rebound to its primary's listing of the shared
+ // PR — the same object, drawn_under kept — so the two strips cannot
+ // disagree. The row itself is copied; the payload stays the server's.
+ function stageTrackerSharedPRRebind(child, parent, prNumber) {
+ const own = Array.isArray(parent && parent.linked_prs) ? parent.linked_prs.find(lp => lp && Number(lp.number) === prNumber) : null;
+ if (!own || !Array.isArray(child.linked_prs)) return child;
+ const shared = Object.assign({}, own, { drawn_under: Number(parent.number) || 0, also_closes: null });
+ return Object.assign({}, child, { linked_prs: child.linked_prs.map(lp => lp && Number(lp.number) === prNumber ? shared : lp) });
+ }
+ // Pure: the list with every shared-PR group contiguous — primary, then
+ // its secondaries (rebound) — in the primary's place; a group whose
+ // primary is folded (collapsed[parentKey]) is its primary alone.
+ function stageTrackerSharedPRContiguous(rows, stages, collapsed) {
+ rows = Array.isArray(rows) ? rows : [];
+ const groups = stageTrackerSharedPRGroups(rows, stages);
+ if (!Object.keys(groups.parentOf).length) return rows;
+ const byKey = {};
+ rows.forEach(it => { if (it) byKey[stageTrackerItemKey(it)] = it; });
+ const emitted = {};
+ const out = [];
+ const emit = (it) => {
+ if (!it) { out.push(it); return; }
+ const k = stageTrackerItemKey(it);
+ if (emitted[k]) return;
+ emitted[k] = true;
+ out.push(it);
+ if (collapsed && collapsed[k]) { (groups.children[k] || []).forEach(ck => { emitted[ck] = true; }); return; }
+ (groups.children[k] || []).forEach(ck => {
+ const child = byKey[ck];
+ if (!child || emitted[ck]) return;
+ const pr = Number(Object.keys(groups.prs[k] || {}).find(n => Array.isArray(child.linked_prs) && child.linked_prs.some(lp => lp && Number(lp.number) === Number(n) && Number(lp.drawn_under) === Number(it.number)))) || 0;
+ emit(pr ? stageTrackerSharedPRRebind(child, it, pr) : child);
+ });
+ };
+ rows.forEach(it => { if (it && groups.parentOf[stageTrackerItemKey(it)]) return; emit(it); });
+ // A secondary whose primary never emitted (a cycle) keeps its own place.
+ rows.forEach(it => { if (it && !emitted[stageTrackerItemKey(it)]) emit(it); });
+ return out;
+ }
+
// Pure: the member numbers of a train the page does not show, given the
// train's record (ahead + size on the last member tells the whole
// queue when the view carries it) and the numbers shown under the
@@ -16619,6 +16718,10 @@
Where to get help
const STAGE_TRACKER_GROUP_DIST_STEPS = 4;
var _stageTrackerGroup = STAGE_TRACKER_GROUP_DEFAULT;
var _stageTrackerCollapsed = {};
+ // Shared-PR groups (a PR closing several listed issues): the secondary
+ // issues' rows collapsed under their primary, by the primary's row key.
+ const STAGE_TRACKER_SHARED_COLLAPSED_KEY = 'hive.tracker.shared.collapsed';
+ var _stageTrackerSharedCollapsed = {};
function stageTrackerDefaultFilter() {
return { kind: 'all', repo: '', q: '', labels: [], needsHuman: false, onHold: false, waitingOnYou: false, attentionFirst: true, age: 'any', author: 'any', attention: false, acted: 'any', sort: 'furthest', dir: 'desc', size: STAGE_TRACKER_DEFAULT_PAGE_SIZE, page: 1 };
}
@@ -19934,19 +20037,30 @@
Where to get help
// hive#15806) — on the PR drawn here, "also closes #A, #B" naming the
// other listed open issues it resolves, every number a link; past
// three it reads "#A, #B, #C +N" and the hover names every title.
- function stageTrackerAlsoClosesChipHtml(lp) {
+ // With `group` ({ key, count, collapsed }: the primary row's key and how
+ // many secondary rows this list draws right under it), the pill is also
+ // the group's fold: a caret button ahead of the words (▾ expanded, ▸
+ // folded; hamSharedToggle(key), remembered in localStorage) — the
+ // secondaries' rows follow this one (stageTrackerSharedPRContiguous).
+ function stageTrackerAlsoClosesChipHtml(lp, group) {
const list = Array.isArray(lp && lp.also_closes) ? lp.also_closes.filter(li => li && Number(li.number) > 0) : [];
if (!list.length) return '';
const shown = list.slice(0, 3);
const links = shown.map(li => `#${Number(li.number)}`).join(', ');
const more = list.length > shown.length ? ' +' + (list.length - shown.length) : '';
- const tip = 'this PR also resolves ' + list.map(li => '#' + Number(li.number) + (li.title ? ' (' + li.title + ')' : '')).join(', ');
- return `also closes ${links}${more}`;
+ let tip = 'this PR also resolves ' + list.map(li => '#' + Number(li.number) + (li.title ? ' (' + li.title + ')' : '')).join(', ');
+ if (!group || !(Number(group.count) > 0)) return `also closes ${links}${more}`;
+ const n = Number(group.count);
+ const rows = n + (n === 1 ? ' issue row' : ' issue rows');
+ tip += group.collapsed ? ' · ' + rows + ' folded under this row; click the caret to show' : ' · ' + rows + ' drawn under this row; click the caret to fold';
+ const label = (group.collapsed ? 'Show ' : 'Fold ') + rows + ' this PR also closes';
+ return `also closes ${links}${more}${group.collapsed ? ` +${n}` : ''}`;
}
// Pure: the lineage-style chips of a covering PR drawn under an issue —
// its lineage / adopted-from chip, then the also-closes chip; null = none.
- function stageTrackerLinkedChipsHtml(lp, lineage) {
- const also = typeof stageTrackerAlsoClosesChipHtml === 'function' ? stageTrackerAlsoClosesChipHtml(lp) : '';
+ // `group`: see stageTrackerAlsoClosesChipHtml.
+ function stageTrackerLinkedChipsHtml(lp, lineage, group) {
+ const also = typeof stageTrackerAlsoClosesChipHtml === 'function' ? stageTrackerAlsoClosesChipHtml(lp, group) : '';
const out = [lineage || '', also].filter(Boolean).join(' ');
return out || null;
}
@@ -20263,6 +20377,26 @@
Where to get help
const isIssue = item.kind === 'issue';
const title = item.title || '';
let prRefs = [], shown = item, range = null, subs = '', subRows = null, prTargetKey = '', basePill = '';
+ // Shared-PR group (stageTrackerSharedPRGroups in ctx.shared): the row
+ // heads a group when secondaries are drawn right under it; it is a
+ // child when it rides a PR drawn under a row of this list.
+ let sharedCls = '', sharedUnder = 0, sharedGroup = null;
+ if (isIssue && ctx.shared) {
+ const key = stageTrackerItemKey(item);
+ const kids = ctx.shared.children && ctx.shared.children[key];
+ const folded = !!(ctx.shared.collapsed && ctx.shared.collapsed[key]);
+ if (kids && kids.length) {
+ sharedGroup = { key, count: kids.length, collapsed: folded };
+ if (!folded) sharedCls += ' ham-shared-head';
+ }
+ const parentKey = ctx.shared.parentOf && ctx.shared.parentOf[key];
+ if (parentKey) {
+ sharedCls += ' ham-shared-child';
+ const sib = ctx.shared.children[parentKey] || [];
+ if (sib[sib.length - 1] === key) sharedCls += ' ham-shared-last';
+ sharedUnder = Number(String(parentKey).split('#').pop()) || 0;
+ }
+ }
if (isIssue) {
const linked = stageTrackerLinkedSorted(item, stages);
// The primary (first-sorted) PR's base; an issue with no PR shows none.
@@ -20281,7 +20415,7 @@
if (out[repo]) delete out[repo]; else out[repo] = true;
return out;
}
+ // The shared-PR groups a viewer folded (hive.tracker.shared.collapsed):
+ // { 'owner/repo/issue#M': true } by the primary row's key, same shape
+ // and lifecycle as the per-repo collapsed set.
+ function stageTrackerLoadSharedCollapsed() {
+ try {
+ const o = JSON.parse(localStorage.getItem(STAGE_TRACKER_SHARED_COLLAPSED_KEY) || '{}');
+ if (!o || typeof o !== 'object' || Array.isArray(o)) return {};
+ const out = {};
+ for (const k of Object.keys(o)) if (o[k]) out[k] = true;
+ return out;
+ } catch { return {}; }
+ }
+ function stageTrackerSaveSharedCollapsed(c) {
+ try { localStorage.setItem(STAGE_TRACKER_SHARED_COLLAPSED_KEY, JSON.stringify(c || {})); } catch {}
+ }
function stageTrackerLoadGrouping() {
_stageTrackerGroup = stageTrackerGroupSetting();
_stageTrackerCollapsed = stageTrackerLoadCollapsed();
+ // Guarded: harnesses lift this function without the shared-PR fold.
+ if (typeof stageTrackerLoadSharedCollapsed === 'function') _stageTrackerSharedCollapsed = stageTrackerLoadSharedCollapsed();
}
function stageTrackerPrimaryRepo() { return (typeof window !== 'undefined' && window._primaryRepo) || ''; }
function hamGroup(value) {
@@ -22001,6 +22152,13 @@
Where to get help
stageTrackerSaveCollapsed(_stageTrackerCollapsed);
renderStageTracker();
}
+ // The caret on a primary row's "also closes #N" pill: fold or unfold
+ // the secondary issues' rows drawn under it (key = the primary's row key).
+ function hamSharedToggle(key) {
+ _stageTrackerSharedCollapsed = stageTrackerToggleCollapsed(_stageTrackerSharedCollapsed, key);
+ stageTrackerSaveSharedCollapsed(_stageTrackerSharedCollapsed);
+ renderStageTracker();
+ }
// A row's repo chip: filter to that repo, or back to all when it already is.
function hamRepoChip(repo) { hamFilter('repo', _stageTrackerFilter.repo === repo ? '' : repo); }
function stageTrackerRepoChipChange(value) {
@@ -22766,7 +22924,15 @@
All labels
if (stageTrackerRepoChipOn(stageTrackerRepoChipSetting(), repos.length)) ctx.repoChips = { primary: stageTrackerPrimaryRepo(), active: f.repo };
const visible = stageTrackerVisible(d.items, f, ctx);
const sorted = stageTrackerTrainContiguous(stageTrackerSort(visible, stages, f, { phone: stageTrackerPhone() }));
- const ordered = typeof stageTrackerPreparationOrderRows === 'function' ? stageTrackerPreparationOrderRows(d, sorted, stages) : sorted;
+ const prepared = typeof stageTrackerPreparationOrderRows === 'function' ? stageTrackerPreparationOrderRows(d, sorted, stages) : sorted;
+ // Shared-PR groups last, so a secondary issue always sits right after
+ // its primary whatever the lead sort or train put between them; the
+ // groups a viewer folded leave their secondaries out of the list.
+ // Guarded: test harnesses lift renderStageTracker without tracker-words-core.
+ const sharing = typeof stageTrackerSharedPRContiguous === 'function';
+ ctx.shared = sharing ? Object.assign(stageTrackerSharedPRGroups(prepared, stages), { collapsed: _stageTrackerSharedCollapsed }) : null;
+ const ordered = sharing ? stageTrackerSharedPRContiguous(prepared, stages, _stageTrackerSharedCollapsed) : prepared;
+ const foldedShared = prepared.length - ordered.length;
// A TV display (display=1&density=tv) shows the rows that fit the
// screen, ungrouped, with "+N more" in place of the pager.
const tv = typeof stageTrackerDisplayTv === 'function' && stageTrackerDisplayTv();
@@ -22777,6 +22943,8 @@
All labels
? stageTrackerGroupPage(stageTrackerGroups(ordered, { primary: stageTrackerPrimaryRepo(), collapsed: _stageTrackerCollapsed, stages }), f)
: stageTrackerPage(ordered, f);
if (!tv && page.page !== f.page) f.page = page.page;
+ // A folded secondary is not filtered out: it counts toward the total.
+ if (foldedShared > 0) page.total += foldedShared;
// The rows this render draws (this page, group headers aside), for
// stageTrackerPRListedOwnRow: a covered issue defers to its PR's row
// only when that row is actually on screen. Kept beside the payload,