From e1ad8b2af6945d091b92481c3aec5b9329c09feb Mon Sep 17 00:00:00 2001 From: Andrew Anderson Date: Wed, 4 Nov 2026 07:07:08 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Activity=20Monitor:=20say=20whos?= =?UTF-8?q?e=20sign-off=20a=20parked=20review=20needs=20and=20lead=20with?= =?UTF-8?q?=20Approve?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rows parked on a policy sign-off ask (fork workflow change needing owner sign-off) read "Review 5/5 · awaiting human decision" with only "Let hive decide" inline, and captioned "Recommendation recorded" after a park-keeping verdict that recorded no recommendation. - Review chevron: "needs your sign-off" when the ask names the viewer, else "needs owner sign-off"; tooltip carries the question. - Server marks the first enabled decide:approve as lead for reviewer/ sentinel asks in human_decision when CI is not failing, so the row shows "Approve ▸" then "Let hive decide ▸". - Row action results carry the delegate verdict; the pend caption says "Recommendation recorded" only for recommend-only verdicts, otherwise "Your decision needed". Fixes #16577 Signed-off-by: Andrew Anderson --- changelog.d/fixed-signoff-lead.md | 1 + src/pkg/dashboard/row_action_result.go | 6 +- src/pkg/dashboard/stage_tracker_activity.go | 2 +- .../dashboard/stage_tracker_activity.test.js | 8 +- src/pkg/dashboard/stage_tracker_build.go | 1 + .../stage_tracker_decided_ui_test.go | 1 + .../dashboard/stage_tracker_decision_pr.go | 46 +++++ .../stage_tracker_remediation_chevron.test.js | 2 +- .../stage_tracker_signoff_lead_test.go | 165 ++++++++++++++++++ .../dashboard/stage_tracker_ui_rows_test.go | 2 +- .../static-src/js/tracker-row-strip.js | 21 ++- .../static-src/js/tracker-words-gate.js | 8 +- src/pkg/dashboard/static/index.html | 29 ++- 13 files changed, 279 insertions(+), 13 deletions(-) create mode 100644 changelog.d/fixed-signoff-lead.md create mode 100644 src/pkg/dashboard/stage_tracker_signoff_lead_test.go diff --git a/changelog.d/fixed-signoff-lead.md b/changelog.d/fixed-signoff-lead.md new file mode 100644 index 0000000000..96970343a2 --- /dev/null +++ b/changelog.d/fixed-signoff-lead.md @@ -0,0 +1 @@ +- Activity Monitor: a row parked on a policy sign-off ask (e.g. a fork's workflow change) now says "Review 5/5 · needs your sign-off" / "needs owner sign-off" instead of "awaiting human decision", leads with an inline "Approve ▸" when CI is green (then "Let hive decide ▸"), and no longer captions "Recommendation recorded" when hive kept the park without recording a recommendation. diff --git a/src/pkg/dashboard/row_action_result.go b/src/pkg/dashboard/row_action_result.go index 587891d64e..eb73664ba0 100644 --- a/src/pkg/dashboard/row_action_result.go +++ b/src/pkg/dashboard/row_action_result.go @@ -25,6 +25,10 @@ type RowActionResult struct { Next string `json:"next"` Rule string `json:"rule,omitempty"` AppliedAt *time.Time `json:"applied_at,omitempty"` + // Verdict is the delegate's verdict slug when the hive decided + // (owner-only, recommend-only, …), so the row caption can tell a + // recorded recommendation from an ask handed back to the person. + Verdict string `json:"verdict,omitempty"` // Why is the glossary slug for why a recorded decision has not taken // effect (Action no-effect); Options are the concrete next actions in // the popover's shape (hivecommons/hive#14822). Both additive. @@ -104,7 +108,7 @@ func delegatedRowActionResult(in delegatedecision.Input, d delegatedecision.Deci if in.Kind == delegatedecision.KindPR { kind = rowActionTargetPR } - out := RowActionResult{Target: rowActionTarget(in.Repo, kind, in.Number), Rule: d.Rule} + out := RowActionResult{Target: rowActionTarget(in.Repo, kind, in.Number), Rule: d.Rule, Verdict: string(d.Verdict)} ruleTag := "" if d.Rule != "" { ruleTag = " (" + delegatedecision.RulePlain(d.Rule) + ")" diff --git a/src/pkg/dashboard/stage_tracker_activity.go b/src/pkg/dashboard/stage_tracker_activity.go index acba132a7c..94e5cf04be 100644 --- a/src/pkg/dashboard/stage_tracker_activity.go +++ b/src/pkg/dashboard/stage_tracker_activity.go @@ -463,7 +463,7 @@ func stageTrackerReviewActivity(pr github.PullRequest, bundle *evidence.Bundle, out.State, out.Caption = "changes_requested", "Review findings · awaiting author" out.Blocker = stageTrackerFixerExhaustedSummary(agg) case "requires_human": - out.State, out.Caption = "human_decision", "Review findings · human decision" + out.State, out.Caption = "human_decision", "Review findings · needs owner sign-off" out.Blocker = agg.DecisionQuestion } } diff --git a/src/pkg/dashboard/stage_tracker_activity.test.js b/src/pkg/dashboard/stage_tracker_activity.test.js index eb7fb9c78a..c991e7b18d 100644 --- a/src/pkg/dashboard/stage_tracker_activity.test.js +++ b/src/pkg/dashboard/stage_tracker_activity.test.js @@ -763,7 +763,13 @@ test('#16484: count grammar — CI passed/total and Review done/total across eve const review = (state, extra = {}, item = {}) => word({ head: 'h', ...item, review_activity: { head: 'h', state, perspectives_done: 3, perspectives_total: 5, ...extra } }, 'review', true); assert.equal(review('approved', { perspectives_done: 5 }), 'Review 5/5 approved'); assert.equal(review('changes_requested'), 'Review 3/5 · changes requested'); - assert.equal(review('human_decision'), 'Review 3/5 · awaiting human decision'); + assert.equal(review('human_decision'), 'Review 3/5 · needs owner sign-off', 'reviews done; the sign-off is what is left, never "awaiting human"'); + assert.equal(review('human_decision', {}, { decision_needed: { question: '@clubanderson should decide whether to accept this workflow change from a fork.' } }), 'Review 3/5 · needs owner sign-off', 'no viewer known: the owner'); + globalThis.window = { _hiveUser: 'ClubAnderson' }; + try { + assert.equal(review('human_decision', {}, { decision_needed: { question: '@clubanderson should decide whether to accept this workflow change from a fork.' } }), 'Review 3/5 · needs your sign-off', 'the ask names the viewer'); + assert.equal(review('human_decision', {}, { decision_needed: { question: '@someone-else should decide.' } }), 'Review 3/5 · needs owner sign-off'); + } finally { delete globalThis.window; } assert.equal(review('reviewing', { actor: 'reviewer-2' }), 'Review 3/5 · reviewer-2 reviewing'); assert.equal(review('adjudicating', { actor: 'adjudicator' }), 'Review 3/5 · adjudicator reviewing'); assert.equal(review('assigned', { actor: 'reviewer' }), 'Review 3/5 · reviewer queued'); diff --git a/src/pkg/dashboard/stage_tracker_build.go b/src/pkg/dashboard/stage_tracker_build.go index e1a9fc0e7c..8e5297c1b4 100644 --- a/src/pkg/dashboard/stage_tracker_build.go +++ b/src/pkg/dashboard/stage_tracker_build.go @@ -474,6 +474,7 @@ func (s *Server) buildStageTracker(status *StatusPayload, store *stagelabels.Sto } it.ReviewActivity = stageTrackerReviewActivity(activityPR, bundle, currentAggregate, dispatchState, status, now) stageTrackerCountPerspectives(it.ReviewActivity, activityPR, bundle, currentAggregate, dispatchState, stageTrackerRepoQualifier(status), expectedPerspectives) + stageTrackerLeadApproveForSignOff(&it) if stageTrackerClaimantStage(it.Kind, it.Stage) { var worker *stageTrackerWorker if w, ok := stageTrackerWorkerOn(workers, repoName, pr.Number); ok { diff --git a/src/pkg/dashboard/stage_tracker_decided_ui_test.go b/src/pkg/dashboard/stage_tracker_decided_ui_test.go index 7faae2855f..1a27f33a5c 100644 --- a/src/pkg/dashboard/stage_tracker_decided_ui_test.go +++ b/src/pkg/dashboard/stage_tracker_decided_ui_test.go @@ -31,6 +31,7 @@ func stageTrackerDecidedUIJS(t *testing.T, html string) string { jsFunc(t, html, "stageTrackerGateCueHtml"), jsFunc(t, html, "stageTrackerDecidedOf"), jsConstBlock(t, html, "STAGE_TRACKER_DECIDED_ACTING"), + jsConstLine(t, html, "STAGE_TRACKER_PARK_KEPT_ACTING"), jsFunc(t, html, "stageTrackerDecidedActing"), jsFunc(t, html, "stageTrackerDecidedLead"), jsFunc(t, html, "stageTrackerLinkedSupersededText"), diff --git a/src/pkg/dashboard/stage_tracker_decision_pr.go b/src/pkg/dashboard/stage_tracker_decision_pr.go index 266c2c2fa0..438c0e3639 100644 --- a/src/pkg/dashboard/stage_tracker_decision_pr.go +++ b/src/pkg/dashboard/stage_tracker_decision_pr.go @@ -206,6 +206,52 @@ func decisionForPR(it StageTrackerItem, verdict *review.Aggregate, sentinelLabel return d } +// decisionApproveSignOffConsequence is the inline Approve pill's hover on +// a sign-off ask. +const decisionApproveSignOffConsequence = "Posts /lgtm + /approve as you; the merge queue takes it from there. Nothing merges here." + +// stageTrackerLeadApproveForSignOff marks Approve the lead answer on a PR +// parked for a policy sign-off: a reviewer or the security check asked a +// person to accept something (a workflow change from a fork touching a +// secret, hivecommons/hive#16572), the reviews are otherwise done +// (human_decision / approved on this head), Approve is enabled and CI is +// not failing. The row then reads "Approve ▸ · Let hive decide ▸" instead +// of leading with delegate. Runs after CI and review activity are +// derived, since decisionForPR sees neither. A lead the question already +// chose (Re-author, Close as superseded) stands. +func stageTrackerLeadApproveForSignOff(it *StageTrackerItem) { + if it == nil || it.Kind != "pr" || it.DecisionNeeded == nil { + return + } + d := it.DecisionNeeded + if d.AskedBy != decisionAskedByReviewer && d.AskedBy != decisionAskedBySentinel { + return + } + for _, o := range d.Options { + if o.Lead { + return + } + } + if it.CIActivity != nil && it.CIActivity.Head == it.Head && (it.CIActivity.State == "failing" || it.CIActivity.ChecksFailed > 0) { + return + } + if it.ReviewActivity == nil || it.ReviewActivity.Head != it.Head || + (it.ReviewActivity.State != "human_decision" && it.ReviewActivity.State != "approved") { + return + } + for i := range d.Options { + o := &d.Options[i] + if o.Action != decisionActionApprove || !o.Enabled { + continue + } + o.Lead = true + if o.Consequence == "" { + o.Consequence = decisionApproveSignOffConsequence + } + return + } +} + // decisionLeadWithCloseSuperseded moves "Close as superseded" to the front // of opts with the superseding PR named in its consequence. func decisionLeadWithCloseSuperseded(opts []StageTrackerDecisionOption, redundantOf int) []StageTrackerDecisionOption { diff --git a/src/pkg/dashboard/stage_tracker_remediation_chevron.test.js b/src/pkg/dashboard/stage_tracker_remediation_chevron.test.js index 6b379b0f28..99411eaf52 100644 --- a/src/pkg/dashboard/stage_tracker_remediation_chevron.test.js +++ b/src/pkg/dashboard/stage_tracker_remediation_chevron.test.js @@ -116,7 +116,7 @@ test('adopted row: a complete review verdict is done-style, and a human-decision const parked = cells(redPR({ stage: 85, display_column: 85, needs_human: true, review_activity: decision }))[5]; assert.match(parked, /class="ham-seg ham-activity-track done decided"/, 'parked on a person is settled, still not amber'); - assert.match(parked, /Review 5\/5 · awaiting human decision 0 { + for _, o := range it.DecisionNeeded.Options { + if o.Lead && o.Consequence == "" { + t.Fatalf("lead %s carries no consequence for its hover", o.Action) + } + } + } + }) + } + t.Run("sentinel ask leads too", func(t *testing.T) { + it := signOffItem("passing", "approved") + it.DecisionNeeded.AskedBy = decisionAskedBySentinel + stageTrackerLeadApproveForSignOff(&it) + if got := leadActions(it.DecisionNeeded); len(got) != 1 || got[0] != decisionActionApprove { + t.Fatalf("leads = %v", got) + } + }) + t.Run("the hive's own park is not a sign-off", func(t *testing.T) { + it := signOffItem("passing", "human_decision") + it.DecisionNeeded.AskedBy = decisionAskedByLane + stageTrackerLeadApproveForSignOff(&it) + if got := leadActions(it.DecisionNeeded); got != nil { + t.Fatalf("leads = %v", got) + } + }) + t.Run("an existing lead (Re-author) stands", func(t *testing.T) { + it := signOffItem("passing", "human_decision") + it.DecisionNeeded.Options = decisionLeadWithReauthor(it.DecisionNeeded.Options) + stageTrackerLeadApproveForSignOff(&it) + if got := leadActions(it.DecisionNeeded); len(got) != 1 || got[0] != decisionActionReauthor { + t.Fatalf("leads = %v", got) + } + }) + t.Run("issues and rows without an ask are untouched", func(t *testing.T) { + it := signOffItem("passing", "human_decision") + it.Kind = "issue" + stageTrackerLeadApproveForSignOff(&it) + if leadActions(it.DecisionNeeded) != nil { + t.Fatal("issue row gained a lead") + } + none := StageTrackerItem{Kind: "pr"} + stageTrackerLeadApproveForSignOff(&none) + }) +} + +func TestStageTrackerRowActionResultCarriesVerdict(t *testing.T) { + got := delegatedRowActionResult(delegatedecision.Input{Repo: "o/r", Kind: delegatedecision.KindPR, Number: 7}, + delegatedecision.Decision{Verdict: delegatedecision.VerdictOwnerOnly, Text: "owner only"}, nil) + if got.Verdict != string(delegatedecision.VerdictOwnerOnly) || got.Action != rowActionRecommended { + t.Fatalf("result = %+v", got) + } +} + +// The row as the SPA draws it: Approve ▸ first, Let hive decide ▸ second; +// the review chevron says whose sign-off; a recommend-less verdict's +// caption hands the decision back. +func TestStageTrackerSignOffRowInline(t *testing.T) { + html := indexHTML(t) + for _, want := range []string{ + `' · needs your sign-off'`, + `' · needs owner sign-off'`, + `const STAGE_TRACKER_PARK_KEPT_ACTING = {`, + } { + if !strings.Contains(html, want) { + t.Errorf("index.html lacks %q", want) + } + } + runStageTrackerRowActionsScript(t, stageTrackerRowActionsPreamble(t, html)+` +const ctx = { user: true, canHold: true, canHuman: true, login: 'clubanderson', nowMs: Date.parse('2026-11-04T12:00:00Z'), governor: null }; +const row = { repo: 'hivecommons/hive', kind: 'pr', number: 16572, title: 'fossa workflow', url: 'https://github.com/hivecommons/hive/pull/16572', stage: 85, head: 'h1', actor: 'maintainer', modifiers: ['needs-decision'], + review_activity: { head: 'h1', state: 'human_decision', perspectives_done: 5, perspectives_total: 5 }, + decision_needed: { question: '@clubanderson should decide whether to accept this .github/workflows/fossa.yml change from a fork.', asked_by: 'a reviewer', + options: [{ action: 'decide:delegate', label: 'Let hive decide', enabled: true }, { action: 'decide:approve', label: 'Approve', enabled: true, lead: true, consequence: 'Posts /lgtm + /approve as you; the merge queue takes it from there. Nothing merges here.' }, { action: 'decide:direction', label: 'Give direction', enabled: true }] } }; +const h = stageTrackerLeadActionHtml(row, ctx); +const acts = [...h.matchAll(/data-ham-act="([^"]+)"/g)].map(m => m[1]); +assert.deepStrictEqual(acts, ['decide:approve', 'decide:delegate'], h); +assert.ok(h.includes('class="ham-lead-act ham-act-primary" data-ham-act="decide:approve" title="Posts /lgtm + /approve as you; the merge queue takes it from there. Nothing merges here."'), h); +assert.ok(h.includes('>Approve') && h.includes('>Let hive decide'), h); +`) + runStageTrackerRowActionsScript(t, ` +const assert = require('assert'); +const STAGE_TRACKER_DECIDED_ACTING = { adopted: 'Adopting · opening hive copy…', approved: 'Approving…', directed: 'Sending back…', closed: 'Closing…', merged: 'Merging…', 'queued-for-merge': 'Queuing for merge…', recommended: 'Recommendation recorded' }; +`+jsConstLine(t, html, "STAGE_TRACKER_PARK_KEPT_ACTING")+` +`+jsFunc(t, html, "stageTrackerDecidedActing")+` +assert.strictEqual(stageTrackerDecidedActing({ action: 'recommended', verdict: 'owner-only' }, {}), 'Your decision needed · owner sign-off'); +assert.strictEqual(stageTrackerDecidedActing({ action: 'recommended', verdict: 'operator-action' }, {}), 'Your action needed · operator step'); +assert.strictEqual(stageTrackerDecidedActing({ action: 'recommended', verdict: 'recommend-only' }, {}), 'Recommendation recorded'); +assert.strictEqual(stageTrackerDecidedActing({ action: 'recommended' }, {}), 'Your decision needed', 'no verdict, no recommendation claimed'); +assert.strictEqual(stageTrackerDecidedActing({ action: 'adopted' }, {}), 'Adopting · opening hive copy…'); +assert.strictEqual(stageTrackerDecidedActing({ action: 'recommended', verdict: 'owner-only' }, { decided: { acting: 'from server' } }), 'from server'); +`) +} diff --git a/src/pkg/dashboard/stage_tracker_ui_rows_test.go b/src/pkg/dashboard/stage_tracker_ui_rows_test.go index 73172c8faa..4e352e75a9 100644 --- a/src/pkg/dashboard/stage_tracker_ui_rows_test.go +++ b/src/pkg/dashboard/stage_tracker_ui_rows_test.go @@ -688,7 +688,7 @@ assert.ok(/[^<]*<\/span>/.test(row) && !/ assert.strictEqual(ci[1], 'done', '11/11 passed is done-style: ' + adoptedRow); const parkedRow = stageTrackerRowHtml({ repo: 'acme/console', number: 16510, kind: 'pr', stage: 85, display_column: 85, head: 'f269349', needs_human: true, author: 'thatguywob', author_kind: 'human', review_activity: { head: 'f269349', state: 'human_decision', caption: 'Review findings · human decision', perspectives_done: 5, perspectives_total: 5, source: 'verified-review-bundle', observed_at: seen } }, stages, ctx); - assert.ok(/
  • ]*>[\s\S]*?Review 5\/5 · awaiting human decision<\/span>/.test(parkedRow), 'genuinely parked on a person keeps the human word, still not amber: ' + parkedRow); + assert.ok(/
  • ]*>[\s\S]*?Review 5\/5 · needs owner sign-off<\/span>/.test(parkedRow), 'genuinely parked on a person names the sign-off, still not amber: ' + parkedRow); } // hivecommons/hive#16540 rows. #16509: adopted, CI 7/11 unreported, review // decided → one lit chevron. #16268: waiting for the contributor, CI 7/11 diff --git a/src/pkg/dashboard/static-src/js/tracker-row-strip.js b/src/pkg/dashboard/static-src/js/tracker-row-strip.js index dd1529cfa5..b4d8b06c88 100644 --- a/src/pkg/dashboard/static-src/js/tracker-row-strip.js +++ b/src/pkg/dashboard/static-src/js/tracker-row-strip.js @@ -79,8 +79,18 @@ case 'approved': return count + ' approved'; case 'changes_requested': return count + ' · changes requested'; // The hive on the repair (adopted / remediating) is not a human - // decision: the findings are the changes requested. - case 'human_decision': return count + (stageTrackerHiveOwnsRepair(item) ? ' · changes requested' : ' · awaiting human decision'); + // decision: the findings are the changes requested. Otherwise the + // reviews are done and a person's sign-off is what is left — the + // viewer's when the ask names them, else the owner's. Never + // "awaiting human" to the human it waits on (hivecommons/hive#16572: + // "why does review say awaiting humans if 5/5 reviews are good?"). + case 'human_decision': { + if (stageTrackerHiveOwnsRepair(item)) return count + ' · changes requested'; + const q = item.decision_needed && item.decision_needed.question ? String(item.decision_needed.question).toLowerCase() : ''; + const me = typeof window !== 'undefined' && window._hiveUser ? String(window._hiveUser).toLowerCase() : ''; + const mine = !!me && q.indexOf('@' + me) >= 0; + return count + (mine ? ' · needs your sign-off' : ' · needs owner sign-off'); + } case 'reviewing': case 'adjudicating': return count + ' · ' + (actor ? actor + ' reviewing' : 'reviewing'); case 'assigned': return count + ' · ' + (actor ? actor + ' queued' : 'queued'); case 'unassigned': return count + ' · swarm requested'; @@ -161,7 +171,12 @@ const source = matches ? a.source || 'unavailable' : 'unavailable'; const freshness = !Number.isFinite(observed) ? 'observation time unknown' : (stale ? 'stale · ' : 'observed · ') + new Date(observed).toISOString(); const since = matches && a.since && Number.isFinite(Date.parse(a.since)) ? ' · since ' + new Date(a.since).toISOString() : ''; - const blocker = matches && a.blocker ? ' · ' + a.blocker : ''; + let blocker = matches && a.blocker ? ' · ' + a.blocker : ''; + // A sign-off ask: the tooltip carries the question itself (who should + // decide what, and why — "workflow change from a fork") when the + // review evidence did not already quote it. + const ask = matches && state === 'human_decision' && item.decision_needed && item.decision_needed.question ? String(item.decision_needed.question) : ''; + if (ask && blocker.indexOf(ask) < 0) blocker += ' · ' + ask; // The backend's plain-language sentence behind the caption rides in // the tooltip only; the chevron clamps the caption. const detail = matches && a.detail ? ' · ' + a.detail : ''; diff --git a/src/pkg/dashboard/static-src/js/tracker-words-gate.js b/src/pkg/dashboard/static-src/js/tracker-words-gate.js index 4ad0fed27f..4ac06300e8 100644 --- a/src/pkg/dashboard/static-src/js/tracker-words-gate.js +++ b/src/pkg/dashboard/static-src/js/tracker-words-gate.js @@ -29,10 +29,16 @@ // Pure: the in-flight caption for a recorded decision — from the // server's projection when it has one, else from the result's action. const STAGE_TRACKER_DECIDED_ACTING = { adopted: 'Adopting · opening hive copy…', approved: 'Approving…', directed: 'Sending back…', closed: 'Closing…', merged: 'Merging…', 'queued-for-merge': 'Queuing for merge…', recommended: 'Recommendation recorded' }; + // A park-keeping verdict by what it recorded: a recommendation only + // when there is one (recommend-only); owner-only / operator-action hand + // the decision back, so the caption says so (hivecommons/hive#16572). + const STAGE_TRACKER_PARK_KEPT_ACTING = { 'recommend-only': 'Recommendation recorded', 'owner-only': 'Your decision needed · owner sign-off', 'operator-action': 'Your action needed · operator step' }; function stageTrackerDecidedActing(result, item) { const d = item && item.decided; if (d && d.acting) return d.acting; - return STAGE_TRACKER_DECIDED_ACTING[result && result.action] || 'Hive decided…'; + const action = result && result.action; + if (action === 'recommended') return STAGE_TRACKER_PARK_KEPT_ACTING[result.verdict] || 'Your decision needed'; + return STAGE_TRACKER_DECIDED_ACTING[action] || 'Hive decided…'; } // Pure: the ✓ badge's first line for a decided row: the decision name // and who / what triggered it — "you · Let hive decide · hive chose diff --git a/src/pkg/dashboard/static/index.html b/src/pkg/dashboard/static/index.html index 7f49c07acc..57555e2301 100644 --- a/src/pkg/dashboard/static/index.html +++ b/src/pkg/dashboard/static/index.html @@ -16729,10 +16729,16 @@

    Where to get help

    // Pure: the in-flight caption for a recorded decision — from the // server's projection when it has one, else from the result's action. const STAGE_TRACKER_DECIDED_ACTING = { adopted: 'Adopting · opening hive copy…', approved: 'Approving…', directed: 'Sending back…', closed: 'Closing…', merged: 'Merging…', 'queued-for-merge': 'Queuing for merge…', recommended: 'Recommendation recorded' }; + // A park-keeping verdict by what it recorded: a recommendation only + // when there is one (recommend-only); owner-only / operator-action hand + // the decision back, so the caption says so (hivecommons/hive#16572). + const STAGE_TRACKER_PARK_KEPT_ACTING = { 'recommend-only': 'Recommendation recorded', 'owner-only': 'Your decision needed · owner sign-off', 'operator-action': 'Your action needed · operator step' }; function stageTrackerDecidedActing(result, item) { const d = item && item.decided; if (d && d.acting) return d.acting; - return STAGE_TRACKER_DECIDED_ACTING[result && result.action] || 'Hive decided…'; + const action = result && result.action; + if (action === 'recommended') return STAGE_TRACKER_PARK_KEPT_ACTING[result.verdict] || 'Your decision needed'; + return STAGE_TRACKER_DECIDED_ACTING[action] || 'Hive decided…'; } // Pure: the ✓ badge's first line for a decided row: the decision name // and who / what triggered it — "you · Let hive decide · hive chose @@ -18173,8 +18179,18 @@

    Where to get help

    case 'approved': return count + ' approved'; case 'changes_requested': return count + ' · changes requested'; // The hive on the repair (adopted / remediating) is not a human - // decision: the findings are the changes requested. - case 'human_decision': return count + (stageTrackerHiveOwnsRepair(item) ? ' · changes requested' : ' · awaiting human decision'); + // decision: the findings are the changes requested. Otherwise the + // reviews are done and a person's sign-off is what is left — the + // viewer's when the ask names them, else the owner's. Never + // "awaiting human" to the human it waits on (hivecommons/hive#16572: + // "why does review say awaiting humans if 5/5 reviews are good?"). + case 'human_decision': { + if (stageTrackerHiveOwnsRepair(item)) return count + ' · changes requested'; + const q = item.decision_needed && item.decision_needed.question ? String(item.decision_needed.question).toLowerCase() : ''; + const me = typeof window !== 'undefined' && window._hiveUser ? String(window._hiveUser).toLowerCase() : ''; + const mine = !!me && q.indexOf('@' + me) >= 0; + return count + (mine ? ' · needs your sign-off' : ' · needs owner sign-off'); + } case 'reviewing': case 'adjudicating': return count + ' · ' + (actor ? actor + ' reviewing' : 'reviewing'); case 'assigned': return count + ' · ' + (actor ? actor + ' queued' : 'queued'); case 'unassigned': return count + ' · swarm requested'; @@ -18255,7 +18271,12 @@

    Where to get help

    const source = matches ? a.source || 'unavailable' : 'unavailable'; const freshness = !Number.isFinite(observed) ? 'observation time unknown' : (stale ? 'stale · ' : 'observed · ') + new Date(observed).toISOString(); const since = matches && a.since && Number.isFinite(Date.parse(a.since)) ? ' · since ' + new Date(a.since).toISOString() : ''; - const blocker = matches && a.blocker ? ' · ' + a.blocker : ''; + let blocker = matches && a.blocker ? ' · ' + a.blocker : ''; + // A sign-off ask: the tooltip carries the question itself (who should + // decide what, and why — "workflow change from a fork") when the + // review evidence did not already quote it. + const ask = matches && state === 'human_decision' && item.decision_needed && item.decision_needed.question ? String(item.decision_needed.question) : ''; + if (ask && blocker.indexOf(ask) < 0) blocker += ' · ' + ask; // The backend's plain-language sentence behind the caption rides in // the tooltip only; the chevron clamps the caption. const detail = matches && a.detail ? ' · ' + a.detail : '';