Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/fixed-review-track-never-unknown.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- The Activity Monitor's Review and CI chevrons never say "activity unknown": with no verdict and no reviewer in flight the tooltip states what the head waits on (closed, draft, waiting for CI, not started and who is next, or no data for the head yet · refreshing), a settled verdict names who decided, how long ago and each perspective's verdict with its first finding, and settled verdicts stay known as observations age.
1 change: 1 addition & 0 deletions src/docs/dashboard-sections/activity-monitor.md
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,7 @@ An *active* chevron is filled amber and carries words; an inactive one is its ic
2. **CI and Review resolve first.** A track is active only while it genuinely runs on the current head (a check-run in progress or queued, a ring not yet full; a reviewer running or queued). If either runs, the PR is waiting on it: the stage chevron (PR in progress, Merge queue …) renders settled-current — filled but still, icon only, its words in the tooltip — and nothing else is active.
3. **CI + Review is the only pair.** Two chevrons are active together only when both tracks run at once; every other combination is exactly one active chevron. The stage chevron is the ≥ 1 fallback: active only when no track is in motion.
4. **The PR in progress chevron speaks the PR's lifecycle** — draft, pushed, rebasing, *Unassigned · next: scanner*, *Waiting for @author · fix owed* — never a CI or review verdict. *CI failing*, *CI 4/11 · 1 failing* and *changes requested* are the CI and Review chevrons' words; the PR in progress tooltip keeps the red reason as detail.
5. **The CI and Review tooltips state what the track waits on — never "activity unknown".** With no verdict and no reviewer in flight the spoke derives the Review statement from what it already knows, in this order: the PR is merged or closed (*Review · n/a (closed)*), it is a draft (*Review · draft, not requested*), CI on the head has not finished (*Review · waiting for CI*), CI is done and nobody started (*Review · not started · hive reviewer next*, or *· needs reviewer* when the repo has no hive reviewer lane). A settled verdict explains itself — *Changes requested by the hive reviewer: 1 perspective posted findings … · 12m ago · quality ✓ · security ✗: token logged* — and stays known as its observation ages. The one no-data wording, *Review · no data for head f269349 yet · refreshing* (CI: *CI · no checks observed for head … yet · refreshing*), appears only when the spoke has fetched nothing for the head, and names the next step.

#### The row's lead action, inline

Expand Down
35 changes: 32 additions & 3 deletions src/pkg/dashboard/stage_tracker_activity.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,18 @@ type StageTrackerActivity struct {
// verdict for the current head.
PerspectivesDone int `json:"perspectives_done,omitempty"`
PerspectivesTotal int `json:"perspectives_total,omitempty"`
// Perspectives lists each perspective's latest verdict on the head
// (dissent preserved) so the tooltip can explain a settled review
// (hivecommons/hive#16617).
Perspectives []StageTrackerPerspective `json:"perspectives,omitempty"`
}

// StageTrackerPerspective is one perspective's current verdict on the head
// with its first finding, when it reported one.
type StageTrackerPerspective struct {
Name string `json:"name"`
Verdict string `json:"verdict"`
Summary string `json:"summary,omitempty"`
}

const trackerActivityFreshWindow = 2 * time.Minute
Expand All @@ -54,7 +66,7 @@ func trackerUnknownActivity(head, caption string) *StageTrackerActivity {
}

