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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/fixed-16484-tracker-chevron-state-word.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- The Activity Monitor's CI and Review chevrons always carry a state word beside their glyph โ€” unknown or stale evidence now reads "CI waiting ยท test not observed ยท seen 14m ago" instead of a bare icon โ€” and when both tracks share the current phase the text says which one the hive is waiting on ("ยท new head d3c0824", "ยท waiting on CI", "ยท waiting on the fix") ([#16484](https://github.com/hivecommons/hive/issues/16484)).
64 changes: 59 additions & 5 deletions src/pkg/dashboard/stage_tracker_activity.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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, 'stageTrackerActivityTrackHtml') + ';return stageTrackerActivityTrackHtml;')(esc, (n, cls) => `<svg class="${cls}" data-icon="${n}"></svg>`);
const track = new Function('esc', 'stageTrackerIcon', fn(strip, 'stageTrackerTrackLead') + fn(strip, 'stageTrackerActivityTrackHtml') + ';return stageTrackerActivityTrackHtml;')(esc, (n, cls) => `<svg class="${cls}" data-icon="${n}"></svg>`);
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');
Expand Down Expand Up @@ -178,7 +178,8 @@ test('12:01 screenshot density preserves physical tracks for issue-only, one-to-
}
for (const cell of cells.filter(cell => /data-display-state="unknown"/.test(cell))) {
const content = cell.match(/aria-describedby="[^"]+">([^]*?)<span id=/)[1];
assert.equal(content.replace(/<[^>]*>/g, '').trim(), '', 'missing evidence remains icon-only at screenshot density');
assert.match(content, /<svg /, 'missing evidence keeps the track glyph');
assert.match(content.replace(/<[^>]*>/g, '').trim(), /unknown/, 'missing evidence still says so in words (#16484)');
}
}
}
Expand Down Expand Up @@ -560,7 +561,7 @@ test('current-phase styling is steady and undimmed, including compact/reduced-mo
assert.doesNotMatch(css, /\.ham-track-position/);
});

