diff --git a/changelog.d/fixed-review-chevron-amber.md b/changelog.d/fixed-review-chevron-amber.md new file mode 100644 index 0000000000..75c4d93c0c --- /dev/null +++ b/changelog.d/fixed-review-chevron-amber.md @@ -0,0 +1 @@ +- Activity Monitor: the Review and CI chevrons wear the amber in-progress fill only while perspectives or checks are actually running; a finished verdict is done-style (approved, changes requested, or a muted "awaiting human decision"). Back in PR in progress with the hive on the repair, a human-decision verdict reads "changes requested" instead of "awaiting human decision" (#16531). diff --git a/src/pkg/dashboard/stage_tracker_activity.test.js b/src/pkg/dashboard/stage_tracker_activity.test.js index c58b6bbbd9..33a005507f 100644 --- a/src/pkg/dashboard/stage_tracker_activity.test.js +++ b/src/pkg/dashboard/stage_tracker_activity.test.js @@ -22,7 +22,7 @@ const STAGE_TRACKER_NEEDS_DECISION = 85, STAGE_TRACKER_ISSUE_NEEDS_DECISION = 45 const STAGE_TRACKER_ISSUE_DECISION_COLUMN = 10, STAGE_TRACKER_TRIAGE_NEEDED = 15, STAGE_TRACKER_POSSIBLY_EXISTS = 17; const STAGE_TRACKER_PRE_MERGE_SOAK = 95; `; -const track = new Function('esc', 'stageTrackerIcon', fn(strip, 'stageTrackerTrackLead') + fn(strip, 'stageTrackerTrackWord') + fn(strip, 'stageTrackerActivityTrackHtml') + ';return stageTrackerActivityTrackHtml;')(esc, (n, cls) => ``); +const track = new Function('esc', 'stageTrackerIcon', fn(strip, 'stageTrackerTrackLead') + fn(strip, 'stageTrackerHiveOwnsRepair') + fn(strip, 'stageTrackerTrackWord') + fn(strip, 'stageTrackerActivityTrackHtml') + ';return stageTrackerActivityTrackHtml;')(esc, (n, cls) => ``); const getAnchor = new Function(globals + anchor + ';return stageTrackerAnchor;')(); const header = new Function('esc', 'stageTrackerIcon', globals + fn(strip, 'stageTrackerHeaderHtml') + ';return stageTrackerHeaderHtml;')(esc, () => ''); const now = Date.parse('2026-11-02T21:00:00Z'); @@ -716,7 +716,7 @@ test('the backend detail sentence rides in the track tooltip, not on the chevron }); test('#16484: count grammar — CI passed/total and Review done/total across every state', () => { - const word = new Function(fn(strip, 'stageTrackerTrackWord') + ';return stageTrackerTrackWord;')(); + const word = new Function(fn(strip, 'stageTrackerHiveOwnsRepair') + fn(strip, 'stageTrackerTrackWord') + ';return stageTrackerTrackWord;')(); const ci = (state, extra = {}) => word({ head: 'h', ci_activity: { head: 'h', state, ...extra } }, 'ci', true); assert.equal(ci('passing', { checks_passed: 14, checks_total: 14 }), 'CI 14/14 passed'); assert.equal(ci('failing', { checks_passed: 11, checks_total: 14, checks_failed: 1, checks_failing: ['lint'] }), 'CI 11/14 · 1 failing (lint)'); diff --git a/src/pkg/dashboard/stage_tracker_build.go b/src/pkg/dashboard/stage_tracker_build.go index 015c48fad7..e1a9fc0e7c 100644 --- a/src/pkg/dashboard/stage_tracker_build.go +++ b/src/pkg/dashboard/stage_tracker_build.go @@ -552,7 +552,7 @@ func (s *Server) buildStageTracker(status *StatusPayload, store *stagelabels.Sto activityItem.CIActivity, activityItem.ReviewActivity = it.CIActivity, it.ReviewActivity stageTrackerApplyCodeActivity(&activityItem, dispatchState, status, now) stageTrackerApplyRemediation(&activityItem, dispatchState, status, stageTrackerFixerAgent(cfg), now) - it.CodeActivity, it.Remediation, it.DisplayColumn, it.Caption = activityItem.CodeActivity, activityItem.Remediation, activityItem.DisplayColumn, activityItem.Caption + it.CodeActivity, it.Remediation, it.ReviewActivity, it.DisplayColumn, it.Caption = activityItem.CodeActivity, activityItem.Remediation, activityItem.ReviewActivity, activityItem.DisplayColumn, activityItem.Caption } resp.NeedsHuman, resp.OnHold = stageTrackerHumanCounts(resp.Items) resp.WaitingOnHuman = stageTrackerWaitingOnHuman(resp.Items) diff --git a/src/pkg/dashboard/stage_tracker_remediation.go b/src/pkg/dashboard/stage_tracker_remediation.go index 2bcbd3fcb3..3aa21534e6 100644 --- a/src/pkg/dashboard/stage_tracker_remediation.go +++ b/src/pkg/dashboard/stage_tracker_remediation.go @@ -261,6 +261,7 @@ func stageTrackerApplyRemediation(it *StageTrackerItem, dispatch review.Dispatch if it.Kind != "pr" || it.Head == "" || it.Superseded != nil || it.Stage == trackerNumberNeedsDecision || it.Stage >= trackerNumberAwaitingMerge { return } + stageTrackerAdoptHumanDecision(it) redSince, redWord, red := stageTrackerRedSince(it) if !red { return @@ -284,6 +285,10 @@ func stageTrackerApplyRemediation(it *StageTrackerItem, dispatch review.Dispatch if out.State == "waiting_ci" && out.Source == "recorded-ci-retry" { return } + // 074: the hive adopted the repair; the stage word stands. + if out.State == "adopted" { + return + } redAt := "" if !redSince.IsZero() { redAt = " at " + redSince.UTC().Format(time.RFC3339) @@ -343,3 +348,34 @@ func stageTrackerApplyRemediation(it *StageTrackerItem, dispatch review.Dispatch it.Caption = out.Caption } } + +// stageTrackerAdoptHumanDecision: a review verdict that asked for a human +// decision stops reading "awaiting human decision" once the row is back in +// PR in progress with the hive on it — adopted (074) or in a fix stage — +// and nobody is actually parked on a person. The findings are then changes +// the hive is addressing; the decision question rides in the detail. +func stageTrackerAdoptHumanDecision(it *StageTrackerItem) { + a := it.ReviewActivity + if a == nil || a.State != "human_decision" || !strings.EqualFold(a.Head, it.Head) { + return + } + if it.NeedsHuman || it.OnHold || it.Hold != nil || it.Stage == trackerNumberNeedsDecision { + return + } + switch it.Stage { + case trackerNumberAdopted, trackerNumberFixing, trackerNumberNeedsAuthor, trackerNumberReturned: + default: + return + } + who := "the hive adopted the repair" + if it.Stage != trackerNumberAdopted { + who = "the row is under repair" + } + a.State, a.Caption, a.Active = "changes_requested", "Review findings · changes requested", false + a.Source += "+adopted-decision" + detail := "The review swarm asked for a human decision; " + who + ", so its findings are the changes to make." + if a.Blocker != "" { + detail += " Question: " + a.Blocker + } + a.Detail = strings.TrimSpace(detail + " " + a.Detail) +} diff --git a/src/pkg/dashboard/stage_tracker_remediation_chevron.test.js b/src/pkg/dashboard/stage_tracker_remediation_chevron.test.js index ca3ddcb8a7..e1cb24e5c9 100644 --- a/src/pkg/dashboard/stage_tracker_remediation_chevron.test.js +++ b/src/pkg/dashboard/stage_tracker_remediation_chevron.test.js @@ -27,7 +27,7 @@ const STAGE_TRACKER_NEEDS_DECISION = 85, STAGE_TRACKER_ISSUE_NEEDS_DECISION = 45 const STAGE_TRACKER_ISSUE_DECISION_COLUMN = 10, STAGE_TRACKER_TRIAGE_NEEDED = 15, STAGE_TRACKER_POSSIBLY_EXISTS = 17; const STAGE_TRACKER_PRE_MERGE_SOAK = 95; `; -const track = new Function('esc', 'stageTrackerIcon', fn(strip, 'stageTrackerTrackLead') + fn(strip, 'stageTrackerTrackWord') + fn(strip, 'stageTrackerActivityTrackHtml') + ';return stageTrackerActivityTrackHtml;')(esc, (n, cls) => ``); +const track = new Function('esc', 'stageTrackerIcon', fn(strip, 'stageTrackerTrackLead') + fn(strip, 'stageTrackerHiveOwnsRepair') + fn(strip, 'stageTrackerTrackWord') + fn(strip, 'stageTrackerActivityTrackHtml') + ';return stageTrackerActivityTrackHtml;')(esc, (n, cls) => ``); const getAnchor = new Function(globals + anchor + ';return stageTrackerAnchor;')(); const segments = new Function('stageTrackerAnchor', globals + ` const STAGE_TRACKER_ACTIVE_WORD = {70: 'Fixing'}; @@ -35,6 +35,7 @@ const STAGE_TRACKER_HUMAN_GATED = 85, STAGE_TRACKER_READY_FOR_HUMAN_MERGE = 90, function stageTrackerSentinelInLane() { return false; } function stageTrackerUnauthorizedWord() { return ''; } function stageTrackerManualMergeWord() { return 'Ready for human merge'; } +function stageTrackerAdoptedWord() { return 'Adopted by hive'; } ` + fn(rowSource, 'stageTrackerSegments') + ';return stageTrackerSegments;')(getAnchor); const renderStrip = new Function('esc', 'stageTrackerSegments', 'stageTrackerActivityTrackHtml', globals + ` const STAGE_TRACKER_MOTION_STATIC = 'static', STAGE_TRACKER_MOTION_ACTIVE = 'active'; @@ -100,3 +101,41 @@ test('a red PR with a stale code head renders no remediation attributes', () => const html = renderStrip(item, stages, null, now, {}); assert.doesNotMatch(html, /data-remediation=/); }); + +// hive#16509 row: back in PR in progress with the hive on it, a finished +// review is done-style — never the amber in-progress fill — and the word is +// the verdict, not "awaiting human decision". +test('adopted row: a complete review verdict is done-style, and a human-decision verdict reads as changes requested', () => { + const adopted = { head: 'abc1234def', state: 'adopted', caption: 'Adopted by hive · activity', source: 'adoption', observed_at: '2026-11-04T02:44:00Z' }; + const decision = { head: 'abc1234def', state: 'human_decision', caption: 'Review findings · human decision', perspectives_done: 5, perspectives_total: 5, source: 'verified-review-bundle', observed_at: '2026-11-04T02:44:00Z', since: red }; + const review = cells(redPR({ stage: 74, display_column: 30, code_activity: adopted, review_activity: decision }))[5]; + assert.match(review, /class="ham-seg ham-activity-track done decided"/, 'done-style, muted: not the active fill'); + assert.doesNotMatch(review, /ham-activity-track active|data-motion="active"/); + assert.match(review, /Review 5\/5 · changes requested { + const item = redPR({ display_column: 50, + code_activity: { head: 'abc1234def', state: 'pushed', caption: 'New head pushed · CI and re-review', source: 'recorded-push', observed_at: '2026-11-04T02:44:00Z' }, + ci_activity: { head: 'abc1234def', state: 'running', active: true, caption: 'CI 4/11 running', checks_passed: 4, checks_total: 11, source: 'checks', observed_at: '2026-11-04T02:44:00Z' }, + review_activity: { head: 'abc1234def', state: 'reviewing', active: true, actor: 'reviewer-2', caption: 'Review 2/5 · reviewer-2 reviewing', perspectives_done: 2, perspectives_total: 5, source: 'dispatch', observed_at: '2026-11-04T02:44:00Z' } }); + const c = cells(item); + assert.match(c[4], /ham-activity-track active ham-current/); + assert.match(c[4], /CI 4\/11/); + assert.match(c[5], /ham-activity-track active ham-current/); + assert.match(c[5], /Review 2\/5 · reviewer-2 reviewing]*title="Standalone PR · Not yet admitted to assert.ok(row.includes('aria-label="human · @cy"') && !row.includes(''), 'author icon label is aria-only: ' + row); // Since cells are untouched: plain text, no title. assert.ok(/<span class="ham-since( ham-stalled)?">[^<]*<\/span>/.test(row) && !/ham-since[^>]*title=/.test(golden), 'since cells unchanged'); +// hive#16509 row: adopted by hive with a finished review (5/5, human +// decision asked). The Review track is done-style and muted — never the amber +// in-progress fill — and reads the verdict, not "awaiting human decision"; +// 11/11 passed CI is done-style too. +{ + const seen = new Date(now - 60000).toISOString(); + const adoptedRow = stageTrackerRowHtml({ repo: 'acme/console', number: 16509, kind: 'pr', stage: 74, display_column: 30, head: 'f269349', author: 'thatguywob', author_kind: 'human', + code_activity: { head: 'f269349', state: 'adopted', caption: 'Adopted by hive · activity', source: 'adoption', observed_at: seen }, + ci_activity: { head: 'f269349', state: 'passing', caption: 'CI 11/11 passed', checks_passed: 11, checks_total: 11, source: 'checks', observed_at: seen }, + 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); + const review = /<li class="ham-seg ham-activity-track ([^"]*)" data-track="review"[^>]*>[\s\S]*?<\/li>/.exec(adoptedRow); + assert.ok(review, 'review track present: ' + adoptedRow); + assert.strictEqual(review[1], 'done decided', 'a finished review back in PR in progress is settled, not amber: ' + review[0]); + assert.ok(review[0].includes('Review 5/5 · changes requested</span>') && !review[0].includes('awaiting human') && !review[0].includes('data-motion='), review[0]); + const ci = /<li class="ham-seg ham-activity-track ([^"]*)" data-track="ci"/.exec(adoptedRow); + 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(/<li class="ham-seg ham-activity-track done decided" data-track="review"[^>]*>[\s\S]*?Review 5\/5 · awaiting human decision<\/span>/.test(parkedRow), 'genuinely parked on a person keeps the human word, still not amber: ' + parkedRow); +} // Merged: the lit cap is the only chevron with hover text. row = stageTrackerRowHtml({ repo: 'acme/console', number: 106, kind: 'pr', stage: 110 }, stages, ctx); assert.ok(/<li class="ham-seg active cap merged" title="Merged — [^"]*" aria-current="step">/.test(row) && titled(strip(row)).length === 1, row); diff --git a/src/pkg/dashboard/static-src/css/tracker.css b/src/pkg/dashboard/static-src/css/tracker.css index b352c33a67..d779d80254 100644 --- a/src/pkg/dashboard/static-src/css/tracker.css +++ b/src/pkg/dashboard/static-src/css/tracker.css @@ -377,6 +377,7 @@ .ham-activity-track.ham-current { opacity: 1; box-shadow: none; } .ham-seg.ham-activity-track.failing { background: var(--status-error); color: var(--surface-0); box-shadow: none; opacity: 1; } .ham-seg.ham-activity-track.failing .ham-ico { stroke-width: 2; } + .ham-seg.ham-activity-track.done.decided { background: var(--surface-3); color: var(--muted); box-shadow: none; opacity: 1; animation: none; } /* The count words stay on one line and ellipsize instead of wrapping. */ .ham-chevron-copy.ham-track-state .ham-ico { vertical-align: -2px; margin-right: 3px; } .ham-seg.active[data-motion]::before { content: ''; position: absolute; inset: 0; opacity: 0; pointer-events: none; } 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 c19c1ba60a..5d69383e19 100644 --- a/src/pkg/dashboard/static-src/js/tracker-row-strip.js +++ b/src/pkg/dashboard/static-src/js/tracker-row-strip.js @@ -78,7 +78,9 @@ switch (state) { case 'approved': return count + ' approved'; case 'changes_requested': return count + ' · changes requested'; - case 'human_decision': return count + ' · awaiting human decision'; + // 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'); case 'reviewing': case 'adjudicating': return count + ' · ' + (actor ? actor + ' reviewing' : 'reviewing'); case 'assigned': return count + ' · ' + (actor ? actor + ' queued' : 'queued'); case 'unassigned': return count + ' · swarm requested'; @@ -86,6 +88,13 @@ } } + function stageTrackerHiveOwnsRepair(item) { + if (!item || item.needs_human || item.on_hold || item.hold) return false; + const code = item.code_activity; + const hive = code && code.head === item.head && ['adopted', 'remediating', 'unassigned', 'fix_pushed', 'fixing'].includes(code.state); + return !!(hive || item.stage === 74 || item.adopted_by); + } + // Evidence is supplied independently by the backend. A native 050 label // cannot say who reviews, whether checks run, or whether an author codes. // The chevron wears its glyph plus the count words from @@ -113,7 +122,10 @@ const text = typeof stageTrackerTrackWord === 'function' ? stageTrackerTrackWord(item, kind, current) : (matches ? a.caption || name + ' ' + state : ''); const finished = matches && (state === 'passing' || state === 'approved'); const finding = matches && (state === 'failing' || state === 'changes_requested'); - const cls = finished ? 'done' : finding ? 'failing' : text ? 'active' : 'todo'; + // A complete verdict parked on a person is settled, not in progress: + // done-style, muted, never the amber fill (hivecommons/hive#16509 row). + const settled = matches && state === 'human_decision' && (!known || !a.active); + const cls = finished ? 'done' : finding ? 'failing' : settled ? 'done decided' : text ? 'active' : 'todo'; 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() : ''; diff --git a/src/pkg/dashboard/static/index.html b/src/pkg/dashboard/static/index.html index 8742902402..58d56b99ef 100644 --- a/src/pkg/dashboard/static/index.html +++ b/src/pkg/dashboard/static/index.html @@ -1714,6 +1714,7 @@ .ham-activity-track.ham-current { opacity: 1; box-shadow: none; } .ham-seg.ham-activity-track.failing { background: var(--status-error); color: var(--surface-0); box-shadow: none; opacity: 1; } .ham-seg.ham-activity-track.failing .ham-ico { stroke-width: 2; } + .ham-seg.ham-activity-track.done.decided { background: var(--surface-3); color: var(--muted); box-shadow: none; opacity: 1; animation: none; } /* The count words stay on one line and ellipsize instead of wrapping. */ .ham-chevron-copy.ham-track-state .ham-ico { vertical-align: -2px; margin-right: 3px; } .ham-seg.active[data-motion]::before { content: ''; position: absolute; inset: 0; opacity: 0; pointer-events: none; } @@ -17867,7 +17868,9 @@ <h3 class="faq-group-title">Where to get help</h3> switch (state) { case 'approved': return count + ' approved'; case 'changes_requested': return count + ' · changes requested'; - case 'human_decision': return count + ' · awaiting human decision'; + // 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'); case 'reviewing': case 'adjudicating': return count + ' · ' + (actor ? actor + ' reviewing' : 'reviewing'); case 'assigned': return count + ' · ' + (actor ? actor + ' queued' : 'queued'); case 'unassigned': return count + ' · swarm requested'; @@ -17875,6 +17878,13 @@ <h3 class="faq-group-title">Where to get help</h3> } } + function stageTrackerHiveOwnsRepair(item) { + if (!item || item.needs_human || item.on_hold || item.hold) return false; + const code = item.code_activity; + const hive = code && code.head === item.head && ['adopted', 'remediating', 'unassigned', 'fix_pushed', 'fixing'].includes(code.state); + return !!(hive || item.stage === 74 || item.adopted_by); + } + // Evidence is supplied independently by the backend. A native 050 label // cannot say who reviews, whether checks run, or whether an author codes. // The chevron wears its glyph plus the count words from @@ -17902,7 +17912,10 @@ <h3 class="faq-group-title">Where to get help</h3> const text = typeof stageTrackerTrackWord === 'function' ? stageTrackerTrackWord(item, kind, current) : (matches ? a.caption || name + ' ' + state : ''); const finished = matches && (state === 'passing' || state === 'approved'); const finding = matches && (state === 'failing' || state === 'changes_requested'); - const cls = finished ? 'done' : finding ? 'failing' : text ? 'active' : 'todo'; + // A complete verdict parked on a person is settled, not in progress: + // done-style, muted, never the amber fill (hivecommons/hive#16509 row). + const settled = matches && state === 'human_decision' && (!known || !a.active); + const cls = finished ? 'done' : finding ? 'failing' : settled ? 'done decided' : text ? 'active' : 'todo'; 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() : '';