Skip to content
Closed
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-16540-activity-chevrons.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Activity Monitor rows light at most two chevrons: only running or queued CI/review tracks turn amber, unreported checks stay muted, and rows waiting on a person light only their stage.
23 changes: 19 additions & 4 deletions src/pkg/dashboard/stage_tracker_activity.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,14 @@ type StageTrackerActivity struct {
Blocker string `json:"blocker,omitempty"`
URL string `json:"url,omitempty"`
Active bool `json:"active,omitempty"`
// Check counts on the current head for the CI track (hivecommons/hive#16484):
// over the required checks when branch protection is known, otherwise
// over every check run observed on the head. ChecksTotal == 0 means no
// count could be made ("CI ?/?").
// Motion counts cover observed checks on this head, independently of the
// aggregate verdict: a missing or failed required check can coexist with
// a queued/running check. Missing checks never count as motion.
ChecksRunning int `json:"checks_running,omitempty"`
ChecksQueued int `json:"checks_queued,omitempty"`
// Verdict counts use required checks when branch protection is known,
// otherwise every check run observed on the head. ChecksTotal == 0 means
// no count could be made ("CI ?/?").
ChecksPassed int `json:"checks_passed,omitempty"`
ChecksTotal int `json:"checks_total,omitempty"`
ChecksFailed int `json:"checks_failed,omitempty"`
Expand All @@ -61,6 +65,17 @@ func stageTrackerCIActivity(pr github.PullRequest, now time.Time) *StageTrackerA
return out
}
out.Source, out.ObservedAt = a.Source, a.ObservedAt
for _, check := range a.Checks {
if check.Head != "" && !strings.EqualFold(check.Head, pr.HeadSHA) {
continue
}
switch check.State {
case "in_progress":
out.ChecksRunning++
case "queued", "waiting", "pending", "requested":
out.ChecksQueued++
}
}
if a.RequiredSource != "" {
out.Source += "+required-" + a.RequiredSource
}
Expand Down
72 changes: 52 additions & 20 deletions src/pkg/dashboard/stage_tracker_activity.test.js

Large diffs are not rendered by default.

29 changes: 29 additions & 0 deletions src/pkg/dashboard/stage_tracker_activity_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -473,3 +473,32 @@ func TestStageTrackerActivityReviewPerspectiveCounts(t *testing.T) {
t.Fatalf("old-head evidence leaked into counts: %d/%d", got.PerspectivesDone, got.PerspectivesTotal)
}
}

