From 79c546e0eb2103dd4658c9cf6ae1797b8c3e9d46 Mon Sep 17 00:00:00 2001 From: thatguywob Date: Wed, 4 Nov 2026 16:24:52 +0000 Subject: [PATCH 1/3] =?UTF-8?q?=F0=9F=90=9B=20fix:=20preserve=20settled=20?= =?UTF-8?q?current-head=20activity=20verdicts?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Keep review and CI verdicts known as observations age, and expose current-head perspective findings in review captions and tooltips. Hive-Run: hivecommons/hive#16617 Hive-Plan: activity-monitor-review-verdict Hive-Spec: hivecommons/hive#16617#fix Signed-off-by: thatguywob Co-authored-by: clubanderson <407614+clubanderson@users.noreply.github.com> --- changelog.d/fixed-16617-review-activity.md | 1 + src/pkg/dashboard/stage_tracker_activity.go | 62 +++++++++++- .../dashboard/stage_tracker_activity.test.js | 98 ++++++++++++++++++- .../dashboard/stage_tracker_activity_test.go | 57 +++++++++++ .../static-src/js/tracker-row-strip.js | 28 ++++-- src/pkg/dashboard/static/index.html | 28 ++++-- 6 files changed, 257 insertions(+), 17 deletions(-) create mode 100644 changelog.d/fixed-16617-review-activity.md diff --git a/changelog.d/fixed-16617-review-activity.md b/changelog.d/fixed-16617-review-activity.md new file mode 100644 index 0000000000..a2edad58bc --- /dev/null +++ b/changelog.d/fixed-16617-review-activity.md @@ -0,0 +1 @@ +- The Activity Monitor preserves settled review and CI verdicts on the current head as observations age, and review tooltips list each perspective’s verdict and finding with the observation age ([#16617](https://github.com/hivecommons/hive/issues/16617)). diff --git a/src/pkg/dashboard/stage_tracker_activity.go b/src/pkg/dashboard/stage_tracker_activity.go index e85ee45610..c9ef5e49cd 100644 --- a/src/pkg/dashboard/stage_tracker_activity.go +++ b/src/pkg/dashboard/stage_tracker_activity.go @@ -43,8 +43,18 @@ type StageTrackerActivity struct { // the swarm's expected set for this PR (configured perspectives plus any // extra one dispatched or reported for the head), Done the ones with a // verdict for the current head. - PerspectivesDone int `json:"perspectives_done,omitempty"` - PerspectivesTotal int `json:"perspectives_total,omitempty"` + PerspectivesDone int `json:"perspectives_done,omitempty"` + PerspectivesTotal int `json:"perspectives_total,omitempty"` + Perspectives []StageTrackerPerspective `json:"perspectives,omitempty"` +} + +// StageTrackerPerspective describes the latest bundle verdict for one perspective +// on the current head, preserving dissent across reviewers. Summary is the +// first finding, when one was reported. +type StageTrackerPerspective struct { + Name string `json:"name"` + Verdict string `json:"verdict"` + Summary string `json:"summary"` } const trackerActivityFreshWindow = 2 * time.Minute @@ -439,6 +449,37 @@ func trackerLatestBundleVerdicts(bundle *evidence.Bundle) []evidence.Verdict { return out } +func trackerReviewPerspectives(bundle *evidence.Bundle) []StageTrackerPerspective { + latest := map[string]evidence.Verdict{} + for _, verdict := range trackerLatestBundleVerdicts(bundle) { + if verdict.Perspective == "" { + continue + } + previous, ok := latest[verdict.Perspective] + // Each backend/model has its own current verdict. An approval by + // another reviewer must not hide dissent that still blocks the head. + if !ok || (previous.Verdict == "approve" && verdict.Verdict != "approve") || + ((previous.Verdict == "approve") == (verdict.Verdict == "approve") && verdict.RecordedAt.After(previous.RecordedAt)) { + latest[verdict.Perspective] = verdict + } + } + names := make([]string, 0, len(latest)) + for name := range latest { + names = append(names, name) + } + slices.Sort(names) + out := make([]StageTrackerPerspective, 0, len(names)) + for _, name := range names { + v := latest[name] + p := StageTrackerPerspective{Name: name, Verdict: v.Verdict} + if len(v.Findings) > 0 { + p.Summary = v.Findings[0].Summary + } + out = append(out, p) + } + return out +} + func trackerBundleApproves(bundle *evidence.Bundle, agg *review.Aggregate) bool { latest := trackerLatestBundleVerdicts(bundle) if len(latest) == 0 || len(agg.Perspectives) == 0 { @@ -515,6 +556,7 @@ func stageTrackerReviewActivity(pr github.PullRequest, bundle *evidence.Bundle, qualify := stageTrackerRepoQualifier(status) if bundle != nil && trackerHeadMatches(pr.Repo, pr.Number, pr.HeadSHA, bundle.Repo, bundle.Number, bundle.HeadSHA) { out.Source, out.ObservedAt = "verified-review-bundle", timePtr(bundle.UpdatedAt) + out.Perspectives = trackerReviewPerspectives(bundle) for _, verdict := range trackerLatestBundleVerdicts(bundle) { if !verdict.RecordedAt.IsZero() && (out.Since == nil || verdict.RecordedAt.After(*out.Since)) { at := verdict.RecordedAt @@ -639,6 +681,22 @@ func stageTrackerReviewActivity(pr github.PullRequest, bundle *evidence.Bundle, break } } + if out.State == "changes_requested" || out.State == "human_decision" { + for _, perspective := range out.Perspectives { + if perspective.Verdict == "changes_requested" || perspective.Verdict == "reject" || perspective.Verdict == "requires_human" { + mark := "✗" + if perspective.Verdict == "requires_human" { + mark = "requires human" + } + out.Caption += " · " + perspective.Name + " " + mark + if perspective.Summary != "" { + out.Caption += ": " + perspective.Summary + } + break + } + } + } + return out } diff --git a/src/pkg/dashboard/stage_tracker_activity.test.js b/src/pkg/dashboard/stage_tracker_activity.test.js index 41ca00b281..3c3cd15420 100644 --- a/src/pkg/dashboard/stage_tracker_activity.test.js +++ b/src/pkg/dashboard/stage_tracker_activity.test.js @@ -561,7 +561,7 @@ test('old-head or stale observations cannot fabricate running/completion, but do } else { assert.match(cells.ci, /active ham-current[^]*CI \?\/\? · running { + for (const [kind, state, caption] of [ + ['review', 'approved', 'Review approved'], + ['review', 'changes_requested', 'Review findings · correctness ✗: handle the stale verdict'], + ['review', 'human_decision', 'Review findings · needs owner sign-off'], + ['ci', 'passing', 'CI green'], + ['ci', 'failing', 'CI failing · build red'], + ]) { + for (const observed of [new Date(now - 15 * 60000).toISOString(), undefined, 'invalid', new Date(now + 60000).toISOString()]) { + const a = { ...activity(state, caption), observed_at: observed }; + const item = { kind: 'pr', head: 'head', [kind + '_activity']: a }; + const html = track(item, kind, {}, false, now); + assert.match(html, /data-display-state="known"/); + assert.ok(html.includes(caption), state + ': caption preserved'); + assert.doesNotMatch(html, /activity unknown|last observed|data-motion/); + if (observed === undefined || observed === 'invalid') assert.match(html, /observation time unknown/); + else if (Date.parse(observed) > now) assert.match(html, /observation time in future/); + else assert.match(html, /observed 15m ago/); + item.head = 'new-head'; + const pushed = track(item, kind, {}, false, now); + assert.match(pushed, /data-display-state="unknown"/); + assert.doesNotMatch(pushed, /data-verdict=|correctness|build red/); + } + } +}); + +test('motion needs a fresh observation even when the backend active flag is cached', () => { + for (const [kind, state] of [['review', 'reviewing'], ['review', 'adjudicating'], ['review', 'assigned'], ['ci', 'running'], ['ci', 'queued']]) { + for (const observed of [new Date(now - 15 * 60000).toISOString(), undefined, new Date(now + 60000).toISOString()]) { + const item = { kind: 'pr', head: 'head', [kind + '_activity']: { ...activity(state, 'Work observed', true), observed_at: observed } }; + const html = track(item, kind, {}, false, now); + assert.match(html, /data-display-state="unknown"/); + assert.match(html, /activity unknown/); + assert.doesNotMatch(html, /data-motion/); + } + } +}); + +test('review tooltip lists escaped perspective verdicts before current-head provenance', () => { + const summary = ' & check the current head'; + const caption = 'Review findings · correctness ✗: ' + summary; + const item = { kind: 'pr', head: 'head', review_activity: { + ...activity('changes_requested', caption), source: 'verified-review-bundle', + observed_at: new Date(now - 15 * 60000).toISOString(), blocker: summary, + perspectives: [ + { name: 'correctness', verdict: 'changes_requested', summary }, + { name: 'security', verdict: 'approve', summary: '' }, + { name: 'quality', verdict: 'reject', summary: 'explain the edge case' }, + ], + } }; + const html = track(item, 'review', {}, false, now); + const tip = html.match(/role="tooltip">([^]*?)<\/span>/)[1]; + assert.ok(tip.includes(esc(caption) + '
correctness ✗: ' + esc(summary))); + assert.match(tip, /
security ✓
quality ✗: explain the edge case
head head · verified-review-bundle · observed 15m ago/); + assert.doesNotMatch(html, / { + const a = { ...activity('human_decision', 'Review findings · needs owner sign-off'), + observed_at: new Date(now - 15 * 60000).toISOString(), + perspectives: [{ name: 'correctness', verdict: 'requires_human', summary: 'Choose whether to keep the API break' }] }; + const item = { kind: 'pr', head: 'head', review_activity: a }; + for (const state of ['human_decision', 'changes_requested']) { + a.state = state; + const html = track(item, 'review', {}, false, now); + assert.match(html, /correctness requires human: Choose whether to keep the API break
correctness requires human: Choose whether to keep the API break
head/); + assert.doesNotMatch(html, /activity unknown|last observed/); + } + for (const state of ['reviewing', 'unknown']) { + a.state = state; + a.caption = 'Review activity unknown'; + const html = track(item, 'review', {}, false, now); + assert.match(html, /data-display-state="unknown"/); + assert.doesNotMatch(html, /correctness|API break|requires human/); + } +}); + +test('a settled failing CI verdict preserves fresh motion from other running checks', () => { + const item = { kind: 'pr', head: 'head', ci_activity: { + ...activity('failing', 'CI failing · build red · other checks still running', true), + checks_failed: 1, checks_total: 2, checks_failing: ['build'], + } }; + const fresh = track(item, 'ci', {}, false, now); + assert.match(fresh, /data-activity-state="failing"/); + assert.match(fresh, /data-display-state="known"/); + assert.match(fresh, /data-motion="active"/); + const stale = track(item, 'ci', {}, false, now + 15 * 60000); + assert.match(stale, /data-activity-state="failing"/); + assert.match(stale, /data-display-state="known"/); + assert.match(stale, /observed 15m ago/); + assert.doesNotMatch(stale, /data-motion|activity unknown|last observed/); +}); diff --git a/src/pkg/dashboard/stage_tracker_activity_test.go b/src/pkg/dashboard/stage_tracker_activity_test.go index 6c58028cc8..8b113db02e 100644 --- a/src/pkg/dashboard/stage_tracker_activity_test.go +++ b/src/pkg/dashboard/stage_tracker_activity_test.go @@ -1,7 +1,9 @@ package dashboard import ( + "encoding/json" "os/exec" + "reflect" "strings" "testing" "time" @@ -485,3 +487,58 @@ func TestStageTrackerActivityReviewPerspectiveCounts(t *testing.T) { t.Fatalf("old-head evidence leaked into counts: %d/%d", got.PerspectivesDone, got.PerspectivesTotal) } } + +func TestStageTrackerReviewPerspectiveDetails(t *testing.T) { + now := time.Date(2026, 11, 4, 3, 0, 0, 0, time.UTC) + observed := now.Add(-15 * time.Minute) + pr := github.PullRequest{Repo: "org/repo", Number: 7, HeadSHA: "head"} + bundle := &evidence.Bundle{Repo: pr.Repo, Number: pr.Number, HeadSHA: pr.HeadSHA, UpdatedAt: observed, + Verdicts: []evidence.Verdict{ + {Perspective: "security", Verdict: "approve", RecordedAt: observed}, + {Perspective: "correctness", Backend: "old", Verdict: "approve", RecordedAt: observed.Add(-time.Minute)}, + {Perspective: "correctness", Backend: "new", Verdict: "changes_requested", RecordedAt: observed, + Findings: []evidence.Finding{{Summary: "do not discard the settled verdict"}}}, + {Perspective: "quality", Verdict: "changes_requested", RecordedAt: observed.Add(-time.Minute), + Findings: []evidence.Finding{{Summary: "superseded finding"}}}, + {Perspective: "quality", Verdict: "approve", RecordedAt: observed}, + {Verdict: "reject", RecordedAt: observed}, + }} + want := []StageTrackerPerspective{ + {Name: "correctness", Verdict: "changes_requested", Summary: "do not discard the settled verdict"}, + {Name: "quality", Verdict: "approve"}, + {Name: "security", Verdict: "approve"}, + } + for _, verdict := range []review.Verdict{"changes_requested", "requires_human"} { + agg := &review.Aggregate{Repo: pr.Repo, Number: pr.Number, HeadSHA: pr.HeadSHA, Verdict: verdict} + got := stageTrackerReviewActivity(pr, bundle, agg, review.DispatchState{}, nil, now) + if !reflect.DeepEqual(got.Perspectives, want) || !strings.Contains(got.Caption, "correctness ✗: do not discard the settled verdict") || got.Active { + t.Fatalf("settled review lost its current-head perspective details: %+v", got) + } + data, err := json.Marshal(got) + if err != nil || !strings.Contains(string(data), `"perspectives":[{"name":"correctness","verdict":"changes_requested","summary":"do not discard the settled verdict"}`) { + t.Fatalf("perspective wire fields missing: %s, %v", data, err) + } + } + bundle.Verdicts[2].Verdict = "requires_human" + agg := &review.Aggregate{Repo: pr.Repo, Number: pr.Number, HeadSHA: pr.HeadSHA, Verdict: "requires_human"} + got := stageTrackerReviewActivity(pr, bundle, agg, review.DispatchState{}, nil, now) + if got.State != "human_decision" || !strings.Contains(got.Caption, "correctness requires human: do not discard the settled verdict") || got.Perspectives[0].Verdict != "requires_human" { + t.Fatalf("human perspective was not explained: %+v", got) + } + bundle.Verdicts[2].Verdict = "changes_requested" + // Approval from another backend must not replace still-current dissent. + bundle.Verdicts = append(bundle.Verdicts, evidence.Verdict{Perspective: "correctness", Backend: "z", Verdict: "approve", RecordedAt: observed.Add(time.Minute)}) + if got := trackerReviewPerspectives(bundle); !reflect.DeepEqual(got, want) { + t.Fatalf("newer approval from another backend hid a finding: %+v", got) + } + for _, other := range []github.PullRequest{ + {Repo: pr.Repo, Number: pr.Number, HeadSHA: "new-head"}, + {Repo: "other/repo", Number: pr.Number, HeadSHA: pr.HeadSHA}, + {Repo: pr.Repo, Number: 8, HeadSHA: pr.HeadSHA}, + } { + got := stageTrackerReviewActivity(other, bundle, nil, review.DispatchState{}, nil, now) + if got.State != "unknown" || len(got.Perspectives) != 0 || strings.Contains(got.Caption, "correctness") { + t.Fatalf("unrelated review details leaked: %+v", got) + } + } +} 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 a57190b1bb..23c3179023 100644 --- a/src/pkg/dashboard/static-src/js/tracker-row-strip.js +++ b/src/pkg/dashboard/static-src/js/tracker-row-strip.js @@ -234,7 +234,7 @@ // a finding, pending and decided are words in their colour on the muted // field — only a running track is filled (hivecommons/hive#16540); not // started = the empty chevron with the glyph alone. Freshness gates only - // the pulse. + // the pulse and certainty of motion; settled current-head verdicts persist. function stageTrackerActivityTrackHtml(item, kind, sg, blank, nowMs, opts) { if (blank) return ``; const name = kind === 'ci' ? 'CI' : 'Review'; @@ -247,8 +247,19 @@ const stale = Number.isFinite(observed) && (clock - observed > activityFreshMS || observed > clock); const current = sg.state === 'active'; const state = matches ? a.state || 'unknown' : 'unknown'; - const known = matches && state !== 'unknown' && Number.isFinite(observed) && !stale; - const active = known && a.active; + const moving = ['running', 'queued', 'reviewing', 'adjudicating', 'assigned'].includes(state); + const fresh = Number.isFinite(observed) && !stale; + const known = matches && state !== 'unknown' && (!moving || fresh); + const active = known && fresh && a.active; + const perspectives = known && kind === 'review' && Array.isArray(a.perspectives) ? a.perspectives : []; + const perspectiveMark = verdict => verdict === 'approve' ? '✓' : ['changes_requested', 'reject'].includes(verdict) ? '✗' : verdict === 'requires_human' ? 'requires human' : verdict || '?'; + const perspectiveLine = p => String(p.name || 'Perspective') + ' ' + perspectiveMark(p.verdict) + (p.summary ? ': ' + p.summary : ''); + // A repair projection can rewrite the generic caption; keep its first + // finding visible without changing the backend's settled verdict. + if (['changes_requested', 'human_decision'].includes(state)) { + const firstFinding = perspectives.find(p => ['changes_requested', 'reject', 'requires_human'].includes(p.verdict)); + if (firstFinding && !caption.includes(perspectiveLine(firstFinding))) caption += ' · ' + perspectiveLine(firstFinding); + } if (matches && !known && state !== 'unknown') caption = name + ' activity unknown · last observed ' + state + ' · ' + caption; const ownsPR = item.kind === 'pr' || item.via_pr; const text = typeof stageTrackerTrackWord === 'function' ? stageTrackerTrackWord(item, kind, current) : (matches ? a.caption || name + ' ' + state : ''); @@ -272,9 +283,11 @@ const humanAction = approvalPending > 0 ? STAGE_TRACKER_WORKFLOW_APPROVAL_TIP : kind === 'review' && state === 'human_decision' ? 'Needs a person\'s decision' : ''; const personIco = stalled && humanAction ? stageTrackerIcon('human', 'ham-ico ham-actor-ico', humanAction) : ''; const source = matches ? a.source || 'unavailable' : 'unavailable'; - const freshness = !Number.isFinite(observed) ? 'observation time unknown' : (stale ? 'stale · ' : 'observed · ') + new Date(observed).toISOString(); + const age = Math.max(0, Math.floor((clock - observed) / 60000)); + const ago = age < 1 ? 'just now' : age < 60 ? age + 'm ago' : age < 1440 ? Math.floor(age / 60) + 'h ago' : Math.floor(age / 1440) + 'd ago'; + const freshness = !Number.isFinite(observed) ? 'observation time unknown' : observed > clock ? 'observation time in future · ' + new Date(observed).toISOString() : 'observed ' + ago + (stale && moving ? ' · stale' : '') + ' · ' + new Date(observed).toISOString(); const since = matches && a.since && Number.isFinite(Date.parse(a.since)) ? ' · since ' + new Date(a.since).toISOString() : ''; - let blocker = matches && a.blocker ? ' · ' + a.blocker : ''; + let blocker = matches && a.blocker && !caption.includes(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. @@ -283,7 +296,8 @@ // 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 : ''; - let tip = caption + blocker + detail + ' · head ' + (item.head || 'unknown') + ' · ' + source + ' · ' + freshness + since; + const perspectiveLines = perspectives.map(perspectiveLine); + let tip = [caption + blocker + detail, ...perspectiveLines, 'head ' + (item.head || 'unknown') + ' · ' + source + ' · ' + freshness + since].join('\n'); const code = item.code_activity; const codeNote = code && code.head === item.head && Number(item.display_column) === 50 && ((kind === 'review' && code.state === 'waiting_fixer') || (kind === 'ci' && code.state === 'waiting_ci')) ? code.caption : ''; @@ -317,7 +331,7 @@ (lead ? ' · hive is waiting on ' + lead.waitingOn + (lead.newHead && sha7 ? ' for new head ' + sha7 : '') : ''); const tipID = 'ham-track-tip-' + [item.repo || '', item.kind || '', item.number || 0, kind].map(x => encodeURIComponent(String(x))).join('-'); const copy = `${evidenceLink}${personIco}`; - return `
  • ${copy}${esc(fullTip)}${decided ? `${decided}` : ''}
  • `; + return `
  • ${copy}${esc(fullTip).replaceAll('\n', '
    ')}${decided ? `${decided}` : ''}
  • `; } // Chevrons for one item. range bounds the columns the item owns (an diff --git a/src/pkg/dashboard/static/index.html b/src/pkg/dashboard/static/index.html index e9518324d7..cc06bf97db 100644 --- a/src/pkg/dashboard/static/index.html +++ b/src/pkg/dashboard/static/index.html @@ -18032,7 +18032,7 @@

    Where to get help

    // a finding, pending and decided are words in their colour on the muted // field — only a running track is filled (hivecommons/hive#16540); not // started = the empty chevron with the glyph alone. Freshness gates only - // the pulse. + // the pulse and certainty of motion; settled current-head verdicts persist. function stageTrackerActivityTrackHtml(item, kind, sg, blank, nowMs, opts) { if (blank) return ``; const name = kind === 'ci' ? 'CI' : 'Review'; @@ -18045,8 +18045,19 @@

    Where to get help

    const stale = Number.isFinite(observed) && (clock - observed > activityFreshMS || observed > clock); const current = sg.state === 'active'; const state = matches ? a.state || 'unknown' : 'unknown'; - const known = matches && state !== 'unknown' && Number.isFinite(observed) && !stale; - const active = known && a.active; + const moving = ['running', 'queued', 'reviewing', 'adjudicating', 'assigned'].includes(state); + const fresh = Number.isFinite(observed) && !stale; + const known = matches && state !== 'unknown' && (!moving || fresh); + const active = known && fresh && a.active; + const perspectives = known && kind === 'review' && Array.isArray(a.perspectives) ? a.perspectives : []; + const perspectiveMark = verdict => verdict === 'approve' ? '✓' : ['changes_requested', 'reject'].includes(verdict) ? '✗' : verdict === 'requires_human' ? 'requires human' : verdict || '?'; + const perspectiveLine = p => String(p.name || 'Perspective') + ' ' + perspectiveMark(p.verdict) + (p.summary ? ': ' + p.summary : ''); + // A repair projection can rewrite the generic caption; keep its first + // finding visible without changing the backend's settled verdict. + if (['changes_requested', 'human_decision'].includes(state)) { + const firstFinding = perspectives.find(p => ['changes_requested', 'reject', 'requires_human'].includes(p.verdict)); + if (firstFinding && !caption.includes(perspectiveLine(firstFinding))) caption += ' · ' + perspectiveLine(firstFinding); + } if (matches && !known && state !== 'unknown') caption = name + ' activity unknown · last observed ' + state + ' · ' + caption; const ownsPR = item.kind === 'pr' || item.via_pr; const text = typeof stageTrackerTrackWord === 'function' ? stageTrackerTrackWord(item, kind, current) : (matches ? a.caption || name + ' ' + state : ''); @@ -18070,9 +18081,11 @@

    Where to get help

    const humanAction = approvalPending > 0 ? STAGE_TRACKER_WORKFLOW_APPROVAL_TIP : kind === 'review' && state === 'human_decision' ? 'Needs a person\'s decision' : ''; const personIco = stalled && humanAction ? stageTrackerIcon('human', 'ham-ico ham-actor-ico', humanAction) : ''; const source = matches ? a.source || 'unavailable' : 'unavailable'; - const freshness = !Number.isFinite(observed) ? 'observation time unknown' : (stale ? 'stale · ' : 'observed · ') + new Date(observed).toISOString(); + const age = Math.max(0, Math.floor((clock - observed) / 60000)); + const ago = age < 1 ? 'just now' : age < 60 ? age + 'm ago' : age < 1440 ? Math.floor(age / 60) + 'h ago' : Math.floor(age / 1440) + 'd ago'; + const freshness = !Number.isFinite(observed) ? 'observation time unknown' : observed > clock ? 'observation time in future · ' + new Date(observed).toISOString() : 'observed ' + ago + (stale && moving ? ' · stale' : '') + ' · ' + new Date(observed).toISOString(); const since = matches && a.since && Number.isFinite(Date.parse(a.since)) ? ' · since ' + new Date(a.since).toISOString() : ''; - let blocker = matches && a.blocker ? ' · ' + a.blocker : ''; + let blocker = matches && a.blocker && !caption.includes(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. @@ -18081,7 +18094,8 @@

    Where to get help

    // 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 : ''; - let tip = caption + blocker + detail + ' · head ' + (item.head || 'unknown') + ' · ' + source + ' · ' + freshness + since; + const perspectiveLines = perspectives.map(perspectiveLine); + let tip = [caption + blocker + detail, ...perspectiveLines, 'head ' + (item.head || 'unknown') + ' · ' + source + ' · ' + freshness + since].join('\n'); const code = item.code_activity; const codeNote = code && code.head === item.head && Number(item.display_column) === 50 && ((kind === 'review' && code.state === 'waiting_fixer') || (kind === 'ci' && code.state === 'waiting_ci')) ? code.caption : ''; @@ -18115,7 +18129,7 @@

    Where to get help

    (lead ? ' · hive is waiting on ' + lead.waitingOn + (lead.newHead && sha7 ? ' for new head ' + sha7 : '') : ''); const tipID = 'ham-track-tip-' + [item.repo || '', item.kind || '', item.number || 0, kind].map(x => encodeURIComponent(String(x))).join('-'); const copy = `${evidenceLink}${personIco}`; - return `
  • ${copy}${esc(fullTip)}${decided ? `${decided}` : ''}
  • `; + return `
  • ${copy}${esc(fullTip).replaceAll('\n', '
    ')}${decided ? `${decided}` : ''}
  • `; } // Chevrons for one item. range bounds the columns the item owns (an From 1fd63c41995badd68acde4e5d02630872c5352e7 Mon Sep 17 00:00:00 2001 From: thatguywob Date: Wed, 4 Nov 2026 16:54:01 +0000 Subject: [PATCH 2/3] =?UTF-8?q?=F0=9F=90=9B=20fix(test):=20align=20activit?= =?UTF-8?q?y=20geometry=20probe=20with=20icon-only=20lanes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Keep current-phase and filled active-lane assertions, while checking inactive CI/Review lanes for their state icon and accessible count words after the chevron update. Signed-off-by: thatguywob --- .../webstatic/testdata/tracker-header-geometry.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/pkg/dashboard/webstatic/testdata/tracker-header-geometry.js b/src/pkg/dashboard/webstatic/testdata/tracker-header-geometry.js index 25644876b6..654a297121 100644 --- a/src/pkg/dashboard/webstatic/testdata/tracker-header-geometry.js +++ b/src/pkg/dashboard/webstatic/testdata/tracker-header-geometry.js @@ -210,8 +210,15 @@ if (cell.dataset.activityState) coverage.states[cell.dataset.activityState] = (coverage.states[cell.dataset.activityState] || 0) + 1; if (cell.dataset.routeState?.split(' ').includes('active')) { assert(cell.classList.contains('ham-current'), name + 'current phase remains highlighted independently of work'); - const style = getComputedStyle(cell); - assert(Number(style.opacity) >= 0.9 && style.backgroundColor !== 'rgba(0, 0, 0, 0)' && style.backgroundColor !== 'transparent', name + 'queued/unknown/assigned/completed current tracks retain a visible steady fill'); + if (cell.classList.contains('active') || !cell.dataset.track) { + const style = getComputedStyle(cell); + assert(Number(style.opacity) >= 0.9 && style.backgroundColor !== 'rgba(0, 0, 0, 0)' && style.backgroundColor !== 'transparent', name + 'active and stalled current tracks retain a visible steady fill'); + } else { + // Inactive CI/Review lanes keep their current-phase location but + // render only the state-coloured icon (#16599); words stay in the label. + const words = cell.querySelector('.ham-track-state')?.innerText.trim() || ''; + assert(!!cell.querySelector('svg') && words === '' && /\b(CI|Review): (CI|Review)\b/.test(cell.getAttribute('aria-label') || ''), name + 'inactive current tracks retain an icon with their words in the label'); + } } if (cell.dataset.track) { // CI / Review lanes are chevrons like their neighbours: same notch From 598099676c55dc61b41c9707d4d8da8d77c5a17f Mon Sep 17 00:00:00 2001 From: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> Date: Wed, 4 Nov 2026 13:20:08 -0500 Subject: [PATCH 3/3] fix(dashboard): escape tooltip lines before joining and age moving review states Addresses the review-swarm findings on #16619: - Production esc() flattens newlines to spaces, so escaping the whole tooltip before substituting
    never produced line breaks. Split the tooltip into lines first, escape each, then join with
    . The JS test stub esc() now mirrors production so the test exercises the real path. - The known rule deny-listed moving states, leaving unassigned and waiting_ci (emitted by v5) known forever once stale. Use an allow-list of settled verdicts instead so every other state ages to unknown, with test coverage for unassigned/waiting_ci. Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> --- src/pkg/dashboard/stage_tracker_activity.test.js | 7 ++++--- src/pkg/dashboard/static-src/js/tracker-row-strip.js | 10 +++++++--- src/pkg/dashboard/static/index.html | 10 +++++++--- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/src/pkg/dashboard/stage_tracker_activity.test.js b/src/pkg/dashboard/stage_tracker_activity.test.js index 3c3cd15420..d40dc0c762 100644 --- a/src/pkg/dashboard/stage_tracker_activity.test.js +++ b/src/pkg/dashboard/stage_tracker_activity.test.js @@ -13,7 +13,8 @@ function fn(source, name) { assert.ok(match, name); return match[0]; } -const esc = text => String(text).replaceAll('&', '&').replaceAll('<', '<').replaceAll('"', '"'); +// Mirrors production esc(): newlines flatten to spaces. +const esc = text => String(text).replaceAll('&', '&').replaceAll('<', '<').replaceAll('"', '"').replaceAll('\n', ' '); const globals = ` const STAGE_TRACKER_PATH = [0, 10, 20, 30, 50, 80]; const STAGE_TRACKER_TERMINAL = 110; @@ -883,7 +884,7 @@ test('settled current-head verdicts keep one known caption at every observation }); test('motion needs a fresh observation even when the backend active flag is cached', () => { - for (const [kind, state] of [['review', 'reviewing'], ['review', 'adjudicating'], ['review', 'assigned'], ['ci', 'running'], ['ci', 'queued']]) { + for (const [kind, state] of [['review', 'reviewing'], ['review', 'adjudicating'], ['review', 'assigned'], ['review', 'unassigned'], ['review', 'waiting_ci'], ['ci', 'running'], ['ci', 'queued'], ['ci', 'waiting_ci']]) { for (const observed of [new Date(now - 15 * 60000).toISOString(), undefined, new Date(now + 60000).toISOString()]) { const item = { kind: 'pr', head: 'head', [kind + '_activity']: { ...activity(state, 'Work observed', true), observed_at: observed } }; const html = track(item, kind, {}, false, now); @@ -911,7 +912,7 @@ test('review tooltip lists escaped perspective verdicts before current-head prov assert.ok(tip.includes(esc(caption) + '
    correctness ✗: ' + esc(summary))); assert.match(tip, /
    security ✓
    quality ✗: explain the edge case
    head head · verified-review-bundle · observed 15m ago/); assert.doesNotMatch(html, / activityFreshMS || observed > clock); const current = sg.state === 'active'; const state = matches ? a.state || 'unknown' : 'unknown'; - const moving = ['running', 'queued', 'reviewing', 'adjudicating', 'assigned'].includes(state); + // Only settled verdicts outlive the freshness window; every other + // state (running, queued, unassigned, waiting_ci, ...) implies motion. + const settledState = ['approved', 'changes_requested', 'human_decision', 'passing', 'failing', 'skipped', 'missing'].includes(state); + const moving = !settledState && state !== 'unknown'; const fresh = Number.isFinite(observed) && !stale; - const known = matches && state !== 'unknown' && (!moving || fresh); + const known = matches && state !== 'unknown' && (settledState || fresh); const active = known && fresh && a.active; const perspectives = known && kind === 'review' && Array.isArray(a.perspectives) ? a.perspectives : []; const perspectiveMark = verdict => verdict === 'approve' ? '✓' : ['changes_requested', 'reject'].includes(verdict) ? '✗' : verdict === 'requires_human' ? 'requires human' : verdict || '?'; @@ -331,7 +334,8 @@ (lead ? ' · hive is waiting on ' + lead.waitingOn + (lead.newHead && sha7 ? ' for new head ' + sha7 : '') : ''); const tipID = 'ham-track-tip-' + [item.repo || '', item.kind || '', item.number || 0, kind].map(x => encodeURIComponent(String(x))).join('-'); const copy = `${evidenceLink}${personIco}`; - return `
  • ${copy}${esc(fullTip).replaceAll('\n', '
    ')}${decided ? `${decided}` : ''}
  • `; + const tipHtml = fullTip.split('\n').map(esc).join('
    '); + return `
  • ${copy}${tipHtml}${decided ? `${decided}` : ''}
  • `; } // Chevrons for one item. range bounds the columns the item owns (an diff --git a/src/pkg/dashboard/static/index.html b/src/pkg/dashboard/static/index.html index f190fc5370..b9a4c9edcb 100644 --- a/src/pkg/dashboard/static/index.html +++ b/src/pkg/dashboard/static/index.html @@ -18118,9 +18118,12 @@

    Where to get help

    const stale = Number.isFinite(observed) && (clock - observed > activityFreshMS || observed > clock); const current = sg.state === 'active'; const state = matches ? a.state || 'unknown' : 'unknown'; - const moving = ['running', 'queued', 'reviewing', 'adjudicating', 'assigned'].includes(state); + // Only settled verdicts outlive the freshness window; every other + // state (running, queued, unassigned, waiting_ci, ...) implies motion. + const settledState = ['approved', 'changes_requested', 'human_decision', 'passing', 'failing', 'skipped', 'missing'].includes(state); + const moving = !settledState && state !== 'unknown'; const fresh = Number.isFinite(observed) && !stale; - const known = matches && state !== 'unknown' && (!moving || fresh); + const known = matches && state !== 'unknown' && (settledState || fresh); const active = known && fresh && a.active; const perspectives = known && kind === 'review' && Array.isArray(a.perspectives) ? a.perspectives : []; const perspectiveMark = verdict => verdict === 'approve' ? '✓' : ['changes_requested', 'reject'].includes(verdict) ? '✗' : verdict === 'requires_human' ? 'requires human' : verdict || '?'; @@ -18202,7 +18205,8 @@

    Where to get help

    (lead ? ' · hive is waiting on ' + lead.waitingOn + (lead.newHead && sha7 ? ' for new head ' + sha7 : '') : ''); const tipID = 'ham-track-tip-' + [item.repo || '', item.kind || '', item.number || 0, kind].map(x => encodeURIComponent(String(x))).join('-'); const copy = `${evidenceLink}${personIco}`; - return `
  • ${copy}${esc(fullTip).replaceAll('\n', '
    ')}${decided ? `${decided}` : ''}
  • `; + const tipHtml = fullTip.split('\n').map(esc).join('
    '); + return `
  • ${copy}${tipHtml}${decided ? `${decided}` : ''}
  • `; } // Chevrons for one item. range bounds the columns the item owns (an