test('unknown tracks show only the canonical column glyph, preserving full focus/hover details and safe evidence links', () => {
test('unknown tracks wear the canonical column glyph beside their caption, preserving full focus/hover details and safe evidence links', () => {
for (const kind of ['ci', 'review']) {
const item = livePR({
number: 16434, repo: 'hivecommons/hive',
Expand All @@ -569,7 +570,7 @@ test('unknown tracks show only the canonical column glyph, preserving full focus
const rendered = track(item, kind, { state: 'active' }, false, now);
const content = rendered.match(/aria-describedby="[^"]+">([^]*?)<span id="[^"]+" class="config-tooltip/)[1];
assert.match(content, kind === 'ci' ? /<svg [^]*data-icon="ci"/ : /<svg [^]*data-icon="50"/, 'CI and Review wear distinct glyphs');
assert.equal(content.replace(/<[^>]*>/g, '').trim(), '', 'no CI/Review/unknown/reason/question-mark panel text');
assert.ok(content.replace(/<[^>]*>/g, '').includes((kind === 'ci' ? 'CI' : 'Review') + ' unknown ยท full precise reason'), 'the caption rides beside the glyph, never a bare icon (#16484)');
assert.match(content, /aria-label="Open current-head/);
assert.match(rendered, /class="ham-chevron-info config-info" tabindex="0"/);
assert.match(rendered, /role="tooltip">[^]*full precise reason[^]*head head/);
Expand Down Expand Up @@ -642,7 +643,7 @@ test('stale activity is visibly unknown and old green observations cannot look l
assert.match(html, /activity unknown ยท last observed reviewing/);
assert.doesNotMatch(html, /data-motion/);
assert.match(html, /data-display-state="unknown"/);
assert.doesNotMatch(html, /ham-chevron-copy/);
assert.match(html, /ham-chevron-copy ham-track-state"><svg [^>]*>(<\/svg>)?Review working ยท reviewer ยท seen 5m ago/, 'stale evidence keeps its words and says how old it is');
item.review_activity = activity('approved', 'Review approved');
assert.doesNotMatch(track(item, 'review', {}, false, now + 300000), /ham-activity-track done/);
});
Expand Down Expand Up @@ -695,3 +696,56 @@ test('the backend detail sentence rides in the track tooltip, not on the chevron
assert.match(html, /role="tooltip">[^]*hasn't reported for this head yet ยท Branch protection requires a check named &quot;test&quot;/);
assert.match(html, /title="[^"]*Branch protection requires a check named &quot;test&quot;, but no check run/);
});

test('#16484: a PR-row track never renders as a bare glyph in any of the four operator shapes', () => {
const stale = (state, caption, extra = {}) => ({ head: 'head', state, caption, source: 'cache', observed_at: new Date(now - 14 * 60000).toISOString(), ...extra });
const shapes = {
'new head, review findings': { stage: 70, display_column: 50, push: { state: 'pushed', sha: 'head', next: 're-review' }, code_activity: { head: 'head', state: 'pushed', caption: 'New head pushed ยท CI and re-review', source: 'recorded-push' }, ci_activity: stale('missing', 'CI waiting ยท test not observed'), review_activity: stale('changes_requested', 'Review findings ยท awaiting author') },
'red CI, review findings': { stage: 70, display_column: 50, ci_activity: { ...stale('failing', 'CI failing ยท test (26)'), observed_at: new Date(now).toISOString() }, review_activity: stale('changes_requested', 'Review findings ยท awaiting author ยท adjudicator') },
'both unknown': { stage: 50, display_column: 50, ci_activity: { head: 'head', state: 'unknown', caption: 'CI unknown ยท required checks not observed', source: 'unavailable' }, review_activity: { head: 'head', state: 'unknown', caption: 'Review unknown ยท current-head evidence unavailable', source: 'unavailable' } },
'held, stale approval': { stage: 70, display_column: 50, modifiers: ['hold'], hold: { by: 'hanthor', pill: 'Held by @hanthor' }, code_activity: { head: 'head', state: 'waiting_fixer', caption: 'Waiting for fixer ยท no code work observed', source: 'native-fix-request' }, ci_activity: stale('missing', 'CI waiting ยท test not observed'), review_activity: stale('approved', 'Review approved') },
'no evidence at all': { stage: 50, display_column: 50 },
};
for (const [name, fields] of Object.entries(shapes)) {
const cells = physicalTracks(livePR(fields));
for (const [kind, cell] of [['ci', cells.ci], ['review', cells.review]]) {
const content = cell.match(/aria-describedby="[^"]+">([^]*?)<span id=/)[1];
const words = content.replace(/<[^>]*>/g, '').trim();
assert.match(content, /<svg /, name + ' ' + kind + ' keeps its glyph');
assert.ok(words.length > 0 && /CI|Review/.test(words), name + ' ' + kind + ' carries a state word: ' + JSON.stringify(words));
assert.match(cell, /ham-current/, name + ' ' + kind + ' stays in the current phase');
}
}
const noEvidence = physicalTracks(livePR(shapes['no evidence at all']));
assert.match(noEvidence.ci.replace(/<[^>]*>/g, ''), /CI unknown ยท no evidence for head/);
});

test('#16484: when CI and Review share the phase the chevrons say which one the hive waits on', () => {
const fresh = (state, caption, extra = {}) => ({ head: 'd3c0824304d4c97b8ee76a267fb1e91f6d4c79a4', state, caption, source: 'cache', observed_at: new Date(now).toISOString(), ...extra });
const head = 'd3c0824304d4c97b8ee76a267fb1e91f6d4c79a4';
const text = cell => cell.match(/aria-describedby="[^"]+">([^]*?)<span id=/)[1].replace(/<[^>]*>/g, '');
// New head pushed, CI not yet reporting, review pending: CI leads on the new head, review waits on CI.
let cells = physicalTracks(livePR({ head, stage: 50, 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('missing', 'CI waiting ยท test not observed'), review_activity: fresh('pending', 'Review pending ยท reviewer-2 queued') }));
assert.equal(text(cells.ci), 'CI waiting ยท test not observed ยท new head d3c0824');
assert.equal(text(cells.review), 'Review pending ยท reviewer-2 queued ยท waiting on CI');
assert.match(cells.review, /hive is waiting on CI for new head d3c0824/);
// Review findings: the fixer's turn; CI is not the blocker and says so.
cells = physicalTracks(livePR({ head, stage: 70, display_column: 50, ci_activity: fresh('missing', 'CI waiting ยท test not observed'), review_activity: fresh('changes_requested', 'Review findings ยท awaiting author') }));
assert.equal(text(cells.ci), 'CI waiting ยท test not observed ยท waiting on the fix');
assert.equal(text(cells.review), 'Review findings ยท awaiting author');
// Red CI plus review findings: both are findings, neither defers to the other.
cells = physicalTracks(livePR({ head, stage: 70, display_column: 50, ci_activity: fresh('failing', 'CI failing ยท test (26)'), review_activity: fresh('changes_requested', 'Review findings ยท awaiting author') }));
assert.equal(text(cells.ci), 'CI failing ยท test (26)');
assert.equal(text(cells.review), 'Review findings ยท awaiting author');
// CI green, review pending: review leads, CI is done and says nothing extra.
cells = physicalTracks(livePR({ head, stage: 50, display_column: 50, ci_activity: fresh('passing', 'CI passed'), review_activity: fresh('pending', 'Review pending') }));
assert.equal(text(cells.ci), 'CI passed');
assert.equal(text(cells.review), 'Review pending');
// Both unknown (fresh PR): CI leads, review waits on CI.
cells = physicalTracks(livePR({ head, stage: 50, display_column: 50, ci_activity: { head, state: 'unknown', caption: 'CI unknown ยท required checks not observed', source: 'unavailable' }, review_activity: { head, state: 'unknown', caption: 'Review unknown ยท current-head evidence unavailable', source: 'unavailable' } }));
assert.equal(text(cells.ci), 'CI unknown ยท required checks not observed');
assert.equal(text(cells.review), 'Review unknown ยท current-head evidence unavailable ยท waiting on CI');
// Outside the current phase (merge gate) the lead clause is silent.
cells = physicalTracks(livePR({ head, stage: 80, display_column: 80, ci_activity: fresh('passing', 'CI passed'), review_activity: fresh('pending', 'Review pending') }));
assert.doesNotMatch(cells.review, /waiting on/);
});
52 changes: 46 additions & 6 deletions src/pkg/dashboard/static-src/js/tracker-row-strip.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,33 @@
return `<div class="ham-cols" aria-hidden="true"><div class="ham-strip-row"><ol class="ham-strip">${cols}<li class="ham-seg cap ham-history-head" title="History โ€” decisions and actions on this item">${stageTrackerIcon('history', 'ham-ico ham-history-ico', 'History โ€” decisions and actions on this item')}</li></ol><span class="ham-since">since</span></div></div>`;
}

// Pure: which of the two column-50 tracks the hive is waiting on when
// both share the current phase (hivecommons/hive#16484). Review
// findings and red CI are the fixer's turn ("the fix"); otherwise CI
// leads until it is green, then review. newHead: the head was just
// pushed, so CI is (re)running on it and the review is a re-review.
function stageTrackerTrackLead(item) {
if (!item || !item.head) return null;
const stateOf = k => { const a = item[k + '_activity']; return a && a.head === item.head && a.state ? a.state : 'unknown'; };
const ci = stateOf('ci');
const review = stateOf('review');
const done = s => s === 'passing' || s === 'approved';
const code = item.code_activity;
const push = item.push;
const newHead = !!((code && code.head === item.head && code.state === 'pushed') || (push && push.state === 'pushed' && push.sha === item.head));
if (review === 'changes_requested') return { track: 'review', waitingOn: 'the fix', newHead: false };
if (ci === 'failing') return { track: 'ci', waitingOn: 'the fix', newHead: false };
if (done(ci) && done(review)) return null;
if (done(ci)) return { track: 'review', waitingOn: 'review', newHead };
return { track: 'ci', waitingOn: 'CI', newHead };
}

// 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 always carries a state word beside its glyph: unknown or
// stale evidence says so in words ("ยท seen 14m ago"), it never shrinks
// to a bare icon (hivecommons/hive#16484). Freshness still gates the
// pulse and the green fill, not the text.
function stageTrackerActivityTrackHtml(item, kind, sg, blank, nowMs) {
if (blank) return `<li class="ham-seg blank" data-track="${kind}" data-route-state="blank" aria-hidden="true"></li>`;
const name = kind === 'ci' ? 'CI' : 'Review';
Expand Down Expand Up @@ -51,19 +76,34 @@
const codeObserved = Date.parse(code && code.observed_at || '');
const codeFresh = code && code.head === item.head && code.source === 'fix-dispatch+successful-edit+verified-git-worktree' && code.active && code.state === 'fixing' && Number.isFinite(codeObserved) && codeObserved <= clock && clock - codeObserved <= activityFreshMS;
if (!codeFresh) decided = decided.replace(/>(?:Fixing|Remediating)(?=\s|<)/g, '>Fix requested');
const word = esc(caption);
const sha7 = item.head ? String(item.head).slice(0, 7) : '';
let seen = '';
if (matches && !known && state !== 'unknown') {
if (!Number.isFinite(observed)) seen = ' ยท observation time unknown';
else if (observed > clock) seen = ' ยท observation ahead of clock';
else {
const m = Math.floor((clock - observed) / 60000);
const h = Math.floor(m / 60);
seen = ' ยท seen ' + (m < 1 ? 'under a minute' : m < 60 ? m + 'm' : h < 48 ? h + 'h' : Math.floor(h / 24) + 'd') + ' ago';
}
}
let text = !matches ? name + ' unknown ยท no evidence for ' + (sha7 || 'this head') : (a.caption || name + ' ' + state) + seen;
const lead = current && ownsPR && typeof stageTrackerTrackLead === 'function' ? stageTrackerTrackLead(item) : null;
if (lead && lead.track === kind && lead.newHead && kind === 'ci' && sha7) text += ' ยท new head ' + sha7;
else if (lead && lead.track !== kind && !(state === 'passing' || state === 'approved' || state === 'failing' || state === 'changes_requested')) text += ' ยท waiting on ' + lead.waitingOn;
const word = esc(text);
const evidenceURL = matches && /^https?:\/\//i.test(String(a.url || '')) ? a.url : '';
const evidenceLink = ownsPR && evidenceURL ? `<a href="${esc(evidenceURL)}" target="_blank" rel="noopener noreferrer" aria-label="${esc('Open current-head ' + name + ' evidence')}">${word}</a>` : word;
const icon = stageTrackerIcon(kind === 'ci' ? 'ci' : 50, 'ham-ico', name);
const evidenceLink = ownsPR && evidenceURL ? `<a href="${esc(evidenceURL)}" target="_blank" rel="noopener noreferrer" aria-label="${esc('Open current-head ' + name + ' evidence')}">${icon}${word}</a>` : icon + word;
const routeState = (sg.state || 'todo') + (sg.detour ? ' detoured' : '');
const hold = item.hold;
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 : '') : '');
(hold ? ' ยท ' + (hold.pill || 'Held by @' + hold.by) + (hold.reason ? ' ยท ' + hold.reason : '') : '') +
(lead ? ' ยท hive is waiting on ' + lead.waitingOn + (lead.newHead && sha7 ? ' for new head ' + sha7 : '') : '');
const tipID = 'ham-track-tip-' + [item.repo || '', item.kind || '', item.number || 0, kind].map(x => encodeURIComponent(String(x))).join('-');
const icon = stageTrackerIcon(kind === 'ci' ? 'ci' : 50, 'ham-ico', name);
const content = known ? `<span class="ham-chevron-copy ham-track-state">${evidenceLink}</span>` : icon;
const linkedIcon = !known && ownsPR && evidenceURL ? `<a href="${esc(evidenceURL)}" target="_blank" rel="noopener noreferrer" aria-label="${esc('Open current-head ' + name + ' evidence')}">${icon}</a>` : content;
const linkedIcon = `<span class="ham-chevron-copy ham-track-state">${evidenceLink}</span>`;
return `<li class="ham-seg ham-activity-track ${cls}${current ? ' ham-current' : ''}" data-track="${kind}" data-route-state="${esc(routeState)}" data-activity-state="${esc(state)}" data-display-state="${known ? 'known' : 'unknown'}"${current ? ' aria-current="step"' : ''}${active ? ' data-motion="active"' : ''}${ownsPR ? ` title="${esc(fullTip)}"` : ''} aria-label="${esc(fullTip)}"><span class="ham-chevron-info config-info" tabindex="0" title="" aria-label="${esc(fullTip)}" aria-describedby="${esc(tipID)}">${linkedIcon}<span id="${esc(tipID)}" class="config-tooltip ham-chevron-tip" role="tooltip">${esc(fullTip)}${decided ? `<span class="ham-track-context">${decided}</span>` : ''}</span></span></li>`;
}

Expand Down
Loading
Loading