func stageTrackerCIActivity(pr github.PullRequest, now time.Time) *StageTrackerActivity {
out := trackerUnknownActivity(pr.HeadSHA, "CI unknown · no check results observed for this head yet")
out := trackerUnknownActivity(pr.HeadSHA, stageTrackerCINoDataCaption(pr.HeadSHA))
out.Detail = "hive has not yet seen which checks branch protection requires, or any check run or commit status for the PR's current commit."
a := pr.CIActivity
if a == nil || pr.HeadSHA == "" || !strings.EqualFold(a.Head, pr.HeadSHA) {
Expand Down Expand Up @@ -558,13 +570,21 @@ func trackerAssignedCodeWorker(status *StatusPayload, repo string, number int, h
}

func stageTrackerReviewActivity(pr github.PullRequest, bundle *evidence.Bundle, agg *review.Aggregate, dispatch review.DispatchState, status *StatusPayload, now time.Time) *StageTrackerActivity {
out := trackerUnknownActivity(pr.HeadSHA, "Review unknown · current-head evidence unavailable")
out := trackerUnknownActivity(pr.HeadSHA, stageTrackerReviewNoDataCaption(pr.HeadSHA))
unverifiedApproval := false
defer func() {
if unverifiedApproval && out.State == "unknown" {
out.State, out.Caption = reviewStateUnverified, "Review · aggregate approves · evidence not verified"
out.Detail = "The review aggregate approves this head but the verified evidence bundle does not establish it (a perspective is missing or dissents, or merge eligibility is withheld); the approval does not count until the evidence agrees."
}
}()
if agg != nil && !trackerHeadMatches(pr.Repo, pr.Number, pr.HeadSHA, agg.Repo, agg.Number, agg.HeadSHA) {
agg = nil
}
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
Expand All @@ -582,7 +602,13 @@ func stageTrackerReviewActivity(pr github.PullRequest, bundle *evidence.Bundle,
if agg.MergeEligible && trackerBundleApproves(bundle, agg) {
out.State, out.Caption = "approved", "Review approved"
} else {
out.Caption = "Review unknown · bundle and aggregate do not establish approval"
// The aggregate approves but the verified bundle does
// not back it (a dissenting or missing perspective, or
// merge eligibility withheld). Not an approval and not
// "unknown": the statement is that the evidence does
// not verify it. A later wait or dispatch on the head
// still takes over below.
unverifiedApproval = true
}
case "changes_requested", "reject":
out.State, out.Caption = "changes_requested", "Review findings · awaiting author"
Expand All @@ -603,6 +629,9 @@ func stageTrackerReviewActivity(pr github.PullRequest, bundle *evidence.Bundle,
}
}
}
if detail := stageTrackerReviewVerdictDetail(out, bundle); detail != "" && out.Detail == "" {
out.Detail = detail
}
if out.State != "unknown" && agg != nil {
var confirmed time.Time
for _, recent := range dispatch.Recent {
Expand Down
54 changes: 52 additions & 2 deletions src/pkg/dashboard/stage_tracker_activity.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -707,10 +707,11 @@ function stageTrackerIcon(n, cls) { return '<svg class="' + cls + '"></svg>'; }
assert.equal((administration.match(/data-motion="active"/g) || []).length, 2, 'cached generic PR administration cannot animate coding');
});

test('stale activity is visibly unknown in the tooltip, never pulses, and still reads in words', () => {
test('stale activity is dated in the tooltip, never pulses, still reads in words, and never says "activity unknown"', () => {
const item = { kind: 'pr', head: 'head', review_activity: { ...activity('reviewing', 'Review working · reviewer', true), actor: 'reviewer', perspectives_done: 1, perspectives_total: 5 } };
const html = track(item, 'review', {}, false, now + 300000);
assert.match(html, /activity unknown · last observed reviewing/);
assert.doesNotMatch(html, /activity unknown/, 'hivecommons/hive#16661');
assert.match(html, /stale · 2026-11-02T21:00:00\.000Z \(5m ago\)/);
assert.doesNotMatch(html, /data-motion/);
assert.match(html, /data-display-state="unknown"/);
assert.match(html, /ham-activity-track active"[^]*ham-chevron-copy ham-track-state"><svg [^]*?<\/svg>Review 1\/5 · reviewer reviewing</, 'stale in-progress evidence keeps the lit fill and its count words');
Expand Down Expand Up @@ -881,3 +882,52 @@ test('#16615: CI green on the pushed head + re-review owed by the hive → Revie
assert.equal(cls(running.ci), 'active'); assert.equal(text(running.ci), 'CI 7/11 · running');
assert.equal(cls(running.review), 'todo'); assert.equal(text(running.review), '');
});

// hivecommons/hive#16661: the Review track never says "activity unknown".
// With no verdict and no reviewer in flight the backend derives what the
// head waits on (stage_tracker_review_fallback.go); the UI carries that
// statement as the words when the column is the stage's own, otherwise in
// the tooltip behind a neutral icon.
test('#16661: derived review waits read as statements — words on the stage column, tooltip elsewhere, never "activity unknown"', () => {
const head = 'f269349abcdef';
const text = cell => cell.match(/aria-describedby="[^"]+">([^]*?)<span id=/)[1].replace(/<[^>]*>/g, '');
const cls = cell => cell.match(/class="ham-seg ham-activity-track ([a-z -]+?)(?: ham-current)?"/)[1];
const tip = cell => (/role="tooltip">([^]*?)<\/span>/.exec(cell) || [])[1].replace(/<[^>]*>/g, '');
const derived = (state, caption, extra = {}) => ({ head, state, caption, source: 'derived-from-pr-state', observed_at: new Date(now).toISOString(), ...extra });
const row = (review, stage, column) => track({ kind: 'pr', head, stage, display_column: column, number: 16650, review_activity: review,
ci_activity: { head, state: 'running', caption: 'CI 3/11 · running', active: true, checks_passed: 3, checks_total: 11, source: 'github-check-runs', observed_at: new Date(now).toISOString() } },
'review', { state: stage === 50 ? 'active' : 'todo' }, false, now);
// 040 with CI running: Review is an inactive neutral icon; the tooltip says why.
const waiting = row(derived('waiting_ci', 'Review · waiting for CI'), 40, 40);
assert.equal(cls(waiting), 'todo'); assert.equal(text(waiting), '');
assert.match(tip(waiting), /Review: Review · waiting for CI · head f269349/);
assert.doesNotMatch(tip(waiting), /unknown/);
// 050 with nobody started yet: the stage's own column carries the statement.
const notStarted = row(derived('not_started', 'Review · not started · hive reviewer next'), 50, 50);
assert.equal(cls(notStarted), 'active'); assert.equal(text(notStarted), 'Review · not started · hive reviewer next');
for (const [state, caption] of [['not_requested', 'Review · draft, not requested'], ['closed', 'Review · n/a (closed)'], ['unverified', 'Review · aggregate approves · evidence not verified']]) {
const cell = row(derived(state, caption), 40, 40);
assert.equal(text(cell), '', state + ' is not motion');
assert.match(tip(cell), new RegExp('Review: ' + caption.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')), state);
assert.doesNotMatch(tip(cell), /activity unknown|Review unknown/);
}
// No evidence at all: the head and the next step, not "unknown"; a legacy
// "Review unknown · reason" caption from an older spoke is rewritten the same way.
const none = row(undefined, 40, 40);
assert.match(tip(none), /Review: Review · no data for head f269349 yet · refreshing/);
assert.doesNotMatch(tip(none), /Review unknown|activity unknown/);
const legacy = row({ head, state: 'unknown', caption: 'Review unknown · current-head evidence unavailable', source: 'unavailable' }, 40, 40);
assert.match(tip(legacy), /Review · no data for head f269349 yet · refreshing · current-head evidence unavailable/);
assert.doesNotMatch(tip(legacy), /Review unknown|activity unknown/);
// A settled verdict explains itself in the tooltip: who, how long ago, and
// each perspective's verdict with its first finding (hivecommons/hive#16617),
// and it stays known as the observation ages.
const settled = row({ head, state: 'changes_requested', caption: 'Review findings · awaiting author', source: 'verified-review-bundle', perspectives_done: 5, perspectives_total: 5,
observed_at: new Date(now - 12 * 60000).toISOString(), since: new Date(now - 12 * 60000).toISOString(),
detail: 'Changes requested by the hive reviewer: 1 perspective posted findings on this head; the fix is owed before a re-review.',
perspectives: [{ name: 'quality', verdict: 'approve' }, { name: 'security', verdict: 'changes_requested', summary: 'token logged' }] }, 40, 40);
assert.equal(cls(settled), 'failing'); assert.equal(text(settled), '');
assert.match(settled, /data-display-state="known"/, 'a settled verdict stays known past the freshness window');
assert.match(tip(settled), /Changes requested by the hive reviewer: 1 perspective posted findings[^]*· 12m ago · quality ✓ · security ✗: token logged · head f269349/);
assert.doesNotMatch(tip(settled), /activity unknown/);
});
10 changes: 6 additions & 4 deletions src/pkg/dashboard/stage_tracker_activity_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,11 +232,13 @@ func TestStageTrackerActivityApprovalRequiresConsistentBundle(t *testing.T) {
{Perspective: "quality", Backend: "backend", Model: "model", Verdict: "approve", RecordedAt: now},
{Perspective: "security", Backend: "backend", Model: "model", Verdict: "changes_requested", RecordedAt: now},
}}
if got := stageTrackerReviewActivity(pr, bundle, agg, dispatch, status, now); got.State != "unknown" {
// Neither an approval nor "unknown": the words say the evidence does
// not verify the aggregate (hivecommons/hive#16661).
if got := stageTrackerReviewActivity(pr, bundle, agg, dispatch, status, now); got.State != reviewStateUnverified || !strings.Contains(got.Caption, "evidence not verified") {
t.Fatalf("conflicting bundle became approval: %+v", got)
}
bundle.Verdicts = bundle.Verdicts[:1]
if got := stageTrackerReviewActivity(pr, bundle, agg, dispatch, status, now); got.State != "unknown" {
if got := stageTrackerReviewActivity(pr, bundle, agg, dispatch, status, now); got.State != reviewStateUnverified {
t.Fatalf("missing perspective became approval: %+v", got)
}
bundle.Verdicts = append(bundle.Verdicts, evidence.Verdict{
Expand All @@ -249,7 +251,7 @@ func TestStageTrackerActivityApprovalRequiresConsistentBundle(t *testing.T) {
}
bundle.Verdicts = append(bundle.Verdicts, evidence.Verdict{
Perspective: "security", Backend: "backend", Model: "model", Verdict: "reject", RecordedAt: now})
if got := stageTrackerReviewActivity(pr, bundle, agg, dispatch, status, now); got.State != "unknown" {
if got := stageTrackerReviewActivity(pr, bundle, agg, dispatch, status, now); got.State != reviewStateUnverified {
t.Fatalf("equal-time conflicting verdict became approval: %+v", got)
}
agg.HeadSHA = "old-head"
Expand Down Expand Up @@ -397,7 +399,7 @@ func TestStageTrackerActivityCICaptionsReadInPlainLanguage(t *testing.T) {
if got := stageTrackerCIActivity(ci(done("build"), chk("lint", "completed", "failure"), done("test")), now); got.State != "failing" || got.Active {
t.Fatalf("settled red head must not read as running: %+v", got)
}
if got := stageTrackerCIActivity(github.PullRequest{Repo: pr.Repo, Number: pr.Number, HeadSHA: pr.HeadSHA}, now); got.Caption != "CI unknown · no check results observed for this head yet" || got.Detail == "" {
if got := stageTrackerCIActivity(github.PullRequest{Repo: pr.Repo, Number: pr.Number, HeadSHA: pr.HeadSHA}, now); got.Caption != "CI · no checks observed for head head yet · refreshing" || got.Detail == "" {
t.Fatalf("no-evidence caption: %+v", got)
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/pkg/dashboard/stage_tracker_actor_icon_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ assert.strictEqual(litTitle(row), '');
// The server word wins over the heuristic: a hive stage with none → no icon.
row = stageTrackerRowHtml(pr(506, { stage: 50, caption: 'CI running', stage_actor: { kind: 'none', why: 'CI is still running' } }), stages, ctx);
assert.strictEqual(actorSvg(row).length, 0, strip(row));
assert.ok(strip(row).includes('CI unknown') && strip(row).includes('Review unknown'), 'missing evidence remains unknown in both tracks');
assert.ok(strip(row).includes('CI · no data for head') && strip(row).includes('Review · no data for head') && !strip(row).includes('activity unknown'), 'missing evidence names the head and the refresh in both tracks, never "unknown"');
assert.strictEqual(litTitle(row), '', 'an aggregate stage alone does not fabricate a reviewer or working chevron');

// An issue riding its one covering PR takes the PR's actor.
Expand Down
4 changes: 3 additions & 1 deletion src/pkg/dashboard/stage_tracker_build.go
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,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)
stageTrackerReviewPendingState(it.ReviewActivity, it.Stage, it.StageSince)
stageTrackerReviewFallbackState(it.ReviewActivity, stageTrackerReviewFallbackInputsFor(&it, pr, len(expectedPerspectives) > 0))
stageTrackerLeadApproveForSignOff(&it)
if stageTrackerClaimantStage(it.Kind, it.Stage) {
var worker *stageTrackerWorker
Expand Down Expand Up @@ -536,7 +537,7 @@ func (s *Server) buildStageTracker(status *StatusPayload, store *stagelabels.Sto
// A push projection can advance the head ahead of the cached PR list.
// Never leave old-head approval/check verdicts on the projected item.
if it.CIActivity == nil || !strings.EqualFold(it.CIActivity.Head, it.Head) {
it.CIActivity = trackerUnknownActivity(it.Head, "CI unknown · no check results observed for this head yet")
it.CIActivity = trackerUnknownActivity(it.Head, stageTrackerCINoDataCaption(it.Head))
}
if it.ReviewActivity == nil || !strings.EqualFold(it.ReviewActivity.Head, it.Head) {
currentPR := github.PullRequest{Repo: activityItem.Repo, Number: it.Number, HeadSHA: it.Head, Author: it.Author}
Expand All @@ -554,6 +555,7 @@ func (s *Server) buildStageTracker(status *StatusPayload, store *stagelabels.Sto
it.ReviewActivity = stageTrackerReviewActivity(currentPR, bundle, currentAggregate, dispatchState, status, now)
stageTrackerCountPerspectives(it.ReviewActivity, currentPR, bundle, currentAggregate, dispatchState, stageTrackerRepoQualifier(status), expectedPerspectives)
stageTrackerReviewPendingState(it.ReviewActivity, it.Stage, it.StageSince)
stageTrackerReviewFallbackState(it.ReviewActivity, stageTrackerReviewFallbackInputsFor(it, currentPR, len(expectedPerspectives) > 0))
}
activityItem.CIActivity, activityItem.ReviewActivity = it.CIActivity, it.ReviewActivity
stageTrackerApplyCodeActivity(&activityItem, dispatchState, status, now)
Expand Down
2 changes: 1 addition & 1 deletion src/pkg/dashboard/stage_tracker_claimant_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ const covered = stageTrackerRowHtml(issue(9, { stage: 40, caption: 'Covered by P
] }), stages, ctx);
const subWords = strips(covered).slice(1).map(s => text((/<li class="ham-seg active[^"]*"[^>]*>([\s\S]*?)<\/li>/.exec(s) || ['', ''])[1]));
assert.deepStrictEqual(subWords, ['Remediating · fixer', ''], JSON.stringify(subWords));
assert.ok(subs(covered)[1].includes('CI unknown') && subs(covered)[1].includes('Review unknown'), 'the PR owner is not an assigned reviewer');
assert.ok(subs(covered)[1].includes('CI · no data for head') && subs(covered)[1].includes('Review · no data for head'), 'the PR owner is not an assigned reviewer');
assert.ok(subs(covered)[1].includes('Held by: @alice'), 'ownership stays available without implying review activity');
console.log('claimant chevron ok');
`)
Expand Down
Loading
Loading