From 64b00baa1157ebaaa6b3f652005e43e483a6a756 Mon Sep 17 00:00:00 2001 From: Andrew Anderson Date: Wed, 28 Oct 2026 15:04:22 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Activity=20Monitor:=20celebrate?= =?UTF-8?q?=20a=20merged=20PR=20on=20the=20issue=20row=20it=20was=20drawn?= =?UTF-8?q?=20on;=20add=20Test=20celebration?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A PR nested under its issue is drawn inline on the issue row with no sub-row, so stageTrackerCelebrateRowKey found no row and the merge only ticked the counter (hive's hive: 19 of 22 open PRs). Rows now stamp the PR keys they draw (data-ham-prs) and the SPA remembers each PR's host row from the last payload; ⚙ → Merges gains a Test celebration button. Fixes #15059. Reported by @clubanderson. Signed-off-by: Andrew Anderson --- changelog.d/fixed-celebrate-nested-pr-row.md | 1 + src/docs/dashboard-sections.md | 2 +- src/pkg/dashboard/stage_tracker_cues_test.go | 109 +++++++++++++++++-- src/pkg/dashboard/static/index.html | 70 ++++++++++-- 4 files changed, 163 insertions(+), 19 deletions(-) create mode 100644 changelog.d/fixed-celebrate-nested-pr-row.md diff --git a/changelog.d/fixed-celebrate-nested-pr-row.md b/changelog.d/fixed-celebrate-nested-pr-row.md new file mode 100644 index 0000000000..04935504af --- /dev/null +++ b/changelog.d/fixed-celebrate-nested-pr-row.md @@ -0,0 +1 @@ +- Activity Monitor: the merge celebration (✓ glow, token to "Merged today") now plays for a PR drawn inline on its issue's row — before, only the counter ticked because such rows carried no sub-row key; rows stamp the PR keys they draw and ⚙ → Merges gains a **Test celebration** button. Reported by @clubanderson. diff --git a/src/docs/dashboard-sections.md b/src/docs/dashboard-sections.md index 38d8711b96..43bb26fe5c 100644 --- a/src/docs/dashboard-sections.md +++ b/src/docs/dashboard-sections.md @@ -702,7 +702,7 @@ Fed by `GET /api/stage-tracker`. Every issue and pull request follows the same p **Confirmations and "Don't ask again".** Each confirm dialog a row action raises — Approve (including a sentinel-flagged head: *⚠ Sentinel flagged security-relevant changes at 40a959b …*), Let hive decide, Close as superseded / won't-fix, Mark needs-human and the rest — carries a **Don't ask again for this action** box. Ticking it and confirming stores `hive.tracker.confirm.=skip` in this browser's `localStorage` (one key per action id, e.g. `hive.tracker.confirm.decide:delegate`); later clicks on that action run at once. Nothing the dialog would have said is lost: the result toast carries the same ⚠ sentinel line (it is per head, so skipping the confirm never skips the warning) and the one-line item summary. Actions that need your text (*Give direction…*, *Send back…*, the superseder picker) always ask. The ⚙ settings dialog's **Confirmations** section lists which actions are skipped and has one **Reset confirmations** button that turns them all back on. -**Merged today.** The toolbar's right end shows a small hex glyph with **Merged today: N** — pull requests the hive saw merge since your local midnight (seeded after a reload from the tracker payload's `merged_24h` list, the audit log's `pr_merged` entries over the last 24 hours, and grown live by the same merge detector that plays the zap); hovering lists the last five with their times. When a PR on the list merges its row does **not** simply vanish on the next refresh: it stays pinned for about 2.5 s, its ✓ cell glows amber, the event line reads *Hive: merged #14947 · by hive*, a flat brand-amber hex token lifts out of the ✓ cell and arcs (≈0.5 s) to the counter, which ticks up with a soft scale-pop — the merge zap, when sound is on, plays as the token lands — and then the row takes its normal exit. Several merges in one refresh stagger 200 ms apart with at most three tokens in flight (the rest tick the count without flying); a merged PR that is filtered out or on another page still counts. Under reduced motion nothing flies: the count ticks and the row glows. The ⚙ dialog's **Merges** section has **Celebrate merges** (default on, `hive.tracker.celebrate`); off, the row leaves as before and the zap plays at once. The row effect is reusable in the SPA as `celebrateRow(rowEl, {kind: 'merged' | 'closed-by-merge'})`. +**Merged today.** The toolbar's right end shows a small hex glyph with **Merged today: N** — pull requests the hive saw merge since your local midnight (seeded after a reload from the tracker payload's `merged_24h` list, the audit log's `pr_merged` entries over the last 24 hours, and grown live by the same merge detector that plays the zap); hovering lists the last five with their times. When a PR on the list merges its row does **not** simply vanish on the next refresh: it stays pinned for about 2.5 s, its ✓ cell glows amber, the event line reads *Hive: merged #14947 · by hive*, a flat brand-amber hex token lifts out of the ✓ cell and arcs (≈0.5 s) to the counter, which ticks up with a soft scale-pop — the merge zap, when sound is on, plays as the token lands — and then the row takes its normal exit. Several merges in one refresh stagger 200 ms apart with at most three tokens in flight (the rest tick the count without flying); a merged PR that is filtered out or on another page still counts. Under reduced motion nothing flies: the count ticks and the row glows. A PR drawn inline on its issue's row (the usual case — one covering PR, no sub-row) celebrates on that issue row: every row stamps the PR keys it draws (`data-ham-prs`) and the SPA remembers each PR's host row from the last payload, so the flight has somewhere to start from even when the merge also closes the issue. The ⚙ dialog's **Merges** section has **Celebrate merges** (default on, `hive.tracker.celebrate`); off, the row leaves as before and the zap plays at once. **Test celebration** beside it plays one flight from the first row of the list to the counter (pop and zap, the count unchanged) so the effect can be checked without waiting for a merge; under reduced motion it says so and only pops. The row effect is reusable in the SPA as `celebrateRow(rowEl, {kind: 'merged' | 'closed-by-merge'})`. **Multi-select.** The checkbox in a row's left gutter selects the row; **Shift+click** selects the range from the last clicked row, **Cmd/Ctrl+click** toggles, **Cmd/Ctrl+Shift+click** adds a range to what is selected; with a row focused, **Space** toggles it (Shift+Space extends). Cmd/Ctrl- or Shift-clicking the row itself, away from its links, selects it too. A selection bar appears above the list with the count, **Clear**, and the same actions for the whole selection — *Decide…* (opens the group as a menu, *Let hive decide* first — each selected row gets its own delegated-decision job, see below), *Hold*, *Release hold*, *Re-evaluate now*, *Mark needs-human…*, *Copy links* — each enabled only when it is valid for every selected row and otherwise greyed with the first reason ("Not applicable to acme/console#12", "Sign in with write access…"). Right-clicking a selected row acts on the whole selection. Bulk actions run one request per row, in list order, under a progress toast ("Hold 2/5 — acme/console#12…"); the result toast lists each failure by row and the successes stand, after which the list and the status snapshot refresh (a hive-wide rescan is sent once per batch). Selection is keyed on the row's item (repository, kind, number), not its node, so the live re-render keeps it; a row that leaves the list — merged, closed, filtered or paged out — leaves the selection. diff --git a/src/pkg/dashboard/stage_tracker_cues_test.go b/src/pkg/dashboard/stage_tracker_cues_test.go index bcb19999e2..3b1558333c 100644 --- a/src/pkg/dashboard/stage_tracker_cues_test.go +++ b/src/pkg/dashboard/stage_tracker_cues_test.go @@ -173,9 +173,11 @@ console.log('ok'); // then the row takes its normal exit; several merges stagger 200 ms apart // under a flight cap; reduced motion flies nothing and ticks at once; the // toggle off keeps the old immediate zap and no pin. -func TestStageTrackerCelebrateNode(t *testing.T) { - html := indexHTML(t) - lifted := strings.Join([]string{ +// stageTrackerCelebrateJS lifts the merge detector and the celebration +// module (counter, token flight, pinned rows) out of index.html. +func stageTrackerCelebrateJS(t *testing.T, html string) string { + t.Helper() + return strings.Join([]string{ "function esc(s) { return String(s).replace(/&/g, '&').replace(/'; }, querySelector(sel) { return e.querySelectorAll(sel)[0] || null; }, - querySelectorAll(sel) { const out = []; const m = sel.match(/^\[([\w-]+)="(.*)"\]$/); const cls = sel.match(/^\.([\w-]+)/); const walk = n => { for (const c of n.children) { if (m && c.attrs[m[1]] === m[2].replace(/\\(.)/g, '$1')) out.push(c); else if (cls && c.classList.contains(cls[1]) && (!sel.includes('[data-at]') || c.attrs['data-at'] != null)) out.push(c); walk(c); } }; walk(e); return out; }, + querySelectorAll(sel) { const out = []; const unesc = v => v.replace(/\\(.)/g, '$1'); const m = sel.match(/^\[([\w-]+)="(.*)"\]$/); const word = sel.match(/^\[([\w-]+)~="(.*)"\]\[data-ham-key\]$/); const cls = sel.match(/^\.([\w-]+)/); const capOfRow = sel === '.ham-row[data-ham-key] .ham-seg.cap'; const walk = n => { for (const c of n.children) { if (capOfRow) { if (c.classList.contains('cap') && c.closest('.ham-row') && c.closest('.ham-row').classList.contains('ham-row')) out.push(c); } else if (m && c.attrs[m[1]] === unesc(m[2])) out.push(c); else if (word && c.attrs['data-ham-key'] != null && String(c.attrs[word[1]] || '').split(' ').includes(unesc(word[2]))) out.push(c); else if (!m && !word && cls && c.classList.contains(cls[1]) && (!sel.includes('[data-at]') || c.attrs['data-at'] != null)) out.push(c); walk(c); } }; walk(e); return out; }, closest(sel) { let n = e; while (n) { if (n.attrs && n.attrs['data-ham-key'] != null) return n; n = n.parentNode; } return null; }, }; return e; @@ -246,16 +259,22 @@ const store = {}; global.localStorage = { getItem: k => (k in store ? store[k] : let reduced = false; function stageTrackerReducedMotion() { return reduced; } let soundOn = true; function stageTrackerSoundGate() { return soundOn; } const zaps = []; function stageTrackerPlayZap(c) { zaps.push(c); } +const toasts = []; function showToast(msg, type) { toasts.push([type, msg]); } let renders = 0; function renderStageTracker() { renders++; } const srcs = new Map(); function stageTrackerRowSrcOf(node) { return srcs.get(node); } let _stageTrackerEvents = {}; const STAGE_TRACKER_TERMINAL = 110; -var _stageTrackerMergeState = null, _stageTrackerZapped = {}, _stageTrackerMergedToday = {}, _stageTrackerMergedTodayCount = -1, _stageTrackerCelebrating = {}, _stageTrackerCelebratePending = {}, _stageTrackerFlights = 0, _stageTrackerReleaseTimer = 0; -function row(key) { const r = el('div', { 'data-ham-key': key }); const strip = el('div'); strip.classList.add('ham-strip-row'); const cap = el('li'); cap.classList.add('ham-seg'); cap.classList.add('cap'); cap.rect = { left: 300, top: 400, width: 20, height: 20 }; strip.appendChild(cap); r.appendChild(strip); srcs.set(r, ''); return r; } +var _stageTrackerPRHost = {}; var _stageTrackerMergeState = null, _stageTrackerZapped = {}, _stageTrackerMergedToday = {}, _stageTrackerMergedTodayCount = -1, _stageTrackerCelebrating = {}, _stageTrackerCelebratePending = {}, _stageTrackerFlights = 0, _stageTrackerReleaseTimer = 0; +function row(key, prs) { const r = el('div', { 'data-ham-key': key }); r.classList.add('ham-row'); if (prs) r.attrs['data-ham-prs'] = prs; const strip = el('div'); strip.classList.add('ham-strip-row'); const cap = el('li'); cap.classList.add('ham-seg'); cap.classList.add('cap'); cap.rect = { left: 300, top: 400, width: 20, height: 20 }; strip.appendChild(cap); r.appendChild(strip); srcs.set(r, ''); return r; } const header = { key: '__header__', html: 'h' }; const items = (...nums) => ({ items: nums.map(x => ({ repo: 'o/r', kind: 'pr', number: x, stage: 50 })) }); const payloadMerged = (...nums) => ({ items: [], recently_merged: nums.map(x => ({ repo: 'o/r', number: x, merged_at: new Date(clock).toISOString() })) }); +` + +func TestStageTrackerCelebrateNode(t *testing.T) { + html := indexHTML(t) + runStageTrackerRowActionsScript(t, stageTrackerCelebrateJS(t, html)+stageTrackerCelebrateFixture+` // 1. A merge: pinned ≥ 2 s, glow, token to the counter, count ticks, zap on arrival, then released. panel.appendChild(row('o/r/pr#1')); panel.appendChild(row('o/r/pr#2')); stageTrackerNoteMerges(items(1, 2)); @@ -322,3 +341,79 @@ assert.ok(r11.children.some(c => c.classList.contains('cue-event') && /closed by console.log('ok'); `) } + +// TestStageTrackerCelebrateNestedPRRow replays the payload shape hive's hive +// serves (captured 2026-10-28 from /api/stage-tracker): a PR nested under +// its issue is drawn inline on the issue row — no sub-row, no +// data-ham-sub-key — and on merge the payload drops both the PR and the +// issue while recently_merged lists the PR. The flight must leave from the +// issue row; before the fix only the counter popped. +func TestStageTrackerCelebrateNestedPRRow(t *testing.T) { + html := indexHTML(t) + runStageTrackerRowActionsScript(t, stageTrackerCelebrateJS(t, html)+stageTrackerCelebrateFixture+` +const before = { items: [ + { repo: 'hivecommons/hive', number: 14816, kind: 'issue', stage: 85, linked_prs: [{ number: 14822, stage: 85, url: 'https://github.com/hivecommons/hive/pull/14822' }] }, + { repo: 'hivecommons/hive', number: 14822, kind: 'pr', stage: 85, nested_under: 14816 }, + { repo: 'hivecommons/hive', number: 15009, kind: 'issue', stage: 40, linked_prs: [{ number: 15017, stage: 60 }, { number: 15020, stage: 85 }] }, + { repo: 'hivecommons/hive', number: 15017, kind: 'pr', stage: 60, nested_under: 15009 }, + { repo: 'hivecommons/hive', number: 15020, kind: 'pr', stage: 85, nested_under: 15009 }, + { repo: 'hivecommons/docs', number: 500, kind: 'pr', stage: 70 }, +], recently_merged: [{ repo: 'hivecommons/hive', number: 14992, merged_at: '2026-10-28T18:47:47Z' }], merged_24h: [{ repo: 'hivecommons/hive', number: 14992, merged_at: '2026-10-28T18:47:47Z' }] }; +const after = { items: before.items.filter(it => it.number !== 14816 && it.number !== 14822), recently_merged: [{ repo: 'hivecommons/hive', number: 14822, merged_at: new Date(clock).toISOString() }].concat(before.recently_merged), merged_24h: [{ repo: 'hivecommons/hive', number: 14822, merged_at: new Date(clock).toISOString() }].concat(before.merged_24h) }; + +// The row stamps the PR keys it draws (the real renderer does this via stageTrackerRowPRKeys). +assert.strictEqual(stageTrackerRowPRKeys(before.items[0]), 'hivecommons/hive/pr#14822'); +assert.strictEqual(stageTrackerRowPRKeys(before.items[2]), 'hivecommons/hive/pr#15017 hivecommons/hive/pr#15020'); +assert.strictEqual(stageTrackerRowPRKeys(before.items[5]), 'hivecommons/docs/pr#500'); +assert.deepStrictEqual(stageTrackerPRHosts(before), { + 'hivecommons/hive/pr#14822': 'hivecommons/hive/issue#14816', + 'hivecommons/hive/pr#15017': 'hivecommons/hive/issue#15009', + 'hivecommons/hive/pr#15020': 'hivecommons/hive/issue#15009', + 'hivecommons/docs/pr#500': 'hivecommons/docs/pr#500', +}); + +// Board as drawn: the issue rows (inline PR, no sub-row) and the standalone PR row. +panel.appendChild(row('hivecommons/hive/issue#14816', 'hivecommons/hive/pr#14822')); +panel.appendChild(row('hivecommons/hive/issue#15009', 'hivecommons/hive/pr#15017 hivecommons/hive/pr#15020')); +panel.appendChild(row('hivecommons/docs/pr#500', 'hivecommons/docs/pr#500')); +stageTrackerNoteMerges(before); +assert.strictEqual(n.textContent, '1', 'seeded from merged_24h, no flourish'); +assert.strictEqual(stageTrackerCelebrateRowKey('hivecommons/hive/pr#14822', panel), 'hivecommons/hive/issue#14816', 'inline PR resolves to its issue row'); +assert.strictEqual(stageTrackerCelebrateRowKey('hivecommons/hive/pr#15020', panel), 'hivecommons/hive/issue#15009'); +assert.strictEqual(stageTrackerCelebrateRowKey('hivecommons/docs/pr#500', panel), 'hivecommons/docs/pr#500'); + +// The merge: the issue row is pinned and celebrated, a token flies, the count ticks on landing. +stageTrackerNoteMerges(after); +assert.deepStrictEqual(Object.keys(_stageTrackerCelebrating), ['hivecommons/hive/issue#14816'], 'the issue row is the celebrating row'); +let rows = stageTrackerPinnedRows(panel, [{ key: '__header__', html: 'h' }, { key: 'hivecommons/hive/issue#15009', html: 'x' }, { key: 'hivecommons/docs/pr#500', html: 'y' }], clock); +assert.ok(rows.some(r => r.key === 'hivecommons/hive/issue#14816' && r.pinned), 'the dropped issue row is pinned'); +assert.strictEqual(n.textContent, '1', 'count waits for the token'); +tick(0); +const issueRow = panel.children[0]; +assert.ok(issueRow.classList.contains('cue-merged'), 'issue row glows: ' + issueRow.className); +assert.ok(issueRow.children.some(c => c.classList.contains('cue-event') && /merged #14822 · by hive/.test(c.textContent)), 'event line names the merged PR'); +assert.strictEqual(body.children.length, 1, 'a token is in flight'); +tick(STAGE_TRACKER_CELEBRATE_FLY_MS * 1.5 + 1); +assert.strictEqual(body.children.length, 0); assert.strictEqual(n.textContent, '2', 'count ticked on landing'); assert.deepStrictEqual(zaps, [1]); + +// Host memory: a PR whose row left the DOM between renders (no stamp to find) still resolves through the last payload. +panel.children.length = 0; +panel.appendChild(row('hivecommons/hive/issue#15009')); +assert.strictEqual(stageTrackerCelebrateRowKey('hivecommons/hive/pr#15017', panel), 'hivecommons/hive/issue#15009', 'resolved via nested_under from the last payload'); +assert.strictEqual(stageTrackerCelebrateRowKey('hivecommons/hive/pr#99999', panel), '', 'unknown PR: counter only'); + +// ⚙ → Merges → Test celebration: one flight from the first row, pop + zap, the count unchanged. +zaps.length = 0; chip.classList.remove('cue-tick'); +const r = stageTrackerTestCelebration(); +assert.deepStrictEqual(r, { flew: true }, JSON.stringify(toasts)); +assert.strictEqual(body.children.length, 1, 'test token in flight'); +tick(STAGE_TRACKER_CELEBRATE_FLY_MS * 1.5 + 1); +assert.strictEqual(n.textContent, '2', 'the test does not count'); assert.ok(chip.classList.contains('cue-tick'), 'but pops'); assert.deepStrictEqual(zaps, [1], 'and zaps'); +assert.ok(!panel.children[0].children.some(c => c.classList.contains('cue-event')), 'no event line is written for a test'); +tick(STAGE_TRACKER_CELEBRATE_PIN_MS + 1); +assert.ok(!panel.children[0].classList.contains('cue-merged'), 'test glow clears'); +panel.children.length = 0; +assert.deepStrictEqual(stageTrackerTestCelebration(), { flew: false }); +assert.ok(toasts.some(x => x[0] === 'warning' && /No row to celebrate on/.test(x[1])), JSON.stringify(toasts)); +`) +} diff --git a/src/pkg/dashboard/static/index.html b/src/pkg/dashboard/static/index.html index 30a37b4b35..b4e9168772 100644 --- a/src/pkg/dashboard/static/index.html +++ b/src/pkg/dashboard/static/index.html @@ -15079,7 +15079,8 @@

Where to get help

${esc(li.text)} `; } - return `
+ const prs = typeof stageTrackerRowPRKeys === 'function' ? stageTrackerRowPRKeys(item) : ''; + return `
${stageTrackerRowToolsHtml(item)}
${stageTrackerHeadColsHtml(prRefs, leadHtml, stageTrackerActedBadgeHtml(item, nowMs) + stageTrackerChipsHtml(shown))} @@ -17641,6 +17642,8 @@

All labels

const next = stageTrackerCarryOpen(_stageTrackerMergeState, stageTrackerMergeState(d)); const fresh = stageTrackerNewlyMerged(_stageTrackerMergeState, next).filter(k => !_stageTrackerZapped[k]); _stageTrackerMergeState = next; + // A merged PR is no longer in this payload, so its last host survives. + if (typeof stageTrackerPRHosts === 'function') Object.assign(_stageTrackerPRHost, stageTrackerPRHosts(d)); // With the celebration on, each fresh merge is counted (and the zap // plays) when its token lands on the counter; off, both happen now. const celebrate = fresh.length && typeof stageTrackerCelebrateSetting === 'function' && stageTrackerCelebrateSetting(); @@ -17745,10 +17748,10 @@

All labels

} // The token has landed (or, under reduced motion, would have): count // the PR, pop the chip, zap. - function stageTrackerCelebrateTick(key) { + function stageTrackerCelebrateTick(key, preview) { delete _stageTrackerCelebratePending[key]; const i = String(key).indexOf('/pr#'); - if (i > 0 && !_stageTrackerMergedToday[key]) _stageTrackerMergedToday[key] = { repo: key.slice(0, i), number: Number(key.slice(i + 4)) || 0, at: Date.now() }; + if (!preview && i > 0 && !_stageTrackerMergedToday[key]) _stageTrackerMergedToday[key] = { repo: key.slice(0, i), number: Number(key.slice(i + 4)) || 0, at: Date.now() }; stageTrackerMergedCountDraw(true); if (stageTrackerSoundGate()) stageTrackerPlayZap(1); } @@ -17756,13 +17759,41 @@

All labels

var _stageTrackerFlights = 0; // Pure-ish: the row that draws this PR — its own row, or the issue row // it is nested under — by key, or '' when it is not on the board. + // Pure: the PR keys a row draws, space-separated — its own key for a + // PR row, the covering PRs for an issue row (one inline, several as + // sub-rows). Stamped as data-ham-prs so a merged PR can be traced to + // the row it was drawn on even when it had no sub-row of its own. + function stageTrackerRowPRKeys(item) { + if (!item) return ''; + if (item.kind === 'pr') return stageTrackerPRKey(item.repo, item.number); + return (Array.isArray(item.linked_prs) ? item.linked_prs : []).filter(lp => lp && Number(lp.number) > 0).map(lp => stageTrackerPRKey(lp.repo || item.repo, lp.number)).join(' '); + } + // PR key → the row key it was last drawn on (from the previous payload's + // nested_under / linked_prs), for a merge whose row left the DOM + // between two renders. + var _stageTrackerPRHost = {}; + function stageTrackerPRHosts(d) { + const out = {}; + for (const it of (d && Array.isArray(d.items) ? d.items : [])) { + if (!it) continue; + if (it.kind === 'pr') out[stageTrackerPRKey(it.repo, it.number)] = Number(it.nested_under) > 0 ? stageTrackerItemKey({ repo: it.repo, kind: 'issue', number: it.nested_under }) : stageTrackerItemKey(it); + for (const lp of (Array.isArray(it.linked_prs) ? it.linked_prs : [])) if (lp && Number(lp.number) > 0) out[stageTrackerPRKey(lp.repo || it.repo, lp.number)] = stageTrackerItemKey(it); + } + return out; + } function stageTrackerCelebrateRowKey(prKey, el) { if (!el || typeof el.querySelector !== 'function') return ''; const own = el.querySelector(`[data-ham-key="${CSS.escape(prKey)}"]`); if (own) return prKey; const sub = el.querySelector(`[data-ham-sub-key="${CSS.escape(prKey)}"]`); const row = sub && typeof sub.closest === 'function' ? sub.closest('[data-ham-key]') : null; - return row ? row.dataset.hamKey : ''; + if (row && row.dataset.hamKey) return row.dataset.hamKey; + // A single covering PR is drawn inline on its issue's row: no sub-row, + // so find the row by the PR keys it stamps (then by the last payload). + const host = el.querySelector(`[data-ham-prs~="${CSS.escape(prKey)}"][data-ham-key]`); + if (host && host.dataset.hamKey) return host.dataset.hamKey; + const k = _stageTrackerPRHost[prKey]; + return k && el.querySelector(`[data-ham-key="${CSS.escape(k)}"]`) ? k : ''; } // Stateful: celebrate every freshly merged PR, staggered. A PR whose // row is not on the board (filtered out, other page) still ticks the @@ -17816,17 +17847,21 @@

All labels

if (!rowEl || !rowEl.classList) return { flew: false }; const kind = opts.kind === 'closed-by-merge' ? 'closed-by-merge' : 'merged'; const key = opts.key || rowEl.dataset.hamKey || ''; + const preview = !!opts.preview; rowEl.classList.add('cue-merged'); - const text = kind === 'merged' ? `merged${opts.number ? ' #' + opts.number : ''} · by hive` : `closed by merge${opts.number ? ' of #' + opts.number : ''}`; - stageTrackerNoteOwnerEvent(rowEl.dataset.hamKey, text, Date.now()); - _stageTrackerEvents[rowEl.dataset.hamKey].who = 'hive'; - stageTrackerEventLineInject(rowEl, rowEl.dataset.hamKey, text); + if (preview) setTimeout(() => rowEl.classList.remove('cue-merged'), STAGE_TRACKER_CELEBRATE_PIN_MS); + else { + const text = kind === 'merged' ? `merged${opts.number ? ' #' + opts.number : ''} · by hive` : `closed by merge${opts.number ? ' of #' + opts.number : ''}`; + stageTrackerNoteOwnerEvent(rowEl.dataset.hamKey, text, Date.now()); + _stageTrackerEvents[rowEl.dataset.hamKey].who = 'hive'; + stageTrackerEventLineInject(rowEl, rowEl.dataset.hamKey, text); + } if (kind !== 'merged') return { flew: false }; const reduced = stageTrackerReducedMotion(); const chip = document.getElementById('activity-monitor-merged'); const cap = rowEl.querySelector('.ham-seg.cap'); if (reduced || !chip || !cap || _stageTrackerFlights >= STAGE_TRACKER_CELEBRATE_MAX_FLIGHTS || typeof cap.getBoundingClientRect !== 'function') { - stageTrackerCelebrateTick(key); + stageTrackerCelebrateTick(key, preview); return { flew: false }; } const from = cap.getBoundingClientRect(), to = chip.getBoundingClientRect(); @@ -17840,7 +17875,7 @@

All labels

token.style.setProperty('--cue-fly-ms', STAGE_TRACKER_CELEBRATE_FLY_MS + 'ms'); document.body.appendChild(token); _stageTrackerFlights++; - stageTrackerAfter(token, 'animationend', STAGE_TRACKER_CELEBRATE_FLY_MS, () => { token.remove(); _stageTrackerFlights--; stageTrackerCelebrateTick(key); }); + stageTrackerAfter(token, 'animationend', STAGE_TRACKER_CELEBRATE_FLY_MS, () => { token.remove(); _stageTrackerFlights--; stageTrackerCelebrateTick(key, preview); }); return { flew: true }; } // Write (or replace) the row's event line in place, so a pinned row @@ -18272,10 +18307,23 @@

All labels

return `
Merges

When a pull request merges its row stays for a moment, its ✓ cell glows and a small token rises into the toolbar's "Merged today" count, which ticks up. Under reduced motion the count ticks and the row glows, nothing flies. The count resets at midnight.

-
+
`; } function stageTrackerCelebrateChange(checked) { stageTrackerSetCelebrate(!!checked); } + // ⚙ → Merges → Test celebration: one flight from the first drawn row to + // the counter (pop + zap, the count itself unchanged) so the effect can + // be seen without waiting for a merge. Says why when it cannot play. + function stageTrackerTestCelebration() { + const el = document.getElementById('activity-monitor-panel'); + const row = el ? el.querySelector('.ham-row[data-ham-key] .ham-seg.cap') : null; + const rowEl = row && typeof row.closest === 'function' ? row.closest('.ham-row[data-ham-key]') : null; + if (!rowEl) { showToast('No row to celebrate on — open the Activity Monitor with at least one item listed.', 'warning'); return { flew: false }; } + const r = celebrateRow(rowEl, { kind: 'merged', key: STAGE_TRACKER_CELEBRATE_TEST_KEY, number: 0, preview: true }); + if (!r.flew) showToast(stageTrackerReducedMotion() ? 'Reduced motion is on: the count pops and the row glows, nothing flies.' : 'The token could not fly (counter hidden or too many in flight); the count popped instead.', 'info'); + return r; + } + const STAGE_TRACKER_CELEBRATE_TEST_KEY = 'preview/pr#0'; // Pure: the Confirmations section — which row-action confirms this // browser skips, and the one link that turns them all back on. function stageTrackerConfirmSectionHtml(skipped) {