diff --git a/changelog.d/fixed-ci-activity-unknown-caption.md b/changelog.d/fixed-ci-activity-unknown-caption.md new file mode 100644 index 0000000000..056a4e8cfa --- /dev/null +++ b/changelog.d/fixed-ci-activity-unknown-caption.md @@ -0,0 +1 @@ +- Activity Monitor stage tracker: a PR head whose checks are still reporting now reads `CI running · 4 checks pending` (chevron `CI 7/11 · 4 running`, or the last one or two unfinished names) instead of `CI activity unknown · last observed missing` / `CI unknown · no check results observed` / `no verdict yet`; a required check with no run while others still execute is one sentence in the tooltip rather than the "missing" verdict; the "no check results observed" wording is reserved for a head with zero check runs; and the chevron tooltip states each fact once (count word, detail sentence, head, source, observation time) instead of repeating the unreported check four times (#16630). Check names embedded in captions and chevron text are wrapped in single quotes. diff --git a/src/pkg/dashboard/stage_tracker_activity.go b/src/pkg/dashboard/stage_tracker_activity.go index 0302221485..dcefe29406 100644 --- a/src/pkg/dashboard/stage_tracker_activity.go +++ b/src/pkg/dashboard/stage_tracker_activity.go @@ -39,6 +39,10 @@ type StageTrackerActivity struct { ChecksTotal int `json:"checks_total,omitempty"` ChecksFailed int `json:"checks_failed,omitempty"` ChecksFailing []string `json:"checks_failing,omitempty"` + // ChecksPending names the counted checks with no final result yet + // (running, queued, or not reported), so the chevron can name the last + // one or two the head waits on (hivecommons/hive#16630). + ChecksPending []string `json:"checks_pending,omitempty"` // Perspective counts on the current head for the Review track: Total is // 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 @@ -81,7 +85,7 @@ func stageTrackerCIActivity(pr github.PullRequest, now time.Time) *StageTrackerA } if !a.RequiredKnown || a.RequiredSource == "" || len(a.RequiredChecks) == 0 || len(a.Required) == 0 { stageTrackerCountHeadChecks(out, a) - stageTrackerHeadChecksMotion(out, a) + out.Active = out.State == "running" return out } type requiredObservation struct { @@ -117,7 +121,7 @@ func stageTrackerCIActivity(pr github.PullRequest, now time.Time) *StageTrackerA } if !found { stageTrackerCountHeadChecks(out, a) - stageTrackerHeadChecksMotion(out, a) + out.Active = out.State == "running" return out } } @@ -191,7 +195,10 @@ func stageTrackerCIActivity(pr github.PullRequest, now time.Time) *StageTrackerA // red, unreported or ambiguous its neighbours are — a ring that is not // yet full is a running ring, so the chevron stays active with its // count (hivecommons/hive#16631). The red names ride in ChecksFailing. + // Runs held behind the approve-workflows gate keep the waiting state, + // since only a person's click moves them (hivecommons/hive#16599). switch { + case out.State == "missing" && a.WorkflowApproval != nil && a.WorkflowApproval.Pending > 0: case running: out.State, out.Blocker = "running", "" case queued && out.State != "queued": @@ -205,6 +212,7 @@ func stageTrackerCIActivity(pr github.PullRequest, now time.Time) *StageTrackerA } total := len(a.Required) out.ChecksTotal = total + var unreported []string for _, name := range a.Required { switch perName[name] { case "passing": @@ -212,9 +220,26 @@ func stageTrackerCIActivity(pr github.PullRequest, now time.Time) *StageTrackerA case "failing": out.ChecksFailed++ out.ChecksFailing = append(out.ChecksFailing, name) - } - } - check := fmt.Sprintf("%q", out.Blocker) + case "missing": + unreported = append(unreported, name) + out.ChecksPending = append(out.ChecksPending, name) + case "skipped": + default: + out.ChecksPending = append(out.ChecksPending, name) + } + } + // A required check that has not reported while others on the same + // head still run or queue is not "missing": the head is mid-pipeline + // and its workflow is usually just later in the fan-out. The state is + // the motion; the unreported name rides in Detail (hivecommons/hive#16630). + // Runs held behind the approve-workflows gate keep the waiting state, + // since only a person's click moves them. + if out.State == "running" || out.State == "queued" { + if since := stageTrackerLatestCheckTime(a); since != nil { + out.Since = since + } + } + check := stageTrackerCheckName(out.Blocker) switch out.State { case "passing": out.Caption = "CI green · all " + plural(total, "required check") + " passed" @@ -223,13 +248,22 @@ func stageTrackerCIActivity(pr github.PullRequest, now time.Time) *StageTrackerA out.Caption = "CI failing · " + check + " red" out.Detail = "Required check " + check + " finished without success (failed, timed out, was cancelled, or needs action) on the PR's current commit. A fix or a re-run has to turn it green before CI can pass." case "running": - out.Caption = fmt.Sprintf("CI running · %d/%d checks done", done, total) + out.Caption = "CI running · " + stageTrackerPendingChecksWord(out.ChecksPending) out.Detail = fmt.Sprintf("%d of the %s have a final result; the rest are still executing or waiting for a runner on the PR's current commit.", done, plural(total, "required check")) + if len(unreported) > 0 { + out.Detail += " " + stageTrackerUnreportedChecksSentence(unreported) + } if out.ChecksFailed > 0 { out.Caption += fmt.Sprintf(" · %d failing", out.ChecksFailed) out.Detail += fmt.Sprintf(" %s already red: %s.", plural(out.ChecksFailed, "required check"), strings.Join(out.ChecksFailing, ", ")) } case "queued": + if len(unreported) > 0 { + out.Blocker = "" + out.Caption = "CI queued · " + stageTrackerPendingChecksWord(out.ChecksPending) + out.Detail = fmt.Sprintf("%d of the %s have a final result; the rest are waiting for a runner on the PR's current commit. %s", done, plural(total, "required check"), stageTrackerUnreportedChecksSentence(unreported)) + break + } out.Caption = "CI queued · " + check + " waiting for a runner" out.Detail = "Required check " + check + " has been requested for the PR's current commit but has not started executing yet." case "missing": @@ -288,7 +322,10 @@ func pluralVerb(n int, one, many string) string { // stageTrackerCountHeadChecks fills the check counts from every check run // observed on the head when the required set is not known: one entry per // check name, red if any run of that name is red, green only if its latest -// run succeeded. +// run succeeded. The state follows the count (hivecommons/hive#16630): red +// when any name is red, running while names still lack a final result, +// and unknown — "no check results observed" — only when the head has no +// check run at all. func stageTrackerCountHeadChecks(out *StageTrackerActivity, a *github.PRCIActivity) { type tally struct { passing, failing bool @@ -327,39 +364,87 @@ func stageTrackerCountHeadChecks(out *StageTrackerActivity, a *github.PRCIActivi out.ChecksFailing = append(out.ChecksFailing, name) case t.passing: out.ChecksPassed++ + default: + out.ChecksPending = append(out.ChecksPending, name) } } + if out.ChecksTotal == 0 { + return + } + out.Since = stageTrackerLatestCheckTime(a) + observed := plural(out.ChecksTotal, "check") + " observed on the head" + unknownSet := "hive has not seen which checks branch protection requires" + switch { + case len(out.ChecksPending) > 0: + // Motion leads: a ring that is not full is running, however red + // its neighbours (hivecommons/hive#16631); the red names ride in + // ChecksFailing and the caption. + out.State = "running" + out.Caption = "CI running · " + stageTrackerPendingChecksWord(out.ChecksPending) + out.Detail = fmt.Sprintf("%d of the %s have a final result; the rest are still executing or waiting for a runner on the PR's current commit. %s, so every check on the head counts.", out.ChecksPassed+out.ChecksFailed, observed, unknownSet) + if out.ChecksFailed > 0 { + out.Caption += fmt.Sprintf(" · %d failing", out.ChecksFailed) + out.Detail += fmt.Sprintf(" %s already red: %s.", plural(out.ChecksFailed, "check"), strings.Join(out.ChecksFailing, ", ")) + } + case out.ChecksFailed > 0: + // Fail closed to unknown, never to a verdict, without the required + // set — but the caption carries the red name. + out.Blocker = out.ChecksFailing[0] + out.Caption = "CI unknown · " + stageTrackerCheckName(out.ChecksFailing[0]) + " red · required set unknown" + out.Detail = fmt.Sprintf("%s of the %s finished without success on the PR's current commit, but %s, so it cannot tell whether the red check gates the merge.", plural(out.ChecksFailed, "check"), observed, unknownSet) + default: + out.Caption = fmt.Sprintf("CI unknown · all %s passed · required set unknown", observed) + out.Detail = fmt.Sprintf("Every check run observed on the PR's current commit succeeded, but %s, so it cannot call CI green.", unknownSet) + } } -// stageTrackerHeadChecksMotion turns the required-set-unknown count into a -// running track while any check run on the head is still executing or -// queued: the ring is not full, so the chevron must be active with its -// count rather than a silent part-green glyph (hivecommons/hive#16631). -func stageTrackerHeadChecksMotion(out *StageTrackerActivity, a *github.PRCIActivity) { - moving := 0 +// stageTrackerLatestCheckTime is the newest timestamp of any check run or +// commit status on the activity's head: the last moment CI was seen moving. +func stageTrackerLatestCheckTime(a *github.PRCIActivity) *time.Time { + var latest *time.Time for _, check := range a.Checks { if check.Head != "" && !strings.EqualFold(check.Head, a.Head) { continue } - switch check.State { - case "in_progress", "queued", "waiting", "pending", "requested": - moving++ + if check.Since != nil && (latest == nil || check.Since.After(*latest)) { + latest = check.Since } } - if moving == 0 { - return - } - done := out.ChecksTotal - moving - if done < 0 { - done = 0 - } - out.State, out.Blocker = "running", "" - out.Caption = fmt.Sprintf("CI running · %d/%d checks done", done, out.ChecksTotal) - out.Detail = fmt.Sprintf("%d of the %s observed on the PR's current commit have a final result; the rest are still executing or waiting for a runner. Which of them branch protection requires is not yet known.", done, plural(out.ChecksTotal, "check")) - if out.ChecksFailed > 0 { - out.Caption += fmt.Sprintf(" · %d failing", out.ChecksFailed) + return latest +} + +// stageTrackerCheckName is a CI job / check name as it reads inside +// caption, detail and chevron text: wrapped in single quotes, so a name +// stands apart from the words around it ('test' not reported). +func stageTrackerCheckName(name string) string { + return "'" + name + "'" +} + +// stageTrackerPendingChecksNamed is the most pending check names the +// caption spells out; beyond it the count speaks. +const stageTrackerPendingChecksNamed = 2 + +// stageTrackerPendingChecksWord: `'test' pending`, `'lint', 'test' pending`, +// or "54 checks pending". +func stageTrackerPendingChecksWord(pending []string) string { + if n := len(pending); n > 0 && n <= stageTrackerPendingChecksNamed { + quoted := make([]string, 0, n) + for _, name := range pending { + quoted = append(quoted, stageTrackerCheckName(name)) + } + return strings.Join(quoted, ", ") + " pending" } - out.Active = true + return plural(len(pending), "check") + " pending" +} + +// stageTrackerUnreportedChecksSentence names the required checks with no +// run on the head, once, for the Detail of a running or queued head. +func stageTrackerUnreportedChecksSentence(names []string) string { + quoted := make([]string, 0, len(names)) + for _, name := range names { + quoted = append(quoted, stageTrackerCheckName(name)) + } + return fmt.Sprintf("Required %s %s %s not reported for this head yet.", pluralVerb(len(names), "check", "checks"), strings.Join(quoted, ", "), pluralVerb(len(names), "has", "have")) } // stageTrackerExpectedPerspectives is the swarm's perspective set for this diff --git a/src/pkg/dashboard/stage_tracker_activity.test.js b/src/pkg/dashboard/stage_tracker_activity.test.js index 12b2c673c8..3aa547d240 100644 --- a/src/pkg/dashboard/stage_tracker_activity.test.js +++ b/src/pkg/dashboard/stage_tracker_activity.test.js @@ -27,7 +27,7 @@ function constLine(source, name) { assert.ok(match, name); return match[0]; } -const trackConsts = ['STAGE_TRACKER_WORKFLOW_APPROVAL_BLOCKER', 'STAGE_TRACKER_WORKFLOW_APPROVAL_TIP', 'STAGE_TRACKER_RING_SEGMENT_GAP_MAX', 'STAGE_TRACKER_RING_RADIUS', 'STAGE_TRACKER_RING_GAP_DEG'].map(name => constLine(strip, name)).join('\n'); +const trackConsts = ['STAGE_TRACKER_WORKFLOW_APPROVAL_BLOCKER', 'STAGE_TRACKER_PENDING_CHECKS_NAMED', 'STAGE_TRACKER_WORKFLOW_APPROVAL_TIP', 'STAGE_TRACKER_RING_SEGMENT_GAP_MAX', 'STAGE_TRACKER_RING_RADIUS', 'STAGE_TRACKER_RING_GAP_DEG'].map(name => constLine(strip, name)).join('\n'); const trackFns = ['stageTrackerHiveOwesReReview', 'stageTrackerTrackLead', 'stageTrackerWaitingOnPerson', 'stageTrackerTrackRunning', 'stageTrackerWorkflowApprovalPending', 'stageTrackerRingSvg', 'stageTrackerStalledTrack', 'stageTrackerQueueAheadWord', 'stageTrackerStageTrack', 'stageTrackerHiveOwnsRepair', 'stageTrackerTrackWord', 'stageTrackerAgoWord', 'stageTrackerActivityTrackHtml'].map(name => fn(strip, name)).join('\n'); const track = new Function('esc', 'stageTrackerIcon', trackConsts + '\n' + trackFns + ';return stageTrackerActivityTrackHtml;')(esc, (n, cls) => ``); const getAnchor = new Function(globals + anchor + ';return stageTrackerAnchor;')(); @@ -458,7 +458,7 @@ test('browser probes require a dedicated preview and cannot count offscreen head }); test('Hotshot #344 shape: queued CI and approved review retain current phase without pretending work runs', () => { - const item = livePR({ stage: 60, ci_activity: activity('queued', 'CI queued · "build" waiting for a runner'), review_activity: activity('approved', 'Review approved') }); + const item = livePR({ stage: 60, ci_activity: activity('queued', "CI queued · 'build' waiting for a runner"), review_activity: activity('approved', 'Review approved') }); const before = JSON.stringify(item); const cells = physicalTracks(item); assert.match(cells.ci, /ham-activity-track active ham-current/, 'queued CI is in progress: the full active fill, no pulse'); @@ -501,7 +501,7 @@ test('Hive #16268 shape: held native Fixing waits for a fixer in the CI/Review p 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' }, - ci_activity: activity('missing', 'CI waiting · required check "test" hasn\'t reported for this head yet'), + ci_activity: activity('missing', "CI waiting · required check 'test' hasn't reported for this head yet"), review_activity: activity('approved', 'Review approved'), }); const cells = physicalTracks(item); @@ -526,7 +526,7 @@ 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, 'todo'], + ['skipped', "CI skipped · check 'build' skipped", false, 'todo'], ]) { const cells = physicalTracks(livePR({ ci_activity: activity(state, caption, running) })); assert.ok(cells.ci.includes('ham-activity-track ' + cls + ' ham-current'), state + ' → ' + cls + ': ' + cells.ci); @@ -759,30 +759,66 @@ test('linked movement uses current-head repair evidence while native sort stays }); test('the backend detail sentence rides in the track tooltip, not on the chevron', () => { - const detail = 'Branch protection requires a check named "test", but no check run or commit status with that name exists for the PR\'s current commit.'; - const item = livePR({ ci_activity: { ...activity('missing', 'CI waiting · required check "test" hasn\'t reported for this head yet'), detail } }); + const detail = "Branch protection requires a check named 'test', but no check run or commit status with that name exists for the PR's current commit."; + const item = livePR({ ci_activity: { ...activity('missing', "CI waiting · required check 'test' hasn't reported for this head yet"), detail } }); const html = track(item, 'ci', { state: 'active' }, false, now); const panel = html.match(/aria-describedby="[^"]+">([^]*?)[^]*hasn't reported for this head yet · Branch protection requires a check named "test"/); - assert.match(html, /title="[^"]*Branch protection requires a check named "test", but no check run/); + assert.match(html, /role="tooltip">Current pipeline phase · CI: CI \?\/\? · no checks reported yet · Branch protection requires a check named 'test'/); + assert.match(html, /title="[^"]*Branch protection requires a check named 'test', but no check run/); + // The detail sentence is the caption spelled out: the caption does not + // repeat beside it, and the blocker is not a third mention (#16630). + assert.doesNotMatch(html, /hasn't reported for this head yet/); + assert.equal((html.match(/role="tooltip">([^<]*?) · head /)[1].match(/test/g) || []).length, 1, 'the unreported check is named once in the tooltip'); +}); + +test('#16630: a head with checks still reporting is running, never "activity unknown", and the tooltip states each fact once', () => { + const stale = now + 10 * 60 * 1000; + const detail = '7 of the 11 required checks have a final result; the rest are still executing on the PR\'s current commit. Required check \'test\' has not reported for this head yet.'; + const item = livePR({ ci_activity: { ...activity('running', 'CI running · 4 checks pending', true), detail, checks_passed: 7, checks_total: 11, checks_pending: ['a', 'b', 'c', 'test'] } }); + const html = track(item, 'ci', { state: 'active' }, false, stale); + const tip = html.match(/role="tooltip">([^<]*)/)[1]; + assert.equal(tip, 'Current pipeline phase · CI: CI 7/11 · 4 running · ' + esc(detail) + ' · head head · observed-test-source · stale · 2026-11-02T21:00:00.000Z (10m ago) · since 2026-11-02T20:59:00.000Z · hive is waiting on CI'); + assert.doesNotMatch(html, /activity unknown|last observed running|no verdict yet|no check results observed/); + assert.match(html, /ham-activity-track active ham-current/, 'a stale poll of a counted running head keeps the lit fill'); + assert.doesNotMatch(html, /data-motion/, 'but does not pulse'); + // Row B: the required set unknown, 12/66 reported — the unfinished count, not "no verdict yet". + const rowB = livePR({ ci_activity: { ...activity('running', 'CI running · 54 checks pending', true), detail: '12 of the 66 checks observed on the head have a final result; the rest are still executing.', checks_passed: 12, checks_total: 66 } }); + const b = track(rowB, 'ci', { state: 'active' }, false, now); + assert.match(b, /ham-chevron-copy ham-track-state">CI 12\/66 · 54 running([^<]*)/)[1]; + assert.match(mt, /^Current pipeline phase · CI: CI 7\/11 · 'test' not reported · Branch protection requires a check named 'test', but no check run[^·]*·( \S+ ago ·)? head head/); + assert.doesNotMatch(mt, /activity unknown|last observed missing|CI waiting/); + assert.equal((mt.split(' · head ')[0].match(/test/g) || []).length, 2, 'count word + detail: not caption, blocker and detail again'); }); test('#16484: count grammar — CI passed/total and Review done/total across every state', () => { const word = new Function(trackConsts + '\n' + fn(strip, 'stageTrackerWorkflowApprovalPending') + fn(strip, 'stageTrackerQueueAheadWord') + fn(strip, 'stageTrackerHiveOwnsRepair') + fn(strip, 'stageTrackerWaitingOnPerson') + fn(strip, 'stageTrackerTrackRunning') + fn(strip, 'stageTrackerTrackWord') + ';return stageTrackerTrackWord;')(); const ci = (state, extra = {}) => word({ head: 'h', ci_activity: { head: 'h', state, ...extra } }, 'ci', true); assert.equal(ci('passing', { checks_passed: 14, checks_total: 14 }), 'CI 14/14 passed'); - assert.equal(ci('failing', { checks_passed: 11, checks_total: 14, checks_failed: 1, checks_failing: ['lint'] }), 'CI 11/14 · 1 failing (lint)'); - assert.equal(ci('failing', { checks_passed: 10, checks_total: 14, checks_failed: 3, checks_failing: ['lint', 'test', 'e2e'] }), 'CI 10/14 · 3 failing (lint, test, …)'); - assert.equal(ci('failing', { blocker: 'native-queue-policy' }), 'CI ?/? · failing (native-queue-policy)', 'older servers without counts still name the red check'); - assert.equal(ci('running', { checks_passed: 3, checks_total: 14 }), 'CI 3/14 · running'); - assert.equal(ci('running', { checks_passed: 3, checks_total: 14, checks_failed: 1, checks_failing: ['lint'] }), 'CI 3/14 · running · 1 failing (lint)'); - assert.equal(ci('queued', { checks_passed: 0, checks_total: 14 }), 'CI 0/14 · queued'); + assert.equal(ci('failing', { checks_passed: 11, checks_total: 14, checks_failed: 1, checks_failing: ['lint'] }), "CI 11/14 · 1 failing ('lint')"); + assert.equal(ci('failing', { checks_passed: 10, checks_total: 14, checks_failed: 3, checks_failing: ['lint', 'test', 'e2e'] }), "CI 10/14 · 3 failing ('lint', 'test', …)"); + assert.equal(ci('failing', { blocker: 'native-queue-policy' }), "CI ?/? · failing ('native-queue-policy')", 'older servers without counts still name the red check'); + assert.equal(ci('running', { checks_passed: 3, checks_total: 14 }), 'CI 3/14 · 11 running'); + assert.equal(ci('running', { checks_passed: 3, checks_total: 14, checks_failed: 1, checks_failing: ['lint'] }), "CI 3/14 · 10 running · 1 failing ('lint')"); + assert.equal(ci('running', { checks_passed: 9, checks_total: 11, checks_pending: ['check-09', 'test'] }), "CI 9/11 · 'check-09', 'test' running", 'the last one or two unfinished checks are named (#16630)'); + assert.equal(ci('running', { checks_passed: 7, checks_total: 11, checks_pending: ['a', 'b', 'c', 'test'] }), 'CI 7/11 · 4 running'); + assert.equal(ci('queued', { checks_passed: 0, checks_total: 14 }), 'CI 0/14 · 14 queued'); + assert.equal(ci('queued', { checks_passed: 13, checks_total: 14, checks_pending: ['test'] }), "CI 13/14 · 'test' queued"); assert.equal(ci('missing', { checks_passed: 0, checks_total: 14, blocker: 'test' }), 'CI 0/14 · no checks reported yet'); - assert.equal(ci('missing', { checks_passed: 13, checks_total: 14, blocker: 'test' }), 'CI 13/14 · test not reported'); - assert.equal(ci('skipped', { checks_passed: 13, checks_total: 14, blocker: 'build' }), 'CI 13/14 · build skipped'); + assert.equal(ci('missing', { checks_passed: 13, checks_total: 14, blocker: 'test' }), "CI 13/14 · 'test' not reported"); + assert.equal(ci('skipped', { checks_passed: 13, checks_total: 14, blocker: 'build' }), "CI 13/14 · 'build' skipped"); assert.equal(ci('unknown'), 'CI ?/? · no checks reported yet'); - assert.equal(ci('unknown', { checks_passed: 51, checks_total: 68 }), 'CI 51/68 · running', 'unprotected base: an unfinished head-wide ring is still running (#16631)'); + assert.equal(ci('unknown', { checks_passed: 51, checks_total: 68 }), 'CI 51/68 · 17 running', 'unprotected base: the unfinished count, never "no verdict yet" (#16630)'); + assert.equal(ci('unknown', { checks_passed: 11, checks_total: 66, checks_failed: 1, checks_failing: ['flaky'] }), "CI 11/66 · 1 failing ('flaky') · 54 running"); + assert.equal(ci('unknown', { checks_passed: 12, checks_total: 12 }), 'CI 12/12 · required set unknown'); + assert.equal(ci('unknown', { checks_passed: 2, checks_total: 3, blocker: 'test' }), "CI 2/3 · 'test' unclear"); + assert.equal(ci('unknown', { checks_passed: 3, checks_total: 3, blocker: 'commit statuses not observed' }), 'CI 3/3 · commit statuses not observed'); assert.equal(word({ head: 'h' }, 'ci', true), 'CI ?/? · no checks reported yet', 'no evidence at all in the current phase'); assert.equal(word({ head: 'h' }, 'ci', false), '', 'no evidence outside the current phase: not started, glyph alone'); assert.equal(word({ head: 'h', ci_activity: { head: 'old', state: 'passing', checks_passed: 14, checks_total: 14 } }, 'ci', true), 'CI ?/? · no checks reported yet', 'old-head evidence counts for nothing'); @@ -820,7 +856,7 @@ test('#16484: the three screenshot rows — both tracks lit with counts, swarm r 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.equal(cls(cells.ci), 'active'); assert.equal(text(cells.ci), 'CI 9/14 · 5 running'); assert.match(cells.ci, /data-motion="active"/); // #16599: the pending re-review is not in motion and not the stage's own // track (070) → glyph alone, its words in the tooltip. @@ -835,7 +871,7 @@ test('#16484: the three screenshot rows — both tracks lit with counts, swarm r // words even while only queued; CI runs beside it (two lit). assert.equal(cls(cells.review), 'active'); assert.equal(text(cells.review), 'Review 0/5 · queued'); assert.doesNotMatch(cells.review, /data-motion/, 'queued is lit but still'); - assert.equal(cls(cells.ci), 'active'); assert.equal(text(cells.ci), 'CI 2/14 · running'); + assert.equal(cls(cells.ci), 'active'); assert.equal(text(cells.ci), 'CI 2/14 · 12 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' }), @@ -845,8 +881,8 @@ test('#16484: the three screenshot rows — both tracks lit with counts, swarm r // the settled approval is the glyph alone, its count words in the tooltip. const tip = cell => cell.match(/ aria-label="([^"]*)"/)[1]; assert.equal(cls(cells.ci), 'active'); assert.match(cells.ci, /ham-activity-track active ham-stalled/); assert.doesNotMatch(cells.ci, /data-motion/); - assert.equal(text(cells.ci), 'CI 13/14 · 1 failing (native-queue-policy)'); assert.match(cells.ci, /data-verdict="fail"/); - assert.match(tip(cells.ci), /^(?:Current pipeline phase · )?CI: CI 13\/14 · 1 failing \(native-queue-policy\) · /); + assert.equal(text(cells.ci), "CI 13/14 · 1 failing ('native-queue-policy')"); assert.match(cells.ci, /data-verdict="fail"/); + assert.match(tip(cells.ci), /^(?:Current pipeline phase · )?CI: CI 13\/14 · 1 failing \('native-queue-policy'\) · /); assert.equal(cls(cells.review), 'done'); assert.equal(text(cells.review), ''); assert.match(cells.review, /data-verdict="pass"/); assert.match(tip(cells.review), /^(?:Current pipeline phase · )?Review: Review 5\/5 approved · /); assert.match(cells.review, /Held by @hanthor/); @@ -879,7 +915,7 @@ test('#16615: CI green on the pushed head + re-review owed by the hive → Revie assert.equal((cells.ci + cells.review).match(/ham-activity-track active/g).length, 1, 'exactly one active track'); // While CI still runs on the pushed head, CI is the lit one and Review waits as a glyph. const running = physicalTracks({ ...item, ci_activity: fresh('running', { checks_passed: 7, checks_total: 11, active: true }) }); - assert.equal(cls(running.ci), 'active'); assert.equal(text(running.ci), 'CI 7/11 · running'); + assert.equal(cls(running.ci), 'active'); assert.equal(text(running.ci), 'CI 7/11 · 4 running'); assert.equal(cls(running.review), 'todo'); assert.equal(text(running.review), ''); }); diff --git a/src/pkg/dashboard/stage_tracker_activity_test.go b/src/pkg/dashboard/stage_tracker_activity_test.go index 154611699e..f2cf9e9de7 100644 --- a/src/pkg/dashboard/stage_tracker_activity_test.go +++ b/src/pkg/dashboard/stage_tracker_activity_test.go @@ -363,12 +363,12 @@ func TestStageTrackerActivityCICaptionsReadInPlainLanguage(t *testing.T) { state, want string detailMention string }{ - {"missing", ci(done("build"), done("lint")), "missing", `CI waiting · required check "test" hasn't reported for this head yet`, `check named "test"`}, - {"running counts", ci(done("build"), chk("lint", "in_progress", ""), chk("test", "in_progress", "")), "running", "CI running · 1/3 checks done", "1 of the 3 required checks"}, - {"queued", ci(done("build"), done("lint"), chk("test", "queued", "")), "queued", `CI queued · "test" waiting for a runner`, "not started"}, - {"failing", ci(done("build"), chk("lint", "completed", "failure"), done("test")), "failing", `CI failing · "lint" red`, `"lint" finished without success`}, - {"skipped", ci(done("build"), done("lint"), chk("test", "completed", "skipped")), "skipped", `CI skipped · check "test" skipped`, "does not count as a pass"}, - {"ambiguous", ci(done("build"), done("lint"), done("test"), chk("test", "completed", "failure")), "unknown", `CI unknown · "test" reported but with no conclusion`, "several runs share the name"}, + {"missing", ci(done("build"), done("lint")), "missing", `CI waiting · required check 'test' hasn't reported for this head yet`, `check named 'test'`}, + {"running counts", ci(done("build"), chk("lint", "in_progress", ""), chk("test", "in_progress", "")), "running", `CI running · 'lint', 'test' pending`, "1 of the 3 required checks"}, + {"queued", ci(done("build"), done("lint"), chk("test", "queued", "")), "queued", `CI queued · 'test' waiting for a runner`, "not started"}, + {"failing", ci(done("build"), chk("lint", "completed", "failure"), done("test")), "failing", `CI failing · 'lint' red`, `'lint' finished without success`}, + {"skipped", ci(done("build"), done("lint"), chk("test", "completed", "skipped")), "skipped", `CI skipped · check 'test' skipped`, "does not count as a pass"}, + {"ambiguous", ci(done("build"), done("lint"), done("test"), chk("test", "completed", "failure")), "unknown", `CI unknown · 'test' reported but with no conclusion`, "several runs share the name"}, {"green", ci(done("build"), done("lint"), done("test")), "passing", "CI green · all 3 required checks passed", "reported success"}, } for _, tc := range cases { @@ -384,8 +384,8 @@ func TestStageTrackerActivityCICaptionsReadInPlainLanguage(t *testing.T) { pr github.PullRequest want string }{ - {"red+running", ci(done("build"), chk("lint", "completed", "failure"), chk("test", "in_progress", "")), "CI running · 2/3 checks done · 1 failing"}, - {"missing+running", ci(done("build"), chk("lint", "in_progress", "")), "CI running · 1/3 checks done"}, + {"red+running", ci(done("build"), chk("lint", "completed", "failure"), chk("test", "in_progress", "")), `CI running · 'test' pending · 1 failing`}, + {"missing+running", ci(done("build"), chk("lint", "in_progress", "")), `CI running · 'lint', 'test' pending`}, } for _, tc := range motion { got := stageTrackerCIActivity(tc.pr, now) @@ -393,7 +393,7 @@ func TestStageTrackerActivityCICaptionsReadInPlainLanguage(t *testing.T) { t.Fatalf("%s: want running %q active, got %+v", tc.name, tc.want, got) } } - if got := stageTrackerCIActivity(ci(done("build"), done("lint"), done("lint"), chk("test", "queued", "")), now); got.State != "queued" || got.Caption != `CI queued · "test" waiting for a runner` { + if got := stageTrackerCIActivity(ci(done("build"), done("lint"), done("lint"), chk("test", "queued", "")), now); got.State != "queued" || got.Caption != `CI queued · 'test' waiting for a runner` { t.Fatalf("ambiguous+queued: a waiting runner keeps the ring queued, not unknown: %+v", got) } if got := stageTrackerCIActivity(ci(done("build"), chk("lint", "completed", "failure"), done("test")), now); got.State != "failing" || got.Active { @@ -538,7 +538,7 @@ func TestStageTrackerActivityCIPartialRingIsRunning(t *testing.T) { Required: required, RequiredSource: "protection", RequiredChecks: bindings, Checks: checks}} } got := stageTrackerCIActivity(build(13, 6), now) - if got.State != "running" || !got.Active || got.ChecksPassed != 13 || got.ChecksTotal != 19 || got.Caption != "CI running · 13/19 checks done" { + if got.State != "running" || !got.Active || got.ChecksPassed != 13 || got.ChecksTotal != 19 || got.Caption != "CI running · 6 checks pending" { t.Fatalf("13/19 with 6 pending must be an active running track: %+v", got) } full := stageTrackerCIActivity(build(19, 0), now) @@ -548,7 +548,126 @@ func TestStageTrackerActivityCIPartialRingIsRunning(t *testing.T) { // Required set unknown: the head-wide count still reads motion. loose := build(13, 6) loose.CIActivity.RequiredKnown, loose.CIActivity.Required, loose.CIActivity.RequiredChecks = false, nil, nil - if got := stageTrackerCIActivity(loose, now); got.State != "running" || !got.Active || got.Caption != "CI running · 13/16 checks done" { + if got := stageTrackerCIActivity(loose, now); got.State != "running" || !got.Active || got.Caption != "CI running · 3 checks pending" { t.Fatalf("head-wide count with checks in progress must run: %+v", got) } } + +// hivecommons/hive#16630: a head with checks still reporting is running, +// never "activity unknown" or "no check results observed"; the unreported +// required check is one sentence in Detail, and "no verdict yet" / "no +// check results observed" are reserved for a head with zero check runs. +func TestStageTrackerActivityCIRunningWhileChecksPending(t *testing.T) { + now := time.Date(2026, 11, 4, 12, 0, 0, 0, time.UTC) + t1, t2, t3 := now.Add(-9*time.Minute), now.Add(-6*time.Minute), now.Add(-3*time.Minute) + name := func(i int) string { return fmt.Sprintf("check-%02d", i) } + run := func(n string, state, conclusion string, at *time.Time) github.PRActivityCheck { + return github.PRActivityCheck{Name: n, State: state, Conclusion: conclusion, Since: at} + } + // Row A: 11 required checks, 7 green, 3 in progress, "test" has no run yet. + rowA := func() github.PullRequest { + var required []github.PRRequiredCheck + var names []string + var checks []github.PRActivityCheck + for i := 0; i < 7; i++ { + required, names = append(required, github.PRRequiredCheck{Name: name(i), AppKnown: true}), append(names, name(i)) + checks = append(checks, run(name(i), "completed", "success", &t1)) + } + for i := 7; i < 10; i++ { + required, names = append(required, github.PRRequiredCheck{Name: name(i), AppKnown: true}), append(names, name(i)) + checks = append(checks, run(name(i), "in_progress", "", &t3)) + } + required, names = append(required, github.PRRequiredCheck{Name: "test", AppKnown: true}), append(names, "test") + return github.PullRequest{HeadSHA: "head", CIActivity: &github.PRCIActivity{Head: "head", Source: "github-check-runs", ObservedAt: &t2, StatusesKnown: true, + RequiredKnown: true, Required: names, RequiredSource: "protection", RequiredChecks: required, Checks: checks}} + } + // Row B: required set unknown, 66 check runs observed, 12 green, 54 running. + rowB := func() github.PullRequest { + var checks []github.PRActivityCheck + for i := 0; i < 12; i++ { + checks = append(checks, run(name(i), "completed", "success", &t1)) + } + for i := 12; i < 66; i++ { + checks = append(checks, run(name(i), "in_progress", "", &t3)) + } + return github.PullRequest{HeadSHA: "head", CIActivity: &github.PRCIActivity{Head: "head", Source: "github-check-runs", ObservedAt: &t2, Checks: checks}} + } + twoLeft := rowA() + twoLeft.CIActivity.Checks = twoLeft.CIActivity.Checks[:7] + twoLeft.CIActivity.Checks = append(twoLeft.CIActivity.Checks, run(name(7), "completed", "success", &t2), run(name(8), "completed", "success", &t2), run(name(9), "in_progress", "", &t3)) + queuedOnly := rowA() + for i := 7; i < 10; i++ { + queuedOnly.CIActivity.Checks[i].State = "queued" + } + settledMissing := rowA() + settledMissing.CIActivity.Checks = settledMissing.CIActivity.Checks[:7] + empty := rowB() + empty.CIActivity.Checks = nil + cases := []struct { + name string + pr github.PullRequest + state, caption string + passed, total int + pending int + since *time.Time + detailHas string + detailLacks string + blocker string + captionForbidden []string + }{ + {"row A required: 7/11 with 3 running and test unreported", rowA(), "running", "CI running · 4 checks pending", 7, 11, 4, &t3, + `Required check 'test' has not reported for this head yet.`, "Branch protection requires", "", []string{"unknown", "waiting", "not reported"}}, + {"row A with two left names them", twoLeft, "running", `CI running · 'check-09', 'test' pending`, 9, 11, 2, &t3, + `'test' has not reported`, "", "", []string{"unknown"}}, + {"row A with only queued runs is queued, not missing", queuedOnly, "queued", "CI queued · 4 checks pending", 7, 11, 4, &t3, + `'test' has not reported`, "", "", []string{"unknown", "waiting"}}, + {"row A with every run final keeps the missing verdict", settledMissing, "missing", `CI waiting · required check 'test' hasn't reported for this head yet`, 7, 11, 4, nil, + `check named 'test'`, "", "test", nil}, + {"row B head-wide: 12/66 with 54 running", rowB(), "running", "CI running · 54 checks pending", 12, 66, 54, &t3, + "12 of the 66 checks observed on the head have a final result", "no check results observed", "", []string{"unknown", "no verdict", "no check results"}}, + {"row B with zero runs is the only unknown", empty, "unknown", stageTrackerCINoDataCaption("head"), 0, 0, 0, nil, + "has not yet seen", "", "", nil}, + } + for _, tc := range cases { + t.Run(tc.name, func(t *testing.T) { + got := stageTrackerCIActivity(tc.pr, now) + if got.State != tc.state || got.Caption != tc.caption { + t.Fatalf("state/caption = %s %q, want %s %q (%+v)", got.State, got.Caption, tc.state, tc.caption, got) + } + if got.ChecksPassed != tc.passed || got.ChecksTotal != tc.total || len(got.ChecksPending) != tc.pending || got.ChecksFailed != 0 { + t.Fatalf("counts = %d/%d pending %v failed %d, want %d/%d pending %d", got.ChecksPassed, got.ChecksTotal, got.ChecksPending, got.ChecksFailed, tc.passed, tc.total, tc.pending) + } + if !strings.Contains(got.Detail, tc.detailHas) || (tc.detailLacks != "" && strings.Contains(got.Detail, tc.detailLacks)) { + t.Fatalf("detail = %q, want mention of %q and none of %q", got.Detail, tc.detailHas, tc.detailLacks) + } + if strings.Count(got.Detail, "test") > 1 && tc.state != "missing" { + t.Fatalf("detail repeats the unreported check: %q", got.Detail) + } + if got.Blocker != tc.blocker { + t.Fatalf("blocker = %q, want %q", got.Blocker, tc.blocker) + } + if (tc.since == nil) != (got.Since == nil) || (tc.since != nil && !got.Since.Equal(*tc.since)) { + t.Fatalf("since = %v, want %v (latest check-run timestamp on the head)", got.Since, tc.since) + } + for _, word := range tc.captionForbidden { + if strings.Contains(strings.ToLower(got.Caption), word) { + t.Fatalf("caption %q must not say %q while checks are pending", got.Caption, word) + } + } + }) + } + // Row B with a red check and runs still pending: motion leads the red + // neighbour (hivecommons/hive#16631); the caption carries both. + red := rowB() + red.CIActivity.Checks[0] = run(name(0), "completed", "failure", &t1) + if got := stageTrackerCIActivity(red, now); got.State != "running" || got.Caption != "CI running · 54 checks pending · 1 failing" || got.ChecksFailed != 1 || got.Blocker != "" { + t.Fatalf("red head-wide: %+v", got) + } + // Running is active whatever the poll's age, in the head-wide path too + // (hivecommons/hive#16643): the observation time rides the tooltip. + for _, pr := range []github.PullRequest{rowB(), func() github.PullRequest { fresh := rowB(); fresh.CIActivity.ObservedAt = &now; return fresh }()} { + if got := stageTrackerCIActivity(pr, now); !got.Active { + t.Fatalf("running head-wide should be active: %+v", got) + } + } +} diff --git a/src/pkg/dashboard/stage_tracker_remediation_chevron.test.js b/src/pkg/dashboard/stage_tracker_remediation_chevron.test.js index 0be376687b..ff2ffec02d 100644 --- a/src/pkg/dashboard/stage_tracker_remediation_chevron.test.js +++ b/src/pkg/dashboard/stage_tracker_remediation_chevron.test.js @@ -161,27 +161,27 @@ const seen = '2026-11-04T02:44:00Z'; test('#16509 row: adopted, CI 7/11 unreported, review 5/5 decided → one amber chevron', () => { const item = redPR({ stage: 74, display_column: 30, code_activity: { head: 'abc1234def', state: 'adopted', caption: 'Adopted by hive · activity', source: 'adoption', observed_at: seen }, - ci_activity: { head: 'abc1234def', state: 'missing', caption: 'CI waiting · required check "test" hasn\'t reported for this head yet', checks_passed: 7, checks_total: 11, blocker: 'test', source: 'checks', observed_at: seen }, + ci_activity: { head: 'abc1234def', state: 'missing', caption: "CI waiting · required check 'test' hasn't reported for this head yet", checks_passed: 7, checks_total: 11, blocker: 'test', source: 'checks', observed_at: seen }, review_activity: { head: 'abc1234def', state: 'human_decision', caption: 'Review findings · human decision', perspectives_done: 5, perspectives_total: 5, source: 'verified-review-bundle', observed_at: seen } }); const c = cells(item); assert.match(c[3], /class="ham-seg active detoured"/, 'the stage chevron is the one lit chevron'); // #16599: unreported checks are not motion and not the stage's track → // neutral glyph alone, count words in the tooltip. assert.match(c[4], /class="ham-seg ham-activity-track todo"/, 'unreported checks are not motion'); - assert.match(c[4], /title="CI: CI 7\/11 · test not reported · /); - assert.doesNotMatch(c[4], /test not reported { const owner = { head: 'abc1234def', state: 'waiting_owner', caption: 'Waiting for @hanthor · not observed coding', actor: 'hanthor', source: 'native-author-wait', observed_at: seen }; - const ci = { head: 'abc1234def', state: 'missing', caption: 'CI waiting · required check "test" hasn\'t reported for this head yet', checks_passed: 7, checks_total: 11, blocker: 'test', source: 'checks', observed_at: seen }; + const ci = { head: 'abc1234def', state: 'missing', caption: "CI waiting · required check 'test' hasn't reported for this head yet", checks_passed: 7, checks_total: 11, blocker: 'test', source: 'checks', observed_at: seen }; const approved = { head: 'abc1234def', state: 'approved', caption: 'Review approved', perspectives_done: 5, perspectives_total: 5, source: 'verified-review-bundle', observed_at: seen }; const c = cells(redPR({ stage: 71, display_column: 30, author: 'hanthor', author_kind: 'human', code_activity: owner, ci_activity: ci, review_activity: approved })); assert.match(c[3], /class="ham-seg active detoured"/); - assert.match(c[4], /class="ham-seg ham-activity-track todo"[^>]*title="CI: CI 7\/11 · test not reported · /); - assert.doesNotMatch(c[4], /test not reported]*title="CI: CI 7\/11 · 'test' not reported · /); + assert.doesNotMatch(c[4], /'test' not reported<\/span>/); assert.equal(litCount(c.join('')), 1); // Even a queued check does not light CI while the row waits on a person. @@ -220,16 +220,16 @@ test('three qualify: CI and review running on a lit PR in progress → tracks wi test('#16634 shape: CI 4/11 · 1 failing still running + unassigned → CI is the one active chevron, PR in progress icon only', () => { const base = { display_column: 30, code_activity: { head: 'abc1234def', state: 'unassigned', caption: 'Unassigned · next: scanner', source: 'no-pickup-evidence', since: seen, observed_at: seen }, - ci_activity: { head: 'abc1234def', state: 'running', active: true, caption: 'CI running · 4/11 checks done · 1 failing', checks_passed: 4, checks_total: 11, checks_failed: 1, checks_failing: ['Sign-off survives'], source: 'checks', observed_at: seen }, + ci_activity: { head: 'abc1234def', state: 'running', active: true, caption: 'CI running · 6 checks pending · 1 failing', checks_passed: 4, checks_total: 11, checks_failed: 1, checks_failing: ['Sign-off survives'], source: 'checks', observed_at: seen }, review_activity: { head: 'abc1234def', state: 'changes_requested', caption: 'Review 5/5 · changes requested', perspectives_done: 5, perspectives_total: 5, source: 'verified-review-bundle', observed_at: seen } }; const a = cells(redPR(base)); - assert.match(a[4], /class="ham-seg ham-activity-track active"[^]*CI 4\/11 · [^<]*1 failing \(Sign-off survives\)([^]*?)<\/span>/.exec(li); const words = m ? m[2].replace(/<[^>]+>/g, '').trim() : ''; diff --git a/src/pkg/dashboard/stage_tracker_ui_rows_test.go b/src/pkg/dashboard/stage_tracker_ui_rows_test.go index c14baba62b..18d5ebb399 100644 --- a/src/pkg/dashboard/stage_tracker_ui_rows_test.go +++ b/src/pkg/dashboard/stage_tracker_ui_rows_test.go @@ -706,19 +706,19 @@ assert.ok(/[^<]*<\/span>/.test(row) && !/ // settled-current. The ≤2 invariant itself runs on every fixture above. { const seen = new Date(now - 60000).toISOString(); - const unreported = { head: 'f269349', state: 'missing', caption: 'CI waiting · required check "test" hasn\'t reported for this head yet', checks_passed: 7, checks_total: 11, blocker: 'test', source: 'checks', observed_at: seen }; + const unreported = { head: 'f269349', state: 'missing', caption: "CI waiting · required check 'test' hasn't reported for this head yet", checks_passed: 7, checks_total: 11, blocker: 'test', source: 'checks', observed_at: seen }; const lit = (html) => litChevrons(strip(html)); const three = stageTrackerRowHtml({ repo: 'acme/console', number: 16509, kind: 'pr', stage: 74, display_column: 30, head: 'f269349', author: 'thatguywob', author_kind: 'human', code_activity: { head: 'f269349', state: 'adopted', caption: 'Adopted by hive · activity', source: 'adoption', observed_at: seen }, ci_activity: unreported, review_activity: { head: 'f269349', state: 'human_decision', caption: 'Review findings · human decision', perspectives_done: 5, perspectives_total: 5, source: 'verified-review-bundle', observed_at: seen } }, stages, ctx); assert.strictEqual(lit(three), 1, 'adopted + unreported CI + decided review lights one chevron: ' + strip(three)); - assert.ok(/
  • ]*title="CI: CI 7\/11 · test not reported · /.test(three), 'unreported checks are the neutral icon, words in the tooltip: ' + three); + assert.ok(/
  • ]*title="CI: CI 7\/11 · 'test' not reported · /.test(three), 'unreported checks are the neutral icon, words in the tooltip: ' + three); const owner = stageTrackerRowHtml({ repo: 'acme/console', number: 16268, kind: 'pr', stage: 71, display_column: 30, head: 'f269349', author: 'hanthor', author_kind: 'human', code_activity: { head: 'f269349', state: 'waiting_owner', caption: 'Waiting for @hanthor · not observed coding', actor: 'hanthor', source: 'native-author-wait', observed_at: seen }, ci_activity: unreported, review_activity: { head: 'f269349', state: 'approved', caption: 'Review approved', perspectives_done: 5, perspectives_total: 5, source: 'verified-review-bundle', observed_at: seen } }, stages, ctx); assert.strictEqual(lit(owner), 1, 'with the contributor: only the stage chevron is lit: ' + strip(owner)); assert.ok(/
  • ]*aria-current="step"/.test(owner) && owner.includes('Waiting for @hanthor'), owner); - assert.ok(/
  • ]*title="CI: CI 7\/11 · test not reported · /.test(owner) && /
  • ]*data-verdict="pass"[^>]*>[\s\S]*?ham-track-verdict">]*>[\s\S]*?<\/svg><\/span>[\s\S]*?Review: Review 5\/5 approved · /.test(owner), 'with the contributor both tracks are icons alone, words in the tooltips: ' + owner); + assert.ok(/
  • ]*title="CI: CI 7\/11 · 'test' not reported · /.test(owner) && /
  • ]*data-verdict="pass"[^>]*>[\s\S]*?ham-track-verdict">]*>[\s\S]*?<\/svg><\/span>[\s\S]*?Review: Review 5\/5 approved · /.test(owner), 'with the contributor both tracks are icons alone, words in the tooltips: ' + owner); const busy = stageTrackerRowHtml({ repo: 'acme/console', number: 16456, kind: 'pr', stage: 70, display_column: 30, head: 'f269349', author: 'hive[bot]', author_kind: 'hive', code_activity: { head: 'f269349', state: 'remediating', caption: 'Remediating · scanner · 4m', actor: 'scanner', active: true, source: 'fix-dispatch', observed_at: seen }, ci_activity: { head: 'f269349', state: 'running', active: true, caption: 'CI running', checks_passed: 4, checks_total: 11, source: 'checks', observed_at: seen }, @@ -806,13 +806,13 @@ assert.ok(/[^<]*<\/span>/.test(row) && !/ review_activity: { head: '9bdf058', state: 'reviewing', active: true, caption: 'Review 2/5 · in progress', perspectives_done: 2, perspectives_total: 5, source: 'verified-review-bundle+stage-review-pending', observed_at: seen } }, stages, ctx); assert.strictEqual(lit(progress), 1, 'review in progress lights the Review column only: ' + strip(progress)); assert.ok(/
  • ]*data-motion="active"[^>]*>[\s\S]*?Review 2\/5 · in progress<\/span>/.test(progress), progress); - assert.ok(/
  • ]*>[\s\S]*?]*data-ring-done="7"[\s\S]*?<\/svg><\/span>]*>[\s\S]*?]*data-ring-done="7"[\s\S]*?<\/svg><\/span>]*data-ring-total="5" data-ring-done="2"/.test(progress) && (progress.match(/ham-ring-pulse/g) || []).length === 1, 'the review ring pulses its next step: ' + progress); const both = stageTrackerRowHtml({ repo: 'acme/promptargs', number: 427, kind: 'pr', stage: 50, display_column: 50, head: '9bdf058', author: 'hive[bot]', author_kind: 'hive', ci_activity: { head: '9bdf058', state: 'running', active: true, caption: 'CI running', checks_passed: 4, checks_total: 11, source: 'checks', observed_at: seen }, review_activity: { head: '9bdf058', state: 'adjudicating', active: true, caption: 'Review 5/5 · verdicts in · aggregating', perspectives_done: 5, perspectives_total: 5, source: 'verified-review-bundle', observed_at: seen } }, stages, ctx); assert.strictEqual(lit(both), 2, 'CI running + adjudicating: both tracks, no third: ' + strip(both)); - assert.ok(both.includes('CI 4/11 · running') && both.includes('Review 5/5 · adjudicating'), both); + assert.ok(both.includes('CI 4/11 · 7 running') && both.includes('Review 5/5 · adjudicating'), both); } // Merged: the lit cap is the only chevron with hover text. row = stageTrackerRowHtml({ repo: 'acme/console', number: 106, kind: 'pr', stage: 110 }, stages, ctx); 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 d3daf54cb8..631f1bba1d 100644 --- a/src/pkg/dashboard/static-src/js/tracker-row-strip.js +++ b/src/pkg/dashboard/static-src/js/tracker-row-strip.js @@ -65,21 +65,36 @@ const failed = n('checks_failed'); const names = matches && Array.isArray(a.checks_failing) ? a.checks_failing : []; const count = 'CI ' + (total ? passed + '/' + total : '?/?'); - const failing = failed ? failed + ' failing' + (names.length ? ' (' + names.slice(0, 2).join(', ') + (names.length > 2 ? ', …' : '') + ')' : '') : ''; + // A check name inside the words wears single quotes ('test' not + // reported) so it stands apart from the words around it. + const q = n => "'" + n + "'"; + const failing = failed ? failed + ' failing' + (names.length ? ' (' + names.slice(0, 2).map(q).join(', ') + (names.length > 2 ? ', …' : '') + ')' : '') : ''; const blocker = matches && a.blocker ? String(a.blocker) : ''; + // The unfinished count carries information; "no verdict yet" or a + // bare "running" beside 12/66 did not (hivecommons/hive#16630). The + // last one or two unfinished names are spelled out. + const pendingNames = matches && Array.isArray(a.checks_pending) ? a.checks_pending.map(String).filter(Boolean) : []; + const pendingCount = total ? Math.max(total - passed - failed, pendingNames.length) : pendingNames.length; + const pending = verb => !pendingCount ? verb : pendingNames.length && pendingNames.length <= STAGE_TRACKER_PENDING_CHECKS_NAMED ? pendingNames.map(q).join(', ') + ' ' + verb : pendingCount + ' ' + verb; switch (state) { case 'passing': return count + ' passed'; - case 'failing': return count + ' · ' + (failing || 'failing' + (blocker ? ' (' + blocker + ')' : '')); - case 'running': return count + ' · running' + (failing ? ' · ' + failing : ''); - case 'queued': return count + ' · queued' + (failing ? ' · ' + failing : ''); - case 'skipped': return count + ' · ' + (blocker ? blocker + ' skipped' : 'skipped'); + case 'failing': return count + ' · ' + (failing || 'failing' + (blocker ? ' (' + q(blocker) + ')' : '')); + case 'running': return count + ' · ' + pending('running') + (failing ? ' · ' + failing : ''); + case 'queued': return count + ' · ' + pending('queued') + (failing ? ' · ' + failing : ''); + case 'skipped': return count + ' · ' + (blocker ? q(blocker) + ' skipped' : 'skipped'); case 'missing': { if (stageTrackerWorkflowApprovalPending(a) > 0) return count + ' · waiting on workflow approval' + (failing ? ' · ' + failing : ''); - return count + ' · ' + (passed ? (blocker ? blocker + ' not reported' : 'not all reported') : 'no checks reported yet') + (failing ? ' · ' + failing : ''); + return count + ' · ' + (passed ? (blocker ? q(blocker) + ' not reported' : 'not all reported') : 'no checks reported yet') + (failing ? ' · ' + failing : ''); + } + default: { + if (!total) return count + ' · no checks reported yet'; + if (failing) return count + ' · ' + failing + (pendingCount ? ' · ' + pending('running') : ''); + // A blocker here is a phrase ("commit statuses not observed") or + // the one check whose result cannot be read. + if (blocker) return count + ' · ' + (/\s/.test(blocker) ? blocker : q(blocker) + ' unclear'); + if (pendingCount) return count + ' · ' + pending('running'); + return count + ' · required set unknown'; } - // An unfinished ring with no settled word is still running - // (hivecommons/hive#16631). - default: return count + ' · ' + (total ? (passed + failed < total ? 'running' + (failing ? ' · ' + failing : '') : 'no verdict yet') : 'no checks reported yet'); } } const total = n('perspectives_total'); @@ -126,6 +141,9 @@ // person's click moves them, so the chevron names the wait and wears // the person icon (hivecommons/hive#16599). const STAGE_TRACKER_WORKFLOW_APPROVAL_BLOCKER = 'workflow-approval-required:'; + // Up to this many unfinished check names are spelled out in the CI + // chevron word; beyond it the count speaks (hivecommons/hive#16630). + const STAGE_TRACKER_PENDING_CHECKS_NAMED = 2; const STAGE_TRACKER_WORKFLOW_APPROVAL_TIP = 'Needs a maintainer to approve the workflow runs on GitHub before the checks can start'; function stageTrackerWorkflowApprovalPending(a) { if (!a) return 0; @@ -317,17 +335,25 @@ const source = matches ? a.source || 'unavailable' : 'unavailable'; const freshness = !Number.isFinite(observed) ? 'observation time unknown' : (stale ? 'stale · ' : 'observed · ') + new Date(observed).toISOString() + ' (' + stageTrackerAgoWord(observed, clock) + ')'; const since = matches && a.since && Number.isFinite(Date.parse(a.since)) ? ' · since ' + new Date(a.since).toISOString() : ''; - let blocker = matches && 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. const ask = matches && state === 'human_decision' && item.decision_needed && item.decision_needed.question ? String(item.decision_needed.question) : ''; - if (ask && blocker.indexOf(ask) < 0) blocker += ' · ' + ask; // 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 : ''; + const detail = matches && a.detail ? String(a.detail) : ''; const sinceAgo = matches && a.since && Number.isFinite(Date.parse(a.since)) && settledState ? ' · ' + stageTrackerAgoWord(Date.parse(a.since), clock) : ''; - let tip = caption + blocker + detail + sinceAgo + (perspectives.length ? ' · ' + perspectives.map(perspectiveLine).join(' · ') : '') + ' · head ' + (item.head || 'unknown') + ' · ' + source + ' · ' + freshness + since; + // Each fact once (hivecommons/hive#16630): the count word, then the + // caption unless the detail sentence already spells it out, then the + // blocker and the ask unless an earlier fact already names them. + const facts = []; + const say = fact => { if (fact && !facts.some(f => f.toLowerCase().includes(fact.toLowerCase()))) facts.push(fact); }; + say(text); + if (!(text && detail)) say(caption); + say(detail); + if (matches && a.blocker) say(String(a.blocker)); + say(ask); + let tip = facts.join(' · ') + sinceAgo + (perspectives.length ? ' · ' + perspectives.map(perspectiveLine).join(' · ') : '') + ' · head ' + (item.head || 'unknown') + ' · ' + source + ' · ' + freshness + since; 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 : ''; @@ -356,7 +382,7 @@ const evidenceLink = ownsPR && evidenceURL ? `${icon}${word}` : icon + word; const routeState = (sg.state || 'todo') + (sg.detour ? ' detoured' : ''); const hold = item.hold; - const fullTip = (current ? 'Current pipeline phase · ' : '') + name + ': ' + (text && text !== caption ? text + ' · ' : '') + tip + + const fullTip = (current ? 'Current pipeline phase · ' : '') + name + ': ' + tip + (matches && a.actor ? ' · actor ' + a.actor : '') + (codeNote || contextWord ? ' · ' + (codeNote || contextWord) : '') + (hold ? ' · ' + (hold.pill || 'Held by @' + hold.by) + (hold.reason ? ' · ' + hold.reason : '') : '') + diff --git a/src/pkg/dashboard/static/index.html b/src/pkg/dashboard/static/index.html index f3aa9ca177..0c8a192069 100644 --- a/src/pkg/dashboard/static/index.html +++ b/src/pkg/dashboard/static/index.html @@ -18001,21 +18001,36 @@

    Where to get help

    const failed = n('checks_failed'); const names = matches && Array.isArray(a.checks_failing) ? a.checks_failing : []; const count = 'CI ' + (total ? passed + '/' + total : '?/?'); - const failing = failed ? failed + ' failing' + (names.length ? ' (' + names.slice(0, 2).join(', ') + (names.length > 2 ? ', …' : '') + ')' : '') : ''; + // A check name inside the words wears single quotes ('test' not + // reported) so it stands apart from the words around it. + const q = n => "'" + n + "'"; + const failing = failed ? failed + ' failing' + (names.length ? ' (' + names.slice(0, 2).map(q).join(', ') + (names.length > 2 ? ', …' : '') + ')' : '') : ''; const blocker = matches && a.blocker ? String(a.blocker) : ''; + // The unfinished count carries information; "no verdict yet" or a + // bare "running" beside 12/66 did not (hivecommons/hive#16630). The + // last one or two unfinished names are spelled out. + const pendingNames = matches && Array.isArray(a.checks_pending) ? a.checks_pending.map(String).filter(Boolean) : []; + const pendingCount = total ? Math.max(total - passed - failed, pendingNames.length) : pendingNames.length; + const pending = verb => !pendingCount ? verb : pendingNames.length && pendingNames.length <= STAGE_TRACKER_PENDING_CHECKS_NAMED ? pendingNames.map(q).join(', ') + ' ' + verb : pendingCount + ' ' + verb; switch (state) { case 'passing': return count + ' passed'; - case 'failing': return count + ' · ' + (failing || 'failing' + (blocker ? ' (' + blocker + ')' : '')); - case 'running': return count + ' · running' + (failing ? ' · ' + failing : ''); - case 'queued': return count + ' · queued' + (failing ? ' · ' + failing : ''); - case 'skipped': return count + ' · ' + (blocker ? blocker + ' skipped' : 'skipped'); + case 'failing': return count + ' · ' + (failing || 'failing' + (blocker ? ' (' + q(blocker) + ')' : '')); + case 'running': return count + ' · ' + pending('running') + (failing ? ' · ' + failing : ''); + case 'queued': return count + ' · ' + pending('queued') + (failing ? ' · ' + failing : ''); + case 'skipped': return count + ' · ' + (blocker ? q(blocker) + ' skipped' : 'skipped'); case 'missing': { if (stageTrackerWorkflowApprovalPending(a) > 0) return count + ' · waiting on workflow approval' + (failing ? ' · ' + failing : ''); - return count + ' · ' + (passed ? (blocker ? blocker + ' not reported' : 'not all reported') : 'no checks reported yet') + (failing ? ' · ' + failing : ''); + return count + ' · ' + (passed ? (blocker ? q(blocker) + ' not reported' : 'not all reported') : 'no checks reported yet') + (failing ? ' · ' + failing : ''); + } + default: { + if (!total) return count + ' · no checks reported yet'; + if (failing) return count + ' · ' + failing + (pendingCount ? ' · ' + pending('running') : ''); + // A blocker here is a phrase ("commit statuses not observed") or + // the one check whose result cannot be read. + if (blocker) return count + ' · ' + (/\s/.test(blocker) ? blocker : q(blocker) + ' unclear'); + if (pendingCount) return count + ' · ' + pending('running'); + return count + ' · required set unknown'; } - // An unfinished ring with no settled word is still running - // (hivecommons/hive#16631). - default: return count + ' · ' + (total ? (passed + failed < total ? 'running' + (failing ? ' · ' + failing : '') : 'no verdict yet') : 'no checks reported yet'); } } const total = n('perspectives_total'); @@ -18062,6 +18077,9 @@

    Where to get help

    // person's click moves them, so the chevron names the wait and wears // the person icon (hivecommons/hive#16599). const STAGE_TRACKER_WORKFLOW_APPROVAL_BLOCKER = 'workflow-approval-required:'; + // Up to this many unfinished check names are spelled out in the CI + // chevron word; beyond it the count speaks (hivecommons/hive#16630). + const STAGE_TRACKER_PENDING_CHECKS_NAMED = 2; const STAGE_TRACKER_WORKFLOW_APPROVAL_TIP = 'Needs a maintainer to approve the workflow runs on GitHub before the checks can start'; function stageTrackerWorkflowApprovalPending(a) { if (!a) return 0; @@ -18253,17 +18271,25 @@

    Where to get help

    const source = matches ? a.source || 'unavailable' : 'unavailable'; const freshness = !Number.isFinite(observed) ? 'observation time unknown' : (stale ? 'stale · ' : 'observed · ') + new Date(observed).toISOString() + ' (' + stageTrackerAgoWord(observed, clock) + ')'; const since = matches && a.since && Number.isFinite(Date.parse(a.since)) ? ' · since ' + new Date(a.since).toISOString() : ''; - let blocker = matches && 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. const ask = matches && state === 'human_decision' && item.decision_needed && item.decision_needed.question ? String(item.decision_needed.question) : ''; - if (ask && blocker.indexOf(ask) < 0) blocker += ' · ' + ask; // 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 : ''; + const detail = matches && a.detail ? String(a.detail) : ''; const sinceAgo = matches && a.since && Number.isFinite(Date.parse(a.since)) && settledState ? ' · ' + stageTrackerAgoWord(Date.parse(a.since), clock) : ''; - let tip = caption + blocker + detail + sinceAgo + (perspectives.length ? ' · ' + perspectives.map(perspectiveLine).join(' · ') : '') + ' · head ' + (item.head || 'unknown') + ' · ' + source + ' · ' + freshness + since; + // Each fact once (hivecommons/hive#16630): the count word, then the + // caption unless the detail sentence already spells it out, then the + // blocker and the ask unless an earlier fact already names them. + const facts = []; + const say = fact => { if (fact && !facts.some(f => f.toLowerCase().includes(fact.toLowerCase()))) facts.push(fact); }; + say(text); + if (!(text && detail)) say(caption); + say(detail); + if (matches && a.blocker) say(String(a.blocker)); + say(ask); + let tip = facts.join(' · ') + sinceAgo + (perspectives.length ? ' · ' + perspectives.map(perspectiveLine).join(' · ') : '') + ' · head ' + (item.head || 'unknown') + ' · ' + source + ' · ' + freshness + since; 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 : ''; @@ -18292,7 +18318,7 @@

    Where to get help

    const evidenceLink = ownsPR && evidenceURL ? `${icon}${word}` : icon + word; const routeState = (sg.state || 'todo') + (sg.detour ? ' detoured' : ''); const hold = item.hold; - const fullTip = (current ? 'Current pipeline phase · ' : '') + name + ': ' + (text && text !== caption ? text + ' · ' : '') + tip + + const fullTip = (current ? 'Current pipeline phase · ' : '') + name + ': ' + tip + (matches && a.actor ? ' · actor ' + a.actor : '') + (codeNote || contextWord ? ' · ' + (codeNote || contextWord) : '') + (hold ? ' · ' + (hold.pill || 'Held by @' + hold.by) + (hold.reason ? ' · ' + hold.reason : '') : '') +