// A leading missing/failing verdict must not hide other checks in motion.
func TestStageTrackerCIMotionCounts(t *testing.T) {
now := time.Date(2026, 11, 4, 2, 45, 0, 0, time.UTC)
for _, known := range []bool{false, true} {
pr := github.PullRequest{HeadSHA: "head", CIActivity: &github.PRCIActivity{
Head: "head", ObservedAt: &now, StatusesKnown: true,
RequiredKnown: known, RequiredSource: "branch-protection",
Required: []string{"test"}, RequiredChecks: []github.PRRequiredCheck{{Name: "test", AppKnown: true}},
Checks: []github.PRActivityCheck{
{Name: "build", Head: "head", State: "in_progress"},
{Name: "lint", Head: "head", State: "queued"},
{Name: "old", Head: "previous-head", State: "in_progress"},
},
}}
got := stageTrackerCIActivity(pr, now)
if got.ChecksRunning != 1 || got.ChecksQueued != 1 {
t.Fatalf("known=%v: lost current-head motion: %+v", known, got)
}
if known && got.State != "missing" {
t.Fatalf("motion counts replaced the missing verdict: %+v", got)
}
pr.CIActivity.Checks = nil
got = stageTrackerCIActivity(pr, now)
if got.ChecksRunning != 0 || got.ChecksQueued != 0 || got.Active {
t.Fatalf("unreported checks fabricated motion: %+v", got)
}
}
}
1 change: 1 addition & 0 deletions src/pkg/dashboard/stage_tracker_advisory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ func TestStageTrackerAdvisoryChipAndAction(t *testing.T) {
jsFunc(t, html, "stageTrackerActorTip"),
jsFunc(t, html, "stageTrackerHeadline"),
jsFunc(t, html, "stageTrackerSegments"),
jsFunc(t, html, "stageTrackerActivityState"),
jsFunc(t, html, "stageTrackerActivityTrackHtml"),
jsFunc(t, html, "stageTrackerStripItems"),
jsFunc(t, html, "stageTrackerItemOnHold"),
Expand Down
2 changes: 2 additions & 0 deletions src/pkg/dashboard/stage_tracker_motion_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,7 @@ func TestStageTrackerMotionRowStamp(t *testing.T) {
jsConstLine(t, html, "STAGE_TRACKER_MOTION_HUMAN_MODS"),
jsFunc(t, html, "stageTrackerMotion"),
jsFunc(t, html, "stageTrackerShortAgo"),
jsFunc(t, html, "stageTrackerActivityState"),
jsFunc(t, html, "stageTrackerActivityTrackHtml"),
jsFunc(t, html, "stageTrackerStripItems"),
jsFunc(t, html, "stageTrackerCurrentStageHtml"),
Expand Down Expand Up @@ -565,6 +566,7 @@ func TestStageTrackerMotionPreviewSample(t *testing.T) {
jsFunc(t, html, "stageTrackerHeaderHtml"),
jsFunc(t, html, "stageTrackerHoldLabels"),
jsFunc(t, html, "stageTrackerSoakLeft"),
jsFunc(t, html, "stageTrackerActivityState"),
jsFunc(t, html, "stageTrackerActivityTrackHtml"),
jsFunc(t, html, "stageTrackerStripItems"),
jsFunc(t, html, "stageTrackerCurrentStageHtml"),
Expand Down
1 change: 1 addition & 0 deletions src/pkg/dashboard/stage_tracker_new_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@ func TestStageTrackerNewRowRendering(t *testing.T) {
jsFunc(t, html, "stageTrackerHumanReason"),
jsFunc(t, html, "stageTrackerHeadline"),
jsFunc(t, html, "stageTrackerSegments"),
jsFunc(t, html, "stageTrackerActivityState"),
jsFunc(t, html, "stageTrackerActivityTrackHtml"),
jsFunc(t, html, "stageTrackerStripItems"),
jsFunc(t, html, "stageTrackerTooltip"),
Expand Down
57 changes: 54 additions & 3 deletions src/pkg/dashboard/stage_tracker_remediation_chevron.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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, 'stageTrackerHiveOwnsRepair') + fn(strip, 'stageTrackerTrackWord') + fn(strip, 'stageTrackerActivityTrackHtml') + ';return stageTrackerActivityTrackHtml;')(esc, (n, cls) => `<svg class="${cls}" data-icon="${n}"></svg>`);
const track = new Function('esc', 'stageTrackerIcon', fn(strip, 'stageTrackerTrackLead') + fn(strip, 'stageTrackerHiveOwnsRepair') + fn(strip, 'stageTrackerTrackWord') + fn(strip, 'stageTrackerActivityState') + fn(strip, 'stageTrackerActivityTrackHtml') + ';return stageTrackerActivityTrackHtml;')(esc, (n, cls) => `<svg class="${cls}" data-icon="${n}"></svg>`);
const getAnchor = new Function(globals + anchor + ';return stageTrackerAnchor;')();
const segments = new Function('stageTrackerAnchor', globals + `
const STAGE_TRACKER_ACTIVE_WORD = {70: 'Fixing'};
Expand All @@ -44,12 +44,16 @@ function stageTrackerActorKind() { return ''; }
function stageTrackerActorTip() { return ''; }
function stageTrackerMotion() { return STAGE_TRACKER_MOTION_STATIC; }
function stageTrackerIcon(n) { return '<svg data-icon="' + n + '"></svg>'; }
` + fn(strip, 'stageTrackerStripItems') + ';return stageTrackerStripItems;')(esc, segments, track);
` + fn(strip, 'stageTrackerActivityState') + fn(strip, 'stageTrackerStripItems') + ';return stageTrackerStripItems;')(esc, segments, track);

const stages = [{ number: 70, branch_from: 50 }, { number: 71, branch_from: 50 }, { number: 72, branch_from: 50 }];
const now = Date.parse('2026-11-04T02:45:00Z');
const red = '2026-11-04T02:05:00Z';
const cells = item => [...renderStrip(item, stages, null, now, {}).matchAll(/<li\b[^]*?<\/li>/g)].map(m => m[0]);
const cells = item => {
const result = [...renderStrip(item, stages, null, now, {}).matchAll(/<li\b[^]*?<\/li>/g)].map(m => m[0]);
assert.ok(result.filter(cell => cell.match(/<li class="([^"]*)"/)[1].split(' ').includes('active')).length <= 2, 'every row fixture has at most two active chevrons');
return result;
};
const redPR = extra => ({
kind: 'pr', repo: 'org/repo', number: 7, head: 'abc1234def', stage: 70, modifiers: [],
ci_activity: { head: 'abc1234def', state: 'passing', caption: 'CI 11/11 passed', source: 'checks', observed_at: '2026-11-04T02:44:00Z' },
Expand Down Expand Up @@ -139,3 +143,50 @@ test('#16494 keeps: review perspectives still running stay amber beside running
assert.match(c[5], /ham-activity-track active ham-current/);
assert.match(c[5], /Review 2\/5 · reviewer-2 reviewing</);
});

const activeCells = rendered => rendered.filter(cell => cell.match(/<li class="([^"]*)"/)[1].split(' ').includes('active'));
test('#16268: owner wait, partially reported CI and approved review light only PR in progress', () => {
const item = redPR({ number: 16268, stage: 71, display_column: 30,
hold: { by: 'hanthor', reason: 'Maintainer hold' }, modifiers: ['hold'],
code_activity: { head: 'abc1234def', state: 'waiting_owner', caption: 'Waiting for @hanthor · not coding' },
ci_activity: { head: 'abc1234def', state: 'missing', checks_passed: 7, checks_total: 11, blocker: 'test', observed_at: '2026-11-04T02:44:00Z' },
review_activity: { head: 'abc1234def', state: 'approved', perspectives_done: 5, perspectives_total: 5, observed_at: '2026-11-04T02:44:00Z' },
});
const c = cells(item);
assert.equal(activeCells(c).length, 1);
assert.match(c[3], /ham-seg active[^]*Waiting for @hanthor/);
assert.match(c[4], /ham-activity-track done decided[^]*CI 7\/11 · test not reported/);
assert.match(c[5], /ham-activity-track done[^]*Review 5\/5 approved/);
assert.doesNotMatch(c[4] + c[5], /data-motion=/);
});

test('row invariant across stages, track states, head freshness and human waits', () => {
const ciStates = ['unknown', 'missing', 'skipped', 'passing', 'failing', 'running', 'queued'];
const reviewStates = ['unknown', 'unassigned', 'approved', 'human_decision', 'changes_requested', 'reviewing', 'assigned'];
for (const stage of [30, 50, 70, 71, 72, 74, 85, 110]) {
for (const ci of ciStates) for (const review of reviewStates) {
for (const wait of ['none', 'owner', 'held', 'needs-human']) for (const age of ['fresh', 'stale', 'old-head']) {
const observation = { head: age === 'old-head' ? 'older' : 'abc1234def', observed_at: age === 'stale' ? red : '2026-11-04T02:44:00Z', active: true };
const item = redPR({ stage, display_column: 30, modifiers: wait === 'held' ? ['hold'] : [],
needs_human: wait === 'needs-human',
code_activity: { head: 'abc1234def', state: wait === 'owner' ? 'waiting_owner' : 'fixing', caption: 'Source work', active: true, source: 'fix-dispatch+successful-edit+verified-git-worktree', observed_at: '2026-11-04T02:44:00Z' },
ci_activity: { ...observation, state: ci, active: ci === 'running' },
review_activity: { ...observation, state: review },
});
const c = cells(item);
if (wait !== 'none') assert.doesNotMatch(c[4] + c[5], /ham-activity-track active|data-motion=/);
}
}
}
});

test('#16509: adopted repair with missing checks and a complete review has one active chevron', () => {
const c = cells(redPR({ stage: 74, display_column: 30,
code_activity: { head: 'abc1234def', state: 'adopted', caption: 'Adopted by hive · activity' },
ci_activity: { head: 'abc1234def', state: 'missing', checks_passed: 7, checks_total: 11, blocker: 'test', observed_at: '2026-11-04T02:44:00Z' },
review_activity: { head: 'abc1234def', state: 'human_decision', perspectives_done: 5, perspectives_total: 5, active: true, observed_at: '2026-11-04T02:44:00Z' },
}));
assert.equal(activeCells(c).length, 1);
assert.match(c[4], /ham-activity-track pending[^]*CI 7\/11 · test not reported/);
assert.match(c[5], /ham-activity-track done decided[^]*Review 5\/5 · changes requested/);
});
1 change: 1 addition & 0 deletions src/pkg/dashboard/stage_tracker_repo_grouping_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ func stageTrackerRepoGroupingHarness(t *testing.T, html string) string {
jsFunc(t, html, "stageTrackerMotion"),
jsFunc(t, html, "stageTrackerHoldLabels"),
jsFunc(t, html, "stageTrackerSoakLeft"),
jsFunc(t, html, "stageTrackerActivityState"),
jsFunc(t, html, "stageTrackerActivityTrackHtml"),
jsFunc(t, html, "stageTrackerStripItems"),
jsFunc(t, html, "stageTrackerCurrentStageHtml"),
Expand Down
11 changes: 10 additions & 1 deletion src/pkg/dashboard/stage_tracker_ui_prelude_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ func stageTrackerRowsPreludeJS(t *testing.T, html string) string {
jsFunc(t, html, "stageTrackerSoakLeft"),
jsFunc(t, html, "stageTrackerHiveOwnsRepair"),
jsFunc(t, html, "stageTrackerTrackWord"),
jsFunc(t, html, "stageTrackerActivityState"),
jsFunc(t, html, "stageTrackerActivityTrackHtml"),
jsFunc(t, html, "stageTrackerStripItems"),
jsFunc(t, html, "stageTrackerCurrentStageHtml"),
Expand Down Expand Up @@ -197,7 +198,15 @@ var _stageTracker = { stages };
// fixture pairing it with 050/060 would draw a contradictory row.
const rebaseCoherent = (it) => { if ((it.modifiers || []).includes('needs-rebase')) assert.ok(![50, 60].includes(Number(it.stage)), 'fixture #' + it.number + ' pairs needs-rebase with stage ' + it.stage); (it.linked_prs || []).forEach(rebaseCoherent); };
const rawRowHtml = stageTrackerRowHtml;
stageTrackerRowHtml = (item, stages, ctx) => { rebaseCoherent(item); return rawRowHtml(item, stages, ctx); };
stageTrackerRowHtml = (item, stages, ctx) => {
rebaseCoherent(item);
const row = rawRowHtml(item, stages, ctx);
for (const strip of row.matchAll(/<ol class="ham-strip" aria-label="Pipeline progress">([\s\S]*?)<\/ol>/g)) {
const active = [...strip[1].matchAll(/<li class="([^"]*)"/g)].filter(m => m[1].split(' ').includes('active'));
assert.ok(active.length <= 2, 'row fixture exceeds two active chevrons: ' + JSON.stringify(item));
}
return row;
};
// A row is a title line, its strip, then zero or more nested PR sub-rows.
const strips = (row) => row.split('aria-label="Pipeline progress"').slice(1);
const strip = (row) => strips(row)[0].split('<div class="ham-sub"')[0];
Expand Down
10 changes: 4 additions & 6 deletions src/pkg/dashboard/static-src/css/tracker.css
Original file line number Diff line number Diff line change
Expand Up @@ -368,12 +368,10 @@
layerize pass of the page every vsync (#13764). ::after is the
movement effects' (flash / ripple / wash). */
.ham-seg.active { background: var(--amber); color: var(--surface-0); }
/* A CI / Review track wears its own state on the current head
(hivecommons/hive#16484): in progress = the full .active fill, done =
.done, a finding (red CI, changes requested) = .failing in the error
colour, not started = .todo with the glyph alone. No muted
"current-phase" tint: the operator reads the words, not the shade.
Only fresh observed work earns the pulse. */
/* Amber means observed running/queued work. Pending tracks retain their
count words; a stage waiting on both tracks stays bright and still. */
.ham-seg.settled-current { background: var(--panel-strong); color: var(--text); opacity: 1; box-shadow: none; }
.ham-seg.ham-activity-track.pending { background: var(--surface-3); color: var(--muted); opacity: 1; box-shadow: none; }
.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; }
Expand Down
Loading
Loading