From 75d0a68ac2318c11d9f9c44a6da5c6c952a2d2b2 Mon Sep 17 00:00:00 2001 From: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> Date: Fri, 30 Oct 2026 15:13:31 -0400 Subject: [PATCH 1/8] fix: stage tracker shows the hive is answering Let hive decide and says why a human is wanted Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> Co-authored-by: clubanderson <407614+clubanderson@users.noreply.github.com> --- ...-stage-tracker-let-hive-decide-feedback.md | 1 + .../stage_tracker_decide_feedback_test.go | 38 +++++++++++++++ src/pkg/dashboard/static-src/css/tracker.css | 1 + .../static-src/js/tracker-actions.js | 35 ++++++++++++-- .../dashboard/static-src/js/tracker-row.js | 11 ++++- src/pkg/dashboard/static/index.html | 47 ++++++++++++++++--- 6 files changed, 119 insertions(+), 14 deletions(-) create mode 100644 changelog.d/fixed-stage-tracker-let-hive-decide-feedback.md create mode 100644 src/pkg/dashboard/stage_tracker_decide_feedback_test.go diff --git a/changelog.d/fixed-stage-tracker-let-hive-decide-feedback.md b/changelog.d/fixed-stage-tracker-let-hive-decide-feedback.md new file mode 100644 index 0000000000..b9fa0070e1 --- /dev/null +++ b/changelog.d/fixed-stage-tracker-let-hive-decide-feedback.md @@ -0,0 +1 @@ +- Stage tracker: Let hive decide now shows the hive is working at once, covered issues no longer repeat their PR's button, and a person's move says why (#15773) diff --git a/src/pkg/dashboard/stage_tracker_decide_feedback_test.go b/src/pkg/dashboard/stage_tracker_decide_feedback_test.go new file mode 100644 index 0000000000..856cac4f1a --- /dev/null +++ b/src/pkg/dashboard/stage_tracker_decide_feedback_test.go @@ -0,0 +1,38 @@ +package dashboard + +import ( + "strings" + "testing" +) + +// Let hive decide answers at once, a covered issue defers to its PR's row, +// and a person's move says why (hivecommons/hive#15773). +func TestStageTrackerLetHiveDecideBusyFeedbackJS(t *testing.T) { + html := indexHTML(t) + for _, want := range []string{ + "Asking the hive…", + "lead.setAttribute('aria-busy', 'true')", + "stageTrackerSetPending([].concat(...items.map(it => stageTrackerPendingKeys(it, rows)))", + `.ham-lead-act[aria-busy="true"]`, + } { + if !strings.Contains(html, want) { + t.Errorf("index.html missing %q", want) + } + } +} + +func TestStageTrackerCoveredIssueDropsPRChipJS(t *testing.T) { + html := indexHTML(t) + for _, want := range []string{"stageTrackerPRListedOwnRow(item, a.target)", "decision pending on #"} { + if !strings.Contains(html, want) { + t.Errorf("index.html missing %q", want) + } + } +} + +func TestStageTrackerHumanChevronSaysWhyJS(t *testing.T) { + html := indexHTML(t) + if !strings.Contains(html, "function stageTrackerHumanWhy(item, kind)") || !strings.Contains(html, "stageTrackerHumanWhy(item, sa.kind)") { + t.Error("the human next-move tooltip must fall back to the row's reason") + } +} diff --git a/src/pkg/dashboard/static-src/css/tracker.css b/src/pkg/dashboard/static-src/css/tracker.css index e84ef59082..f55e9aeb03 100644 --- a/src/pkg/dashboard/static-src/css/tracker.css +++ b/src/pkg/dashboard/static-src/css/tracker.css @@ -684,6 +684,7 @@ .ham-lead-act { padding: 0 var(--sp-3); border: var(--line-width) solid var(--cue-state, var(--accent)); border-radius: var(--r-pill); background: color-mix(in srgb, var(--cue-state, var(--accent)) 10%, transparent); color: var(--cue-state, var(--accent)); font: inherit; font-size: var(--fs-xs); font-weight: var(--fw-semibold); line-height: 1.4; cursor: pointer; white-space: nowrap; } .ham-lead-act:hover, .ham-lead-act:focus-visible { background: color-mix(in srgb, var(--cue-state, var(--accent)) 22%, transparent); outline: none; } .ham-lead-act:focus-visible { box-shadow: 0 0 0 var(--line-width) var(--accent); } + .ham-lead-act[aria-busy="true"] { cursor: progress; opacity: 1; border-style: solid; color: var(--cue-work); } .ham-lead-act.ham-menu-danger { color: var(--red); border-color: var(--red); background: color-mix(in srgb, var(--red) 10%, transparent); } .ham-lead-act[aria-disabled="true"] { color: var(--text-faint); border-color: var(--line-subtle); border-style: dashed; background: transparent; cursor: default; opacity: 0.7; } /* The technical background folds behind one collapsed Details. */ diff --git a/src/pkg/dashboard/static-src/js/tracker-actions.js b/src/pkg/dashboard/static-src/js/tracker-actions.js index 5221430a6d..ba1f6fd6d4 100644 --- a/src/pkg/dashboard/static-src/js/tracker-actions.js +++ b/src/pkg/dashboard/static-src/js/tracker-actions.js @@ -490,8 +490,15 @@ // button — "Let hive decide" showed twice per item (hive#15320 → // #15647, hive#15338 → #15648). The ⋯ menu's "Decide PR #N…" stays on // the parent. subRows: the linked PRs drawn as sub-rows, or none. + // Pure: is the covering PR also a row of its own in the tracker (a + // top-level item, not a sub-row)? Then only that row carries the button. + function stageTrackerPRListedOwnRow(issue, t) { + const key = stageTrackerItemKey({ repo: t.repo || issue.repo, kind: 'pr', number: t.number }); + return !!_stageTracker && Array.isArray(_stageTracker.items) && _stageTracker.items.some(it => stageTrackerItemKey(it) === key); + } function stageTrackerLeadActionOnRow(item, ctx, subRows) { const a = stageTrackerLeadAction(item, ctx); + if (a && a.target && item.kind === 'issue' && a.target.kind === 'pr' && stageTrackerPRListedOwnRow(item, a.target)) return Object.assign({}, a, { passive: a.target.number }); if (!a || !a.target || !Array.isArray(subRows) || !subRows.length || item.kind !== 'issue') return a; const t = a.target; if (t.kind !== 'pr') return a; @@ -507,6 +514,7 @@ function stageTrackerLeadActionHtml(item, ctx, subRows) { const a = stageTrackerLeadActionOnRow(item, ctx, subRows); if (!a) return ''; + if (a.passive) return `decision pending on #${Number(a.passive) || 0}`; const label = String(a.label || a.id); const tip = a.enabled ? String(a.hint || a.note || a.consequence || '') : String(a.why || ''); const ref = typeof stageTrackerRefOf === 'function' ? stageTrackerRefOf(item) : ''; @@ -1574,8 +1582,12 @@ // or null when cancelled or when the operator took the merge // alternative (which runs as its own row action with the chosen button // recorded on the ledger). - async function stageTrackerDelegatePreview(items) { - const plans = await Promise.all(items.map(stageTrackerFetchDelegatePlan)); + async function stageTrackerDelegatePreview(items, rows) { + // The plan gathers the PR live (seconds): the row reads "acting…" and + // its button busy from the click until the preview can open. + const pend = stageTrackerSetPending([].concat(...items.map(it => stageTrackerPendingKeys(it, rows))).filter((k, i, a) => a.indexOf(k) === i), stageTrackerActingCaption('decide:delegate')); + let plans; + try { plans = await Promise.all(items.map(stageTrackerFetchDelegatePlan)); } finally { stageTrackerClearPending(pend); } const failed = plans.filter(pl => pl.error); if (failed.length) { showToast('Could not preview ' + failed.map(pl => pl.ref + ' (' + pl.error + ')').join(', '), 'error'); return null; } const picked = await stageTrackerDelegatePlanDialog(plans, stageTrackerSentinelPreface(items)); @@ -1586,7 +1598,7 @@ } return { chosen: picked.chosen }; } - async function stageTrackerActionPayload(items, id) { + async function stageTrackerActionPayload(items, id, rows) { const refs = items.map(stageTrackerRefOf).join(', '); const who = window._hiveUser || 'you'; const prs = items.length > 0 && items.every(it => it.kind === 'pr'); @@ -1596,7 +1608,7 @@ case 'decide:delegate': // Preview first (hivecommons/hive#15126): nothing is written // until the operator picks a button. - return stageTrackerDelegatePreview(items); + return stageTrackerDelegatePreview(items, rows); case 'decide:delegate-all': { // Confirms as Let hive decide (same opt-out key), naming each PR. const prs = [].concat(...items.map(stageTrackerNestedOpenPRs)); @@ -2008,6 +2020,19 @@ for (const n of nodes) { const key = n.getAttribute('data-ham-sub-key') || n.getAttribute('data-ham-key'); const cap = want[key]; + // A pending Let hive decide shows on its button too: busy, not clickable again. + const lead = n.querySelector(':scope > .ham-row-head .ham-lead-act[data-ham-act^="decide:delegate"]'); + if (lead) { + if (cap && lead.getAttribute('aria-busy') !== 'true') { + lead.dataset.hamLabel = lead.textContent; + lead.setAttribute('aria-busy', 'true'); lead.setAttribute('aria-disabled', 'true'); + lead.textContent = ''; + const sp = document.createElement('span'); sp.className = 'toast-spinner cue-acting-spin'; lead.appendChild(sp); + lead.appendChild(document.createTextNode(' Asking the hive…')); + } else if (!cap && lead.getAttribute('aria-busy') === 'true') { + lead.removeAttribute('aria-busy'); lead.removeAttribute('aria-disabled'); lead.textContent = lead.dataset.hamLabel || ''; + } + } const strip = n.querySelector(':scope > .ham-strip-row'); // The caption lives inside the lit chevron (the pill), never as a // separate element beside the ✓ badge (#15126); a row without a @@ -2101,7 +2126,7 @@ .filter(t => t && !seen[stageTrackerItemKey(t)] && (seen[stageTrackerItemKey(t)] = true)); if (!items.length) { stageTrackerNothingToActOn(id, rows); return { toasts: [], pending: [] }; } } - const payload = await stageTrackerActionPayload(items, id); + const payload = await stageTrackerActionPayload(items, id, rows); if (payload == null) return { toasts: [], pending: [], cancelled: true }; const results = await stageTrackerRunActions(items, id, payload, rows); return { toast: results.toasts[0] || null, toasts: results.toasts, pending: results.pending, results }; diff --git a/src/pkg/dashboard/static-src/js/tracker-row.js b/src/pkg/dashboard/static-src/js/tracker-row.js index 74d8377c4d..f588d7f98a 100644 --- a/src/pkg/dashboard/static-src/js/tracker-row.js +++ b/src/pkg/dashboard/static-src/js/tracker-row.js @@ -197,11 +197,18 @@ } // " · Next move: hive @fixer — fixer commented · 3m ago", or, with // nobody on it, " · no one is working on this right now — ". + // A person's move with no stage_actor.why says why from the row's own + // reason, so the 👤 marker never leaves the question unanswered. + function stageTrackerHumanWhy(item, kind) { + if (kind !== 'human' && kind !== 'maintainer') return ''; + return String(item.human_merge_reason_text || item.reason || '').trim(); + } function stageTrackerActorTip(item) { const sa = stageTrackerStageActor(item); - if (!sa) { const k = stageTrackerActorKind(item); return k ? ' · Next move: ' + k : ''; } + if (!sa) { const k = stageTrackerActorKind(item); const w = stageTrackerHumanWhy(item, k); return k ? ' · Next move: ' + k + (w ? ' — ' + w : '') : ''; } if (sa.kind === STAGE_TRACKER_ACTOR_NONE) return sa.why ? ' · ' + STAGE_TRACKER_NOBODY_LEAD + ' — ' + sa.why : ''; - return ' · Next move: ' + sa.kind + (sa.login ? ' @' + sa.login : '') + (sa.why ? ' — ' + sa.why : ''); + const why = sa.why || stageTrackerHumanWhy(item, sa.kind); + return ' · Next move: ' + sa.kind + (sa.login ? ' @' + sa.login : '') + (why ? ' — ' + why : ''); } // Who holds the row: the payload's claimant {kind, login, agent, hive, // since, source} (hivecommons/hive#15422). The chevron gets one short diff --git a/src/pkg/dashboard/static/index.html b/src/pkg/dashboard/static/index.html index 1e69e749ab..adb403de2b 100644 --- a/src/pkg/dashboard/static/index.html +++ b/src/pkg/dashboard/static/index.html @@ -2013,6 +2013,7 @@ .ham-lead-act { padding: 0 var(--sp-3); border: var(--line-width) solid var(--cue-state, var(--accent)); border-radius: var(--r-pill); background: color-mix(in srgb, var(--cue-state, var(--accent)) 10%, transparent); color: var(--cue-state, var(--accent)); font: inherit; font-size: var(--fs-xs); font-weight: var(--fw-semibold); line-height: 1.4; cursor: pointer; white-space: nowrap; } .ham-lead-act:hover, .ham-lead-act:focus-visible { background: color-mix(in srgb, var(--cue-state, var(--accent)) 22%, transparent); outline: none; } .ham-lead-act:focus-visible { box-shadow: 0 0 0 var(--line-width) var(--accent); } + .ham-lead-act[aria-busy="true"] { cursor: progress; opacity: 1; border-style: solid; color: var(--cue-work); } .ham-lead-act.ham-menu-danger { color: var(--red); border-color: var(--red); background: color-mix(in srgb, var(--red) 10%, transparent); } .ham-lead-act[aria-disabled="true"] { color: var(--text-faint); border-color: var(--line-subtle); border-style: dashed; background: transparent; cursor: default; opacity: 0.7; } /* The technical background folds behind one collapsed Details. */ @@ -16633,11 +16634,18 @@

Where to get help

} // " · Next move: hive @fixer — fixer commented · 3m ago", or, with // nobody on it, " · no one is working on this right now — ". + // A person's move with no stage_actor.why says why from the row's own + // reason, so the 👤 marker never leaves the question unanswered. + function stageTrackerHumanWhy(item, kind) { + if (kind !== 'human' && kind !== 'maintainer') return ''; + return String(item.human_merge_reason_text || item.reason || '').trim(); + } function stageTrackerActorTip(item) { const sa = stageTrackerStageActor(item); - if (!sa) { const k = stageTrackerActorKind(item); return k ? ' · Next move: ' + k : ''; } + if (!sa) { const k = stageTrackerActorKind(item); const w = stageTrackerHumanWhy(item, k); return k ? ' · Next move: ' + k + (w ? ' — ' + w : '') : ''; } if (sa.kind === STAGE_TRACKER_ACTOR_NONE) return sa.why ? ' · ' + STAGE_TRACKER_NOBODY_LEAD + ' — ' + sa.why : ''; - return ' · Next move: ' + sa.kind + (sa.login ? ' @' + sa.login : '') + (sa.why ? ' — ' + sa.why : ''); + const why = sa.why || stageTrackerHumanWhy(item, sa.kind); + return ' · Next move: ' + sa.kind + (sa.login ? ' @' + sa.login : '') + (why ? ' — ' + why : ''); } // Who holds the row: the payload's claimant {kind, login, agent, hive, // since, source} (hivecommons/hive#15422). The chevron gets one short @@ -20074,8 +20082,15 @@

