diff --git a/changelog.d/fixed-16540-activity-chevrons.md b/changelog.d/fixed-16540-activity-chevrons.md new file mode 100644 index 0000000000..4cc08bcc5d --- /dev/null +++ b/changelog.d/fixed-16540-activity-chevrons.md @@ -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. diff --git a/src/pkg/dashboard/stage_tracker_activity.go b/src/pkg/dashboard/stage_tracker_activity.go index 469aa9bce1..12ae00fe11 100644 --- a/src/pkg/dashboard/stage_tracker_activity.go +++ b/src/pkg/dashboard/stage_tracker_activity.go @@ -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"` @@ -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 } diff --git a/src/pkg/dashboard/stage_tracker_activity.test.js b/src/pkg/dashboard/stage_tracker_activity.test.js index 33a005507f..7f294a9d0b 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, 'stageTrackerHiveOwnsRepair') + 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, 'stageTrackerActivityState') + 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'); @@ -116,12 +116,13 @@ function stageTrackerActorKind() { return ''; } function stageTrackerActorTip() { return ''; } function stageTrackerMotion() { return STAGE_TRACKER_MOTION_STATIC; } function stageTrackerIcon(n) { return ''; } -` + fn(strip, 'stageTrackerStripItems') + ';return stageTrackerStripItems;')(esc, segments, track, ...Object.values(helpers)); +` + fn(strip, 'stageTrackerActivityState') + fn(strip, 'stageTrackerStripItems') + ';return stageTrackerStripItems;')(esc, segments, track, ...Object.values(helpers)); const renderStrip = makeStripRenderer(); function physicalTracks(item) { const rendered = renderStrip(item, stages, null, now, {}); const cells = [...rendered.matchAll(//g)].map(match => match[0]); + assert.ok(cells.filter(cell => cell.match(/
  • 1 ? { to: 20 } : item !== row && linked.length > 1 ? { from: 30 } : null; const rendered = renderStrip(item, fixtureStages, range, clock, {}); const cells = [...rendered.matchAll(//g)].map(match => match[0]); + assert.ok(cells.filter(cell => cell.match(/
  • /class="ham-seg blank"/.test(cell)), 'nested PRs reserve the physical Open–Claimed slots'); @@ -474,7 +476,7 @@ test('Hive #16434 shape: missing current-head CI and review stay unknown but vis review_activity: { head: 'head', state: 'unknown', caption: 'Review unknown · current-head evidence unavailable', source: 'unavailable' }, })); for (const cell of [cells.ci, cells.review]) { - assert.match(cell, /ham-activity-track active ham-current/, 'absent evidence in the current phase is still in progress: lit, with words'); + assert.match(cell, /ham-activity-track pending ham-current/, 'absent evidence retains words without claiming work'); assert.match(cell, /data-activity-state="unknown"/); assert.match(cell, /data-display-state="unknown"/); assert.doesNotMatch(cell, /data-motion=|ham-activity-track done/); @@ -484,7 +486,7 @@ test('Hive #16434 shape: missing current-head CI and review stay unknown but vis assert.doesNotMatch(cells.cells[3], /aria-current|data-motion/); }); -test('Hive #16268 shape: held native Fixing waits for a fixer in the CI/Review phase, not observed coding', () => { +test('held native Fixing lights the stage while tracks remain settled', () => { const item = livePR({ stage: 70, modifiers: ['hold'], hold: { by: 'hanthor', reason: 'Maintainer hold' }, display_column: 50, code_activity: { head: 'head', state: 'waiting_fixer', caption: 'Waiting for fixer · no code work observed', source: 'native-fix-request' }, @@ -492,11 +494,12 @@ test('Hive #16268 shape: held native Fixing waits for a fixer in the CI/Review p review_activity: activity('approved', 'Review approved'), }); const cells = physicalTracks(item); - assert.match(cells.ci, /active ham-current/); + assert.match(cells.ci, /done decided/); + assert.match(cells.cells[3], /class="ham-seg active/); assert.match(cells.ci, /CI \?\/\? · no checks reported yet(?:Fixing|Remediating) ·/); assert.equal(item.stage, 70); @@ -508,12 +511,12 @@ test('current phase, running activity, failure and successful completion are ind ['failing', 'CI failing · "build" red', false, 'failing'], ['running', 'CI running · 1/2 checks done', true, 'active'], ['passing', 'CI green · all 2 required checks passed', false, 'done'], - ['skipped', 'CI skipped · check "build" skipped', false, 'active'], + ['skipped', 'CI skipped · check "build" skipped', false, 'pending'], ]) { const cells = physicalTracks(livePR({ ci_activity: activity(state, caption, running) })); assert.ok(cells.ci.includes('ham-activity-track ' + cls + ' ham-current'), state + ' → ' + cls); assert.equal(cells.ci.includes('data-motion="active"'), running); - assert.match(cells.review, /active ham-current[^]*data-activity-state="unknown"/); + assert.match(cells.review, /pending ham-current[^]*data-activity-state="unknown"/); } const admitted = physicalTracks(livePR({ stage: 80, ci_activity: activity('passing', 'CI green · all 2 required checks passed'), review_activity: activity('approved', 'Review approved') })); assert.doesNotMatch(admitted.ci + admitted.review, /ham-current|aria-current/); @@ -536,10 +539,10 @@ test('old-head or stale observations cannot fabricate running/completion, but do } if (mode === 'old-head') { assert.match(cells.review, /data-activity-state="unknown"/); - assert.match(cells.ci, /active ham-current[^]*CI \?\/\? · no checks reported yet \.ham-strip-row, \.ham-sub > \.ham-strip-row, \.ham-cols > \.ham-strip-row \{ overflow-x: auto; \}/); }); -test('real source repair can show three concurrent activities without naming a generic worker as reviewer', () => { +test('both running tracks take priority over source repair without losing its words', () => { const row = fs.readFileSync(path.join(root, 'tracker-row.js'), 'utf8'); const definitions = globals + ` const STAGE_TRACKER_HUMAN_GATED = 85, STAGE_TRACKER_READY_FOR_HUMAN_MERGE = 90, STAGE_TRACKER_ADOPTED_BY_HIVE = 74; @@ -632,7 +635,7 @@ function stageTrackerActorKind() { return ''; } function stageTrackerActorTip() { return ''; } function stageTrackerMotion() { return 'active'; } function stageTrackerIcon(n, cls) { return ''; } -` + anchor + fn(row, 'stageTrackerSegments') + fn(strip, 'stageTrackerActivityTrackHtml') + fn(strip, 'stageTrackerStripItems'); +` + anchor + fn(row, 'stageTrackerSegments') + fn(strip, 'stageTrackerActivityState') + fn(strip, 'stageTrackerActivityTrackHtml') + fn(strip, 'stageTrackerStripItems'); const render = new Function('esc', definitions + ';return stageTrackerStripItems;')(esc); const item = { kind: 'pr', stage: 70, head: 'head', display_column: 30, ci_activity: activity('running', 'CI running · 1/2 checks done', true), @@ -641,7 +644,9 @@ function stageTrackerIcon(n, cls) { return ''; } }; const html = render(item, [{ number: 30, short: 'PR in progress' }, { number: 50, short: 'CI / Review' }, { number: 70, short: 'Fixing', branch_from: 50 }], null, now, {}); assert.equal((html.match(/
  • m[1].split(' ').includes('active')).length, 2); + assert.match(html, /class="ham-seg settled-current detoured"/); assert.match(html, /ham-detour[^>]*>Remediating · fixer/); assert.match(html, /data-track="review"[^]*Review working · reviewer/); item.code_activity.observed_at = new Date(now - 300000).toISOString(); @@ -661,7 +666,7 @@ test('stale activity is visibly unknown in the tooltip, never pulses, and still assert.match(html, /activity unknown · last observed reviewing/); 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>Review 1\/5 · reviewer reviewing]*><\/svg>Review 1\/5 · reviewer reviewing { +test('#16484 screenshot counts survive pending tracks and owner waits', () => { const head = 'd3c0824304d4c97b8ee76a267fb1e91f6d4c79a4'; const fresh = (state, extra = {}) => ({ head, state, caption: state, source: 'cache', observed_at: new Date(now).toISOString(), ...extra }); const text = cell => cell.match(/aria-describedby="[^"]+">([^]*?)]*>/g, ''); const cls = cell => cell.match(/class="ham-seg ham-activity-track ([a-z]+)/)[1]; - // #16456: CI running on the new head while the re-review is pending → BOTH lit, counts disambiguate. + // #16456: CI runs on the new head while the re-review is pending; only CI is amber. let cells = physicalTracks(livePR({ head, stage: 70, display_column: 50, push: { state: 'pushed', sha: head, next: 're-review' }, code_activity: { head, state: 'pushed', caption: 'New head pushed · CI and re-review', source: 'recorded-push' }, ci_activity: fresh('running', { checks_passed: 9, checks_total: 14, active: true }), review_activity: fresh('unknown', { perspectives_done: 0, perspectives_total: 5 }) })); assert.equal(cls(cells.ci), 'active'); assert.equal(text(cells.ci), 'CI 9/14 · running'); assert.match(cells.ci, /data-motion="active"/); - assert.equal(cls(cells.review), 'active'); assert.equal(text(cells.review), 'Review 0/5 · re-review pending (new head)'); + assert.equal(cls(cells.review), 'pending'); assert.equal(text(cells.review), 'Review 0/5 · re-review pending (new head)'); assert.doesNotMatch(cells.review, /data-motion/); assert.match(cells.review, /hive is waiting on CI for new head d3c0824/, 'the tooltip still says which track leads'); // #16491: review swarm requested, no bundle yet; CI shows its count. cells = physicalTracks(livePR({ head, stage: 50, display_column: 50, ci_activity: fresh('running', { checks_passed: 2, checks_total: 14 }), review_activity: fresh('unassigned', { perspectives_done: 0, perspectives_total: 5, blocker: 'no reviewer free' }) })); - assert.equal(cls(cells.review), 'active'); assert.equal(text(cells.review), 'Review 0/5 · swarm requested'); + assert.equal(cls(cells.review), 'pending'); assert.equal(text(cells.review), 'Review 0/5 · swarm requested'); assert.equal(cls(cells.ci), 'active'); assert.equal(text(cells.ci), 'CI 2/14 · running'); // #16268: CI failed native-queue-policy, review approved, held. cells = physicalTracks(livePR({ head, stage: 70, display_column: 50, modifiers: ['hold'], hold: { by: 'hanthor', pill: 'Held by @hanthor' }, ci_activity: fresh('failing', { checks_passed: 13, checks_total: 14, checks_failed: 1, checks_failing: ['native-queue-policy'], blocker: 'native-queue-policy' }), review_activity: fresh('approved', { perspectives_done: 5, perspectives_total: 5 }) })); - assert.equal(cls(cells.ci), 'failing'); assert.equal(text(cells.ci), 'CI 13/14 · 1 failing (native-queue-policy)'); + assert.equal(cls(cells.ci), 'done'); assert.equal(text(cells.ci), 'CI 13/14 · 1 failing (native-queue-policy)'); assert.equal(cls(cells.review), 'done'); assert.equal(text(cells.review), 'Review 5/5 approved'); assert.match(cells.review, /Held by @hanthor/); // Not started: a PR still being written (column 30) with no evidence shows the glyph alone, never lit. @@ -783,3 +788,30 @@ test('#16484: the three screenshot rows — both tracks lit with counts, swarm r assert.match(cell, / { + for (const state of ['missing', 'failing', 'unknown']) for (const motion of ['checks_queued', 'checks_running']) { + const item = livePR({ stage: 70, display_column: 30, + code_activity: activity('fixing', 'Fixing · fixer', true), + ci_activity: { ...activity(state, 'CI partially reported'), [motion]: 1, checks_passed: 7, checks_total: 11, blocker: 'test' }, + review_activity: activity('approved', 'Review approved'), + }); + const c = physicalTracks(item); + assert.match(c.cells[3], /class="ham-seg active/); + assert.match(c.ci, /ham-activity-track active/); + assert.match(c.review, /ham-activity-track done/); + assert.doesNotMatch(c.ci, /data-motion=/, 'motion counts do not invent a worker pulse'); + } +}); + +test('a pending CI track stays muted beside the only running review track', () => { + const c = physicalTracks(livePR({ stage: 70, display_column: 30, + code_activity: activity('fixing', 'Fixing · fixer', true), + ci_activity: { ...activity('missing', 'CI waiting'), checks_passed: 7, checks_total: 11, blocker: 'test' }, + review_activity: activity('assigned', 'Review queued · reviewer'), + })); + assert.match(c.cells[3], /class="ham-seg active/); + assert.match(c.ci, /ham-activity-track pending[^]*CI 7\/11 · test not reported/); + assert.match(c.review, /ham-activity-track active/); + assert.doesNotMatch(c.review, /data-motion=/); +}); diff --git a/src/pkg/dashboard/stage_tracker_activity_test.go b/src/pkg/dashboard/stage_tracker_activity_test.go index 6b74436097..33bece2351 100644 --- a/src/pkg/dashboard/stage_tracker_activity_test.go +++ b/src/pkg/dashboard/stage_tracker_activity_test.go @@ -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) + } + } +} diff --git a/src/pkg/dashboard/stage_tracker_advisory_test.go b/src/pkg/dashboard/stage_tracker_advisory_test.go index 2b3fc7b1cc..7fb4154a11 100644 --- a/src/pkg/dashboard/stage_tracker_advisory_test.go +++ b/src/pkg/dashboard/stage_tracker_advisory_test.go @@ -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"), diff --git a/src/pkg/dashboard/stage_tracker_motion_test.go b/src/pkg/dashboard/stage_tracker_motion_test.go index 172e70d097..7b243c8a20 100644 --- a/src/pkg/dashboard/stage_tracker_motion_test.go +++ b/src/pkg/dashboard/stage_tracker_motion_test.go @@ -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"), @@ -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"), diff --git a/src/pkg/dashboard/stage_tracker_new_test.go b/src/pkg/dashboard/stage_tracker_new_test.go index f7e97fe328..21e268dae4 100644 --- a/src/pkg/dashboard/stage_tracker_new_test.go +++ b/src/pkg/dashboard/stage_tracker_new_test.go @@ -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"), diff --git a/src/pkg/dashboard/stage_tracker_remediation_chevron.test.js b/src/pkg/dashboard/stage_tracker_remediation_chevron.test.js index e1cb24e5c9..c6e6d4d02b 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, 'stageTrackerHiveOwnsRepair') + 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, 'stageTrackerActivityState') + 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'}; @@ -44,12 +44,16 @@ function stageTrackerActorKind() { return ''; } function stageTrackerActorTip() { return ''; } function stageTrackerMotion() { return STAGE_TRACKER_MOTION_STATIC; } function stageTrackerIcon(n) { return ''; } -` + 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(//g)].map(m => m[0]); +const cells = item => { + const result = [...renderStrip(item, stages, null, now, {}).matchAll(//g)].map(m => m[0]); + assert.ok(result.filter(cell => cell.match(/
  • ({ 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' }, @@ -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 rendered.filter(cell => cell.match(/
  • { + 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/); +}); diff --git a/src/pkg/dashboard/stage_tracker_repo_grouping_test.go b/src/pkg/dashboard/stage_tracker_repo_grouping_test.go index cbfb593f47..534bb60b90 100644 --- a/src/pkg/dashboard/stage_tracker_repo_grouping_test.go +++ b/src/pkg/dashboard/stage_tracker_repo_grouping_test.go @@ -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"), diff --git a/src/pkg/dashboard/stage_tracker_ui_prelude_test.go b/src/pkg/dashboard/stage_tracker_ui_prelude_test.go index 8be70f52a6..f6a8993378 100644 --- a/src/pkg/dashboard/stage_tracker_ui_prelude_test.go +++ b/src/pkg/dashboard/stage_tracker_ui_prelude_test.go @@ -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"), @@ -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(/
      ([\s\S]*?)<\/ol>/g)) { + const active = [...strip[1].matchAll(/
    1. 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('
      0 || Number(a.checks_queued) > 0))) return ''; const n = k => matches ? Number(a[k]) || 0 : 0; if (kind === 'ci') { const total = n('checks_total'); @@ -95,14 +95,37 @@ return !!(hive || item.stage === 74 || item.adopted_by); } + // Only observed current-head work earns amber. Ownership waits suppress + // both tracks, even if their last observation still says running. + function stageTrackerActivityState(item, nowMs) { + const code = item.code_activity; + const mods = Array.isArray(item.modifiers) ? item.modifiers : []; + const ownerWait = !code && [71, 72].includes(Number(item.stage)) && + !(item.push && ['pushed', 'checking'].includes(item.push.state)); + const waitingOnPerson = !!(item.hold || item.on_hold || item.needs_human || + mods.some(m => ['hold', 'needs-human', 'needs-decision', 'unauthorized'].includes(m)) || + (code && code.head === item.head && code.state === 'waiting_owner') || + ownerWait || [45, 85, 90].includes(Number(item.stage))); + const clock = Number(nowMs) || Date.now(); + const running = kind => { + const a = item[kind + '_activity']; + const observed = Date.parse(a && a.observed_at || ''); + if (Number(item.stage) >= 110 || waitingOnPerson || !a || !item.head || a.head !== item.head || + !Number.isFinite(observed) || observed > clock || clock - observed > 2 * 60 * 1000) return false; + return kind === 'ci' + ? !!(a.active || Number(a.checks_running) > 0 || Number(a.checks_queued) > 0 || ['running', 'queued'].includes(a.state)) + : ['reviewing', 'adjudicating', 'assigned'].includes(a.state); + }; + return { waitingOnPerson, ci: running('ci'), review: running('review') }; + } + // 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 // stageTrackerTrackWord (hivecommons/hive#16484). Style follows the - // track's own state on the current head: in progress = the full active - // fill (both tracks may be lit at once; the words disambiguate), done = - // the passed-stage style, a finding = the failing style, not started = - // the empty chevron with the glyph alone. Freshness gates only the pulse. + // track's own state on the current head: running/queued = active, done = + // the passed-stage style, a finding = failing, missing = pending with + // its words. Stale work keeps its words without claiming current motion. function stageTrackerActivityTrackHtml(item, kind, sg, blank, nowMs) { if (blank) return `
    2. `; const name = kind === 'ci' ? 'CI' : 'Review'; @@ -116,7 +139,9 @@ 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 activity = stageTrackerActivityState(item, nowMs); + const running = activity[kind]; + const active = running && known && a.active; 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 : ''); @@ -124,8 +149,8 @@ const finding = matches && (state === 'failing' || state === 'changes_requested'); // 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 settled = matches && (state === 'human_decision' || activity.waitingOnPerson); + const cls = running ? 'active' : finished ? 'done' : settled ? 'done decided' : finding ? 'failing' : text ? 'pending' : '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() : ''; @@ -168,6 +193,18 @@ // whose move it is); passed and upcoming chevrons have none. function stageTrackerStripItems(item, stages, range, nowMs, ctx) { const segs = stageTrackerSegments(item, stages, nowMs, ctx); + const activity = stageTrackerActivityState(item, nowMs); + // A held repair belongs to PR in progress, even if an older payload + // projected its wait onto the CI / Review phase. + const phase = segs.find(sg => sg.number === 50 && sg.state === 'active'); + if (activity.waitingOnPerson && phase) { + const progress = segs.find(sg => sg.number === 30); + Object.assign(progress, { state: 'active', short: 'PR in progress', detour: phase.detour }); + phase.state = 'todo'; + phase.detour = null; + } + const tracksVisible = (!range || range.from == null || range.from <= 50) && (!range || range.to == null || range.to >= 50); + const stageSettled = tracksVisible && activity.ci && activity.review; const trains = ctx && ctx.trains; const curStage = Number(item.stage) || 0; const from = range && range.from != null ? range.from : -Infinity; @@ -222,7 +259,7 @@ const sentinel = !!(sg.detour && sg.detour.sentinel); const sentinelSuffix = !!(sg.detour && sg.detour.sentinelSuffix); const fixPushed = sg.number === 30 && sg.state === 'done' && remediation === 'fix_pushed'; - const cls = ['ham-seg', sg.state, sg.cap ? 'cap' : '', fixPushed ? 'ham-fix-pushed' : '', sg.state === 'active' && sg.number === 30 && remediation ? 'ham-remediation-' + remediation : '', sg.cap && sg.terminal ? 'merged' : '', sg.detour ? 'detoured' : '', sg.hold ? 'ham-open-hold' : '', sg.blocked ? 'ham-open-blocked' : '', sg.draft ? 'ham-open-draft' : '', sg.isNew ? 'ham-open-new' : '', sg.advisory ? 'ham-open-advisory' : '', sg.openSince && sg.openSince.stale ? 'ham-open-stale' : '', sentinel || sentinelSuffix ? 'ham-sentinel' : ''].filter(Boolean).join(' '); + const cls = ['ham-seg', sg.state === 'active' && stageSettled ? 'settled-current' : sg.state, sg.cap ? 'cap' : '', fixPushed ? 'ham-fix-pushed' : '', sg.state === 'active' && sg.number === 30 && remediation ? 'ham-remediation-' + remediation : '', sg.cap && sg.terminal ? 'merged' : '', sg.detour ? 'detoured' : '', sg.hold ? 'ham-open-hold' : '', sg.blocked ? 'ham-open-blocked' : '', sg.draft ? 'ham-open-draft' : '', sg.isNew ? 'ham-open-new' : '', sg.advisory ? 'ham-open-advisory' : '', sg.openSince && sg.openSince.stale ? 'ham-open-stale' : '', sentinel || sentinelSuffix ? 'ham-sentinel' : ''].filter(Boolean).join(' '); const active = sg.state === 'active'; let tip = ''; let gateCaption = ''; @@ -308,7 +345,7 @@ const tipID = 'ham-chevron-tip-' + [item.repo || '', item.kind || '', item.number || 0, sg.number].map(x => encodeURIComponent(String(x))).join('-'); inner = `${stageTrackerIcon(sg.number, 'ham-ico')}${esc(code.caption)}${esc(pushedTip)}`; } else inner = stageTrackerIcon(sg.number, 'ham-ico'); - return `
    3. ${inner}
    4. `; + return `
    5. ${inner}
    6. `; }).join(''); } diff --git a/src/pkg/dashboard/static/index.html b/src/pkg/dashboard/static/index.html index 58d56b99ef..3810136d8e 100644 --- a/src/pkg/dashboard/static/index.html +++ b/src/pkg/dashboard/static/index.html @@ -1705,12 +1705,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; } @@ -17833,12 +17831,12 @@

      Where to get help

      // re-review pending (new head)", "Review 2/5 · awaiting human // decision". '' means the track has not started on this head (the // chevron shows its glyph alone). current: column 50 is the row's - // active phase, so even absent evidence is "in progress" there. + // current phase, so absent evidence still gets explanatory words there. function stageTrackerTrackWord(item, kind, current) { const a = item && item[kind + '_activity']; const matches = !!(a && item.head && a.head === item.head); const state = matches ? a.state || 'unknown' : 'unknown'; - if (state === 'unknown' && !current) return ''; + if (state === 'unknown' && !current && !(kind === 'ci' && matches && (Number(a.checks_running) > 0 || Number(a.checks_queued) > 0))) return ''; const n = k => matches ? Number(a[k]) || 0 : 0; if (kind === 'ci') { const total = n('checks_total'); @@ -17885,14 +17883,37 @@

      Where to get help

      return !!(hive || item.stage === 74 || item.adopted_by); } + // Only observed current-head work earns amber. Ownership waits suppress + // both tracks, even if their last observation still says running. + function stageTrackerActivityState(item, nowMs) { + const code = item.code_activity; + const mods = Array.isArray(item.modifiers) ? item.modifiers : []; + const ownerWait = !code && [71, 72].includes(Number(item.stage)) && + !(item.push && ['pushed', 'checking'].includes(item.push.state)); + const waitingOnPerson = !!(item.hold || item.on_hold || item.needs_human || + mods.some(m => ['hold', 'needs-human', 'needs-decision', 'unauthorized'].includes(m)) || + (code && code.head === item.head && code.state === 'waiting_owner') || + ownerWait || [45, 85, 90].includes(Number(item.stage))); + const clock = Number(nowMs) || Date.now(); + const running = kind => { + const a = item[kind + '_activity']; + const observed = Date.parse(a && a.observed_at || ''); + if (Number(item.stage) >= 110 || waitingOnPerson || !a || !item.head || a.head !== item.head || + !Number.isFinite(observed) || observed > clock || clock - observed > 2 * 60 * 1000) return false; + return kind === 'ci' + ? !!(a.active || Number(a.checks_running) > 0 || Number(a.checks_queued) > 0 || ['running', 'queued'].includes(a.state)) + : ['reviewing', 'adjudicating', 'assigned'].includes(a.state); + }; + return { waitingOnPerson, ci: running('ci'), review: running('review') }; + } + // 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 // stageTrackerTrackWord (hivecommons/hive#16484). Style follows the - // track's own state on the current head: in progress = the full active - // fill (both tracks may be lit at once; the words disambiguate), done = - // the passed-stage style, a finding = the failing style, not started = - // the empty chevron with the glyph alone. Freshness gates only the pulse. + // track's own state on the current head: running/queued = active, done = + // the passed-stage style, a finding = failing, missing = pending with + // its words. Stale work keeps its words without claiming current motion. function stageTrackerActivityTrackHtml(item, kind, sg, blank, nowMs) { if (blank) return ``; const name = kind === 'ci' ? 'CI' : 'Review'; @@ -17906,7 +17927,9 @@

      Where to get help

      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 activity = stageTrackerActivityState(item, nowMs); + const running = activity[kind]; + const active = running && known && a.active; 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 : ''); @@ -17914,8 +17937,8 @@

      Where to get help

      const finding = matches && (state === 'failing' || state === 'changes_requested'); // 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 settled = matches && (state === 'human_decision' || activity.waitingOnPerson); + const cls = running ? 'active' : finished ? 'done' : settled ? 'done decided' : finding ? 'failing' : text ? 'pending' : '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() : ''; @@ -17958,6 +17981,18 @@

      Where to get help

      // whose move it is); passed and upcoming chevrons have none. function stageTrackerStripItems(item, stages, range, nowMs, ctx) { const segs = stageTrackerSegments(item, stages, nowMs, ctx); + const activity = stageTrackerActivityState(item, nowMs); + // A held repair belongs to PR in progress, even if an older payload + // projected its wait onto the CI / Review phase. + const phase = segs.find(sg => sg.number === 50 && sg.state === 'active'); + if (activity.waitingOnPerson && phase) { + const progress = segs.find(sg => sg.number === 30); + Object.assign(progress, { state: 'active', short: 'PR in progress', detour: phase.detour }); + phase.state = 'todo'; + phase.detour = null; + } + const tracksVisible = (!range || range.from == null || range.from <= 50) && (!range || range.to == null || range.to >= 50); + const stageSettled = tracksVisible && activity.ci && activity.review; const trains = ctx && ctx.trains; const curStage = Number(item.stage) || 0; const from = range && range.from != null ? range.from : -Infinity; @@ -18012,7 +18047,7 @@

      Where to get help

      const sentinel = !!(sg.detour && sg.detour.sentinel); const sentinelSuffix = !!(sg.detour && sg.detour.sentinelSuffix); const fixPushed = sg.number === 30 && sg.state === 'done' && remediation === 'fix_pushed'; - const cls = ['ham-seg', sg.state, sg.cap ? 'cap' : '', fixPushed ? 'ham-fix-pushed' : '', sg.state === 'active' && sg.number === 30 && remediation ? 'ham-remediation-' + remediation : '', sg.cap && sg.terminal ? 'merged' : '', sg.detour ? 'detoured' : '', sg.hold ? 'ham-open-hold' : '', sg.blocked ? 'ham-open-blocked' : '', sg.draft ? 'ham-open-draft' : '', sg.isNew ? 'ham-open-new' : '', sg.advisory ? 'ham-open-advisory' : '', sg.openSince && sg.openSince.stale ? 'ham-open-stale' : '', sentinel || sentinelSuffix ? 'ham-sentinel' : ''].filter(Boolean).join(' '); + const cls = ['ham-seg', sg.state === 'active' && stageSettled ? 'settled-current' : sg.state, sg.cap ? 'cap' : '', fixPushed ? 'ham-fix-pushed' : '', sg.state === 'active' && sg.number === 30 && remediation ? 'ham-remediation-' + remediation : '', sg.cap && sg.terminal ? 'merged' : '', sg.detour ? 'detoured' : '', sg.hold ? 'ham-open-hold' : '', sg.blocked ? 'ham-open-blocked' : '', sg.draft ? 'ham-open-draft' : '', sg.isNew ? 'ham-open-new' : '', sg.advisory ? 'ham-open-advisory' : '', sg.openSince && sg.openSince.stale ? 'ham-open-stale' : '', sentinel || sentinelSuffix ? 'ham-sentinel' : ''].filter(Boolean).join(' '); const active = sg.state === 'active'; let tip = ''; let gateCaption = ''; @@ -18098,7 +18133,7 @@

      Where to get help

      const tipID = 'ham-chevron-tip-' + [item.repo || '', item.kind || '', item.number || 0, sg.number].map(x => encodeURIComponent(String(x))).join('-'); inner = `${stageTrackerIcon(sg.number, 'ham-ico')}${esc(code.caption)}${esc(pushedTip)}`; } else inner = stageTrackerIcon(sg.number, 'ham-ico'); - return `
    7. ${inner}
    8. `; + return `
    9. ${inner}
    10. `; }).join(''); }