All labels

// button — "Let hive decide" showed twice per item (hive#15320 → // #15647, hive#15338 → #15648). The ⋯ menu's "Decide PR #N…" stays on // the parent. subRows: the linked PRs drawn as sub-rows, or none. + // Pure: is the covering PR also a row of its own in the tracker (a + // top-level item, not a sub-row)? Then only that row carries the button. + function stageTrackerPRListedOwnRow(issue, t) { + const key = stageTrackerItemKey({ repo: t.repo || issue.repo, kind: 'pr', number: t.number }); + return !!_stageTracker && Array.isArray(_stageTracker.items) && _stageTracker.items.some(it => stageTrackerItemKey(it) === key); + } function stageTrackerLeadActionOnRow(item, ctx, subRows) { const a = stageTrackerLeadAction(item, ctx); + if (a && a.target && item.kind === 'issue' && a.target.kind === 'pr' && stageTrackerPRListedOwnRow(item, a.target)) return Object.assign({}, a, { passive: a.target.number }); if (!a || !a.target || !Array.isArray(subRows) || !subRows.length || item.kind !== 'issue') return a; const t = a.target; if (t.kind !== 'pr') return a; @@ -20091,6 +20106,7 @@

All labels

function stageTrackerLeadActionHtml(item, ctx, subRows) { const a = stageTrackerLeadActionOnRow(item, ctx, subRows); if (!a) return ''; + if (a.passive) return `decision pending on #${Number(a.passive) || 0}`; const label = String(a.label || a.id); const tip = a.enabled ? String(a.hint || a.note || a.consequence || '') : String(a.why || ''); const ref = typeof stageTrackerRefOf === 'function' ? stageTrackerRefOf(item) : ''; @@ -21158,8 +21174,12 @@

All labels

// or null when cancelled or when the operator took the merge // alternative (which runs as its own row action with the chosen button // recorded on the ledger). - async function stageTrackerDelegatePreview(items) { - const plans = await Promise.all(items.map(stageTrackerFetchDelegatePlan)); + async function stageTrackerDelegatePreview(items, rows) { + // The plan gathers the PR live (seconds): the row reads "acting…" and + // its button busy from the click until the preview can open. + const pend = stageTrackerSetPending([].concat(...items.map(it => stageTrackerPendingKeys(it, rows))).filter((k, i, a) => a.indexOf(k) === i), stageTrackerActingCaption('decide:delegate')); + let plans; + try { plans = await Promise.all(items.map(stageTrackerFetchDelegatePlan)); } finally { stageTrackerClearPending(pend); } const failed = plans.filter(pl => pl.error); if (failed.length) { showToast('Could not preview ' + failed.map(pl => pl.ref + ' (' + pl.error + ')').join(', '), 'error'); return null; } const picked = await stageTrackerDelegatePlanDialog(plans, stageTrackerSentinelPreface(items)); @@ -21170,7 +21190,7 @@

All labels

} return { chosen: picked.chosen }; } - async function stageTrackerActionPayload(items, id) { + async function stageTrackerActionPayload(items, id, rows) { const refs = items.map(stageTrackerRefOf).join(', '); const who = window._hiveUser || 'you'; const prs = items.length > 0 && items.every(it => it.kind === 'pr'); @@ -21180,7 +21200,7 @@

All labels

case 'decide:delegate': // Preview first (hivecommons/hive#15126): nothing is written // until the operator picks a button. - return stageTrackerDelegatePreview(items); + return stageTrackerDelegatePreview(items, rows); case 'decide:delegate-all': { // Confirms as Let hive decide (same opt-out key), naming each PR. const prs = [].concat(...items.map(stageTrackerNestedOpenPRs)); @@ -21592,6 +21612,19 @@

All labels

for (const n of nodes) { const key = n.getAttribute('data-ham-sub-key') || n.getAttribute('data-ham-key'); const cap = want[key]; + // A pending Let hive decide shows on its button too: busy, not clickable again. + const lead = n.querySelector(':scope > .ham-row-head .ham-lead-act[data-ham-act^="decide:delegate"]'); + if (lead) { + if (cap && lead.getAttribute('aria-busy') !== 'true') { + lead.dataset.hamLabel = lead.textContent; + lead.setAttribute('aria-busy', 'true'); lead.setAttribute('aria-disabled', 'true'); + lead.textContent = ''; + const sp = document.createElement('span'); sp.className = 'toast-spinner cue-acting-spin'; lead.appendChild(sp); + lead.appendChild(document.createTextNode(' Asking the hive…')); + } else if (!cap && lead.getAttribute('aria-busy') === 'true') { + lead.removeAttribute('aria-busy'); lead.removeAttribute('aria-disabled'); lead.textContent = lead.dataset.hamLabel || ''; + } + } const strip = n.querySelector(':scope > .ham-strip-row'); // The caption lives inside the lit chevron (the pill), never as a // separate element beside the ✓ badge (#15126); a row without a @@ -21685,7 +21718,7 @@

All labels

.filter(t => t && !seen[stageTrackerItemKey(t)] && (seen[stageTrackerItemKey(t)] = true)); if (!items.length) { stageTrackerNothingToActOn(id, rows); return { toasts: [], pending: [] }; } } - const payload = await stageTrackerActionPayload(items, id); + const payload = await stageTrackerActionPayload(items, id, rows); if (payload == null) return { toasts: [], pending: [], cancelled: true }; const results = await stageTrackerRunActions(items, id, payload, rows); return { toast: results.toasts[0] || null, toasts: results.toasts, pending: results.pending, results }; From f1e1119750412bea75c787f2041accb120efa506 Mon Sep 17 00:00:00 2001 From: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> Date: Fri, 30 Oct 2026 15:34:38 -0400 Subject: [PATCH 2/8] fix: guard stageTrackerActorTip's stageTrackerHumanWhy call for lifted test fixtures Seven dashboard test fixtures lift stageTrackerActorTip by name without stageTrackerHumanWhy, so the shuffle job failed with ReferenceError. Follow the file's existing guarded-helper pattern and regenerate index.html. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> --- src/pkg/dashboard/stage_tracker_decide_feedback_test.go | 2 +- src/pkg/dashboard/static-src/js/tracker-row.js | 6 ++++-- src/pkg/dashboard/static/index.html | 6 ++++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/pkg/dashboard/stage_tracker_decide_feedback_test.go b/src/pkg/dashboard/stage_tracker_decide_feedback_test.go index 856cac4f1a..cd12a0fac7 100644 --- a/src/pkg/dashboard/stage_tracker_decide_feedback_test.go +++ b/src/pkg/dashboard/stage_tracker_decide_feedback_test.go @@ -32,7 +32,7 @@ func TestStageTrackerCoveredIssueDropsPRChipJS(t *testing.T) { func TestStageTrackerHumanChevronSaysWhyJS(t *testing.T) { html := indexHTML(t) - if !strings.Contains(html, "function stageTrackerHumanWhy(item, kind)") || !strings.Contains(html, "stageTrackerHumanWhy(item, sa.kind)") { + if !strings.Contains(html, "function stageTrackerHumanWhy(item, kind)") || !strings.Contains(html, "sa.why || humanWhy(item, sa.kind)") { t.Error("the human next-move tooltip must fall back to the row's reason") } } diff --git a/src/pkg/dashboard/static-src/js/tracker-row.js b/src/pkg/dashboard/static-src/js/tracker-row.js index f588d7f98a..03e16b340b 100644 --- a/src/pkg/dashboard/static-src/js/tracker-row.js +++ b/src/pkg/dashboard/static-src/js/tracker-row.js @@ -204,10 +204,12 @@ return String(item.human_merge_reason_text || item.reason || '').trim(); } function stageTrackerActorTip(item) { + // Guarded: test harnesses lift this function by name without stageTrackerHumanWhy. + const humanWhy = typeof stageTrackerHumanWhy === 'function' ? stageTrackerHumanWhy : () => ''; const sa = stageTrackerStageActor(item); - if (!sa) { const k = stageTrackerActorKind(item); const w = stageTrackerHumanWhy(item, k); return k ? ' · Next move: ' + k + (w ? ' — ' + w : '') : ''; } + if (!sa) { const k = stageTrackerActorKind(item); const w = humanWhy(item, k); return k ? ' · Next move: ' + k + (w ? ' — ' + w : '') : ''; } if (sa.kind === STAGE_TRACKER_ACTOR_NONE) return sa.why ? ' · ' + STAGE_TRACKER_NOBODY_LEAD + ' — ' + sa.why : ''; - const why = sa.why || stageTrackerHumanWhy(item, sa.kind); + const why = sa.why || humanWhy(item, sa.kind); return ' · Next move: ' + sa.kind + (sa.login ? ' @' + sa.login : '') + (why ? ' — ' + why : ''); } // Who holds the row: the payload's claimant {kind, login, agent, hive, diff --git a/src/pkg/dashboard/static/index.html b/src/pkg/dashboard/static/index.html index adb403de2b..4abc7d3584 100644 --- a/src/pkg/dashboard/static/index.html +++ b/src/pkg/dashboard/static/index.html @@ -16641,10 +16641,12 @@

Where to get help

return String(item.human_merge_reason_text || item.reason || '').trim(); } function stageTrackerActorTip(item) { + // Guarded: test harnesses lift this function by name without stageTrackerHumanWhy. + const humanWhy = typeof stageTrackerHumanWhy === 'function' ? stageTrackerHumanWhy : () => ''; const sa = stageTrackerStageActor(item); - if (!sa) { const k = stageTrackerActorKind(item); const w = stageTrackerHumanWhy(item, k); return k ? ' · Next move: ' + k + (w ? ' — ' + w : '') : ''; } + if (!sa) { const k = stageTrackerActorKind(item); const w = humanWhy(item, k); return k ? ' · Next move: ' + k + (w ? ' — ' + w : '') : ''; } if (sa.kind === STAGE_TRACKER_ACTOR_NONE) return sa.why ? ' · ' + STAGE_TRACKER_NOBODY_LEAD + ' — ' + sa.why : ''; - const why = sa.why || stageTrackerHumanWhy(item, sa.kind); + const why = sa.why || humanWhy(item, sa.kind); return ' · Next move: ' + sa.kind + (sa.login ? ' @' + sa.login : '') + (why ? ' — ' + why : ''); } // Who holds the row: the payload's claimant {kind, login, agent, hive, From a1d9cf77c11b4d291b789a3705f85fa5a0558dd0 Mon Sep 17 00:00:00 2001 From: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> Date: Fri, 30 Oct 2026 15:55:12 -0400 Subject: [PATCH 3/8] test: lift stageTrackerPRListedOwnRow into the row-actions preamble stageTrackerLeadActionOnRow now calls it, and the node fixture that lifts functions by name raised ReferenceError without it. Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> --- src/pkg/dashboard/stage_tracker_row_actions_test.go | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pkg/dashboard/stage_tracker_row_actions_test.go b/src/pkg/dashboard/stage_tracker_row_actions_test.go index 06606693e2..a8ae006cbe 100644 --- a/src/pkg/dashboard/stage_tracker_row_actions_test.go +++ b/src/pkg/dashboard/stage_tracker_row_actions_test.go @@ -96,6 +96,7 @@ func stageTrackerRowActionsPreamble(t *testing.T, html string) string { jsFunc(t, html, "stageTrackerLeadAction"), jsFunc(t, html, "stageTrackerMaintainerMoved"), jsFunc(t, html, "stageTrackerDevWarn"), + jsFunc(t, html, "stageTrackerPRListedOwnRow"), jsFunc(t, html, "stageTrackerLeadActionOnRow"), jsFunc(t, html, "stageTrackerLeadActionHtml"), jsFunc(t, html, "stageTrackerMenuTextHtml"), From 6e5964af774ddab929b2e0a5c0c0d692eaa408c3 Mon Sep 17 00:00:00 2001 From: ci-maintainer <280983584+hivecommons-hive[bot]@users.noreply.github.com> Date: Fri, 30 Oct 2026 17:13:51 -0400 Subject: [PATCH 4/8] fix: busy Let hive decide keeps its colour, only its own pend busies it, chip names the lead MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Review of #15871: - The busy lead rule lost the cascade to the equal-specificity aria-disabled rule that followed it, so the button rendered faint and dashed while the hive was asked. The rule is now the compound [aria-busy][aria-disabled] selector and sits after the disabled one. - stageTrackerPendingSync busied the delegate button for any pending entry on the row (a confirmed action's "Adopting…", any ⋯ action) and its restore dropped a pre-existing aria-disabled, making a lead the row rendered disabled clickable. The preview's pend is now tagged with the button it busies (stageTrackerSetPending's new busy argument); only a lead with that data-ham-act goes busy, and its original aria-disabled and title are saved and put back when the pend clears. - The passive chip fires for every PR-targeted lead, so its tooltip now names the lead it stands in for (Merge now, Adopt…) instead of always saying Let hive decide. - Tests: node cases cover the covering-PR → passive path (including a Merge now lead), and busy/restore under stageTrackerPendingSync (tagged vs untagged pend, other verb left alone, disabled lead restored with its reason); the CSS test asserts the compound rule follows the disabled one. The DOM stub gains removeAttribute, dataset and the row-head descendant selector. Hive-Fix-Attempt: 1/6 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: ci-maintainer <280983584+hivecommons-hive[bot]@users.noreply.github.com> --- .../stage_tracker_decide_feedback_test.go | 126 ++++++++++++++++-- .../stage_tracker_decided_ui_test.go | 2 + .../stage_tracker_row_actions_test.go | 10 +- src/pkg/dashboard/static-src/css/tracker.css | 4 +- .../static-src/js/tracker-actions.js | 59 +++++--- src/pkg/dashboard/static/index.html | 63 ++++++--- 6 files changed, 209 insertions(+), 55 deletions(-) diff --git a/src/pkg/dashboard/stage_tracker_decide_feedback_test.go b/src/pkg/dashboard/stage_tracker_decide_feedback_test.go index cd12a0fac7..0a62592e51 100644 --- a/src/pkg/dashboard/stage_tracker_decide_feedback_test.go +++ b/src/pkg/dashboard/stage_tracker_decide_feedback_test.go @@ -7,29 +7,133 @@ import ( // Let hive decide answers at once, a covered issue defers to its PR's row, // and a person's move says why (hivecommons/hive#15773). -func TestStageTrackerLetHiveDecideBusyFeedbackJS(t *testing.T) { + +// The busy button keeps the tracker's working colour: the busy rule also +// carries aria-disabled (the click guard reads it), so it must be the +// compound selector and sit after the plain disabled rule, or the faint +// dashed disabled look wins on equal specificity. +func TestStageTrackerLetHiveDecideBusyCSS(t *testing.T) { html := indexHTML(t) - for _, want := range []string{ - "Asking the hive…", - "lead.setAttribute('aria-busy', 'true')", - "stageTrackerSetPending([].concat(...items.map(it => stageTrackerPendingKeys(it, rows)))", - `.ham-lead-act[aria-busy="true"]`, - } { - if !strings.Contains(html, want) { - t.Errorf("index.html missing %q", want) + busy := strings.Index(html, `.ham-lead-act[aria-busy="true"][aria-disabled="true"] {`) + disabled := strings.Index(html, `.ham-lead-act[aria-disabled="true"] {`) + if busy < 0 || disabled < 0 { + t.Fatalf("index.html lacks the busy (%d) or disabled (%d) lead rule", busy, disabled) + } + if busy < disabled { + t.Error("the busy lead rule must come after the disabled one so it wins the cascade") + } + rule := html[busy : busy+strings.Index(html[busy:], "}")] + for _, want := range []string{"color: var(--cue-work)", "cursor: progress", "opacity: 1", "border-style: solid"} { + if !strings.Contains(rule, want) { + t.Errorf("busy lead rule lacks %q: %s", want, rule) } } } -func TestStageTrackerCoveredIssueDropsPRChipJS(t *testing.T) { +// The preview's pend is the one tagged to busy the button; the confirmed +// action's pend is not. +func TestStageTrackerLetHiveDecidePreviewTagsPend(t *testing.T) { html := indexHTML(t) - for _, want := range []string{"stageTrackerPRListedOwnRow(item, a.target)", "decision pending on #"} { + for _, want := range []string{ + "stageTrackerActingCaption('decide:delegate'), undefined, 'decide:delegate');", + "try { plans = await Promise.all(items.map(stageTrackerFetchDelegatePlan)); } finally { stageTrackerClearPending(pend); }", + "stageTrackerLeadBusySync(n.querySelector(':scope > .ham-row-head .ham-lead-act[data-ham-act]'), busy[key] || '');", + } { if !strings.Contains(html, want) { t.Errorf("index.html missing %q", want) } } } +// stageTrackerPendingSync under node: only the tagged pend busies the lead, +// and only the lead it names; a disabled lead comes back disabled with its +// reason once the pend clears. +func TestStageTrackerLetHiveDecideBusyRestoreNode(t *testing.T) { + html := indexHTML(t) + runStageTrackerRowActionsScript(t, stageTrackerRowActionsPreamble(t, html)+` +const now = Date.now(); +function hamStubLead(act, disabledWhy) { + const head = hamStubEl('div'); head.classList.add('ham-row-head'); + const b = hamStubEl('button'); b.classList.add('ham-lead-act'); b.setAttribute('data-ham-act', act); b.textContent = 'Let hive decide'; + if (disabledWhy) { b.setAttribute('aria-disabled', 'true'); b.setAttribute('title', disabledWhy); } else b.setAttribute('title', 'delegate'); + head.appendChild(b); return { head, b }; +} +const K = 'hivecommons/hive/pr#15773'; +// 1. The preview's tagged pend: busy + spinner + "Asking the hive…", not clickable; restore puts the label and hint back. +let row = hamStubRow(K); let { head, b } = hamStubLead('decide:delegate'); row.appendChild(head); hamPanel.children.length = 0; hamPanel.appendChild(row); +let pend = stageTrackerSetPending([K], stageTrackerActingCaption('decide:delegate'), now, 'decide:delegate'); +assert.strictEqual(b.getAttribute('aria-busy'), 'true', 'tagged pend busies the button'); +assert.strictEqual(b.getAttribute('aria-disabled'), 'true', 'busy is not clickable (the click guard reads aria-disabled)'); +assert.strictEqual(b.getAttribute('title'), null, 'the hint does not show while busy'); +assert.ok(b.children.some(c => c.classList && c.classList.contains('cue-acting-spin')), 'spinner'); +assert.strictEqual(b.children[b.children.length - 1].nodeValue, STAGE_TRACKER_LEAD_BUSY_TEXT); +assert.ok(row.classList.contains('cue-acting'), 'the row still wears the acting caption'); +stageTrackerPendingSync(hamPanel); +assert.strictEqual(b.children.filter(c => c.classList && c.classList.contains('cue-acting-spin')).length, 1, 'a re-sync adds no second spinner'); +stageTrackerClearPending(pend); +assert.strictEqual(b.getAttribute('aria-busy'), null); assert.strictEqual(b.getAttribute('aria-disabled'), null, 'an enabled lead is clickable again'); +assert.strictEqual(b.getAttribute('title'), 'delegate', 'the hint is back'); assert.strictEqual(b.textContent, 'Let hive decide'); +// 2. The confirmed action's pend (no tag, "Adopting…" etc.) never touches the button, even on a decide:delegate lead. +pend = stageTrackerSetPending([K], 'Adopting…', now); +assert.strictEqual(b.getAttribute('aria-busy'), null, 'an untagged pend leaves the lead alone: ' + JSON.stringify(b.attrs)); +assert.ok(row.classList.contains('cue-acting'), 'but the row caption shows'); +stageTrackerClearPending(pend); +// 3. A tagged pend on a row whose lead is another verb leaves that lead alone. +row = hamStubRow(K); ({ head, b } = hamStubLead('decide:merge-now')); row.appendChild(head); hamPanel.children.length = 0; hamPanel.appendChild(row); +pend = stageTrackerSetPending([K], stageTrackerActingCaption('decide:delegate'), now, 'decide:delegate'); +assert.strictEqual(b.getAttribute('aria-busy'), null, 'Merge now does not read Asking the hive…'); +stageTrackerClearPending(pend); +// 4. A lead the row rendered disabled (aria-disabled + why) is disabled again after the pend clears — not clickable. +row = hamStubRow(K); ({ head, b } = hamStubLead('decide:delegate', 'Needs write access')); row.appendChild(head); hamPanel.children.length = 0; hamPanel.appendChild(row); +pend = stageTrackerSetPending([K], stageTrackerActingCaption('decide:delegate'), now, 'decide:delegate'); +assert.strictEqual(b.getAttribute('aria-busy'), 'true'); +stageTrackerClearPending(pend); +assert.strictEqual(b.getAttribute('aria-busy'), null); +assert.strictEqual(b.getAttribute('aria-disabled'), 'true', 'a disabled lead stays disabled after the pend clears'); +assert.strictEqual(b.getAttribute('title'), 'Needs write access', 'with its reason'); +assert.strictEqual(b.textContent, 'Let hive decide'); +`) +} + +// A covered issue whose PR is listed as its own tracker row renders a +// passive chip, named after whatever the lead is, not a second button. +func TestStageTrackerCoveredIssueDropsPRChipNode(t *testing.T) { + html := indexHTML(t) + runStageTrackerRowActionsScript(t, stageTrackerRowActionsPreamble(t, html)+` +const NOW = Date.parse('2026-10-30T18:00:00Z'); +const ctx = { user: true, canHold: true, canHuman: true, login: 'octo', nowMs: NOW, governor: {} }; +const buttons = h => (h.match(/ x && x !== c).join(' '); }, contains(c) { return el.className.split(' ').includes(c); } }, appendChild(c) { c.parentNode = el; el.children.push(c); return c; }, prepend(c) { c.parentNode = el; el.children.unshift(c); }, - setAttribute(k, v) { el.attrs[k] = String(v); }, getAttribute(k) { return k in el.attrs ? el.attrs[k] : null; }, + setAttribute(k, v) { el.attrs[k] = String(v); }, getAttribute(k) { return k in el.attrs ? el.attrs[k] : null; }, removeAttribute(k) { delete el.attrs[k]; }, dataset: {}, addEventListener(n, fn) { el._listeners[n] = fn; }, remove() { if (el.parentNode) el.parentNode.children = el.parentNode.children.filter(c => c !== el); el.parentNode = null; }, get lastChild() { return el.children[el.children.length - 1] || null; }, - querySelector(sel) { const m = sel.match(/^:scope > \.([\w-]+)$/); if (!m) return null; return el.children.find(c => c.classList.contains(m[1])) || null; }, + querySelector(sel) { + // ":scope > .child .descendant[attr]" — the lead button under the row head. + const d = sel.match(/^:scope > \.([\w-]+) \.([\w-]+)(?:\[([\w-]+)\])?$/); + if (d) { const head = el.children.find(c => c.classList && c.classList.contains(d[1])); if (!head) return null; const walk = n => { for (const c of (n.children || [])) { if (c.classList && c.classList.contains(d[2]) && (!d[3] || c.attrs[d[3]] != null)) return c; const r = walk(c); if (r) return r; } return null; }; return walk(head); } + const m = sel.match(/^:scope > \.([\w-]+)$/); if (!m) return null; return el.children.find(c => c.classList && c.classList.contains(m[1])) || null; }, querySelectorAll(sel) { const out = []; const walk = n => { for (const c of (n.children || [])) { if (!c.attrs) continue; if ((sel.includes('[data-ham-key]') && c.attrs['data-ham-key'] != null) || (sel.includes('[data-ham-sub-key]') && c.attrs['data-ham-sub-key'] != null)) out.push(c); walk(c); } }; walk(el); return out; }, }; return el; diff --git a/src/pkg/dashboard/static-src/css/tracker.css b/src/pkg/dashboard/static-src/css/tracker.css index f55e9aeb03..d4192b1a7f 100644 --- a/src/pkg/dashboard/static-src/css/tracker.css +++ b/src/pkg/dashboard/static-src/css/tracker.css @@ -684,9 +684,11 @@ .ham-lead-act { padding: 0 var(--sp-3); border: var(--line-width) solid var(--cue-state, var(--accent)); border-radius: var(--r-pill); background: color-mix(in srgb, var(--cue-state, var(--accent)) 10%, transparent); color: var(--cue-state, var(--accent)); font: inherit; font-size: var(--fs-xs); font-weight: var(--fw-semibold); line-height: 1.4; cursor: pointer; white-space: nowrap; } .ham-lead-act:hover, .ham-lead-act:focus-visible { background: color-mix(in srgb, var(--cue-state, var(--accent)) 22%, transparent); outline: none; } .ham-lead-act:focus-visible { box-shadow: 0 0 0 var(--line-width) var(--accent); } - .ham-lead-act[aria-busy="true"] { cursor: progress; opacity: 1; border-style: solid; color: var(--cue-work); } .ham-lead-act.ham-menu-danger { color: var(--red); border-color: var(--red); background: color-mix(in srgb, var(--red) 10%, transparent); } .ham-lead-act[aria-disabled="true"] { color: var(--text-faint); border-color: var(--line-subtle); border-style: dashed; background: transparent; cursor: default; opacity: 0.7; } + /* Busy (Let hive decide gathering its preview) also sets aria-disabled, so this + compound rule sits after the disabled one and wins: the working colour, not faint/dashed. */ + .ham-lead-act[aria-busy="true"][aria-disabled="true"] { cursor: progress; opacity: 1; border-style: solid; border-color: var(--cue-work); background: color-mix(in srgb, var(--cue-work) 10%, transparent); color: var(--cue-work); } /* The technical background folds behind one collapsed Details. */ .ham-decision-details { margin: var(--sp-2) 0 0; font-size: var(--fs-xs); color: var(--text-muted); } .ham-decision-details > summary { cursor: pointer; color: var(--text-faint); } diff --git a/src/pkg/dashboard/static-src/js/tracker-actions.js b/src/pkg/dashboard/static-src/js/tracker-actions.js index ba1f6fd6d4..77df86b55b 100644 --- a/src/pkg/dashboard/static-src/js/tracker-actions.js +++ b/src/pkg/dashboard/static-src/js/tracker-actions.js @@ -514,7 +514,10 @@ function stageTrackerLeadActionHtml(item, ctx, subRows) { const a = stageTrackerLeadActionOnRow(item, ctx, subRows); if (!a) return ''; - if (a.passive) return `decision pending on #${Number(a.passive) || 0}`; + // The covering PR has its own row: the decision — whatever its lead + // (Let hive decide, Merge now, Adopt…) — is taken there, so this row + // shows a passive chip that names that lead rather than a second button. + if (a.passive) return `decision pending on #${Number(a.passive) || 0}`; const label = String(a.label || a.id); const tip = a.enabled ? String(a.hint || a.note || a.consequence || '') : String(a.why || ''); const ref = typeof stageTrackerRefOf === 'function' ? stageTrackerRefOf(item) : ''; @@ -1584,8 +1587,10 @@ // recorded on the ledger). async function stageTrackerDelegatePreview(items, rows) { // The plan gathers the PR live (seconds): the row reads "acting…" and - // its button busy from the click until the preview can open. - const pend = stageTrackerSetPending([].concat(...items.map(it => stageTrackerPendingKeys(it, rows))).filter((k, i, a) => a.indexOf(k) === i), stageTrackerActingCaption('decide:delegate')); + // its Let hive decide button busy from the click until the preview can + // open. The pend is tagged with the button it busies: a confirmed + // action's pend (or any other ⋯ action on the row) leaves it alone. + const pend = stageTrackerSetPending([].concat(...items.map(it => stageTrackerPendingKeys(it, rows))).filter((k, i, a) => a.indexOf(k) === i), stageTrackerActingCaption('decide:delegate'), undefined, 'decide:delegate'); let plans; try { plans = await Promise.all(items.map(stageTrackerFetchDelegatePlan)); } finally { stageTrackerClearPending(pend); } const failed = plans.filter(pl => pl.error); @@ -1983,8 +1988,10 @@ pend.caption = stageTrackerDecidedActing(result, item); stageTrackerPendingSync(document.getElementById('activity-monitor-panel')); } - function stageTrackerSetPending(keys, caption, now) { - const pend = { keys: keys.slice(), caption, key: '', state: null, decided: false, at: typeof now === 'number' ? now : Date.now() }; + // busy: the data-ham-act of the row's lead button that reads busy while + // this entry is pending ('' — the default — busies no button). + function stageTrackerSetPending(keys, caption, now, busy) { + const pend = { keys: keys.slice(), caption, key: '', state: null, decided: false, at: typeof now === 'number' ? now : Date.now(), busy: busy || '' }; _stageTrackerPending.push(pend); stageTrackerPendingSync(document.getElementById('activity-monitor-panel')); return pend; @@ -2010,29 +2017,41 @@ }); } function stageTrackerPendingExpire(d, now) { _stageTrackerPending = stageTrackerPendingLive(_stageTrackerPending, d, typeof now === 'number' ? now : Date.now()); } + // The row's lead button while a tagged pend (busyAct, its data-ham-act) + // waits: busy, spinner, "Asking the hive…", not clickable again. The + // button's own aria-disabled / title are kept and put back when the + // pend clears, so a lead the row rendered disabled stays disabled. + const STAGE_TRACKER_LEAD_BUSY_TEXT = ' Asking the hive…'; + function stageTrackerLeadBusySync(lead, busyAct) { + if (!lead) return; + const on = !!busyAct && lead.getAttribute('data-ham-act') === busyAct; + const isBusy = lead.getAttribute('aria-busy') === 'true'; + if (on && !isBusy) { + lead.dataset.hamLabel = lead.textContent; + lead.dataset.hamWasDisabled = lead.getAttribute('aria-disabled') === 'true' ? 'true' : ''; + lead.dataset.hamTitle = lead.getAttribute('title') || ''; + lead.setAttribute('aria-busy', 'true'); lead.setAttribute('aria-disabled', 'true'); lead.removeAttribute('title'); + lead.textContent = ''; + const sp = document.createElement('span'); sp.className = 'toast-spinner cue-acting-spin'; lead.appendChild(sp); + lead.appendChild(document.createTextNode(STAGE_TRACKER_LEAD_BUSY_TEXT)); + } else if (!on && isBusy) { + lead.removeAttribute('aria-busy'); + if (lead.dataset.hamWasDisabled === 'true') lead.setAttribute('aria-disabled', 'true'); else lead.removeAttribute('aria-disabled'); + if (lead.dataset.hamTitle) lead.setAttribute('title', lead.dataset.hamTitle); else lead.removeAttribute('title'); + lead.textContent = lead.dataset.hamLabel || ''; + } + } // Mark rows / sub-rows acting; captions are real nodes so a kept row // keeps its caption and a re-rendered one gets it back. function stageTrackerPendingSync(el) { if (!el || typeof el.querySelectorAll !== 'function') return; - const want = {}; - for (const p of _stageTrackerPending) for (const k of p.keys) want[k] = p.caption; + const want = {}, busy = {}; + for (const p of _stageTrackerPending) for (const k of p.keys) { want[k] = p.caption; if (p.busy) busy[k] = p.busy; } const nodes = Array.from(el.querySelectorAll('[data-ham-key], [data-ham-sub-key]')); for (const n of nodes) { const key = n.getAttribute('data-ham-sub-key') || n.getAttribute('data-ham-key'); const cap = want[key]; - // A pending Let hive decide shows on its button too: busy, not clickable again. - const lead = n.querySelector(':scope > .ham-row-head .ham-lead-act[data-ham-act^="decide:delegate"]'); - if (lead) { - if (cap && lead.getAttribute('aria-busy') !== 'true') { - lead.dataset.hamLabel = lead.textContent; - lead.setAttribute('aria-busy', 'true'); lead.setAttribute('aria-disabled', 'true'); - lead.textContent = ''; - const sp = document.createElement('span'); sp.className = 'toast-spinner cue-acting-spin'; lead.appendChild(sp); - lead.appendChild(document.createTextNode(' Asking the hive…')); - } else if (!cap && lead.getAttribute('aria-busy') === 'true') { - lead.removeAttribute('aria-busy'); lead.removeAttribute('aria-disabled'); lead.textContent = lead.dataset.hamLabel || ''; - } - } + stageTrackerLeadBusySync(n.querySelector(':scope > .ham-row-head .ham-lead-act[data-ham-act]'), busy[key] || ''); const strip = n.querySelector(':scope > .ham-strip-row'); // The caption lives inside the lit chevron (the pill), never as a // separate element beside the ✓ badge (#15126); a row without a diff --git a/src/pkg/dashboard/static/index.html b/src/pkg/dashboard/static/index.html index 4abc7d3584..5fc86cd882 100644 --- a/src/pkg/dashboard/static/index.html +++ b/src/pkg/dashboard/static/index.html @@ -2013,9 +2013,11 @@ .ham-lead-act { padding: 0 var(--sp-3); border: var(--line-width) solid var(--cue-state, var(--accent)); border-radius: var(--r-pill); background: color-mix(in srgb, var(--cue-state, var(--accent)) 10%, transparent); color: var(--cue-state, var(--accent)); font: inherit; font-size: var(--fs-xs); font-weight: var(--fw-semibold); line-height: 1.4; cursor: pointer; white-space: nowrap; } .ham-lead-act:hover, .ham-lead-act:focus-visible { background: color-mix(in srgb, var(--cue-state, var(--accent)) 22%, transparent); outline: none; } .ham-lead-act:focus-visible { box-shadow: 0 0 0 var(--line-width) var(--accent); } - .ham-lead-act[aria-busy="true"] { cursor: progress; opacity: 1; border-style: solid; color: var(--cue-work); } .ham-lead-act.ham-menu-danger { color: var(--red); border-color: var(--red); background: color-mix(in srgb, var(--red) 10%, transparent); } .ham-lead-act[aria-disabled="true"] { color: var(--text-faint); border-color: var(--line-subtle); border-style: dashed; background: transparent; cursor: default; opacity: 0.7; } + /* Busy (Let hive decide gathering its preview) also sets aria-disabled, so this + compound rule sits after the disabled one and wins: the working colour, not faint/dashed. */ + .ham-lead-act[aria-busy="true"][aria-disabled="true"] { cursor: progress; opacity: 1; border-style: solid; border-color: var(--cue-work); background: color-mix(in srgb, var(--cue-work) 10%, transparent); color: var(--cue-work); } /* The technical background folds behind one collapsed Details. */ .ham-decision-details { margin: var(--sp-2) 0 0; font-size: var(--fs-xs); color: var(--text-muted); } .ham-decision-details > summary { cursor: pointer; color: var(--text-faint); } @@ -20108,7 +20110,10 @@

All labels

function stageTrackerLeadActionHtml(item, ctx, subRows) { const a = stageTrackerLeadActionOnRow(item, ctx, subRows); if (!a) return ''; - if (a.passive) return `decision pending on #${Number(a.passive) || 0}`; + // The covering PR has its own row: the decision — whatever its lead + // (Let hive decide, Merge now, Adopt…) — is taken there, so this row + // shows a passive chip that names that lead rather than a second button. + if (a.passive) return `decision pending on #${Number(a.passive) || 0}`; const label = String(a.label || a.id); const tip = a.enabled ? String(a.hint || a.note || a.consequence || '') : String(a.why || ''); const ref = typeof stageTrackerRefOf === 'function' ? stageTrackerRefOf(item) : ''; @@ -21178,8 +21183,10 @@

All labels

// recorded on the ledger). async function stageTrackerDelegatePreview(items, rows) { // The plan gathers the PR live (seconds): the row reads "acting…" and - // its button busy from the click until the preview can open. - const pend = stageTrackerSetPending([].concat(...items.map(it => stageTrackerPendingKeys(it, rows))).filter((k, i, a) => a.indexOf(k) === i), stageTrackerActingCaption('decide:delegate')); + // its Let hive decide button busy from the click until the preview can + // open. The pend is tagged with the button it busies: a confirmed + // action's pend (or any other ⋯ action on the row) leaves it alone. + const pend = stageTrackerSetPending([].concat(...items.map(it => stageTrackerPendingKeys(it, rows))).filter((k, i, a) => a.indexOf(k) === i), stageTrackerActingCaption('decide:delegate'), undefined, 'decide:delegate'); let plans; try { plans = await Promise.all(items.map(stageTrackerFetchDelegatePlan)); } finally { stageTrackerClearPending(pend); } const failed = plans.filter(pl => pl.error); @@ -21577,8 +21584,10 @@

All labels

pend.caption = stageTrackerDecidedActing(result, item); stageTrackerPendingSync(document.getElementById('activity-monitor-panel')); } - function stageTrackerSetPending(keys, caption, now) { - const pend = { keys: keys.slice(), caption, key: '', state: null, decided: false, at: typeof now === 'number' ? now : Date.now() }; + // busy: the data-ham-act of the row's lead button that reads busy while + // this entry is pending ('' — the default — busies no button). + function stageTrackerSetPending(keys, caption, now, busy) { + const pend = { keys: keys.slice(), caption, key: '', state: null, decided: false, at: typeof now === 'number' ? now : Date.now(), busy: busy || '' }; _stageTrackerPending.push(pend); stageTrackerPendingSync(document.getElementById('activity-monitor-panel')); return pend; @@ -21604,29 +21613,41 @@

All labels

}); } function stageTrackerPendingExpire(d, now) { _stageTrackerPending = stageTrackerPendingLive(_stageTrackerPending, d, typeof now === 'number' ? now : Date.now()); } + // The row's lead button while a tagged pend (busyAct, its data-ham-act) + // waits: busy, spinner, "Asking the hive…", not clickable again. The + // button's own aria-disabled / title are kept and put back when the + // pend clears, so a lead the row rendered disabled stays disabled. + const STAGE_TRACKER_LEAD_BUSY_TEXT = ' Asking the hive…'; + function stageTrackerLeadBusySync(lead, busyAct) { + if (!lead) return; + const on = !!busyAct && lead.getAttribute('data-ham-act') === busyAct; + const isBusy = lead.getAttribute('aria-busy') === 'true'; + if (on && !isBusy) { + lead.dataset.hamLabel = lead.textContent; + lead.dataset.hamWasDisabled = lead.getAttribute('aria-disabled') === 'true' ? 'true' : ''; + lead.dataset.hamTitle = lead.getAttribute('title') || ''; + lead.setAttribute('aria-busy', 'true'); lead.setAttribute('aria-disabled', 'true'); lead.removeAttribute('title'); + lead.textContent = ''; + const sp = document.createElement('span'); sp.className = 'toast-spinner cue-acting-spin'; lead.appendChild(sp); + lead.appendChild(document.createTextNode(STAGE_TRACKER_LEAD_BUSY_TEXT)); + } else if (!on && isBusy) { + lead.removeAttribute('aria-busy'); + if (lead.dataset.hamWasDisabled === 'true') lead.setAttribute('aria-disabled', 'true'); else lead.removeAttribute('aria-disabled'); + if (lead.dataset.hamTitle) lead.setAttribute('title', lead.dataset.hamTitle); else lead.removeAttribute('title'); + lead.textContent = lead.dataset.hamLabel || ''; + } + } // Mark rows / sub-rows acting; captions are real nodes so a kept row // keeps its caption and a re-rendered one gets it back. function stageTrackerPendingSync(el) { if (!el || typeof el.querySelectorAll !== 'function') return; - const want = {}; - for (const p of _stageTrackerPending) for (const k of p.keys) want[k] = p.caption; + const want = {}, busy = {}; + for (const p of _stageTrackerPending) for (const k of p.keys) { want[k] = p.caption; if (p.busy) busy[k] = p.busy; } const nodes = Array.from(el.querySelectorAll('[data-ham-key], [data-ham-sub-key]')); for (const n of nodes) { const key = n.getAttribute('data-ham-sub-key') || n.getAttribute('data-ham-key'); const cap = want[key]; - // A pending Let hive decide shows on its button too: busy, not clickable again. - const lead = n.querySelector(':scope > .ham-row-head .ham-lead-act[data-ham-act^="decide:delegate"]'); - if (lead) { - if (cap && lead.getAttribute('aria-busy') !== 'true') { - lead.dataset.hamLabel = lead.textContent; - lead.setAttribute('aria-busy', 'true'); lead.setAttribute('aria-disabled', 'true'); - lead.textContent = ''; - const sp = document.createElement('span'); sp.className = 'toast-spinner cue-acting-spin'; lead.appendChild(sp); - lead.appendChild(document.createTextNode(' Asking the hive…')); - } else if (!cap && lead.getAttribute('aria-busy') === 'true') { - lead.removeAttribute('aria-busy'); lead.removeAttribute('aria-disabled'); lead.textContent = lead.dataset.hamLabel || ''; - } - } + stageTrackerLeadBusySync(n.querySelector(':scope > .ham-row-head .ham-lead-act[data-ham-act]'), busy[key] || ''); const strip = n.querySelector(':scope > .ham-strip-row'); // The caption lives inside the lit chevron (the pill), never as a // separate element beside the ✓ badge (#15126); a row without a From 4442dac5ca4213e4b8206a515ad553d1a998c9a5 Mon Sep 17 00:00:00 2001 From: ci-maintainer <280983584+hivecommons-hive[bot]@users.noreply.github.com> Date: Fri, 30 Oct 2026 18:12:46 -0400 Subject: [PATCH 5/8] fix: covered-issue chip only when the PR is a drawn row MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit stageTrackerPRListedOwnRow read _stageTracker.items, but a PR nested_under a listed issue (stage_tracker_links.go) is folded into that issue's sub-row by stageTrackerVisible and never drawn as its own row outside the Pull requests view — so the issue row showed a passive "decision pending on #N" chip pointing at a row that did not exist and lost its only decision button. The render now records the drawn rows (_stageTracker.rows) and the chip follows them; without a render the items stand in, minus PRs nested under a listed issue. Test covers nested_under and the drawn-rows path. Hive-Fix-Attempt: 2/6 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: ci-maintainer <280983584+hivecommons-hive[bot]@users.noreply.github.com> --- .../stage_tracker_decide_feedback_test.go | 17 +++++++++++++++ .../static-src/js/tracker-actions.js | 18 ++++++++++++++-- .../static-src/js/tracker-filter-render.js | 3 +++ src/pkg/dashboard/static/index.html | 21 +++++++++++++++++-- 4 files changed, 55 insertions(+), 4 deletions(-) diff --git a/src/pkg/dashboard/stage_tracker_decide_feedback_test.go b/src/pkg/dashboard/stage_tracker_decide_feedback_test.go index 0a62592e51..2ee242dc5f 100644 --- a/src/pkg/dashboard/stage_tracker_decide_feedback_test.go +++ b/src/pkg/dashboard/stage_tracker_decide_feedback_test.go @@ -122,6 +122,23 @@ assert.ok(h.includes('decision pending on #15647'), h); assert.ok(h.includes('Let hive decide lives on its row'), h); // The PR's own row still carries the button. assert.strictEqual(buttons(stageTrackerLeadActionHtml(prRow, ctx)), 1); +// Nested under the issue (stage_tracker_links.go sets nested_under): the PR +// is in items but stageTrackerVisible folds it into the issue's sub-row, so +// no chip — the issue keeps its button when no sub-row is drawn (one +// covering PR) and yields it to the sub-row when several are. +const nested = Object.assign({}, prRow, { nested_under: 15320 }); +_stageTracker = { items: [issue, nested] }; +a = stageTrackerLeadActionOnRow(issue, ctx); +assert.ok(a && !a.passive, 'a nested PR is not its own row: ' + JSON.stringify(a)); +assert.strictEqual(buttons(stageTrackerLeadActionHtml(issue, ctx)), 1, 'the issue row keeps its only decision button'); +assert.strictEqual(stageTrackerLeadActionOnRow(issue, ctx, [asking]), null, 'drawn as a sub-row, the sub-row carries it'); +// A render records the drawn rows; the chip follows them, not the items: +// the PR hidden by the filter leaves the button on the issue, the PR drawn +// as a row turns it into the chip. +_stageTracker = { items: [issue, prRow], rows: [issue] }; +assert.ok(!stageTrackerLeadActionOnRow(issue, ctx).passive, 'the PR not drawn: no chip'); +_stageTracker = { items: [issue, nested], rows: [issue, nested] }; +assert.strictEqual(stageTrackerLeadActionOnRow(issue, ctx).passive, 15647, 'the PR drawn (Pull requests view aside, a row is a row): chip'); // A server-marked lead that is not Let hive decide is named as itself. const merging = Object.assign({}, asking, { decision_needed: { question: 'Merge?', options: [{ action: 'decide:merge-now', label: 'Merge now', enabled: true, lead: true }, { action: 'decide:delegate', label: 'Let hive decide', enabled: true }] } }); const issue2 = Object.assign({}, issue, { number: 15321, linked_prs: [merging] }); diff --git a/src/pkg/dashboard/static-src/js/tracker-actions.js b/src/pkg/dashboard/static-src/js/tracker-actions.js index 77df86b55b..3468cc162c 100644 --- a/src/pkg/dashboard/static-src/js/tracker-actions.js +++ b/src/pkg/dashboard/static-src/js/tracker-actions.js @@ -491,10 +491,24 @@ // #15647, hive#15338 → #15648). The ⋯ menu's "Decide PR #N…" stays on // the parent. subRows: the linked PRs drawn as sub-rows, or none. // Pure: is the covering PR also a row of its own in the tracker (a - // top-level item, not a sub-row)? Then only that row carries the button. + // top-level row, not a sub-row)? Then only that row carries the button. + // Reads the rows the last render drew (_stageTracker.rows, set by + // stageTrackerRender from stageTrackerVisible), not the payload's items: + // a PR nested_under a listed issue is in items but is never its own row + // outside the Pull requests view (tracker-filter.js stageTrackerVisible), + // and a filter may hide the PR while it shows the issue. Without a + // render (the node harness) the items stand in, minus PRs nested under + // a listed issue, so the chip never points at a row that is not drawn. function stageTrackerPRListedOwnRow(issue, t) { + if (!_stageTracker) return false; const key = stageTrackerItemKey({ repo: t.repo || issue.repo, kind: 'pr', number: t.number }); - return !!_stageTracker && Array.isArray(_stageTracker.items) && _stageTracker.items.some(it => stageTrackerItemKey(it) === key); + let rows = _stageTracker.rows; + if (!Array.isArray(rows)) { + const items = Array.isArray(_stageTracker.items) ? _stageTracker.items : []; + const issues = new Set(items.filter(it => it && it.kind === 'issue').map(it => it.repo + '#' + it.number)); + rows = items.filter(it => it && !(it.kind === 'pr' && it.nested_under && issues.has(it.repo + '#' + it.nested_under))); + } + return rows.some(it => it && stageTrackerItemKey(it) === key); } function stageTrackerLeadActionOnRow(item, ctx, subRows) { const a = stageTrackerLeadAction(item, ctx); 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 71a9d7dc71..3f8b05ee25 100644 --- a/src/pkg/dashboard/static-src/js/tracker-filter-render.js +++ b/src/pkg/dashboard/static-src/js/tracker-filter-render.js @@ -83,6 +83,9 @@ // 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); + // The rows this view draws, for stageTrackerPRListedOwnRow: a covered + // issue defers to its PR's row only when that row is actually drawn. + if (_stageTracker) _stageTracker.rows = visible; const ordered = stageTrackerTrainContiguous(stageTrackerSort(visible, stages, f)); const grouping = _stageTrackerGroup === 'repo'; const page = grouping diff --git a/src/pkg/dashboard/static/index.html b/src/pkg/dashboard/static/index.html index 5fc86cd882..110d20ddfc 100644 --- a/src/pkg/dashboard/static/index.html +++ b/src/pkg/dashboard/static/index.html @@ -19304,6 +19304,9 @@

All labels

// 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); + // The rows this view draws, for stageTrackerPRListedOwnRow: a covered + // issue defers to its PR's row only when that row is actually drawn. + if (_stageTracker) _stageTracker.rows = visible; const ordered = stageTrackerTrainContiguous(stageTrackerSort(visible, stages, f)); const grouping = _stageTrackerGroup === 'repo'; const page = grouping @@ -20087,10 +20090,24 @@

All labels

// #15647, hive#15338 → #15648). The ⋯ menu's "Decide PR #N…" stays on // the parent. subRows: the linked PRs drawn as sub-rows, or none. // Pure: is the covering PR also a row of its own in the tracker (a - // top-level item, not a sub-row)? Then only that row carries the button. + // top-level row, not a sub-row)? Then only that row carries the button. + // Reads the rows the last render drew (_stageTracker.rows, set by + // stageTrackerRender from stageTrackerVisible), not the payload's items: + // a PR nested_under a listed issue is in items but is never its own row + // outside the Pull requests view (tracker-filter.js stageTrackerVisible), + // and a filter may hide the PR while it shows the issue. Without a + // render (the node harness) the items stand in, minus PRs nested under + // a listed issue, so the chip never points at a row that is not drawn. function stageTrackerPRListedOwnRow(issue, t) { + if (!_stageTracker) return false; const key = stageTrackerItemKey({ repo: t.repo || issue.repo, kind: 'pr', number: t.number }); - return !!_stageTracker && Array.isArray(_stageTracker.items) && _stageTracker.items.some(it => stageTrackerItemKey(it) === key); + let rows = _stageTracker.rows; + if (!Array.isArray(rows)) { + const items = Array.isArray(_stageTracker.items) ? _stageTracker.items : []; + const issues = new Set(items.filter(it => it && it.kind === 'issue').map(it => it.repo + '#' + it.number)); + rows = items.filter(it => it && !(it.kind === 'pr' && it.nested_under && issues.has(it.repo + '#' + it.nested_under))); + } + return rows.some(it => it && stageTrackerItemKey(it) === key); } function stageTrackerLeadActionOnRow(item, ctx, subRows) { const a = stageTrackerLeadAction(item, ctx); From 0a783689b923ea398346c7b47f01a77ada66ab2a Mon Sep 17 00:00:00 2001 From: ci-maintainer <280983584+hivecommons-hive[bot]@users.noreply.github.com> Date: Fri, 30 Oct 2026 22:15:36 -0400 Subject: [PATCH 6/8] =?UTF-8?q?=F0=9F=90=9B=20fix:=20one=20preview=20capti?= =?UTF-8?q?on,=20rows-only=20chip=20rule,=20operator=20doc=20for=20#15773?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Review follow-ups on #15871: - The Let hive decide preview pend now carries its own entry in STAGE_TRACKER_ACTING_CAPTIONS ('decide:delegate:preview' → "Asking the hive…"); the busy lead button renders the pend's caption, so the row caption and the button say one phrase and the read-only preview is told apart from the confirmed "Hive deciding…". The STAGE_TRACKER_LEAD_BUSY_TEXT constant is gone. - stageTrackerPRListedOwnRow reads only _stageTracker.rows (what the last render drew); the harness-only items fallback that duplicated stageTrackerVisible's nesting rule returns false instead, and the node test sets rows as stageTrackerRender would. - activity-monitor.md describes the "decision pending on #N" chip, the pre-preview "Asking the hive…" busy button, and the human-move tooltip fallback to human_merge_reason_text / reason. Hive-Fix-Attempt: 3/6 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: ci-maintainer <280983584+hivecommons-hive[bot]@users.noreply.github.com> --- .../dashboard-sections/activity-monitor.md | 15 +++--- .../stage_tracker_decide_feedback_test.go | 35 ++++++++------ .../stage_tracker_decided_ui_test.go | 1 - .../stage_tracker_row_actions_test.go | 1 - .../static-src/js/tracker-actions.js | 46 +++++++++---------- src/pkg/dashboard/static/index.html | 46 +++++++++---------- 6 files changed, 71 insertions(+), 73 deletions(-) diff --git a/src/docs/dashboard-sections/activity-monitor.md b/src/docs/dashboard-sections/activity-monitor.md index a54de68fbb..d43eedbfa8 100644 --- a/src/docs/dashboard-sections/activity-monitor.md +++ b/src/docs/dashboard-sections/activity-monitor.md @@ -369,7 +369,7 @@ Plain words throughout — working / waiting on X / set back by Y / merged — n #### The row's lead action, inline -A row whose next move is yours does not hide its answer behind three dots. Beside the chips on the right of the header (and on a nested PR sub-row's own header), the row renders its **lead action** as a real `