From 7463c73fff5118c63f4ad04a04b34220383fb7f8 Mon Sep 17 00:00:00 2001 From: Andrew Anderson Date: Tue, 3 Nov 2026 12:16:30 -0500 Subject: [PATCH 1/4] =?UTF-8?q?=F0=9F=90=9B=20Restore=20activity=20monitor?= =?UTF-8?q?=20layout=20and=20compact=20chevrons?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Restore canonical metadata spans, full-row right-anchored controls and bounded shared tracks for linked and multi-PR rows. Separate current-phase position from running activity. Wrap chevrons to two visible lines with accessible full details and icon-only unknowns. Preserve decision controls without competing tooltip overlays. Independent review cleared the final implementation; canonical CI and published-render geometry/interaction proof remain required. All reported chevron work stays in this single branch and PR. Signed-off-by: Andrew Anderson --- changelog.d/fixed-activity-header-spans.md | 1 + src/docs/dashboard-source-layout.md | 58 ++++ .../stage_tracker_acting_caption_test.go | 15 +- .../dashboard/stage_tracker_activity.test.js | 306 +++++++++++++++++- .../stage_tracker_decision_popover_test.go | 3 +- .../stage_tracker_header_spans.test.js | 207 ++++++++++++ .../stage_tracker_human_attention.test.js | 1 + .../stage_tracker_merge_failed_column_test.go | 3 +- .../stage_tracker_preparation_visual.test.js | 1 + .../dashboard/stage_tracker_ui_rows_test.go | 2 +- src/pkg/dashboard/static-src/css/tracker.css | 99 +++--- .../static-src/js/tracker-actions.js | 3 +- .../static-src/js/tracker-row-layout.js | 19 +- .../static-src/js/tracker-row-strip.js | 40 ++- src/pkg/dashboard/static/index.html | 161 ++++----- .../testdata/tracker-activity-density.json | 83 +++++ .../testdata/tracker-decision-interaction.js | 98 ++++++ .../testdata/tracker-header-geometry.js | 177 ++++++++++ 18 files changed, 1122 insertions(+), 155 deletions(-) create mode 100644 changelog.d/fixed-activity-header-spans.md create mode 100644 src/pkg/dashboard/stage_tracker_header_spans.test.js create mode 100644 src/pkg/dashboard/webstatic/testdata/tracker-activity-density.json create mode 100644 src/pkg/dashboard/webstatic/testdata/tracker-decision-interaction.js create mode 100644 src/pkg/dashboard/webstatic/testdata/tracker-header-geometry.js diff --git a/changelog.d/fixed-activity-header-spans.md b/changelog.d/fixed-activity-header-spans.md new file mode 100644 index 0000000000..8afd299b1f --- /dev/null +++ b/changelog.d/fixed-activity-header-spans.md @@ -0,0 +1 @@ +- Restore activity issue/PR header spans and far-right action controls; keep truthful current-phase highlights across parallel CI/Review, wrap all chevrons within two lines with complete hover/keyboard details, and show unknown track states as icons rather than verbose panels. diff --git a/src/docs/dashboard-source-layout.md b/src/docs/dashboard-source-layout.md index c54ab8dec2..b560d2f532 100644 --- a/src/docs/dashboard-source-layout.md +++ b/src/docs/dashboard-source-layout.md @@ -27,6 +27,64 @@ is *where edits land* — a toast fix touches `css/alerts-toasts.css`, a tracker fix touches `js/tracker-row.js`, and two such PRs no longer conflict on one 60 000-line file. +Activity row headers share the progress strip's physical grid. Their issue +metadata spans Open through Claimed, even without a PR; PR metadata starts at +the canonical PR in progress boundary and spans through Merge gate, including +the independent CI and Review tracks. Modifier/action badges wrap in their own +full-width, far-right-anchored toolbar line, rather than overflowing the history +cap into a title or ending in an issue-side column. At narrow widths the header +slots stack and wrap; small-screen progress strips scroll horizontally without +moving header controls offscreen. `stage_tracker_header_spans.test.js` +checks rendered markup and track arithmetic in CI; actual clipping and overlap +still require browser geometry checks on a dedicated published-preview tab. Invoke +`webstatic/testdata/tracker-header-geometry.js` as +`()({ dedicatedPreview: true })` there at desktop and narrow +widths with issue-only, linked, and PR-only rows present, including long titles +and waiting/regression badges. It asserts measured lane boundaries, metadata +containment, badge separation and header-to-progress separation. Every relevant +header control must stay horizontally contained and pass center hit-testing; +the probe deliberately scrolls vertically offscreen controls into view and +restores scroll positions rather than silently skipping them. It never activates +controls. Do not run interaction/scroll probes in the user's live dashboard tab. +Nested PRs use the same explicit bounded grid-track contract as root rows, +not implicit min-content tracks that long identity/context text can widen. +The probe also compares physical lane positions/heights across rows and bounds +vertical gaps by the actual CSS gap/margins, allowing real wrapped content but +rejecting unexplained empty space. + +`webstatic/testdata/tracker-activity-density.json` records acceptance shapes from +the owner's 12:01 screenshot: #16404 with #16442/#16378, Hotshot #343/#344, +#16438 with #16446/#16449, issue-only #16420, and a PR-only #16437 view variant. +It preserves full GitHub-read titles, author identities, heads and long waiting +captions. Its stage/activity projections and frozen clock are deterministic test +inputs, not a claimed live backend snapshot. Use these structures plus long +unbroken-handle stress data for preview coverage; a fixture passing is not proof +that the published application renders correctly. + +The split CI/Review cards also distinguish position from activity: a steady +outline and accessible current-phase label identify the occupied phase, even when +evidence is unknown, work is queued or a PR is held. The running-work class and +motion still require fresh current-head activity evidence; completion remains +evidence-based. Both parallel tracks can occupy the current phase without +claiming either is running. Native stages, holds and merge authority do not +change. + +All progress chevrons share a fixed two-line text budget, wrapping even unbroken +handles. Icons have reserved space clear of the chevron points. Full details +remain in the native title and/or shared hover/focus tooltip portal; links and +decision controls remain interactive. Decision chevrons, including native +merge-gate claim conflicts, instead use their existing decision dialog as the +sole hover/focus detail surface. The gate caption remains a decision button; +full caption, reason and head metadata go to its keyboard-accessible Details, +without a competing tooltip or extra focus stop. The dedicated-preview +`webstatic/testdata/tracker-decision-interaction.js` probe uses the same invocation +to check pointer hover, focus, ArrowDown/Enter/Space entry, action hit-testing, +and tooltip exclusion. It never activates a decision action. Unknown, stale or old-head CI/Review +observations show only the existing 050 column glyph, with their full source, +reason, owner and head metadata available in the keyboard-accessible tooltip. +Unknown does not mean running, passed or approved. Known track captions use the +same two-line budget; fixer/diagnostic detail belongs in the tooltip. + The sources sit in a sibling directory (`static-src/`, not `static/src/`) on purpose: `//go:embed static` embeds everything under `static/` recursively, so sources placed inside it would be compiled into the binary and served. diff --git a/src/pkg/dashboard/stage_tracker_acting_caption_test.go b/src/pkg/dashboard/stage_tracker_acting_caption_test.go index 95675d0939..5514990bd4 100644 --- a/src/pkg/dashboard/stage_tracker_acting_caption_test.go +++ b/src/pkg/dashboard/stage_tracker_acting_caption_test.go @@ -14,13 +14,13 @@ import ( // sat on them in muted grey — unreadable — while "Ready for human merge · // untrusted author" still showed beside it, wrapped to four lines. While an // action is in flight a lit chevron shows ONE caption, on an opaque plate -// that meets WCAG AA in both themes, on one line. +// that meets WCAG AA in both themes, within the shared two-line budget. const stageTrackerActingHideRule = `.cue-acting > .ham-strip-row > .ham-strip > .ham-seg.active:not(.cap) > :not(.cue-acting-cap) { display: none; }` // stageTrackerActingPlateRule is the plate: page surface under page text, -// above the stripes and the pulse overlay, one line with an ellipsis. -const stageTrackerActingPlateRule = `.ham-seg.active > .cue-acting-cap { display: inline-block; position: relative; z-index: 1; margin-left: 0; max-width: 100%; min-width: 0; box-sizing: border-box; padding: var(--sp-1) var(--sp-2); border-radius: var(--r-pill); background: var(--surface-0); color: var(--text); font-weight: var(--fw-medium); line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }` +// above the stripes and the pulse overlay, wrapping within two lines. +const stageTrackerActingPlateRule = `.ham-seg.active > .cue-acting-cap { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: var(--ham-chevron-text-lines); line-clamp: var(--ham-chevron-text-lines); position: relative; z-index: 1; margin-left: 0; max-width: 100%; min-width: 0; box-sizing: border-box; padding: 0 var(--sp-2); border-radius: var(--r-pill); background: var(--surface-0); color: var(--text); font-weight: var(--fw-medium); line-height: var(--ham-chevron-line-height); overflow: hidden; white-space: normal; overflow-wrap: anywhere; }` // wcagMinContrastAA is the WCAG 2.x AA ratio for normal text. const wcagMinContrastAA = 4.5 @@ -139,8 +139,10 @@ for (const [label, item] of [['merge gate', gateIssue], ['decision', decideIssue const lit = (row.match(/
  • 0 && reachable === lit, label + ': ' + lit + ' lit chevron(s), ' + reachable + ' at row > .ham-strip-row > .ham-strip > .ham-seg.active:\n' + row); - // The word is a child of the lit chevron, so the hide rule reaches it. - assert.ok(/
  • ]*>(?:<[^l][^>]*>|)*?<(?:span|button) class="(?:ham-seg-t|ham-detour|ham-decision-trigger)/.test(row), label + ': the word is a direct child of the lit chevron:\n' + row); + // The focusable tooltip/copy wrapper is a direct child, so the hide rule + // reaches the complete wrapped word and its reserved glyphs together. + assert.ok(/
  • ]*> c.classList.contains('cue-acting-cap')); assert.strictEqual(caps.length, 1, 'exactly one caption'); assert.strictEqual(caps[0].lastChild.nodeValue, 'Queuing for merge…'); assert.strictEqual(caps[0].getAttribute('role'), 'status'); +assert.strictEqual(caps[0].title, 'Queuing for merge…', 'clamped action caption retains its full hover text'); +assert.strictEqual(caps[0].getAttribute('aria-label'), 'Queuing for merge…'); +assert.strictEqual(caps[0].getAttribute('tabindex'), '0', 'full status remains keyboard accessible'); const capEls = caps[0].children.filter(c => c.classList); // the stub lists the text node too assert.strictEqual(capEls.length, 1, 'spinner + text only'); assert.ok(capEls[0].classList.contains('cue-acting-spin')); const shown = seg.children.filter(c => !c.classList.contains('cue-acting-cap')); diff --git a/src/pkg/dashboard/stage_tracker_activity.test.js b/src/pkg/dashboard/stage_tracker_activity.test.js index b0be4119a1..0f149ac5d9 100644 --- a/src/pkg/dashboard/stage_tracker_activity.test.js +++ b/src/pkg/dashboard/stage_tracker_activity.test.js @@ -20,7 +20,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', fn(strip, 'stageTrackerActivityTrackHtml') + ';return stageTrackerActivityTrackHtml;')(esc); +const track = new Function('esc', 'stageTrackerIcon', 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'); @@ -99,6 +99,304 @@ test('linked PRs carry independent evidence and hidden issue columns stay aligne assert.match(render, /ci_activity: lp.ci_activity \|\| null, review_activity: lp.review_activity \|\| null/); }); +const rowSource = fs.readFileSync(path.join(root, 'tracker-row.js'), 'utf8'); +const segments = new Function('stageTrackerAnchor', globals + ` +const STAGE_TRACKER_ACTIVE_WORD = {70: 'Fixing'}; +const STAGE_TRACKER_HUMAN_GATED = 85, STAGE_TRACKER_READY_FOR_HUMAN_MERGE = 90, STAGE_TRACKER_ADOPTED_BY_HIVE = 74; +function stageTrackerSentinelInLane() { return false; } +function stageTrackerUnauthorizedWord() { return ''; } +function stageTrackerManualMergeWord() { return 'Ready for human merge'; } +` + fn(rowSource, 'stageTrackerSegments') + ';return stageTrackerSegments;')(getAnchor); +const makeStripRenderer = (helpers = {}) => new Function('esc', 'stageTrackerSegments', 'stageTrackerActivityTrackHtml', ...Object.keys(helpers), globals + ` +const STAGE_TRACKER_MOTION_STATIC = 'static', STAGE_TRACKER_MOTION_ACTIVE = 'active'; +const STAGE_TRACKER_READY_FOR_HUMAN_MERGE = 90; +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)); +const renderStrip = makeStripRenderer(); + +function physicalTracks(item) { + const rendered = renderStrip(item, stages, null, now, {}); + const cells = [...rendered.matchAll(//g)].map(match => match[0]); + assert.equal(cells.length, 8, 'actual strip expands native 050 into two physical tracks plus history'); + assert.match(cells[4], /data-track="ci"/); + assert.match(cells[5], /data-track="review"/); + return { rendered, cells, ci: cells[4], review: cells[5] }; +} +const livePR = extra => ({ kind: 'pr', head: 'head', stage: 50, modifiers: [], ...extra }); + +const actions = fs.readFileSync(path.join(root, 'tracker-actions.js'), 'utf8'); + +test('12:01 screenshot density preserves physical tracks for issue-only, one-to-one, multi-PR and PR-only rows', () => { + const fixture = JSON.parse(fs.readFileSync(path.join(__dirname, 'webstatic/testdata/tracker-activity-density.json'), 'utf8')); + const clock = Date.parse(fixture.clock); + const fixtureStages = [...stages, { number: 90, short: 'Ready for human merge', branch_from: 80 }]; + for (const row of fixture.rows) { + const linked = row.linked_prs || []; + const items = linked.length === 1 ? [{ ...linked[0], kind: 'pr', repo: row.repo }] : + [row, ...linked.map(pr => ({ ...pr, kind: 'pr', repo: row.repo }))]; + for (const item of items) { + const range = item === row && linked.length > 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.equal(cells.length, 8, 'all row structures retain seven lanes plus history'); + if (range?.from) { + assert.ok(cells.slice(0, 3).every(cell => /class="ham-seg blank"/.test(cell)), 'nested PRs reserve the physical Open–Claimed slots'); + } + if (range?.to) { + assert.ok(cells.slice(3).every(cell => /class="ham-seg blank/.test(cell)), 'multi-PR issue owns no PR-side activity'); + } + if (item.number === 344) { + assert.match(cells[4], /todo ham-current/); + assert.match(cells[5], /done ham-current/); + } + if (item.code_activity?.state === 'waiting_owner') { + assert.ok(cells[3].includes(item.code_activity.caption)); + assert.doesNotMatch(rendered, /data-motion="active"/, 'waiting for an author is not observed coding'); + } + for (const cell of cells.filter(cell => /data-display-state="unknown"/.test(cell))) { + const content = cell.match(/aria-describedby="[^"]+">([^]*?)]*>/g, '').trim(), '', 'missing evidence remains icon-only at screenshot density'); + } + } + } +}); + +test('merge-gate claim decisions wrap the complete gate caption and use only their existing decision dialog', () => { + const gate = { word: 'Claim conflict · @' + 'unbrokenclaimanthandle'.repeat(12), detail: 'needs a pick', tip: 'Two claimants need a human decision' }; + const decisionOf = new Function('stageTrackerItemKey', fn(actions, 'stageTrackerDecisionOf') + ';return stageTrackerDecisionOf;')(item => item.repo + '/' + item.kind + '#' + item.number); + const trigger = new Function('esc', fn(actions, 'stageTrackerDecisionTriggerHtml') + ';return stageTrackerDecisionTriggerHtml;')(esc); + const gateSource = fs.readFileSync(path.join(root, 'tracker-words-gate.js'), 'utf8'); + const gateWord = new Function('esc', 'stageTrackerMergeGateInfo', fn(gateSource, 'stageTrackerMergeGateWordHtml') + ';return stageTrackerMergeGateWordHtml;')(esc, () => gate); + const render = makeStripRenderer({ + stageTrackerDecisionOf: decisionOf, stageTrackerDecisionTriggerHtml: trigger, + stageTrackerMergeGateInfo: () => gate, stageTrackerMergeGateWordHtml: gateWord, + }); + const item = livePR({ + repo: 'hivecommons/hive', number: 7, stage: 80, reason: 'Unabridged claim conflict reason', + decision_needed: { question: 'Which claimant should continue?', blocker: 'Do not merge until the claim conflict is resolved' }, + }); + const cells = [...render(item, stages, null, now, {}).matchAll(//g)].map(match => match[0]); + const cell = cells[6]; + assert.match(cell, /^
  • ]*>/); + assert.match(cell, /ham-chevron-copy">', + stageTrackerTooltip: () => 'tooltip', + stageTrackerPRPillsHtml: ref => `${ref}base v5`, + stageTrackerActedBadgeHtml: () => '', + stageTrackerChipsHtml: () => chips, + stageTrackerMoveAttrs: () => '', + stageTrackerSinceHtml: () => '2m', + stageTrackerCurrentStageHtml: () => '', + stageTrackerRowToolsHtml: () => '', + stageTrackerStripItems: () => '', + }); + for (const name of ['STAGE_TRACKER_PATH', 'STAGE_TRACKER_PR_COLUMN', 'STAGE_TRACKER_TERMINAL', + 'STAGE_TRACKER_CLOSED_ISSUE_TITLE', 'STAGE_TRACKER_UNTITLED_ISSUE', 'STAGE_TRACKER_SOFT_LINK_VIAS', 'STAGE_TRACKER_SOFT_LINK_TIP']) { + vm.runInContext(pick(new RegExp('const ' + name + ' = [^\\n]*'), name), ctx); + } + for (const name of ['stageTrackerHeadColsHtml', 'stageTrackerHeaderHtml', 'stageTrackerRowHtml', 'stageTrackerSubRowHtml', + 'stageTrackerPRRef', 'stageTrackerPRIssueSlot', 'stageTrackerTitleHtml', 'stageTrackerSplitTitleTag']) { + vm.runInContext(fn(name), ctx); + } + return ctx; +} +const pr = { kind: 'pr', repo: 'hivecommons/hive', number: 7, stage: 70, title, author: 'a-very-long-contributor', author_kind: 'human', url: 'https://github.com/hivecommons/hive/pull/7' }; +const issue = { kind: 'issue', repo: pr.repo, number: 1, stage: 20, title: '[scanner] ' + title, url: 'https://github.com/hivecommons/hive/issues/1' }; + +for (const [name, item] of [ + ['issue-only', issue], + ['linked issue/PR', { ...issue, linked_prs: [pr] }], + ['PR-only', pr], +]) test(name + ': full metadata stays in the correct header slots', () => { + const ctx = load(); + const rendered = ctx.stageTrackerRowHtml(item, [], { nowMs: 1, repoChips: {} }); + const start = Number(rendered.match(/--ham-pr-start: (\d+)/)[1]); + assert.equal(start, 4, 'PR metadata starts at PR in progress, not Actionable'); + const lead = rendered.match(/
  • ([\s\S]*?)<\/li>/)[1]; + if (name === 'PR-only') { + assert.match(lead, /no linked issue/); + assert.doesNotMatch(lead, /#7/); + } else { + assert.match(lead, /#1/); + assert.ok(lead.includes(title), 'complete issue title, not a shortened replacement'); + assert.match(lead, /ham-title-tag/); + } + if (name !== 'issue-only') { + const ref = rendered.match(/
  • ]*>([\s\S]*?)<\/li>/)[1]; + assert.match(ref, /#7/); + assert.ok(ref.includes(title)); + assert.match(ref, /ham-author-human/); + if (name === 'linked issue/PR') assert.match(rendered, /data-ham-target-key="pr:7"/); + } + assert.ok(rendered.includes(chips), 'waiting, push, and regression metadata is retained'); +}); + +function rule(selector) { + const found = html.match(new RegExp(selector.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') + ' \\{([^}]+)\\}')); + assert.ok(found, selector); + return found[1]; +} + +test('spans share the physical lane grid, including independent concurrent CI/Review', () => { + const ctx = load(); + const header = ctx.stageTrackerHeaderHtml([]); + const physicalCount = (header.match(/
  • CI<\/span>/); + assert.match(header, />Review<\/span>/); + const strip = rule('.ham-strip'); + assert.match(strip, /display: grid/); + assert.match(strip, /grid-template-columns: repeat\(var\(--ham-visible-columns\), minmax\(0, 1fr\)\) 4em/); + const laneCount = Number(strip.match(/--ham-visible-columns: (\d+)/)[1]); + assert.equal(laneCount, physicalCount - 1, 'CSS and actual rendered lane count must agree'); + assert.match(rule('.ham-head-cols .ham-seg.ham-head-lead'), /grid-column: 1 \/ var\(--ham-pr-start\)/); + assert.match(rule('.ham-head-cols .ham-seg.ham-head-pr'), /grid-column: var\(--ham-pr-start\) \/ -2/); + assert.match(rule('.ham-head-cols .ham-seg.cap'), /grid-column: 1 \/ -1; grid-row: 2/); + assert.match(rule('.ham-head-cols .ham-seg.cap'), /justify-content: flex-end/); + // Resolve the declared grid lines using the actual header's track count. + // Content cannot alter minmax(0,1fr) track widths; covered gaps belong to spans. + const start = Number(ctx.stageTrackerHeadColsHtml(['PR'], 'issue', chips).match(/--ham-pr-start: (\d+)/)[1]); + const gap = 4, cap = 48; + for (const width of [2400, 1440, 1110]) { + const lane = (width - cap - laneCount * gap) / laneCount; + const prLeft = (start - 1) * (lane + gap); + const issueRight = (start - 1) * lane + (start - 2) * gap; + const prRight = laneCount * lane + (laneCount - 1) * gap; + assert.ok(Math.abs(prLeft - issueRight - gap) < 1e-9, 'issue span ends one gutter before PR'); + assert.ok(Math.abs((prRight - prLeft) - ((laneCount - start + 1) * lane + (laneCount - start) * gap)) < 1e-9); + assert.ok(prRight < width - cap, 'PR span excludes the history cap'); + } + vm.runInContext('STAGE_TRACKER_PATH.splice(2, 0, 15)', ctx); + assert.match(ctx.stageTrackerHeadColsHtml(['PR']), /--ham-pr-start: 5/, 'boundary derives from canonical stages, not a second hard-coded span'); +}); + +test('long metadata wraps in bounded slots and the narrow layout resets both grid axes', () => { + assert.match(rule('.ham-head-cols .ham-seg.ham-head-pr'), /flex-wrap: wrap/); + assert.match(rule('.ham-head-cols .ham-seg.cap .ham-badges'), /flex-wrap: wrap/); + assert.match(rule('.ham-head-cols .ham-seg.cap .ham-badges'), /max-width: 100%/); + assert.match(rule('.ham-head-cols .ham-seg.cap .ham-badges'), /justify-content: flex-end/); + assert.match(rule('.ham-head-cols .ham-badge'), /white-space: normal; overflow-wrap: anywhere/); + assert.match(html, /\.ham-head-main > \.ham-title, \.ham-head-pr \.ham-pr-title \{ white-space: normal; overflow: visible; overflow-wrap: anywhere; \}/); + assert.match(html, /@media \(max-width: 1100px\) \{[\s\S]*?\.ham-head-cols \.ham-strip > \.ham-seg \{ grid-column: 1 \/ -1; grid-row: auto; padding: 0; \}/); + assert.doesNotMatch(html, /\.ham-strip:not\(\.ham-head-cols\)/, 'the old ancestor/element selector mistake must not return'); +}); + +test('issue-only, linked and PR-only controls occupy one full-row far-right toolbar, independent of title spans', () => { + for (const [number, label, history, blocked] of [ + [15329, 'Let hive decide', 1, false], + [16242, '', 0, false], + [16422, 'Accept triage', 0, false], + [16423, '', 1, false], + [16363, '', 0, false], + [16424, 'Close now', 0, false], + [431, '', 1, true], + ]) { + const ctx = load(); + ctx.stageTrackerActedBadgeHtml = () => history ? 'history ' + history + '' : ''; + ctx.stageTrackerChipsHtml = () => blocked ? 'blocked' : ''; + ctx.stageTrackerLeadButtonHtml = () => label ? '' : ''; + for (const item of [{ ...issue, number, is_tracker: number === 16242 }, { ...issue, number, linked_prs: [pr] }, { ...pr, number }]) { + const rendered = ctx.stageTrackerRowHtml(item, [], { nowMs: 1 }); + const toolbar = rendered.match(/
  • ([^]*?)<\/li>/)[1]; + if (label) { + assert.ok(toolbar.includes(label)); + assert.equal(rendered.split(label).length - 1, 1, 'action is not duplicated to fake alignment'); + assert.match(toolbar, /type="button"[^]*data-action="fixtureAction"/); + } + if (history) assert.match(toolbar, /ham-acted" tabindex="0">history 1/); + if (blocked) assert.match(toolbar, />blocked([^]*?)<\/li>/)[1]; + assert.doesNotMatch(lead, /ham-lead-act|ham-acted|>blocked { + const fixture = JSON.parse(fs.readFileSync(path.join(__dirname, 'webstatic/testdata/tracker-activity-density.json'), 'utf8')); + const ctx = load(); + vm.runInContext(fn('stageTrackerPRPillsHtml'), ctx); + ctx.stageTrackerChipsHtml = item => item.push ? `${esc('@' + item.push.login + ' · ' + (item.rework?.state || item.push.state))}` : ''; + ctx.stageTrackerLeadButtonHtml = item => { + const text = item.linked_prs?.length > 1 ? 'Let hive decide — all ' + item.linked_prs.length + ' PRs' : item.decision_needed ? 'Let hive decide' : item.manual_merge ? 'Approve and let hive merge' : ''; + return text ? `` : ''; + }; + ctx.stageTrackerActedBadgeHtml = item => item.operator_action_count ? 'history 1' : ''; + ctx.stageTrackerHumanContextHtml = item => item.reason ? `
    ${esc(item.reason)}
    ` : ''; + let multi = 0, nested = 0; + for (const item of fixture.rows) { + const rendered = ctx.stageTrackerRowHtml(item, [], { nowMs: Date.parse(fixture.clock), repoChips: {} }); + const children = item.linked_prs?.length > 1 ? item.linked_prs : []; + multi += children.length > 1 ? 1 : 0; + nested += children.length; + assert.equal((rendered.match(/
    /g)) { + assert.match(header[1], /--ham-pr-start: 4/); + assert.equal((header[1].match(/class="ham-seg cap"/g) || []).length, 1, 'one separate far-right toolbar per identity'); + const lead = header[1].match(/ham-head-lead[^"]*">([^]*?)<\/li>/)[1]; + assert.doesNotMatch(lead, /ham-badge-waiting|ham-lead-act|ham-acted/, 'activity/action/history controls never overprint the issue title slot'); + } + for (const pr of children) { + const start = rendered.indexOf('data-ham-sub-key="pr:' + pr.number + '"'); + assert.ok(start >= 0); + const sub = rendered.slice(start).split('
  • ${name}${evidenceLink}${codeNote || contextWord ? `${esc(codeNote || contextWord)}` : ''}${decided ? `${decided}` : ''}${stale || !Number.isFinite(observed) ? '?' : ''}
  • `; + 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 : '') : ''); + const tipID = 'ham-track-tip-' + [item.repo || '', item.kind || '', item.number || 0, kind].map(x => encodeURIComponent(String(x))).join('-'); + const icon = stageTrackerIcon(50, 'ham-ico', name); + const content = known ? `${evidenceLink}` : icon; + const linkedIcon = !known && ownsPR && evidenceURL ? `${icon}` : content; + return `
  • ${linkedIcon}${esc(fullTip)}${decided ? `${decided}` : ''}
  • `; } // Chevrons for one item. range bounds the columns the item owns (an @@ -108,6 +119,7 @@ const cls = ['ham-seg', sg.state, sg.cap ? 'cap' : '', 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 = ''; if (active) { tip = sg.label + (sg.description ? ' — ' + sg.description : ''); if (sg.blocked) tip += ' — ' + stageTrackerBlockedTip(item); @@ -119,7 +131,10 @@ // With merge_gate in the payload the sentence is the gate's own // (what holds it, next sweep, soak left — #15073). const gateInfo = !sg.detour && typeof stageTrackerMergeGateInfo === 'function' ? stageTrackerMergeGateInfo(item, nowMs, trains) : null; - if (gateInfo) tip = sg.label + ' — ' + gateInfo.tip; + if (gateInfo) { + tip = sg.label + ' — ' + gateInfo.tip; + gateCaption = [gateInfo.word, gateInfo.detail].filter(Boolean).join(' · '); + } else if (!sg.detour && (curStage === 60 || curStage === 80)) tip = sg.label + ' — not yet admitted' + (item.caption || item.reason ? ' — ' + (item.caption || item.reason) : ''); else if (curStage === STAGE_TRACKER_PRE_MERGE_SOAK) tip = sg.label + ' — admitted, soaking' + stageTrackerSoakLeft(item); else if (curStage === 100) tip = sg.label + ' — admitted, merging'; @@ -170,8 +185,17 @@ // The cap chevron is the ✓ only once the PR is merged; until then // the column is the row's history and wears the history mark. if (sg.cap) inner = sg.terminal ? stageTrackerIcon(sg.number, 'ham-ico') : stageTrackerIcon('history', 'ham-ico ham-history-ico', 'History — no decisions or actions recorded yet'); - else if (active) inner = gateCue + workIco + (decision ? stageTrackerDecisionTriggerHtml(decision, word, tip) : word) + (actorIco || holderIco); - else inner = stageTrackerIcon(sg.number, 'ham-ico'); + else if (active) { + const fullTip = [tip, gateCaption || (sg.detour ? sg.detour.text : sg.short), item.caption, item.reason, + item.head ? 'head ' + item.head : '', + item.hold ? (item.hold.pill || 'Held by @' + item.hold.by) + (item.hold.reason ? ' · ' + item.hold.reason : '') : ''].filter(Boolean).join(' · '); + const tipID = 'ham-chevron-tip-' + [item.repo || '', item.kind || '', item.number || 0, sg.number].map(x => encodeURIComponent(String(x))).join('-'); + const caption = gateWord || word; + const text = decision ? stageTrackerDecisionTriggerHtml(decision, caption, fullTip) : caption; + const content = `${gateCue}${workIco}${text}${actorIco || holderIco}`; + // A decision's dialog is its sole hover/focus detail surface. + inner = decision ? `${content}` : `${content}${esc(fullTip)}`; + } else inner = stageTrackerIcon(sg.number, 'ham-ico'); return `
  • ${inner}
  • `; }).join(''); } diff --git a/src/pkg/dashboard/static/index.html b/src/pkg/dashboard/static/index.html index 80065e550f..aeeca570a4 100644 --- a/src/pkg/dashboard/static/index.html +++ b/src/pkg/dashboard/static/index.html @@ -1431,39 +1431,29 @@ /* Title line = a ghost strip with the same column widths as the chevrons below: a lead cell spanning Open..Claimed carries the number + title, a PR cell spanning PR in progress..Merge gate carries "[icon] #N title", - the cap column is kept for the modifier chip and the since column is - an empty spacer (the time on step rides the strip row's since cell, in - line with the chevrons). Both cells wrap rather than collide; the lead - keeps a clear gap before the PR column. The spanning cells' flex-basis - absorbs the gaps they cover so the PR cell starts exactly at the PR in - progress chevron. */ + modifiers get a separate, full-width right-anchored toolbar line. The since column is + an empty spacer (the time on step rides the strip row's since cell). + Explicit grid spans share the chevrons' tracks, including the two + concurrent CI/Review tracks, without content changing their widths. */ .ham-row-head { position: relative; display: flex; align-items: flex-start; gap: var(--sp-3); font-size: var(--fs-sm); min-width: 0; line-height: 1.3; } .ham-head-cols { flex: 1 1 auto; min-width: 0; min-height: 1.3em; align-items: flex-start; } .ham-head-cols .ham-strip { height: auto; } .ham-head-cols .ham-seg { background: transparent; clip-path: none; align-items: flex-start; justify-content: flex-start; padding: 0 var(--sp-2) 0 var(--sp-4); white-space: normal; } - /* Lead = exactly three of the six equal chevrons (half of the strip - minus the fixed 4em cap and the six gaps) plus the two gaps between - them, so the PR cell starts at the PR in progress chevron; the PR cell takes what - is left and gives way to the chip, which lives in the cap cell. */ - .ham-head-cols .ham-seg.ham-head-lead { flex: 0 0 calc((100% - 4em - var(--ham-visible-columns) * var(--sp-1)) * 3 / var(--ham-visible-columns) + 2 * var(--sp-1)); padding: 0 var(--sp-6) 0 0; } - .ham-head-cols .ham-seg.ham-head-lead.ham-head-wide { flex: 1 1 0; } - /* The PR cell is one line: connector, author icon + #N + title, lineage - chip and base pill sit side by side; the lineage chip gives way first - (flex-shrink 2), then the title (1), the pills and the connector never shrink - (hivecommons/hive "consolidate from 3 lines of text to 1"). */ - .ham-head-cols .ham-seg.ham-head-pr { flex: 1 1 0; flex-direction: row; flex-wrap: nowrap; align-items: center; gap: var(--sp-2); min-width: 0; overflow: hidden; } - .ham-head-cols .ham-seg.ham-head-pr > .ham-linked-ico, .ham-head-cols .ham-seg.ham-head-pr > .ham-badge { flex: 0 0 auto; } - .ham-head-cols .ham-seg.ham-head-pr > .ham-lineage, .ham-head-cols .ham-seg.ham-head-pr > .ham-adopted-from { display: block; flex: 0 2 auto; min-width: 7em; overflow: hidden; text-overflow: ellipsis; } + .ham-head-cols .ham-seg.ham-head-lead { grid-column: 1 / var(--ham-pr-start); grid-row: 1; padding: 0 var(--sp-6) 0 0; } + .ham-head-cols .ham-seg.ham-head-pr { grid-column: var(--ham-pr-start) / -2; grid-row: 1; flex-direction: row; flex-wrap: wrap; align-items: center; gap: var(--sp-2); min-width: 0; overflow: visible; padding: 0; } + .ham-head-cols .ham-seg.ham-head-pr > .ham-linked-ico { flex: 0 0 auto; } + .ham-head-cols .ham-seg.ham-head-pr > .ham-lineage, .ham-head-cols .ham-seg.ham-head-pr > .ham-adopted-from { flex: 0 1 auto; min-width: 0; max-width: 100%; flex-wrap: wrap; } .ham-head-cols .ham-seg.ham-head-pr > .ham-lineage > .ham-author-ico { vertical-align: text-bottom; margin-right: var(--sp-1); } .ham-head-cols .ham-seg.ham-head-pr > .ham-pr-ref, .ham-head-cols .ham-seg.ham-head-pr > .ham-pr-line { flex: 0 1 auto; } - /* The chip hugs the bottom of the title block (align-items: flex-end - inside the stretched cap cell): on a two-line title it sits on the - second line, directly over the strip it describes, never up at the - previous entry's edge. */ - .ham-head-cols .ham-seg.cap { flex: 0 0 auto; min-width: 4em; overflow: visible; align-items: flex-end; justify-content: flex-end; padding: 0; } - .ham-head-cols .ham-seg.cap .ham-badges { position: static; } - .ham-head-main { display: flex; flex: 1; align-items: center; gap: var(--sp-3); min-width: 0; overflow: hidden; } - .ham-head-main > .ham-badge { flex: 0 0 auto; } + .ham-head-cols .ham-seg.cap { grid-column: 1 / -1; grid-row: 2; min-width: 0; overflow: visible; align-items: flex-end; justify-content: flex-end; padding: 0; } + .ham-head-cols .ham-seg.cap:has(> .ham-badges:empty) { display: none; } + .ham-head-cols .ham-seg.cap .ham-badges { position: static; flex-wrap: wrap; justify-content: flex-end; min-width: 0; max-width: 100%; } + .ham-head-cols .ham-badges > :is(button, a) { min-width: 0; max-width: 100%; white-space: normal; overflow-wrap: anywhere; } + .ham-head-cols .ham-badge { min-width: 0; max-width: 100%; white-space: normal; overflow-wrap: anywhere; } + .ham-head-main { display: flex; flex: 1; flex-wrap: wrap; align-items: center; gap: var(--sp-3); min-width: 0; } + .ham-head-main > .ham-badge { flex: 0 1 auto; } + .ham-head-main > .ham-title, .ham-head-pr .ham-pr-title { white-space: normal; overflow: visible; overflow-wrap: anywhere; } + .ham-head-pr .ham-pr-ref, .ham-head-pr .ham-pr-line { flex-wrap: wrap; overflow: visible; } .ham-pr-ref { display: inline-flex; align-items: center; gap: var(--sp-2); min-width: 0; max-width: 100%; overflow: hidden; color: var(--muted); text-decoration: none; font-size: var(--fs-xs); } .ham-pr-ref:hover { color: var(--text); } .ham-linked-ico { color: var(--text-faint); font-size: var(--fs-xs); margin-right: var(--sp-1); } @@ -1663,15 +1653,10 @@ .ham-badge-reroute { color: var(--status-warn); border-color: color-mix(in srgb, var(--status-warn) 55%, transparent); font-weight: var(--fw-medium); display: inline-flex; align-items: center; gap: var(--sp-1); } .ham-badge-reroute .ham-presence-dot { width: 0.5em; height: 0.5em; border-radius: var(--r-pill); background: var(--text-faint); flex: 0 0 auto; } .ham-badge-reroute.ham-reroute-online .ham-presence-dot { background: var(--status-ok); } - .ham-strip { list-style: none; margin: 0; padding: 0; display: flex; gap: var(--sp-1); min-height: 18px; flex: 1 1 auto; min-width: 0; --ham-notch: 8px; --ham-visible-columns: 7; } - .ham-strip:not(.ham-head-cols) { display: grid; grid-template-columns: repeat(var(--ham-visible-columns), minmax(0, 1fr)) 4em; } + .ham-strip { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(var(--ham-visible-columns), minmax(0, 1fr)) 4em; gap: var(--sp-1); min-height: 18px; flex: 1 1 auto; min-width: 0; font-size: var(--fs-xs); --ham-notch: 8px; --ham-visible-columns: 7; --ham-chevron-text-lines: 2; --ham-chevron-line-height: 1.3; } .ham-seg { position: relative; flex: 1 1 0; min-width: 0; display: flex; align-items: center; justify-content: center; padding: 0 var(--sp-4) 0 var(--sp-5); font-size: var(--fs-xs); font-weight: var(--fw-medium); white-space: nowrap; overflow: hidden; clip-path: polygon(0 0, calc(100% - var(--ham-notch)) 0, 100% 50%, calc(100% - var(--ham-notch)) 100%, 0 100%, var(--ham-notch) 50%); } - .ham-activity-track { clip-path: none; border: var(--line-width) solid var(--line-subtle); border-radius: var(--r-sm); flex-direction: column; align-items: flex-start; padding: var(--sp-1) var(--sp-2); white-space: normal; } - .ham-track-name { font-weight: var(--fw-semibold); } - .ham-track-state { overflow-wrap: anywhere; font-size: var(--fs-xs); } + .ham-activity-track { clip-path: none; border: var(--line-width) solid var(--line-subtle); border-radius: var(--r-sm); white-space: normal; } .ham-track-state a { color: inherit; } - .ham-track-code-note, .ham-track-context { overflow-wrap: anywhere; font-size: var(--fs-xs); } - .ham-track-freshness { position: absolute; right: var(--sp-1); top: 0; color: var(--amber); } .ham-activity-track[data-activity-state="failing"], .ham-activity-track[data-activity-state="changes_requested"] { border-color: var(--amber); color: var(--amber); } .ham-seg:first-child { clip-path: polygon(0 0, calc(100% - var(--ham-notch)) 0, 100% 50%, calc(100% - var(--ham-notch)) 100%, 0 100%); } .ham-seg.cap { flex: 0 0 4em; } @@ -1682,17 +1667,12 @@ /* The holder's offline / not-registered state is muted: a flag, not an alarm. */ .ham-holder-presence { margin-right: 0; color: var(--text-faint); font-weight: normal; } .ham-holder-presence.ham-presence-offline { --ham-presence-color: var(--text-faint); } - /* A word with a holder ("PR in progress · @bob's clanker") stays on one - line: the stage word keeps its width and the name gives way with an - ellipsis before anything wraps (hivecommons/hive#15541). */ - .ham-seg-t.ham-has-holder, .ham-detour.ham-has-holder { display: inline-flex; align-items: baseline; min-width: 0; max-width: 100%; white-space: nowrap; } - .ham-has-holder > .ham-holder { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: pre; } .ham-ico { width: 12px; height: 12px; flex: 0 0 auto; } .ham-actor-ico { margin-left: var(--sp-1); stroke-width: 2; } .ham-seg.done { background: var(--panel-strong); color: var(--text-faint); } .ham-seg.todo { background: transparent; color: var(--text-faint); box-shadow: inset 0 0 0 var(--line-width) var(--line-subtle); opacity: 0.5; } .ham-seg.blank { visibility: hidden; } - .ham-sub { display: grid; gap: var(--sp-2); margin-top: var(--sp-3); position: relative; } + .ham-sub { display: grid; grid-template-columns: minmax(0, 1fr); min-width: 0; gap: var(--sp-2); margin-top: var(--sp-3); position: relative; } /* Only the two moving buckets animate (see stageTrackerMotion): the hive acting = gentle pulse; waiting on a person = slower amber→red breathe. A lit step with no data-motion (Open, Open · hold, Claimed, …) is a @@ -1702,6 +1682,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); } + /* Position is independent of observed work: queued, held and unknown + tracks retain a steady current-phase outline, never a work pulse. */ + .ham-activity-track.ham-current { border-color: var(--amber); opacity: 1; box-shadow: inset 0 0 0 var(--line-width) var(--amber); } + .ham-activity-track.ham-current:not(.active) { background: color-mix(in srgb, var(--amber) 12%, var(--panel)); } .ham-seg.active[data-motion]::before { content: ''; position: absolute; inset: 0; opacity: 0; pointer-events: none; } .ham-seg.active[data-motion="active"]::before { background: white; animation: ham-pulse 1.6s ease-in-out infinite; } .ham-seg.active[data-motion="needs-human"]::before { background: var(--red); animation: ham-breathe-human 2.8s ease-in-out infinite; } @@ -1731,10 +1715,18 @@ after the word ("next sweep in 42s", "7m left") is muted. */ .ham-gate-ico { display: inline-flex; align-items: center; margin-right: var(--sp-1); cursor: help; } .ham-gate-ico .ham-ico { width: 12px; height: 12px; } - /* The detail is a fixed short phrase; should a long one ever reach it - (hivecommons/docs#512 drew a raw GitHub URL across the column) it is - clipped with an ellipsis rather than overflowing the chip. */ - .ham-gate-detail { font-weight: normal; opacity: 0.85; white-space: nowrap; font-variant-numeric: tabular-nums; display: inline-block; vertical-align: bottom; max-width: 12em; overflow: hidden; text-overflow: ellipsis; } + .ham-gate-detail { font-weight: normal; opacity: 0.85; font-variant-numeric: tabular-nums; } + /* All physical chevrons share a two-line budget. The portal tooltip is + outside the clipped polygon; keyboard focus exposes the same full text. */ + .ham-strip[aria-label="Pipeline progress"] { grid-auto-rows: calc(var(--ham-chevron-text-lines) * var(--ham-chevron-line-height) * 1em + 2 * var(--sp-2) + 2 * var(--line-width)); } + .ham-strip[aria-label="Pipeline progress"] > .ham-seg { box-sizing: border-box; height: 100%; line-height: var(--ham-chevron-line-height); padding: var(--sp-2) calc(var(--ham-notch) + var(--sp-2)); } + .ham-chevron-info.config-info, .ham-chevron-info.ham-chevron-decision { display: flex; align-items: center; justify-content: center; gap: var(--sp-1); width: 100%; height: 100%; min-width: 0; flex-shrink: 1; margin: 0; padding: 0; border: 0; border-radius: 0; background: transparent; color: inherit; font: inherit; line-height: inherit; position: static; } + .ham-chevron-info.config-info:hover { background: transparent; border: 0; color: inherit; } + .ham-chevron-info:focus-visible, .ham-chevron-decision:focus-within { outline: var(--line-width) solid currentColor; outline-offset: var(--sp-1); } + .ham-chevron-copy { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: var(--ham-chevron-text-lines); line-clamp: var(--ham-chevron-text-lines); max-height: calc(var(--ham-chevron-text-lines) * var(--ham-chevron-line-height) * 1em); flex: 1 1 auto; min-width: 0; overflow: hidden; white-space: normal; overflow-wrap: anywhere; } + .ham-chevron-copy :is(.ham-seg-t, .ham-detour, .ham-holder, .ham-gate-detail) { display: inline; white-space: normal; overflow-wrap: anywhere; } + .ham-chevron-copy > .ham-decision-trigger { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: var(--ham-chevron-text-lines); line-clamp: var(--ham-chevron-text-lines); max-width: 100%; overflow: hidden; white-space: normal; overflow-wrap: anywhere; } + .config-tooltip.ham-chevron-tip { overflow-wrap: anywhere; max-width: calc(100vw - var(--sp-8)); max-height: calc(100vh - var(--sp-8)); overflow-y: auto; pointer-events: auto; } @keyframes ham-pulse { 0%, 100% { opacity: 0; } 50% { opacity: 0.3; } } /* ---- tracker-cues: the Activity Monitor's shared cue vocabulary ------ Owner request: a viewer must always read where an item stands, @@ -1831,7 +1823,7 @@ page text: ≥ 15:1 in both themes, see the contrast test) above the stripes and the pulse overlay, on one line with an ellipsis. */ .cue-acting > .ham-strip-row > .ham-strip > .ham-seg.active:not(.cap) > :not(.cue-acting-cap) { display: none; } - .ham-seg.active > .cue-acting-cap { display: inline-block; position: relative; z-index: 1; margin-left: 0; max-width: 100%; min-width: 0; box-sizing: border-box; padding: var(--sp-1) var(--sp-2); border-radius: var(--r-pill); background: var(--surface-0); color: var(--text); font-weight: var(--fw-medium); line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } + .ham-seg.active > .cue-acting-cap { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: var(--ham-chevron-text-lines); line-clamp: var(--ham-chevron-text-lines); position: relative; z-index: 1; margin-left: 0; max-width: 100%; min-width: 0; box-sizing: border-box; padding: 0 var(--sp-2); border-radius: var(--r-pill); background: var(--surface-0); color: var(--text); font-weight: var(--fw-medium); line-height: var(--ham-chevron-line-height); overflow: hidden; white-space: normal; overflow-wrap: anywhere; } .ham-seg.active > .cue-acting-cap > .cue-acting-spin { vertical-align: -1px; margin-right: var(--sp-2); } .cue-event { display: flex; align-items: baseline; gap: var(--sp-2); margin: 0; padding-left: var(--sp-5); font-size: var(--fs-xs); color: var(--muted); overflow-wrap: anywhere; animation: cue-event-in 0.4s ease-out; } .cue-event-who { font-weight: var(--fw-medium); color: var(--text); } @@ -2095,21 +2087,17 @@ a needs-human step keeps a steady red tint so it still stands out. */ @media (prefers-reduced-motion: reduce) { .ham-seg.active { animation: none; box-shadow: inset 0 0 0 2px var(--surface-0); } .ham-seg.active[data-motion]::before { display: none; } .ham-seg.active[data-motion="needs-human"] { background: color-mix(in srgb, var(--amber) 45%, var(--red)); } } @media (max-width: 1100px) { - /* Keep the aligned progress strip compact; put its active step in a - wrapping caption instead of squeezing actionable words into a chevron. */ - .ham-cols .ham-seg-t, .ham-row .ham-seg-t, .ham-row .ham-detour { display: none; } + /* Stack headers, but keep the same two-line progress text budget. */ + .ham-cols .ham-seg-t { display: none; } .ham-cols .ham-track-head .ham-seg-t { display: inline; } - .ham-track-state { display: none; } - .ham-track-code-note, .ham-track-context { display: none; } - .ham-activity-track { align-items: center; } .ham-active-ico { display: block; } .ham-row .ham-actor-ico { display: none; } .ham-current-stage { display: block; } .ham-head-cols { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--sp-2) var(--sp-3); } .ham-head-cols > .ham-strip { display: contents; } - .ham-head-cols .ham-seg.ham-head-lead, .ham-head-cols .ham-seg.ham-head-pr { grid-column: 1 / -1; padding: 0; } + .ham-head-cols .ham-strip > .ham-seg { grid-column: 1 / -1; grid-row: auto; padding: 0; } .ham-head-cols .ham-head-lead:empty { display: none; } - .ham-head-cols .ham-seg.cap { grid-column: 1 / -1; min-width: 0; justify-content: flex-start; } + .ham-head-cols .ham-seg.cap { grid-column: 1 / -1; min-width: 0; justify-content: flex-end; } .ham-head-cols > .ham-since { display: none; } .ham-row .ham-seg { padding: 0 var(--sp-2) 0 var(--sp-3); } .ham-row .ham-seg.cap { flex-basis: 2em; } @@ -2117,6 +2105,11 @@ .ham-cols .ham-seg { padding: 0 var(--sp-2) 0 var(--sp-3); } .ham-cols .ham-seg.cap { flex-basis: 2em; } } + @media (max-width: 640px) { + #activity-monitor-panel { --ham-compact-min-width: 60em; } + .ham-row > .ham-strip-row, .ham-sub > .ham-strip-row, .ham-cols > .ham-strip-row { overflow-x: auto; } + .ham-row > .ham-strip-row > .ham-strip, .ham-sub > .ham-strip-row > .ham-strip, .ham-cols > .ham-strip-row > .ham-strip { min-width: var(--ham-compact-min-width); } + } /* Movement animation: when an item's lit chevron changes column between two refreshes, the chosen effect (settings gear → Movement animation) plays once on that row. Overlays live in .ham-anim-layer, an absolute @@ -17599,10 +17592,12 @@

    Where to get help

    const activityFreshMS = 2 * 60 * 1000; const clock = Number(nowMs) || Date.now(); const stale = Number.isFinite(observed) && (clock - observed > activityFreshMS || observed > clock); - const active = matches && a.active && Number.isFinite(observed) && !stale; + const current = sg.state === 'active'; const state = matches ? a.state || 'unknown' : 'unknown'; - if (matches && (a.active || ['running', 'reviewing', 'adjudicating'].includes(state)) && (!Number.isFinite(observed) || stale)) caption = name + ' activity unknown · last observed ' + state; - const cls = Number.isFinite(observed) && !stale && (state === 'passing' || state === 'approved') ? 'done' : active ? 'active' : 'todo'; + const known = matches && state !== 'unknown' && Number.isFinite(observed) && !stale; + const active = known && a.active; + if (matches && !known && state !== 'unknown') caption = name + ' activity unknown · last observed ' + state + ' · ' + caption; + const cls = known && (state === 'passing' || state === 'approved') ? 'done' : active ? 'active' : '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() : ''; @@ -17618,11 +17613,20 @@

    Where to get help

    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(?=\s|<)/g, '>Fix requested'); - const word = esc(caption.replace(new RegExp('^' + name + ' ?'), '') || state); + const word = esc(caption); const evidenceURL = matches && /^https?:\/\//i.test(String(a.url || '')) ? a.url : ''; const evidenceLink = ownsPR && evidenceURL ? `${word}` : word; const routeState = (sg.state || 'todo') + (sg.detour ? ' detoured' : ''); - return `
  • ${name}${evidenceLink}${codeNote || contextWord ? `${esc(codeNote || contextWord)}` : ''}${decided ? `${decided}` : ''}${stale || !Number.isFinite(observed) ? '?' : ''}
  • `; + 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 : '') : ''); + const tipID = 'ham-track-tip-' + [item.repo || '', item.kind || '', item.number || 0, kind].map(x => encodeURIComponent(String(x))).join('-'); + const icon = stageTrackerIcon(50, 'ham-ico', name); + const content = known ? `${evidenceLink}` : icon; + const linkedIcon = !known && ownsPR && evidenceURL ? `${icon}` : content; + return `
  • ${linkedIcon}${esc(fullTip)}${decided ? `${decided}` : ''}
  • `; } // Chevrons for one item. range bounds the columns the item owns (an @@ -17680,6 +17684,7 @@

    Where to get help

    const cls = ['ham-seg', sg.state, sg.cap ? 'cap' : '', 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 = ''; if (active) { tip = sg.label + (sg.description ? ' — ' + sg.description : ''); if (sg.blocked) tip += ' — ' + stageTrackerBlockedTip(item); @@ -17691,7 +17696,10 @@

    Where to get help

    // With merge_gate in the payload the sentence is the gate's own // (what holds it, next sweep, soak left — #15073). const gateInfo = !sg.detour && typeof stageTrackerMergeGateInfo === 'function' ? stageTrackerMergeGateInfo(item, nowMs, trains) : null; - if (gateInfo) tip = sg.label + ' — ' + gateInfo.tip; + if (gateInfo) { + tip = sg.label + ' — ' + gateInfo.tip; + gateCaption = [gateInfo.word, gateInfo.detail].filter(Boolean).join(' · '); + } else if (!sg.detour && (curStage === 60 || curStage === 80)) tip = sg.label + ' — not yet admitted' + (item.caption || item.reason ? ' — ' + (item.caption || item.reason) : ''); else if (curStage === STAGE_TRACKER_PRE_MERGE_SOAK) tip = sg.label + ' — admitted, soaking' + stageTrackerSoakLeft(item); else if (curStage === 100) tip = sg.label + ' — admitted, merging'; @@ -17742,8 +17750,17 @@

    Where to get help

    // The cap chevron is the ✓ only once the PR is merged; until then // the column is the row's history and wears the history mark. if (sg.cap) inner = sg.terminal ? stageTrackerIcon(sg.number, 'ham-ico') : stageTrackerIcon('history', 'ham-ico ham-history-ico', 'History — no decisions or actions recorded yet'); - else if (active) inner = gateCue + workIco + (decision ? stageTrackerDecisionTriggerHtml(decision, word, tip) : word) + (actorIco || holderIco); - else inner = stageTrackerIcon(sg.number, 'ham-ico'); + else if (active) { + const fullTip = [tip, gateCaption || (sg.detour ? sg.detour.text : sg.short), item.caption, item.reason, + item.head ? 'head ' + item.head : '', + item.hold ? (item.hold.pill || 'Held by @' + item.hold.by) + (item.hold.reason ? ' · ' + item.hold.reason : '') : ''].filter(Boolean).join(' · '); + const tipID = 'ham-chevron-tip-' + [item.repo || '', item.kind || '', item.number || 0, sg.number].map(x => encodeURIComponent(String(x))).join('-'); + const caption = gateWord || word; + const text = decision ? stageTrackerDecisionTriggerHtml(decision, caption, fullTip) : caption; + const content = `${gateCue}${workIco}${text}${actorIco || holderIco}`; + // A decision's dialog is its sole hover/focus detail surface. + inner = decision ? `${content}` : `${content}${esc(fullTip)}`; + } else inner = stageTrackerIcon(sg.number, 'ham-ico'); return `
  • ${inner}
  • `; }).join(''); } @@ -18331,14 +18348,15 @@

    Where to get help

    // Ghost strip for a title line: the lead cell (Open..Claimed) carries // the item's own number + title, the PR cell (PR in progress..Merge gate) - // the given refs, and the cap cell the modifier chip, bottom-aligned so - // it sits on the last title line, directly over the strip's right end. + // the given refs. Modifier chips wrap on their own full-width, + // right-anchored line rather than overflowing the history cap into titles. // The since column is an empty spacer here (same width as the strip // row's, which carries the time on step): a wrapped title must not float // the age away from the chevrons it describes. function stageTrackerHeadColsHtml(prRefs, leadHtml, chipsHtml, prTargetKey) { const wide = !(prRefs && prRefs.length); - return `
    1. ${leadHtml || ''}
    2. ${wide ? '' : `
    3. ${prRefs.join('')}
    4. `}
    5. ${chipsHtml || ''}
    `; + const prStart = STAGE_TRACKER_PATH.indexOf(STAGE_TRACKER_PR_COLUMN) + 1; + return `
    1. ${leadHtml || ''}
    2. ${wide ? '' : `
    3. ${prRefs.join('')}
    4. `}
    5. ${chipsHtml || ''}
    `; } function stageTrackerSinceHtml(item, nowMs) { @@ -18547,12 +18565,10 @@

    Where to get help

    if (typeof stageTrackerPreparationMark === 'function') stageTrackerPreparationMark(pr); const superseded = typeof stageTrackerLinkedSupersededText === 'function' ? stageTrackerLinkedSupersededText(lp, issue) : ''; let ref = stageTrackerPRRef(pr.number, pr.url, pr.author_kind, pr.author, pr.title, (pr.title ? pr.title + ' · ' : '') + (superseded ? superseded + ' · ' + stageTrackerLinkedSupersededTip(lp) : stageTrackerTooltip(pr, nowMs)) + ' · ' + stageTrackerLinkedTip(issue, pr.number, ctx)); - // One line (hivecommons/hive: "consolidate from 3 lines of text to - // 1"): connector, repo chip, author icon + #N + title, the lineage / - // adopted-from chip, then the base pill — all siblings of the flex-row - // PR cell; the title ellipsizes, the pills never shrink. A superseded - // original wears neither pill — it closes as superseded, not as the - // closer of anything. + // Connector, repo chip, author icon + #N + title, lineage / + // adopted-from chip and base pill share the wrapping PR-side cell. + // A superseded original wears neither pill — it closes as superseded, + // not as the closer of anything. const lineage = superseded ? '' : ((typeof stageTrackerLineageChipHtml === 'function' ? stageTrackerLineageChipHtml(pr, nowMs) : '') || (typeof stageTrackerAdoptedFromChipHtml === 'function' ? stageTrackerAdoptedFromChipHtml(pr, nowMs) : '')); const chip = ctx && ctx.repoChips ? stageTrackerRepoChipHtml(pr.repo, ctx) : ''; if (chip) ref = `${chip}${ref}`; @@ -18561,7 +18577,7 @@

    Where to get help

    if (superseded) { // The adopted original: one muted line, no chevron track, no row // tools, no needs-human styling — the copy carries the chevron. The - // trailing note never wraps; the title ellipsizes first (owner, + // trailing note stays distinct from the wrapping title (owner, // hivecommons/hive#15511: "superseded · hive adopted → #15574"). return `
    @@ -22265,6 +22281,7 @@

    All labels

    function stageTrackerOpenDecisionPop(trigger, pin) { const key = trigger && trigger.dataset ? trigger.dataset.hamDecision : ''; if (!key) return; + if (typeof hideConfigTooltip === 'function') hideConfigTooltip(); if (_stageTrackerDecisionPop && _stageTrackerDecisionPop.key === key) { if (pin) _stageTrackerDecisionPop.pinned = true; clearTimeout(_stageTrackerDecisionPop.timer); @@ -23562,7 +23579,7 @@

    All labels

    n.classList.add('cue-acting'); if (capEl && capEl.parentNode !== host) { capEl.remove(); capEl = null; } if (host && !capEl) { capEl = document.createElement('span'); capEl.className = 'cue-acting-cap'; capEl.setAttribute('role', 'status'); const sp = document.createElement('span'); sp.className = 'toast-spinner cue-acting-spin'; capEl.appendChild(sp); capEl.appendChild(document.createTextNode('')); host.appendChild(capEl); } - if (capEl) capEl.lastChild.nodeValue = cap; + if (capEl) { capEl.lastChild.nodeValue = cap; capEl.title = cap; capEl.setAttribute('aria-label', cap); capEl.setAttribute('tabindex', '0'); } } else { n.classList.remove('cue-acting'); if (capEl) capEl.remove(); diff --git a/src/pkg/dashboard/webstatic/testdata/tracker-activity-density.json b/src/pkg/dashboard/webstatic/testdata/tracker-activity-density.json new file mode 100644 index 0000000000..7baccd3f47 --- /dev/null +++ b/src/pkg/dashboard/webstatic/testdata/tracker-activity-density.json @@ -0,0 +1,83 @@ +{ + "source": "Screenshot 2026-11-03 at 12.01.36 PM.png", + "clock": "2026-11-03T17:01:36Z", + "provenance": "Screenshot-shaped acceptance data, not a live backend snapshot. Titles/authors/heads were read from GitHub at 17:04Z. Relationships follow the screenshot, including dashboard-only links under #16404. Stage/activity projections are deterministic test inputs; #16437 is also exercised as a PR-only view variant. Passing a fixture is not published-preview proof.", + "rows": [ + { + "repo": "hivecommons/hive", "kind": "issue", "number": 16404, "stage": 40, "url": "https://github.com/hivecommons/hive/issues/16404", + "title": "[scanner] native-queue-policy cannot pass when the DCO app hits its 250-commit ceiling (forward-merge PRs)", + "linked_prs": [ + { + "number": 16442, "stage": 85, "base_ref": "v5", "author": "thatguywob", "author_kind": "clanker", "url": "https://github.com/hivecommons/hive/pull/16442", + "title": "🐛 fix(ci): report unavailable DCO enumeration without weakening admission", + "head": "0ac19dfa36e6fbe46e50120ddced291fac3a7bdb", + "decision_needed": { "question": "Should this admission-workflow change land?", "blocker": "Workflow/admission policy edits need a maintainer's sign-off." }, + "ci_activity": { "head": "0ac19dfa36e6fbe46e50120ddced291fac3a7bdb", "state": "passing", "caption": "CI passed", "observed_at": "2026-11-03T17:01:36Z", "source": "acceptance-fixture" }, + "review_activity": { "head": "0ac19dfa36e6fbe46e50120ddced291fac3a7bdb", "state": "changes_requested", "caption": "Review findings · human decision · adjudicator", "observed_at": "2026-11-03T17:01:36Z", "source": "acceptance-fixture" } + }, + { + "number": 16378, "stage": 71, "display_column": 30, "base_ref": "v6", "author": "clubanderson", "author_kind": "human", "url": "https://github.com/hivecommons/hive/pull/16378", + "title": "🌱 Top up v6 with the latest v5 snapshot", + "head": "670776c942dbed8c3e9d82cc5593599071675e67", + "caption": "Waiting for @clubanderson · not observed coding", + "reason": "CI failed: native-queue-policy; waits for a new author commit.", + "code_activity": { "head": "670776c942dbed8c3e9d82cc5593599071675e67", "state": "waiting_owner", "caption": "Waiting for @clubanderson · not observed coding", "source": "native-author-wait" }, + "push": { "state": "waiting", "login": "clubanderson", "since": "2026-11-03T16:49:36Z", "next": "re-review" }, + "rework": { "state": "pushed", "actor": "clubanderson", "since": "2026-11-03T16:49:36Z" } + } + ] + }, + { + "repo": "hivecommons/hotshot", "kind": "issue", "number": 343, "stage": 40, "url": "https://github.com/hivecommons/hotshot/issues/343", + "title": "[scanner] injection-failure runbook omits injection.iterm2 events; runbook-events guard regex cannot validate them", + "linked_prs": [{ + "number": 344, "stage": 60, "base_ref": "main", "author": "hivecommons-hive", "author_kind": "hive", "url": "https://github.com/hivecommons/hotshot/pull/344", + "title": "📖 docs: document injection.iterm2 runbook events and widen the runbook-events guard", + "head": "ece77aa02c477fe85875cb399decd3ecb00a2e85", + "push": { "state": "pushed", "login": "hivecommons-hive[bot]", "sha": "ece77aa02c477fe85875cb399decd3ecb00a2e85", "since": "2026-11-03T16:01:36Z", "next": "re-review" }, + "ci_activity": { "head": "ece77aa02c477fe85875cb399decd3ecb00a2e85", "state": "queued", "caption": "CI queued", "observed_at": "2026-11-03T17:01:36Z", "source": "acceptance-fixture" }, + "review_activity": { "head": "ece77aa02c477fe85875cb399decd3ecb00a2e85", "state": "approved", "caption": "Review approved", "observed_at": "2026-11-03T17:01:36Z", "source": "acceptance-fixture" } + }] + }, + { + "repo": "hivecommons/hive", "kind": "issue", "number": 16438, "stage": 40, "url": "https://github.com/hivecommons/hive/issues/16438", + "title": "Boot from ConfigMap seed silently drops safety gates present in the prior runtime overlay", + "linked_prs": [ + { + "number": 16446, "stage": 72, "display_column": 30, "base_ref": "v5", "author": "thatguywob", "author_kind": "clanker", "url": "https://github.com/hivecommons/hive/pull/16446", + "title": "🐛 fix: warn before boot recovery drops safety gates", + "head": "96d5ad5db1cf6989f118d78e60738d233f97b509", + "caption": "Waiting for @thatguywob · not observed coding", + "code_activity": { "head": "96d5ad5db1cf6989f118d78e60738d233f97b509", "state": "waiting_owner", "caption": "Waiting for @thatguywob · not observed coding", "source": "native-author-wait" }, + "push": { "state": "waiting", "login": "thatguywob", "since": "2026-11-03T16:55:36Z", "next": "re-review" }, + "rework": { "state": "acknowledged", "actor": "thatguywob", "since": "2026-11-03T16:55:36Z" }, + "ci_activity": { "head": "96d5ad5db1cf6989f118d78e60738d233f97b509", "state": "failing", "caption": "CI failing · test", "observed_at": "2026-11-03T17:01:36Z", "source": "acceptance-fixture" }, + "review_activity": { "head": "96d5ad5db1cf6989f118d78e60738d233f97b509", "state": "queued", "caption": "Review queued · unassigned", "observed_at": "2026-11-03T17:01:36Z", "source": "acceptance-fixture" } + }, + { + "number": 16449, "stage": 71, "display_column": 30, "base_ref": "v5", "author": "clubanderson", "author_kind": "human", "url": "https://github.com/hivecommons/hive/pull/16449", + "title": "🐛 fix(config): warn, report and optionally refuse when a seed boot drops a safety gate the previous runtime overlay carried", + "head": "3b4c78cad27083e1e39b8e08460485d78102fdf4", + "caption": "Waiting for @clubanderson · not observed coding", + "reason": "CI failed: build-and-test; waits for a new author commit.", + "code_activity": { "head": "3b4c78cad27083e1e39b8e08460485d78102fdf4", "state": "waiting_owner", "caption": "Waiting for @clubanderson · not observed coding", "source": "native-author-wait" }, + "push": { "state": "waiting", "login": "clubanderson", "since": "2026-11-03T16:57:36Z", "next": "re-review" }, + "rework": { "state": "requested", "actor": "clubanderson", "since": "2026-11-03T16:57:36Z" }, + "ci_activity": { "head": "3b4c78cad27083e1e39b8e08460485d78102fdf4", "state": "failing", "caption": "CI failing · golangci-lint", "observed_at": "2026-11-03T17:01:36Z", "source": "acceptance-fixture" }, + "review_activity": { "head": "3b4c78cad27083e1e39b8e08460485d78102fdf4", "state": "queued", "caption": "Review queued · unassigned", "observed_at": "2026-11-03T17:01:36Z", "source": "acceptance-fixture" } + } + ] + }, + { + "repo": "hivecommons/hive", "kind": "issue", "number": 16420, "stage": 20, "url": "https://github.com/hivecommons/hive/issues/16420", + "title": "[v6] 🐛 standby tile counts an item for a lane that dispatch then refuses (lane split mismatch)", + "operator_action_count": 1 + }, + { + "repo": "hivecommons/hive", "kind": "pr", "number": 16437, "stage": 90, "base_ref": "v6", "url": "https://github.com/hivecommons/hive/pull/16437", + "title": "📖 docs: complete standby readiness prerequisites", "author": "thatguywob", "author_kind": "clanker", + "head": "13b859a8d5e8e434d6f708c75321265241493ac6", + "manual_merge": true, "human_merge_reason_text": "untrusted author" + } + ] +} diff --git a/src/pkg/dashboard/webstatic/testdata/tracker-decision-interaction.js b/src/pkg/dashboard/webstatic/testdata/tracker-decision-interaction.js new file mode 100644 index 0000000000..9be65679fd --- /dev/null +++ b/src/pkg/dashboard/webstatic/testdata/tracker-decision-interaction.js @@ -0,0 +1,98 @@ +// Dedicated preview only: evaluate ()({ dedicatedPreview: true }). +// Exercises pointer/focus/keyboard UI, never clicks a row/decision action. +(async ({ dedicatedPreview = false } = {}) => { + if (!dedicatedPreview) throw new Error('Use a dedicated published-preview tab, not the user’s live dashboard'); + const tolerance = 1; + const hoverSettleMS = 200; + const failures = []; + const assert = (ok, message) => { if (!ok) failures.push(message); }; + const triggers = [...document.querySelectorAll('#activity-monitor-panel .ham-chevron-decision .ham-decision-trigger')]; + const nativeStage = trigger => Number(trigger.closest('[data-ham-stage]')?.dataset.hamStage); + const gate = triggers.find(trigger => nativeStage(trigger) === 80 && trigger.querySelector('.ham-seg-t')); + if (!gate) throw new Error('Preview fixture must include native stage 80 with a gate caption and claim-conflict decision'); + const other = triggers.find(trigger => trigger !== gate && nativeStage(trigger) !== 80); + const targets = other ? [gate, other] : [gate]; + const help = document.querySelector('#activity-monitor-panel .ham-chevron-info.config-info'); + if (!help) throw new Error('Preview fixture must include an ordinary chevron tooltip to test mutual exclusion'); + const originalFocus = document.activeElement; + const scrollParents = new Map(); + for (const target of [...targets, help]) { + for (let parent = target.parentElement; parent; parent = parent.parentElement) { + if (!scrollParents.has(parent) && (parent.scrollHeight > parent.clientHeight || parent.scrollWidth > parent.clientWidth)) { + scrollParents.set(parent, { left: parent.scrollLeft, top: parent.scrollTop }); + } + } + } + const frame = () => new Promise(requestAnimationFrame); + const close = () => document.body.dispatchEvent(new PointerEvent('pointerdown', { bubbles: true, pointerType: 'mouse' })); + const portalOpen = () => { + const portal = document.getElementById('config-tooltip-portal'); + return portal && !portal.hidden && getComputedStyle(portal).display !== 'none'; + }; + const hit = (element, label) => { + const box = element.getBoundingClientRect(); + assert(box.width > 0 && box.height > 0 && box.left >= -tolerance && box.right <= innerWidth + tolerance && + box.top >= -tolerance && box.bottom <= innerHeight + tolerance, label + ' is wholly reachable in the viewport'); + const actual = document.elementFromPoint((box.left + box.right) / 2, (box.top + box.bottom) / 2); + assert(actual === element || element.contains(actual), label + ' is not intercepted by a tooltip or other overlay'); + }; + const inspectDialog = (trigger, mode) => { + const dialogs = [...document.querySelectorAll('.ham-decision-pop')]; + assert(dialogs.length === 1, mode + ': exactly one decision dialog'); + assert(!portalOpen(), mode + ': no competing shared-tooltip portal'); + assert(trigger.getAttribute('aria-expanded') === 'true', mode + ': native trigger owns the dialog'); + const dialog = dialogs[0]; + if (!dialog) return null; + assert(dialog.getAttribute('role') === 'dialog', mode + ': dialog semantics retained'); + const actions = [...dialog.querySelectorAll('.ham-decision-act')]; + assert(actions.length > 0, mode + ': decision actions remain present'); + for (const action of actions) hit(action, mode + ': ' + action.textContent.trim()); + const details = dialog.querySelector('.ham-decision-details'); + assert(!!details?.querySelector('summary'), mode + ': full overflow details have a keyboard-accessible disclosure'); + const fullTip = trigger.dataset.hamTip || ''; + // The existing dialog deduplicates sentences and normalizes separators. + const words = fullTip.toLowerCase().match(/[\p{L}\p{N}_@/#-]+/gu) || []; + const dialogWords = new Set(dialog.textContent.toLowerCase().match(/[\p{L}\p{N}_@/#-]+/gu) || []); + assert(words.length > 0 && words.every(word => dialogWords.has(word)), mode + ': unclamped caption/head/reasons survive in the sole dialog'); + return dialog; + }; + try { + for (const trigger of targets) { + close(); + trigger.scrollIntoView({ block: 'center', inline: 'nearest', behavior: 'instant' }); + await frame(); + hit(trigger, 'decision trigger'); + assert(!trigger.closest('.config-info') && !trigger.closest('.ham-chevron-info').querySelector('.config-tooltip'), 'decision has no generic tooltip ancestor/source'); + help.focus({ preventScroll: true }); + assert(portalOpen(), 'ordinary tooltip is open before testing decision takeover'); + trigger.dispatchEvent(new PointerEvent('pointerover', { bubbles: true, pointerType: 'mouse' })); + trigger.dispatchEvent(new MouseEvent('mouseover', { bubbles: true })); + assert(!portalOpen(), 'pointer decision opening immediately cancels the previous shared tooltip'); + await new Promise(resolve => setTimeout(resolve, hoverSettleMS)); + inspectDialog(trigger, 'pointer hover'); + close(); + trigger.focus({ preventScroll: true }); + inspectDialog(trigger, 'keyboard focus'); + for (const key of ['ArrowDown', 'Enter', ' ']) { + // The real delegated key handler moves focus into the dialog; no + // synthetic native default or action-button activation is assumed. + trigger.focus({ preventScroll: true }); + trigger.dispatchEvent(new KeyboardEvent('keydown', { key, bubbles: true, cancelable: true })); + const dialog = inspectDialog(trigger, 'keyboard ' + JSON.stringify(key)); + assert(!!dialog?.contains(document.activeElement), 'keyboard entry focuses the existing dialog actions'); + } + const dialog = document.querySelector('.ham-decision-pop'); + const summary = dialog?.querySelector('.ham-decision-details > summary'); + summary?.focus({ preventScroll: true }); + assert(!!summary && document.activeElement === summary, 'overflow disclosure is keyboard reachable'); + document.dispatchEvent(new KeyboardEvent('keydown', { key: 'Escape', bubbles: true, cancelable: true })); + } + } finally { + close(); + originalFocus?.focus?.({ preventScroll: true }); + close(); + for (const [el, position] of scrollParents) el.scrollTo({ ...position, behavior: 'instant' }); + } + if (failures.length) throw new Error(JSON.stringify({ viewport: innerWidth, tested: targets.length, failures })); + return { viewport: innerWidth, tested: targets.length, failures }; +}) diff --git a/src/pkg/dashboard/webstatic/testdata/tracker-header-geometry.js b/src/pkg/dashboard/webstatic/testdata/tracker-header-geometry.js new file mode 100644 index 0000000000..7aed7940b7 --- /dev/null +++ b/src/pkg/dashboard/webstatic/testdata/tracker-header-geometry.js @@ -0,0 +1,177 @@ +// Dedicated preview only: evaluate ()({ dedicatedPreview: true }). +// Scrolls every header control into view for hit-testing, then restores scroll. +// Never run in the user's live tab; never activates controls or changes rows. +(async ({ dedicatedPreview = false } = {}) => { + if (!dedicatedPreview) throw new Error('Use a dedicated published-preview tab, not the user’s live dashboard'); + const tolerance = 1; + const failures = []; + const coverage = { issueOnly: 0, linked: 0, prOnly: 0, nested: 0, multiIssue: 0, unknown: 0, queuedApproved: 0, wrapped: 0, controls: 0, controlTargets: 0, hitTested: 0 }; + const near = (a, b) => Math.abs(a - b) <= tolerance; + const visible = el => el && el.getClientRects().length && getComputedStyle(el).display !== 'none'; + const rect = el => el.getBoundingClientRect(); + const assert = (ok, label) => { if (!ok) failures.push(label); }; + const inspectControl = async (control, toolbar, name) => { + coverage.controlTargets++; + assert(visible(control), name + 'expected header control is not hidden'); + if (!visible(control)) return; // Already a failure, never an untested success. + assert(!control.closest('[inert]'), name + 'controls remain focusable/clickable'); + const contained = () => { + const box = rect(control), bounds = rect(toolbar); + assert(box.width > 0 && box.height > 0 && box.left >= Math.max(0, bounds.left) - tolerance && + box.right <= Math.min(innerWidth, bounds.right) + tolerance, name + 'entire header control stays horizontally inside the toolbar and viewport'); + return box; + }; + contained(); // Horizontal overflow must fail even if scrolling could hide it. + const scrollParents = []; + for (let parent = control.parentElement; parent; parent = parent.parentElement) { + if (parent.scrollHeight > parent.clientHeight || parent.scrollWidth > parent.clientWidth) { + scrollParents.push({ el: parent, left: parent.scrollLeft, top: parent.scrollTop }); + } + } + try { + control.scrollIntoView({ block: 'center', inline: 'nearest', behavior: 'instant' }); + await new Promise(requestAnimationFrame); + const box = contained(); + assert(box.top >= -tolerance && box.bottom <= innerHeight + tolerance, name + 'entire control is vertically reachable after deliberate scrolling'); + const hit = document.elementFromPoint((box.left + box.right) / 2, (box.top + box.bottom) / 2); + coverage.hitTested++; + assert(hit === control || control.contains(hit), name + 'every control center hits that control, not an overlay or offscreen null'); + } finally { + for (const { el, left, top } of scrollParents) el.scrollTo({ left, top, behavior: 'instant' }); + } + }; + const rows = [...document.querySelectorAll('#activity-monitor-section .ham-row, #activity-monitor-section .ham-sub')]; + let reference = null; + for (const [index, row] of rows.entries()) { + const header = row.querySelector(':scope > .ham-row-head > .ham-head-cols'); + const strip = row.querySelector(':scope > .ham-strip-row > ol[aria-label="Pipeline progress"]'); + if (!visible(header) || !visible(strip)) continue; + const lead = header.querySelector('.ham-head-lead'); + const pr = header.querySelector('.ham-head-pr'); + const badges = header.querySelector('.ham-badges'); + const columns = [...strip.children]; + // The renderer emits this boundary from its private canonical lane path. + const prStart = Number(header.style.getPropertyValue('--ham-pr-start')) - 1; + const lastLane = columns.length - 2; + const name = 'row ' + index + ' '; + if (row.matches('.ham-sub')) coverage.nested++; + else if (row.dataset.hamKind === 'pr') coverage.prOnly++; + else if (pr) coverage.linked++; + else coverage.issueOnly++; + if (row.matches('.ham-row') && row.querySelectorAll(':scope > .ham-sub').length > 1) coverage.multiIssue++; + const signature = columns.map(cell => ({ left: rect(cell).left - rect(strip).left, width: rect(cell).width, height: rect(cell).height })); + const stripLeft = rect(strip.parentElement).left; + if (!reference) reference = { signature, left: stripLeft }; + assert(near(stripLeft, reference.left), name + 'root/nested progress containers share one horizontal origin'); + for (const [lane, box] of signature.entries()) { + assert(near(box.left, reference.signature[lane].left) && near(box.width, reference.signature[lane].width), name + 'physical lane ' + lane + ' aligns across issue, PR-only and multi-PR rows'); + assert(near(box.height, reference.signature[lane].height), name + 'physical lane ' + lane + ' has the same compact height across rows'); + } + const flow = [...row.children].filter(child => visible(child) && !['absolute', 'fixed'].includes(getComputedStyle(child).position)); + const rowGap = parseFloat(getComputedStyle(row).rowGap) || 0; + for (let child = 1; child < flow.length; child++) { + const previous = flow[child - 1], next = flow[child]; + const spacing = rowGap + (parseFloat(getComputedStyle(previous).marginBottom) || 0) + (parseFloat(getComputedStyle(next).marginTop) || 0); + const measured = rect(next).top - rect(previous).bottom; + assert(measured >= -tolerance && measured <= spacing + tolerance, name + 'no overlap or unexplained vertical gap between successive content/sub-rows'); + } + if (matchMedia('(min-width: 1101px)').matches) { + assert(near(rect(lead).left, rect(columns[0]).left), name + 'issue starts at Open'); + assert(near(rect(lead).right, rect(columns[prStart - 1]).right), name + 'issue ends at Claimed'); + if (pr) { + assert(near(rect(pr).left, rect(columns[prStart]).left), name + 'PR starts at PR in progress'); + assert(near(rect(pr).right, rect(columns[lastLane]).right), name + 'PR ends at Merge gate'); + if (visible(badges) && badges.children.length) { + assert(rect(badges).top >= rect(pr).bottom - tolerance, name + 'badges below PR metadata'); + } + } + } else if (pr && visible(lead)) { + assert(rect(pr).top >= rect(lead).bottom - tolerance, name + 'narrow PR below issue'); + } + for (const slot of [lead, pr, badges]) { + if (!visible(slot)) continue; + const bounds = rect(slot); + for (const child of slot.querySelectorAll('.ham-title, .ham-pr-title, .ham-badge, .ham-pr-ref, button')) { + if (!visible(child)) continue; + const box = rect(child); + assert(box.left >= bounds.left - tolerance && box.right <= bounds.right + tolerance, name + child.className + ' within its header slot'); + if (child.clientWidth) assert(child.scrollWidth <= child.clientWidth + tolerance, name + child.className + ' no horizontal clipping'); + } + } + if (badges) { + if (badges.children.length) { + assert(visible(badges), name + 'nonempty action/history toolbar is not hidden'); + coverage.controls++; + const toolbar = badges.parentElement; + const headerStrip = header.querySelector('.ham-strip'); + const expectedRight = matchMedia('(min-width: 1101px)').matches ? rect(headerStrip).right : rect(header).right; + assert(near(rect(toolbar).right, expectedRight), name + 'full-row toolbar reaches the far right'); + assert(near(rect(badges).right, expectedRight), name + 'controls are right-anchored, not in an issue-side column'); + assert(rect(toolbar).top >= rect(lead).bottom - tolerance, name + 'toolbar does not intersect issue metadata'); + if (pr) assert(rect(toolbar).top >= rect(pr).bottom - tolerance, name + 'toolbar does not intersect PR metadata'); + for (const control of badges.querySelectorAll('button, a, [tabindex]')) { + if (!control.closest('.config-tooltip')) await inspectControl(control, toolbar, name); + } + } + const chips = [...badges.children].filter(visible).map(rect); + for (let a = 0; a < chips.length; a++) for (let b = a + 1; b < chips.length; b++) { + const overlapX = Math.min(chips[a].right, chips[b].right) - Math.max(chips[a].left, chips[b].left); + const overlapY = Math.min(chips[a].bottom, chips[b].bottom) - Math.max(chips[a].top, chips[b].top); + assert(overlapX <= tolerance || overlapY <= tolerance, name + 'badges do not overlap'); + } + } + const heights = columns.map(cell => rect(cell).height); + assert(Math.max(...heights) - Math.min(...heights) <= tolerance, name + 'all physical chevrons have uniform height'); + const ci = strip.querySelector('[data-track="ci"]'); + const review = strip.querySelector('[data-track="review"]'); + if (ci?.dataset.activityState === 'queued' && review?.dataset.activityState === 'approved') coverage.queuedApproved++; + for (const cell of columns) { + if (cell.dataset.routeState?.split(' ').includes('active')) { + assert(cell.classList.contains('ham-current'), name + 'current phase remains highlighted independently of work'); + } + if (cell.dataset.displayState === 'unknown') { + coverage.unknown++; + assert(cell.innerText.trim() === '', name + 'unknown track is icon-only'); + assert(!!cell.querySelector('svg'), name + 'unknown track retains the column glyph'); + assert(!cell.hasAttribute('data-motion'), name + 'unknown cannot animate as observed work'); + } + const info = cell.querySelector('.ham-chevron-info'); + if (info?.classList.contains('ham-chevron-decision')) { + const button = info.querySelector('.ham-decision-trigger'); + assert(!!button && button.getAttribute('aria-haspopup') === 'dialog', name + 'decision retains its native keyboard/pointer trigger'); + assert(!info.matches('.config-info, [tabindex]') && !info.querySelector('.config-tooltip') && !button?.closest('.config-info'), name + 'decision dialog is the sole hover/focus detail surface'); + assert(!!button?.dataset.hamTip, name + 'decision dialog receives full unclamped overflow details'); + } else if (info) { + const tip = document.getElementById(info.getAttribute('aria-describedby')); + assert(info.tabIndex === 0 && !!tip && tip.getAttribute('role') === 'tooltip', name + 'full details are keyboard/hover accessible'); + assert(!!info.getAttribute('aria-label'), name + 'full accurate accessible label is retained'); + } + for (const copy of cell.querySelectorAll('.ham-chevron-copy, .cue-acting-cap')) { + if (!visible(copy)) continue; + const style = getComputedStyle(copy); + const lineHeight = parseFloat(style.lineHeight); + const bounds = rect(copy); + assert(style.whiteSpace === 'normal' && style.overflowWrap === 'anywhere', name + 'text wraps, including unbroken handles'); + assert(bounds.height <= lineHeight * 2 + tolerance, name + 'maximum two visible text lines'); + if (bounds.height > lineHeight + tolerance) coverage.wrapped++; + assert(bounds.left >= rect(cell).left + parseFloat(getComputedStyle(cell).paddingLeft) - tolerance, name + 'text clears the left chevron notch'); + assert(bounds.right <= rect(cell).right - parseFloat(getComputedStyle(cell).paddingRight) + tolerance, name + 'text clears the right chevron point'); + const icons = info ? [...info.querySelectorAll(':scope > svg, :scope > .ham-active-ico-wrap svg, :scope > .ham-gate-ico svg')].filter(visible) : []; + for (const icon of icons) { + const box = rect(icon); + assert(box.right <= bounds.left + tolerance || box.left >= bounds.right - tolerance, name + 'text does not overlap reserved icons'); + } + } + } + const progressTop = rect(strip).top; + for (const slot of [lead, pr, badges]) { + if (visible(slot)) assert(rect(slot).bottom <= progressTop + tolerance, name + 'header above progress tracks'); + } + } + assert(coverage.issueOnly > 0 && coverage.linked > 0 && coverage.prOnly > 0, 'preview must contain issue-only, linked, and PR-only fixtures'); + assert(coverage.multiIssue > 0 && coverage.nested >= 2, 'preview must contain a real multi-PR issue with independent nested rows'); + assert(coverage.unknown > 0 && coverage.queuedApproved > 0 && coverage.wrapped > 0 && coverage.controls > 0, 'preview must include unknown, queued-CI/approved-review, long wrapped text and action/history controls'); + assert(coverage.controlTargets > 0 && coverage.controlTargets === coverage.hitTested, 'every relevant header control must be hit-tested, never skipped as offscreen'); + if (failures.length) throw new Error(JSON.stringify({ viewport: innerWidth, coverage, failures })); + return { viewport: innerWidth, coverage, failures }; +}) From 69a6312c3255f8cfaf5cbe310e4fecd3aa3de5b7 Mon Sep 17 00:00:00 2001 From: Andrew Anderson Date: Tue, 3 Nov 2026 13:03:46 -0500 Subject: [PATCH 2/4] =?UTF-8?q?=F0=9F=90=9B=20Repair=20activity=20monitor?= =?UTF-8?q?=20regressions=20and=20cover=20dense=20layouts?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Exercise production row layouts and decision controls in the existing browser harness, repair coupled expectations without reducing ratchets, and label observed PR source repair Remediating while preserving native state identifiers. Signed-off-by: Andrew Anderson --- .github/scripts/integration-governance.cjs | 2 +- .github/workflows/dashboard-mobile-shots.yml | 1 + changelog.d/fixed-activity-header-spans.md | 2 +- src/docs/dashboard-source-layout.md | 40 ++++- src/pkg/dashboard/stage_tracker.go | 8 +- src/pkg/dashboard/stage_tracker_activity.go | 12 +- .../dashboard/stage_tracker_activity.test.js | 56 +++++- .../dashboard/stage_tracker_activity_test.go | 16 +- .../stage_tracker_actor_icon_test.go | 10 +- src/pkg/dashboard/stage_tracker_caption.go | 4 +- .../dashboard/stage_tracker_claimant_test.go | 2 +- src/pkg/dashboard/stage_tracker_fixer.go | 2 +- src/pkg/dashboard/stage_tracker_fixer_test.go | 2 +- .../stage_tracker_header_spans.test.js | 29 +++- .../stage_tracker_merge_gate_test.go | 6 +- .../stage_tracker_merge_train_eta.go | 2 +- .../stage_tracker_sentinel_lane_test.go | 3 +- src/pkg/dashboard/stage_tracker_test.go | 8 +- .../stage_tracker_ui_prelude_test.go | 3 +- .../dashboard/stage_tracker_ui_rows_test.go | 16 +- src/pkg/dashboard/stage_tracker_vocabulary.go | 2 +- .../stage_tracker_vocabulary_test.go | 2 +- src/pkg/dashboard/static-src/css/tracker.css | 2 +- .../static-src/js/tracker-actions.js | 4 + .../dashboard/static-src/js/tracker-motion.js | 6 + .../static-src/js/tracker-row-layout.js | 2 +- .../static-src/js/tracker-row-strip.js | 8 +- .../dashboard/static-src/js/tracker-row.js | 2 +- .../static-src/js/tracker-words-core.js | 4 +- .../static-src/js/tracker-words-gate.js | 3 +- .../static-src/js/tracker-words-stage.js | 4 +- src/pkg/dashboard/static/index.html | 35 ++-- .../testdata/tracker-header-geometry.js | 27 ++- src/scripts/dashboard-mobile-shots.mjs | 131 +++++++++++++- .../fixtures/dashboard-activity-density.mjs | 162 ++++++++++++++++++ .../fixtures/dashboard-preparation-rail.mjs | 4 +- 36 files changed, 539 insertions(+), 83 deletions(-) create mode 100644 src/scripts/fixtures/dashboard-activity-density.mjs diff --git a/.github/scripts/integration-governance.cjs b/.github/scripts/integration-governance.cjs index 847040a5ca..eda94c1d6b 100644 --- a/.github/scripts/integration-governance.cjs +++ b/.github/scripts/integration-governance.cjs @@ -9,7 +9,7 @@ const MAX_COMMITS = 1000; const MAX_AUTHOR_BATCH = 50; // This literal is inside the enrolled .github closure. A caller-supplied // preparedBy.sourceSHA must never choose a new executable verifier tree. -const TRUSTED_SCRIPTS_TREE = '9ba1ee4cedf0c05df6d68b5ef905fed8a2924af5'; +const TRUSTED_SCRIPTS_TREE = '95d9a33da1c179412d8c5ef1d63ba626806de619'; const SOURCE = 'https://github.com/kubernetes-sigs/kubebuilder-release-tools/tree/012269a88fa4c034a0acf1ba84c26b195c0dbab4'; const sha = value => crypto.createHash('sha256').update(value).digest('hex'); const git = (args, cwd = process.cwd()) => diff --git a/.github/workflows/dashboard-mobile-shots.yml b/.github/workflows/dashboard-mobile-shots.yml index f55eb1242c..e6c5b37a84 100644 --- a/.github/workflows/dashboard-mobile-shots.yml +++ b/.github/workflows/dashboard-mobile-shots.yml @@ -9,6 +9,7 @@ on: - 'src/pkg/dashboard/**' - 'src/scripts/dashboard-mobile-shots.mjs' - 'src/scripts/fixtures/dashboard-preparation-rail.mjs' + - 'src/scripts/fixtures/dashboard-activity-density.mjs' - '.github/workflows/dashboard-mobile-shots.yml' concurrency: diff --git a/changelog.d/fixed-activity-header-spans.md b/changelog.d/fixed-activity-header-spans.md index 8afd299b1f..f2bd6f427d 100644 --- a/changelog.d/fixed-activity-header-spans.md +++ b/changelog.d/fixed-activity-header-spans.md @@ -1 +1 @@ -- Restore activity issue/PR header spans and far-right action controls; keep truthful current-phase highlights across parallel CI/Review, wrap all chevrons within two lines with complete hover/keyboard details, and show unknown track states as icons rather than verbose panels. +- Restore activity issue/PR header spans and far-right action controls; keep truthful current-phase highlights across parallel CI/Review, wrap all chevrons within two lines with complete hover/keyboard details, show unknown track states as icons rather than verbose panels, and label observed PR remediation “Remediating” without renaming native states or implying work during waits. diff --git a/src/docs/dashboard-source-layout.md b/src/docs/dashboard-source-layout.md index b560d2f532..a4ab39bfc6 100644 --- a/src/docs/dashboard-source-layout.md +++ b/src/docs/dashboard-source-layout.md @@ -35,8 +35,39 @@ full-width, far-right-anchored toolbar line, rather than overflowing the history cap into a title or ending in an issue-side column. At narrow widths the header slots stack and wrap; small-screen progress strips scroll horizontally without moving header controls offscreen. `stage_tracker_header_spans.test.js` -checks rendered markup and track arithmetic in CI; actual clipping and overlap -still require browser geometry checks on a dedicated published-preview tab. Invoke +checks rendered markup and track arithmetic in CI; these are not visual proof. +The existing Dashboard Mobile Shots workflow additionally runs the generated +SPA in real Chrome against `scripts/fixtures/dashboard-activity-density.mjs`, +preserving the preparation-rail suite. It adds activity-only desktop widths +2400, 1440, 1110 and 1024 to the existing mobile/tablet viewports (including +768 and 390), in both themes. Canonical lane boundaries are carried in +`data-ham-pr-start` and bound to the CSS custom property by the production +row materializer, including nested rows; no parallel hardcoded span is used. +Browser fixture evidence is explicitly mocked and rebased to the browser clock; +permissions are mocked only in this isolated file-page, restored on cleanup. +This does not validate private authenticated live projection or production rollout. +The existing `dashboard-mobile-shots` artifact contains `activity-layout.json`, +per-viewport/theme `*-activity-probes.json` and `*-activity-density.png`, with +PR head, checkout SHA and generated-asset SHA256 provenance. Activity probe +violations fail capture after saving the results/screenshots for every viewport; +the existing reporting-only workflow policy and permissions are unchanged. +In addition to the DOM-handler probes, real CDP mouse movement and +ArrowDown/Enter/Space key dispatch check tooltip takeover and entry into an +already-open decision dialog. `*-activity-decision-pointer.png` and +`*-activity-decision-keyboard.png` capture those actual browser interactions; +no decision action is activated. Fixture/probe failures remain failures, not +skipped or string-assertion substitutes for browser proof. +The 12:36 screenshot shapes additionally exercise nested #16450 and root +#16451 recorded/unverified preparation fronts, #16446 awaiting a superseding +human decision, pluk #436 assigned review after passing CI, #16437 approved +review with unknown CI, and Hotshot #344 queued CI with approved review. +These identities/relationships are acceptance inputs, not live stage claims. +Every rendered progress strip must own a visible current location or delegate +to drawn PR children; closed adopted-original notes intentionally own no strip. +The existing preparation-root rail gutter is retained: cross-row comparison +uses like gutters, while every header is measured against its own lane edges. +The same probes can be invoked on a dedicated published-preview fixture tab: +invoke `webstatic/testdata/tracker-header-geometry.js` as `()({ dedicatedPreview: true })` there at desktop and narrow widths with issue-only, linked, and PR-only rows present, including long titles @@ -84,6 +115,11 @@ observations show only the existing 050 column glyph, with their full source, reason, owner and head metadata available in the keyboard-accessible tooltip. Unknown does not mean running, passed or approved. Known track captions use the same two-line budget; fixer/diagnostic detail belongs in the tooltip. +PR source repair after failed CI or review findings is labelled **Remediating** +when current-head verified work is observed. Native `fixing` state identifiers +and `stage/070-fixing` remain unchanged; waiting for an author/fixer, stale +evidence and re-review do not become active remediation. General Fix actions, +PR titles and recorded historical text are not renamed. The sources sit in a sibling directory (`static-src/`, not `static/src/`) on purpose: `//go:embed static` embeds everything under `static/` recursively, so diff --git a/src/pkg/dashboard/stage_tracker.go b/src/pkg/dashboard/stage_tracker.go index 1520e3ec1c..e3151ae0ef 100644 --- a/src/pkg/dashboard/stage_tracker.go +++ b/src/pkg/dashboard/stage_tracker.go @@ -971,7 +971,7 @@ func stageTrackerShort(s stagelabels.Stage) string { case stagelabels.Reviewed: return "Review passed" case stagelabels.Fixing: - return "Fixing" + return "Remediating" case stagelabels.NeedsAuthor: return "Needs author" case stagelabels.ReturnedToContributor: @@ -996,9 +996,13 @@ func stageTrackerStages(overrides map[string]time.Duration) []StageTrackerStage out := make([]StageTrackerStage, 0, len(stagelabels.Table)) for _, d := range stagelabels.Table { branch := stageTrackerBranchFrom(d.Number) + description := d.Description + if d.Stage == stagelabels.Fixing { + description = stageTrackerRemediationNeededCaption + } out = append(out, StageTrackerStage{ Number: d.Number, Slug: d.Slug, Label: d.Stage.Label(), Short: stageTrackerShort(d.Stage), - Description: d.Description, Issue: d.Issue, PR: d.PR, Main: branch == 0, BranchFrom: branch, + Description: description, Issue: d.Issue, PR: d.PR, Main: branch == 0, BranchFrom: branch, DwellSeconds: int64(stagelabels.Dwell(d.Stage, overrides) / time.Second), FallsTo: stageTrackerFallsTo(d), }) diff --git a/src/pkg/dashboard/stage_tracker_activity.go b/src/pkg/dashboard/stage_tracker_activity.go index 455547218e..02e7999267 100644 --- a/src/pkg/dashboard/stage_tracker_activity.go +++ b/src/pkg/dashboard/stage_tracker_activity.go @@ -416,7 +416,7 @@ func stageTrackerApplyCodeActivity(it *StageTrackerItem, dispatch review.Dispatc // Bind an observed successful, worktree-verified edit to the exact // actor/repo/head assignment; unsupported instrumentation is unknown. if codeWork := trackerAssignedCodeWorker(status, it.Repo, it.Number, it.Head, fix.Agent, fix.Dispatched, now); codeWork != nil { - out.State, out.Caption, out.Active = "fixing", "Fixing · "+fix.Agent, true + out.State, out.Caption, out.Active = "fixing", "Remediating · "+fix.Agent, true out.Source, out.ObservedAt = "fix-dispatch+"+codeWork.Source, timePtr(codeWork.At) it.DisplayColumn = trackerNumberPRInProgress } @@ -462,15 +462,19 @@ func stageTrackerApplyCodeActivity(it *StageTrackerItem, dispatch review.Dispatc if it.Stage == trackerNumberNeedsDecision || it.Stage >= trackerNumberAwaitingMerge || it.Superseded != nil { it.DisplayColumn = 0 } - if out.State == "waiting_fixer" && strings.HasPrefix(it.Caption, "Fixing paused") { - out.Blocker = strings.Replace(it.Caption, "Fixing paused", "Fix task blocked", 1) + if out.State == "waiting_fixer" && (strings.HasPrefix(it.Caption, "Remediation paused") || strings.HasPrefix(it.Caption, "Fixing paused")) { + detail := strings.TrimPrefix(it.Caption, "Remediation paused") + if detail == it.Caption { + detail = strings.TrimPrefix(it.Caption, "Fixing paused") + } + out.Blocker = "Fix task blocked" + detail out.Source += "+fix-dispatch-status" } it.CodeActivity = out // Replace generic or previously projected activity, not independent // native facts such as a foreign bot conflict, hold or rebase episode. if it.Stage == trackerNumberFixing && it.Superseded == nil && - (it.Caption == "" || strings.HasPrefix(it.Caption, "Fixing") || activityCaption || out.Active) { + (it.Caption == "" || strings.HasPrefix(it.Caption, "Remediating") || strings.HasPrefix(it.Caption, "Remediation paused") || strings.HasPrefix(it.Caption, "Fixing") || activityCaption || out.Active) { it.Caption = out.Caption if out.Actor != "" && !out.Active { it.Caption += " · " + out.Actor diff --git a/src/pkg/dashboard/stage_tracker_activity.test.js b/src/pkg/dashboard/stage_tracker_activity.test.js index 0f149ac5d9..0e24b6bfc2 100644 --- a/src/pkg/dashboard/stage_tracker_activity.test.js +++ b/src/pkg/dashboard/stage_tracker_activity.test.js @@ -129,6 +129,24 @@ const livePR = extra => ({ kind: 'pr', head: 'head', stage: 50, modifiers: [], . const actions = fs.readFileSync(path.join(root, 'tracker-actions.js'), 'utf8'); +test('remediation wording preserves native identifiers, source names and waiting semantics', () => { + for (const caption of ['Fixing · FixingBot', 'Remediating · FixingBot']) { + const code = activity('fixing', caption, true); + const item = livePR({ stage: 70, display_column: 30, title: 'Fixing a widget — public PR title', code_activity: code }); + const current = physicalTracks(item).cells[3]; + assert.match(current, /Remediating · FixingBot/); + assert.match(current, /data-motion="active"/); + assert.equal(code.state, 'fixing', 'internal state stays stable'); + assert.equal(code.caption, caption, 'rendering does not rewrite recorded source evidence'); + assert.equal(item.title, 'Fixing a widget — public PR title'); + code.observed_at = new Date(now - 300000).toISOString(); + const stale = physicalTracks(item).cells[3]; + assert.doesNotMatch(stale, /data-motion="active"/); + assert.match(stale, /Fix task assigned · activity unknown/); + assert.doesNotMatch(stale, /ham-detour[^>]*>Remediating/); + } +}); + test('12:01 screenshot density preserves physical tracks for issue-only, one-to-one, multi-PR and PR-only rows', () => { const fixture = JSON.parse(fs.readFileSync(path.join(__dirname, 'webstatic/testdata/tracker-activity-density.json'), 'utf8')); const clock = Date.parse(fixture.clock); @@ -223,10 +241,40 @@ test('decision pointer, focus and keyboard delegation retain the same accessible listeners.click(event()); assert.deepEqual(opened.pop(), { button, pin: { focus: true } }, 'pointer activation preserves the native decision action path'); let hidden = 0; - const openExisting = new Function('hideConfigTooltip', 'let _stageTrackerDecisionPop = { key: "hivecommons/hive/pr#7", timer: 0 };\n' + fn(actions, 'stageTrackerOpenDecisionPop') + ';return stageTrackerOpenDecisionPop;')(() => { hidden++; }); + let actionFocused = 0; + const action = { focus() { actionFocused++; } }; + const dialog = { querySelector() { return action; } }; + const openExisting = new Function('hideConfigTooltip', 'dialog', 'let _stageTrackerDecisionPop = { key: "hivecommons/hive/pr#7", timer: 0, el: dialog };\n' + fn(actions, 'stageTrackerOpenDecisionPop') + ';return stageTrackerOpenDecisionPop;')(() => { hidden++; }, dialog); openExisting(button, false); openExisting(button, true); assert.equal(hidden, 2, 'opening or focusing even an existing decision cancels stale/pending shared tooltips'); + for (const key of ['ArrowDown', 'Enter', ' ']) { + openExisting(button, { focus: true }); + assert.ok(actionFocused > 0, key + ' enters an already-open hover/focus dialog'); + } + assert.equal(actionFocused, 3, 'existing-dialog fast path honors each keyboard focus request'); +}); + +test('canonical activity browser wiring is retained (not browser/visual proof)', () => { + const harness = fs.readFileSync(path.join(__dirname, '../../scripts/dashboard-mobile-shots.mjs'), 'utf8'); + const fixture = fs.readFileSync(path.join(__dirname, '../../scripts/fixtures/dashboard-activity-density.mjs'), 'utf8'); + assert.match(harness, /ACTIVITY_DESKTOP_WIDTHS = \[2400, 1440, 1110, 1024\]/); + for (const name of ['tracker-header-geometry', 'tracker-decision-interaction', 'native-CDP-pointer-keyboard']) { + assert.ok(harness.includes(name), name + ' stays wired into the existing canonical browser run'); + } + assert.match(harness, /Input\.dispatchMouseEvent/); + assert.match(harness, /Input\.dispatchKeyEvent/); + assert.match(harness, /preparationRailLayoutFixture\.toString/); + assert.match(harness, /if \(activityFailures\.length\) throw new Error/); + assert.match(harness, /activity-probes\.json/); + assert.match(harness, /generatedAssetSHA256/); + assert.match(fixture, /stageTrackerRowHtml\(item, stages, ctx\)/); + assert.match(fixture, /stageTrackerRowNode\(row\.key, row\.html\)/); + assert.match(fixture, /stageTrackerPreparationVisualSync/); + assert.match(fixture, /stageTrackerPreparationInlineRows/); + assert.match(fixture, /stageTrackerWireRowActions\(panel\)/); + assert.match(fixture, /fix-dispatch\+successful-edit\+verified-git-worktree/); + assert.match(fixture, /__activityDensityCleanup/); }); test('browser probes require a dedicated preview and cannot count offscreen header controls as success', async () => { @@ -291,7 +339,7 @@ test('Hive #16268 shape: held native Fixing waits for a fixer in the CI/Review p assert.match(cells.review, /done ham-current/); assert.match(cells.review, /Waiting for fixer · no code work observed/); assert.match(cells.review, /Held by @hanthor · Maintainer hold/); - assert.doesNotMatch(cells.rendered, /data-motion=|>Fixing ·/); + assert.doesNotMatch(cells.rendered, /data-motion=|>(?:Fixing|Remediating) ·/); assert.equal(item.stage, 70); assert.deepEqual(item.modifiers, ['hold']); }); @@ -335,7 +383,7 @@ test('genuine current-head source work still lights PR in progress; fix assignme const code = activity('fixing', 'Fixing · observed-fixer', true); const coding = physicalTracks(livePR({ stage: 70, display_column: 30, code_activity: code })); assert.match(coding.cells[3], /class="ham-seg active detoured"[^]*data-motion="active"/); - assert.match(coding.cells[3], /Fixing · observed-fixer/); + assert.match(coding.cells[3], /Remediating · observed-fixer/); assert.doesNotMatch(coding.ci + coding.review, /ham-current|aria-current/); const assigned = physicalTracks(livePR({ stage: 70, display_column: 50, @@ -418,7 +466,7 @@ 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(/
  • ]*>Fixing · fixer/); + 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(); const stale = render(item, stages, null, now, {}); diff --git a/src/pkg/dashboard/stage_tracker_activity_test.go b/src/pkg/dashboard/stage_tracker_activity_test.go index f4365e235e..e974ea9284 100644 --- a/src/pkg/dashboard/stage_tracker_activity_test.go +++ b/src/pkg/dashboard/stage_tracker_activity_test.go @@ -141,7 +141,8 @@ func TestStageTrackerActivitySourceRepairAndWaits(t *testing.T) { } dispatch.Fixes = []review.PendingFix{{Repo: pr.Repo, Number: pr.Number, HeadSHA: pr.HeadSHA, Agent: "fixer", Dispatched: now}} stageTrackerApplyCodeActivity(&it, dispatch, status, now) - if it.Stage != trackerNumberFixing || it.DisplayColumn != trackerNumberPRInProgress || !it.CodeActivity.Active || it.CodeActivity.Actor != "fixer" { + if it.Stage != trackerNumberFixing || it.DisplayColumn != trackerNumberPRInProgress || !it.CodeActivity.Active || it.CodeActivity.Actor != "fixer" || + it.CodeActivity.State != "fixing" || it.CodeActivity.Caption != "Remediating · fixer" { t.Fatalf("repair failed to return visually: %+v", it) } if !stageTrackerReviewActivity(pr, nil, nil, dispatch, status, now).Active { @@ -251,6 +252,19 @@ func TestStageTrackerActivityApprovalRequiresConsistentBundle(t *testing.T) { } } +func TestStageTrackerRemediationPausedWordingPreservesEvidence(t *testing.T) { + now := time.Date(2026, 11, 2, 21, 0, 0, 0, time.UTC) + for _, prefix := range []string{"Remediation paused", "Fixing paused"} { + it := StageTrackerItem{Kind: "pr", Repo: "org/repo", Number: 7, Head: "head", Stage: trackerNumberFixing, + Caption: prefix + " — attempts exhausted; historical stage Fixing"} + stageTrackerApplyCodeActivity(&it, review.DispatchState{}, nil, now) + if it.CodeActivity == nil || it.CodeActivity.Active || it.CodeActivity.State != "waiting_fixer" || + it.DisplayColumn != trackerNumberReviewPending || it.CodeActivity.Blocker != "Fix task blocked — attempts exhausted; historical stage Fixing" { + t.Fatalf("paused remediation or legacy caption invented work or rewrote history: %+v", it) + } + } +} + func TestStageTrackerActivityCIRetryAndMixedChecks(t *testing.T) { now := time.Date(2026, 11, 2, 21, 0, 0, 0, time.UTC) pr, dispatch, status := trackerActivityFixture(now) diff --git a/src/pkg/dashboard/stage_tracker_actor_icon_test.go b/src/pkg/dashboard/stage_tracker_actor_icon_test.go index ad10e0fc6a..a78b335558 100644 --- a/src/pkg/dashboard/stage_tracker_actor_icon_test.go +++ b/src/pkg/dashboard/stage_tracker_actor_icon_test.go @@ -34,14 +34,14 @@ const fixing = (n, extra, actor) => pr(n, Object.assign({head:'head', display_co let row = stageTrackerRowHtml(fixing(501, { author: 'hive-bot', author_kind: 'hive', stage_actor: { kind: 'hive', login: 'fixer', why: 'fixer commented · 3m ago' } }, 'fixer'), stages, ctx); assert.strictEqual(actorSvg(row)[1], 'Next move: hive', row); assert.ok(actorSvg(row)[2].includes(STAGE_TRACKER_ICONS.hive), 'hive draws the honeycomb'); -assert.strictEqual(detour(row), 'Fixing · fixer', 'an observed assigned fixer is named'); +assert.strictEqual(detour(row), 'Remediating · fixer', 'an observed assigned fixer is named; legacy source state/caption remains accepted'); assert.ok(litTitle(row).includes('fix-dispatch+successful-edit+verified-git-worktree'), litTitle(row)); // clanker → robot head. row = stageTrackerRowHtml(fixing(502, { author_kind: 'clanker', stage_actor: { kind: 'clanker', login: 'acme-agent', why: '@acme-agent must push a fix' } }, 'acme-agent'), stages, ctx); assert.strictEqual(actorSvg(row)[1], 'Next move: clanker'); assert.ok(actorSvg(row)[2].includes(STAGE_TRACKER_ICONS.clanker)); -assert.strictEqual(detour(row), 'Fixing · acme-agent'); +assert.strictEqual(detour(row), 'Remediating · acme-agent'); // human → the person glyph "Needs human decision" uses. row = stageTrackerRowHtml(fixing(503, { stage_actor: { kind: 'human', login: 'alice', why: '@alice must push a fix' } }, 'alice'), stages, ctx); @@ -99,7 +99,7 @@ row = stageTrackerRowHtml({ repo: 'hivecommons/docs', number: 497, kind: 'issue' ] }, stages, ctx); const subRows = subs(row); assert.strictEqual(subRows.length, 2); -assert.ok(subRows[0].includes('aria-label="Next move: hive"') && subRows[0].includes('Fixing · fixer'), subRows[0]); +assert.ok(subRows[0].includes('aria-label="Next move: hive"') && subRows[0].includes('Remediating · fixer'), subRows[0]); assert.ok(!subRows[1].includes('ham-actor-ico') && subRows[1].includes('Waiting for fixer'), subRows[1]); const externalLP={...lp,author:'clubanderson',author_kind:'',modifiers:[],stage_actor:{kind:'none',why:'author kind unknown'}}; row=stageTrackerRowHtml({repo:'hivecommons/docs',number:600,kind:'issue',stage:40,author:'issue-filer',linked_prs:[externalLP]},stages,ctx); @@ -147,7 +147,7 @@ let row = stageTrackerRowHtml(issue(14910, [lp(14921, 14910)]), stages, ctx); assert.deepStrictEqual(prCol(row).length, 1, 'owner: the PR sits in the PR column: ' + row); assert.ok(prCol(row)[0].includes('#14921')); assert.strictEqual(strips(row).length, 1); -assert.ok(row.includes('Fixing · fixer') && row.includes('aria-label="Next move: hive"'), row); +assert.ok(row.includes('Remediating · fixer') && row.includes('aria-label="Next move: hive"'), row); assert.deepStrictEqual(elsewhere(row), [], 'owner carries no elsewhere chip'); // The other issue does not redraw the PR: its own strip (040 Covered by PR) and a chip pointing at the owner row. @@ -157,7 +157,7 @@ assert.strictEqual(subs(row).length, 0); assert.strictEqual(strips(row).length, 1); assert.ok(strip(row).includes('PR in progress') && strip(row).includes('title="Covered by PR'), 'the issue draws its own 040 stage (lit at the PR column): ' + strip(row)); assert.deepStrictEqual(elsewhere(row), [{ title: 'PR #14921 covers this issue too; its row is drawn under #14910', text: '↳ #14921 · under #14910' }]); -assert.ok(!strip(row).includes('Fixing'), 'no second lit Fixing pill'); +assert.ok(!/(?:Fixing|Remediating)<\/span>/.test(strip(row)), 'no second lit remediation pill'); assert.ok(tooltip(row).includes('Covering PR: #14921'), 'the row tooltip still names the covering PR'); // Several PRs: the ones drawn here are sorted and drawn, the rest become chips. diff --git a/src/pkg/dashboard/stage_tracker_caption.go b/src/pkg/dashboard/stage_tracker_caption.go index 36f094faec..ca75bc7196 100644 --- a/src/pkg/dashboard/stage_tracker_caption.go +++ b/src/pkg/dashboard/stage_tracker_caption.go @@ -754,6 +754,8 @@ func joinClause(head, clause string) string { return head + " — " + clause } +const stageTrackerRemediationNeededCaption = "CI failed or review changes requested; remediation needed" + // stageTrackerCaption builds the human sentence and the actor for an item. func stageTrackerCaption(stage stagelabels.Stage, reason, author string, kind string, mirrored bool, rec stagelabels.Record, hasRec bool, linkedPR int, head string) (caption, actor string) { clause := humanizeStageReason(reason) @@ -798,7 +800,7 @@ func stageTrackerCaption(stage stagelabels.Stage, reason, author string, kind st case stagelabels.Reviewed: return joinClause("Review passed; waiting for merge admission", clause), "CI" case stagelabels.Fixing: - return joinClause("Red or changes requested; a hive agent is fixing it", clause), "hive" + return joinClause(stageTrackerRemediationNeededCaption, clause), "hive" case stagelabels.NeedsAuthor: return joinClause("Needs "+who, clause) + " — " + who + " must act", strings.TrimPrefix(who, "@") case stagelabels.ReturnedToContributor: diff --git a/src/pkg/dashboard/stage_tracker_claimant_test.go b/src/pkg/dashboard/stage_tracker_claimant_test.go index 8bd431fcb6..7e328d4833 100644 --- a/src/pkg/dashboard/stage_tracker_claimant_test.go +++ b/src/pkg/dashboard/stage_tracker_claimant_test.go @@ -209,7 +209,7 @@ const covered = stageTrackerRowHtml(issue(9, { stage: 40, caption: 'Covered by P { number: 92, url: 'https://x/92', title: 'alt', author: 'alice', author_kind: 'human', stage: 50, stage_since: since, caption: 'CI', stage_actor: { kind: 'hive', why: 'review' }, claimant: { kind: 'person', login: 'alice', since, source: 'author' } }, ] }), stages, ctx); const subWords = strips(covered).slice(1).map(s => text((/
  • ]*>([\s\S]*?)<\/li>/.exec(s) || ['', ''])[1])); -assert.deepStrictEqual(subWords, ['Fixing · fixer', ''], JSON.stringify(subWords)); +assert.deepStrictEqual(subWords, ['Remediating · fixer', ''], JSON.stringify(subWords)); assert.ok(subs(covered)[1].includes('CI unknown') && subs(covered)[1].includes('Review unknown'), 'the PR owner is not an assigned reviewer'); assert.ok(subs(covered)[1].includes('Held by: @alice'), 'ownership stays available without implying review activity'); console.log('claimant chevron ok'); diff --git a/src/pkg/dashboard/stage_tracker_fixer.go b/src/pkg/dashboard/stage_tracker_fixer.go index 7a1ec8da65..7947760cd0 100644 --- a/src/pkg/dashboard/stage_tracker_fixer.go +++ b/src/pkg/dashboard/stage_tracker_fixer.go @@ -39,7 +39,7 @@ func stageTrackerApplyFixerStatus(it *StageTrackerItem, fixer review.FixDispatch if slices.Contains(it.Modifiers, modNeedsRebase) { why += "; conflicting with the base branch" } - it.Caption = "Fixing paused — " + why + "; no fix job is dispatched" + it.Caption = "Remediation paused — " + why + "; no fix job is dispatched" it.StageActor.Kind = StageActorNone it.StageActor.Login = "" it.StageActor.Why = "nobody — " + why + "; the hive will not re-kick it" diff --git a/src/pkg/dashboard/stage_tracker_fixer_test.go b/src/pkg/dashboard/stage_tracker_fixer_test.go index efa5457c5d..d5be8979ea 100644 --- a/src/pkg/dashboard/stage_tracker_fixer_test.go +++ b/src/pkg/dashboard/stage_tracker_fixer_test.go @@ -24,7 +24,7 @@ func TestStageTrackerApplyFixerStatusExhausted(t *testing.T) { it := base() stageTrackerApplyFixerStatus(&it, exhausted, nil) - if !strings.HasPrefix(it.Caption, "Fixing paused — fixer gave up after 6 attempts") || !strings.Contains(it.Caption, "conflicting with the base branch") { + if !strings.HasPrefix(it.Caption, "Remediation paused — fixer gave up after 6 attempts") || !strings.Contains(it.Caption, "conflicting with the base branch") { t.Fatalf("caption = %q", it.Caption) } if it.StageActor.Kind != StageActorNone || it.StageActor.Login != "" || it.Actor != "maintainer" { diff --git a/src/pkg/dashboard/stage_tracker_header_spans.test.js b/src/pkg/dashboard/stage_tracker_header_spans.test.js index a1f199e7f9..37189dde68 100644 --- a/src/pkg/dashboard/stage_tracker_header_spans.test.js +++ b/src/pkg/dashboard/stage_tracker_header_spans.test.js @@ -57,7 +57,7 @@ for (const [name, item] of [ ]) test(name + ': full metadata stays in the correct header slots', () => { const ctx = load(); const rendered = ctx.stageTrackerRowHtml(item, [], { nowMs: 1, repoChips: {} }); - const start = Number(rendered.match(/--ham-pr-start: (\d+)/)[1]); + const start = Number(rendered.match(/data-ham-pr-start="(\d+)"/)[1]); assert.equal(start, 4, 'PR metadata starts at PR in progress, not Actionable'); const lead = rendered.match(/
  • ([\s\S]*?)<\/li>/)[1]; if (name === 'PR-only') { @@ -79,11 +79,30 @@ for (const [name, item] of [ }); function rule(selector) { - const found = html.match(new RegExp(selector.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') + ' \\{([^}]+)\\}')); + // Match the whole selector, not its suffix in ".ham-cols .ham-strip". + const found = html.match(new RegExp('(?:^|[\\r\\n])[\\t ]*' + selector.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') + ' \\{([^}]+)\\}')); assert.ok(found, selector); return found[1]; } +test('row materialization binds canonical header boundaries for root and nested rows', () => { + const headers = ['4', '5'].map(hamPrStart => ({ + dataset: { hamPrStart }, properties: {}, + style: { setProperty(name, value) { this.owner.properties[name] = value; } }, + })); + for (const header of headers) header.style.owner = header; + const node = { dataset: {}, querySelectorAll(selector) { + assert.equal(selector, '.ham-head-cols[data-ham-pr-start]'); + return headers; + } }; + const ctx = vm.createContext({ _stageTrackerRowSrc: null, + document: { createElement: () => ({ content: { firstElementChild: node } }) } }); + vm.runInContext(fn('stageTrackerRowNode'), ctx); + assert.equal(ctx.stageTrackerRowNode('issue:1', ''), node); + assert.equal(node.dataset.hamKey, 'issue:1'); + assert.deepEqual(headers.map(header => header.properties['--ham-pr-start']), ['4', '5']); +}); + test('spans share the physical lane grid, including independent concurrent CI/Review', () => { const ctx = load(); const header = ctx.stageTrackerHeaderHtml([]); @@ -102,7 +121,7 @@ test('spans share the physical lane grid, including independent concurrent CI/Re assert.match(rule('.ham-head-cols .ham-seg.cap'), /justify-content: flex-end/); // Resolve the declared grid lines using the actual header's track count. // Content cannot alter minmax(0,1fr) track widths; covered gaps belong to spans. - const start = Number(ctx.stageTrackerHeadColsHtml(['PR'], 'issue', chips).match(/--ham-pr-start: (\d+)/)[1]); + const start = Number(ctx.stageTrackerHeadColsHtml(['PR'], 'issue', chips).match(/data-ham-pr-start="(\d+)"/)[1]); const gap = 4, cap = 48; for (const width of [2400, 1440, 1110]) { const lane = (width - cap - laneCount * gap) / laneCount; @@ -114,7 +133,7 @@ test('spans share the physical lane grid, including independent concurrent CI/Re assert.ok(prRight < width - cap, 'PR span excludes the history cap'); } vm.runInContext('STAGE_TRACKER_PATH.splice(2, 0, 15)', ctx); - assert.match(ctx.stageTrackerHeadColsHtml(['PR']), /--ham-pr-start: 5/, 'boundary derives from canonical stages, not a second hard-coded span'); + assert.match(ctx.stageTrackerHeadColsHtml(['PR']), /data-ham-pr-start="5"/, 'boundary derives from canonical stages, not a second hard-coded span'); }); test('long metadata wraps in bounded slots and the narrow layout resets both grid axes', () => { @@ -183,7 +202,7 @@ test('12:01 screenshot density: real multi-PR/sub-row structure preserves distin assert.equal((rendered.match(/
    /g)) { - assert.match(header[1], /--ham-pr-start: 4/); + assert.match(header[1], /data-ham-pr-start="4"/); assert.equal((header[1].match(/class="ham-seg cap"/g) || []).length, 1, 'one separate far-right toolbar per identity'); const lead = header[1].match(/ham-head-lead[^"]*">([^]*?)<\/li>/)[1]; assert.doesNotMatch(lead, /ham-badge-waiting|ham-lead-act|ham-acted/, 'activity/action/history controls never overprint the issue title slot'); diff --git a/src/pkg/dashboard/stage_tracker_merge_gate_test.go b/src/pkg/dashboard/stage_tracker_merge_gate_test.go index 8b575b20e0..6f84e6be6f 100644 --- a/src/pkg/dashboard/stage_tracker_merge_gate_test.go +++ b/src/pkg/dashboard/stage_tracker_merge_gate_test.go @@ -148,8 +148,10 @@ func TestStageTrackerMergeGateNode(t *testing.T) { `const STAGE_TRACKER_MERGE_GATE_WORD = { 'gate-pending': 'Review passed', ready: 'Ready for auto merge', soaking: 'Soaking', merging: 'Merging', merged: 'Merged', 'merge-failed': 'Merge failed' };`, `60: 'Review passed', 80: 'Ready for auto merge', 95: 'Soaking', 100: 'Merging'`, `const gateCue = gateWord && typeof stageTrackerGateCueHtml === 'function' ? stageTrackerGateCueHtml(item, nowMs, trains) : '';`, - `else if (active) inner = gateCue + workIco + (decision ? stageTrackerDecisionTriggerHtml(decision, word, tip) : word) + (actorIco || holderIco);`, - `if (gateInfo) tip = sg.label + ' — ' + gateInfo.tip;`, + `const caption = gateWord || word;`, + `const text = decision ? stageTrackerDecisionTriggerHtml(decision, caption, fullTip) : caption;`, + `tip = sg.label + ' — ' + gateInfo.tip;`, + `gateCaption = [gateInfo.word, gateInfo.detail].filter(Boolean).join(' · ');`, `if (typeof stageTrackerGateCountdownSync === 'function') stageTrackerGateCountdownSync(el, nowMs);`, `.ham-gate-ico { display: inline-flex;`, `.ham-gate-detail {`, } { diff --git a/src/pkg/dashboard/stage_tracker_merge_train_eta.go b/src/pkg/dashboard/stage_tracker_merge_train_eta.go index d341205afb..cbdee954a9 100644 --- a/src/pkg/dashboard/stage_tracker_merge_train_eta.go +++ b/src/pkg/dashboard/stage_tracker_merge_train_eta.go @@ -79,7 +79,7 @@ func mergeTrainHeadState(head *StageTrackerItem, now time.Time) (state, reason s case trackerNumberReviewed, trackerNumberReviewPending: return mergeTrainHeadCI, "waiting for CI", 0, false case trackerNumberFixing, trackerNumberReturned, trackerNumberNeedsAuthor: - return mergeTrainHeadFixing, "being fixed by its author", 0, false + return mergeTrainHeadFixing, "being remediated by its author", 0, false } if head.Hold != nil || head.NeedsHuman { return mergeTrainHeadNeedsHuman, "waiting for a maintainer", 0, false diff --git a/src/pkg/dashboard/stage_tracker_sentinel_lane_test.go b/src/pkg/dashboard/stage_tracker_sentinel_lane_test.go index 2fc653a6da..dd673a02e3 100644 --- a/src/pkg/dashboard/stage_tracker_sentinel_lane_test.go +++ b/src/pkg/dashboard/stage_tracker_sentinel_lane_test.go @@ -371,7 +371,8 @@ const parked = stageTrackerRowHtml(P('o/r', 109, 85, flagged), stages, ctx); const lit = /
  • ]*)>([\s\S]*?)<\/li>/.exec(parked); assert.ok(lit, 'the lit merge-gate chevron carries ham-sentinel: ' + parked); assert.ok(lit[2].includes('Sentinel alert · needs human'), 'lane text: ' + lit[2]); -assert.ok(!lit[2].includes('Needs human decision'), 'the plain word is replaced, not appended'); +const visibleChevron = lit[2].replace(/]*class="config-tooltip ham-chevron-tip"[^>]*>[^<]*<\/span>/g, ''); +assert.ok(!visibleChevron.includes('Needs human decision'), 'the plain word is replaced, not appended in visible copy; full context remains in the tooltip'); assert.ok(lit[1].includes('title="' + TIP + ' — '), 'the chevron tooltip leads with the reason: ' + lit[1]); assert.ok(lit[1].includes('aria-current="step"')); assert.ok(lit[1].includes('aria-label="Sentinel alert · needs human — ' + TIP + '"'), 'aria-label carries the wording: ' + lit[1]); diff --git a/src/pkg/dashboard/stage_tracker_test.go b/src/pkg/dashboard/stage_tracker_test.go index a4ea892e98..9b44ad7678 100644 --- a/src/pkg/dashboard/stage_tracker_test.go +++ b/src/pkg/dashboard/stage_tracker_test.go @@ -95,13 +95,19 @@ func TestStageTrackerStagesFallsTo(t *testing.T) { // returned-to-contributor (clanker) are both review-side detours with their // own chevron word and an author-must-act caption. func TestStageTrackerNeedsAuthorAndReturnedWords(t *testing.T) { + for _, stage := range stageTrackerStages(nil) { + if stage.Number == stagelabels.Fixing.Number() && + (stage.Label != stagelabels.Fixing.Label() || stage.Short != "Remediating" || stage.Description != "CI failed or review changes requested; remediation needed") { + t.Fatalf("remediation display wording changed the native identity or lost its waiting-safe description: %+v", stage) + } + } for _, tc := range []struct { stage stagelabels.Stage word, captionHead string }{ {stagelabels.NeedsAuthor, "Needs author", "Needs @sam"}, {stagelabels.ReturnedToContributor, "Returned to contributor", "Returned to @sam"}, - {stagelabels.Fixing, "Fixing", "Red or changes requested; a hive agent is fixing it"}, + {stagelabels.Fixing, "Remediating", "CI failed or review changes requested; remediation needed"}, } { if got := stageTrackerShort(tc.stage); got != tc.word { t.Errorf("%v: short = %q, want %q", tc.stage, got, tc.word) diff --git a/src/pkg/dashboard/stage_tracker_ui_prelude_test.go b/src/pkg/dashboard/stage_tracker_ui_prelude_test.go index cc9b4a8d4f..73a6b88b7c 100644 --- a/src/pkg/dashboard/stage_tracker_ui_prelude_test.go +++ b/src/pkg/dashboard/stage_tracker_ui_prelude_test.go @@ -209,7 +209,8 @@ const segStates = (html) => Array.from(strip(html).matchAll(/
  • ]*>(.*?)<\/a>/g)).map(m => m[1]); const B = 'blank'; -const text = (h) => h.replace(/<[^>]+>/g, '').replace(/'/g, "'").replace(/\s+/g, ' ').trim(); +const visibleMarkup = (h) => h.replace(/]*class="config-tooltip ham-chevron-tip"[^>]*>[^<]*<\/span>/g, ''); +const text = (h) => visibleMarkup(h).replace(/<[^>]+>/g, '').replace(/'/g, "'").replace(/\s+/g, ' ').trim(); // The row tooltip rides the issue's #N link on an issue row and the PR link // (after "PR title · ") on a PR row; the issue slot of a PR row carries none. const tooltip = (row) => (/]*title="([^"]*)"/.exec(row) || /]*title="([^"]*)"/.exec(row))[1]; diff --git a/src/pkg/dashboard/stage_tracker_ui_rows_test.go b/src/pkg/dashboard/stage_tracker_ui_rows_test.go index feaba7ef11..2fbe205a8b 100644 --- a/src/pkg/dashboard/stage_tracker_ui_rows_test.go +++ b/src/pkg/dashboard/stage_tracker_ui_rows_test.go @@ -67,7 +67,7 @@ assert.ok(tooltip(row).includes('Open · on hold (do-not-merge/hold) · No stage row = stageTrackerRowHtml({ repo: 'acme/console', number: 11, kind: 'issue', title: 'New report', stage: 0, caption: 'No stage recorded yet', labels: ['needs-triage'], modifiers: ['needs-triage'] }, stages, ctx); assert.deepStrictEqual(segStates(row), ['active', T, T, T, T, T, 'todo cap']); assert.ok(row.includes('ham-mod-needs-triage">triage needed'), row); -assert.ok(/aria-current="step">]*>[\s\S]*?<\/svg>Open<\/span><\/li>/.test(row), row); +assert.ok(/aria-current="step">]*>]*>[\s\S]*?<\/svg>Open<\/span><\/span>/.test(row), row); assert.ok(tooltip(row).startsWith('Open No stage recorded yet') && tooltip(row).includes('Flags: triage needed'), tooltip(row)); // 015 triage-needed: the Actionable column lights (not a detour) with the @@ -75,7 +75,7 @@ assert.ok(tooltip(row).startsWith('Open No stage recorded yet') && tooltip(row). // chevron tooltip name the stage; the server already dropped the chip. row = stageTrackerRowHtml({ repo: 'acme/console', number: 13262, kind: 'issue', title: 'Review backlog (security)', stage: 15, author: 'hive-bot', author_kind: 'hive', caption: 'Actionable, but no maintainer has looked at it yet; waiting for triage' }, stages, ctx); assert.deepStrictEqual(segStates(row), [D, 'active', T, T, T, T, 'todo cap'], '015 lights the Actionable column: ' + row); -assert.ok(/aria-current="step">]*>[\s\S]*?<\/svg>Triage needed<\/span>]*>]*>[\s\S]*?<\/svg>Triage needed<\/span><\/span>]*>[\s\S]*?<\/svg>Actionable<\/span><\/li>/.test(row), row); +assert.ok(/aria-current="step">]*>]*>[\s\S]*?<\/svg>Actionable<\/span><\/span>/.test(row), row); // Plain Open (no stage label, not held) says how long it has sat there, from // the same instant the since column draws (stage_since), with the ISO time on @@ -212,7 +212,7 @@ assert.ok(!stageTrackerRowHtml({ repo: 'acme/console', number: 30, kind: 'pr', t // With the PR's stage known the issue strip rides it (merge queue → Merge gate lit, hive move). row = stageTrackerRowHtml({ repo: 'acme/console', number: 8, kind: 'issue', stage: 40, linked_prs: [{ number: 102, title: 'Fix it', author_kind: 'human', author: 'bob', stage: 100, stage_since: new Date(now - 7200000).toISOString(), modifiers: ['stalled'], caption: 'Admitted, merging' }] }, stages, ctx); assert.deepStrictEqual(segStates(row), [D, D, D, D, D, 'active', 'todo cap']); -assert.ok(row.includes('MergingMergingstalled') && row.includes('2h'), 'chips + since come from the covering PR: ' + row); assert.ok(tooltip(row).includes('Admitted, merging') && tooltip(row).includes('Covering PR: #102'), tooltip(row)); assert.ok(prCol(row)[0].includes('ham-author-human') && prCol(row)[0].includes('Fix it'), prCol(row)[0]); @@ -366,11 +366,11 @@ assert.strictEqual(stageTrackerTrailText(live14787), 'review-pending → needs-a assert.strictEqual(stageTrackerTrailText({ history: [{ number: 50 }, { number: 85 }] }), '', 'numbers alone, no table, no slug: nothing to name'); _stageTracker = savedStages; row = stageTrackerRowHtml({ repo: 'acme/console', number: 7, kind: 'issue', stage: 40, linked_prs: [{ number: 108, author_kind: 'clanker', stage: 30 }] }, stages, ctx); -assert.ok(subs(row).length === 0 && strip(row).includes('aria-label="Next move: clanker"') && strip(row).includes('PR in progressPR in progressPR in progressPR in progressClaimedClaimedClaimed'), 'no claimant known, no icon: ' + row); row = stageTrackerRowHtml({ repo: 'acme/console', number: 9, kind: 'issue', stage: 10 }, stages, ctx); @@ -473,7 +473,7 @@ assert.strictEqual(sr.length, 2, 'one sub-row per covering PR'); assert.ok(prCol(sr[0])[0].includes('ham-author-human') && prCol(sr[0])[0].includes('#102') && prCol(sr[0])[0].includes('Fix it'), prCol(sr[0])[0]); assert.deepStrictEqual(segStates(sr[0]), [B, B, B, D, 'active detoured', T, 'todo cap'], 'PR strip starts at PR in progress'); assert.ok(sr[0].includes('Waiting for fixer') && !sr[0].includes('ham-actor-ico') && sr[0].indexOf('1h') > sr[0].indexOf('aria-label="Pipeline progress"') && sr[0].includes('ham-mod-needs-rebase">needs rebase'), 'a rebase label and next mover cannot manufacture observed coding: ' + sr[0]); -assert.ok(/^ data-ham-kind="pr" data-ham-stage="70" data-ham-sub-key="acme\/console\/pr#102">/.test(sr[0]) && /]*title="Fix it · Fixing review findings Rebasing onto main/.test(sr[0]), 'sub-row tooltip rides the PR link, not the container: ' + sr[0].slice(0, 400)); +assert.ok(/^ data-ham-kind="pr" data-ham-stage="70" data-ham-sub-key="acme\/console\/pr#102">/.test(sr[0]) && /]*title="Fix it · Remediating CI or review findings Rebasing onto main/.test(sr[0]), 'sub-row tooltip rides the PR link, not the container: ' + sr[0].slice(0, 400)); assert.ok(prCol(sr[1])[0].includes('ham-author-clanker') && prCol(sr[1])[0].includes('#103')); assert.deepStrictEqual(segStates(sr[1]), [B, B, B, 'active', T, T, 'todo cap'], 'a PR at 030 lights PR in progress on its own sub-row'); assert.ok(!row.slice(0, row.indexOf('
    .ham-seg { box-sizing: border-box; height: 100%; line-height: var(--ham-chevron-line-height); padding: var(--sp-2) calc(var(--ham-notch) + var(--sp-2)); } - .ham-chevron-info.config-info, .ham-chevron-info.ham-chevron-decision { display: flex; align-items: center; justify-content: center; gap: var(--sp-1); width: 100%; height: 100%; min-width: 0; flex-shrink: 1; margin: 0; padding: 0; border: 0; border-radius: 0; background: transparent; color: inherit; font: inherit; line-height: inherit; position: static; } + .ham-chevron-info.config-info, .ham-chevron-info.ham-chevron-decision { display: flex; align-items: center; justify-content: center; gap: var(--sp-1); width: 100%; height: 100%; min-width: 0; flex-shrink: 1; margin: 0; padding: 0; border: 0; background: transparent; color: inherit; font: inherit; line-height: inherit; position: static; } .ham-chevron-info.config-info:hover { background: transparent; border: 0; color: inherit; } .ham-chevron-info:focus-visible, .ham-chevron-decision:focus-within { outline: var(--line-width) solid currentColor; outline-offset: var(--sp-1); } .ham-chevron-copy { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: var(--ham-chevron-text-lines); line-clamp: var(--ham-chevron-text-lines); max-height: calc(var(--ham-chevron-text-lines) * var(--ham-chevron-line-height) * 1em); flex: 1 1 auto; min-width: 0; overflow: hidden; white-space: normal; overflow-wrap: anywhere; } diff --git a/src/pkg/dashboard/static-src/js/tracker-actions.js b/src/pkg/dashboard/static-src/js/tracker-actions.js index 9c85822855..628e430732 100644 --- a/src/pkg/dashboard/static-src/js/tracker-actions.js +++ b/src/pkg/dashboard/static-src/js/tracker-actions.js @@ -1031,6 +1031,10 @@ if (_stageTrackerDecisionPop && _stageTrackerDecisionPop.key === key) { if (pin) _stageTrackerDecisionPop.pinned = true; clearTimeout(_stageTrackerDecisionPop.timer); + if (pin && pin.focus) { + const first = _stageTrackerDecisionPop.el.querySelector('.ham-decision-act:not([aria-disabled="true"])'); + (first || _stageTrackerDecisionPop.el).focus(); + } return; } stageTrackerCloseDecisionPop(false); diff --git a/src/pkg/dashboard/static-src/js/tracker-motion.js b/src/pkg/dashboard/static-src/js/tracker-motion.js index 4d0dfcd7e0..5788981cbc 100644 --- a/src/pkg/dashboard/static-src/js/tracker-motion.js +++ b/src/pkg/dashboard/static-src/js/tracker-motion.js @@ -657,6 +657,12 @@ tpl.innerHTML = html; const node = tpl.content.firstElementChild; node.dataset.hamKey = key; + // Bind canonical lane geometry when materializing root and nested rows. + if (typeof node.querySelectorAll === 'function') { + for (const header of node.querySelectorAll('.ham-head-cols[data-ham-pr-start]')) { + header.style.setProperty('--ham-pr-start', header.dataset.hamPrStart); + } + } if (_stageTrackerRowSrc) _stageTrackerRowSrc.set(node, stageTrackerRowSrcKey(html)); return node; } diff --git a/src/pkg/dashboard/static-src/js/tracker-row-layout.js b/src/pkg/dashboard/static-src/js/tracker-row-layout.js index 619507fe79..204dc3bb21 100644 --- a/src/pkg/dashboard/static-src/js/tracker-row-layout.js +++ b/src/pkg/dashboard/static-src/js/tracker-row-layout.js @@ -9,7 +9,7 @@ function stageTrackerHeadColsHtml(prRefs, leadHtml, chipsHtml, prTargetKey) { const wide = !(prRefs && prRefs.length); const prStart = STAGE_TRACKER_PATH.indexOf(STAGE_TRACKER_PR_COLUMN) + 1; - return `
    1. ${leadHtml || ''}
    2. ${wide ? '' : `
    3. ${prRefs.join('')}
    4. `}
    5. ${chipsHtml || ''}
    `; + return `
    1. ${leadHtml || ''}
    2. ${wide ? '' : `
    3. ${prRefs.join('')}
    4. `}
    5. ${chipsHtml || ''}
    `; } function stageTrackerSinceHtml(item, nowMs) { 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 00a5d0b331..faca32da4b 100644 --- a/src/pkg/dashboard/static-src/js/tracker-row-strip.js +++ b/src/pkg/dashboard/static-src/js/tracker-row-strip.js @@ -47,7 +47,7 @@ let decided = kind === 'review' && sg.state === 'active' && item.decided && typeof stageTrackerMergeGateWordHtml === 'function' ? stageTrackerMergeGateWordHtml(item, nowMs) : ''; 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(?=\s|<)/g, '>Fix requested'); + if (!codeFresh) decided = decided.replace(/>(?:Fixing|Remediating)(?=\s|<)/g, '>Fix requested'); const word = esc(caption); const evidenceURL = matches && /^https?:\/\//i.test(String(a.url || '')) ? a.url : ''; const evidenceLink = ownsPR && evidenceURL ? `
    ${word}` : word; @@ -61,7 +61,7 @@ const icon = stageTrackerIcon(50, 'ham-ico', name); const content = known ? `${evidenceLink}` : icon; const linkedIcon = !known && ownsPR && evidenceURL ? `${icon}` : content; - return `
  • ${linkedIcon}${esc(fullTip)}${decided ? `${decided}` : ''}
  • `; + return `
  • ${linkedIcon}${esc(fullTip)}${decided ? `${decided}` : ''}
  • `; } // Chevrons for one item. range bounds the columns the item owns (an @@ -194,7 +194,7 @@ const text = decision ? stageTrackerDecisionTriggerHtml(decision, caption, fullTip) : caption; const content = `${gateCue}${workIco}${text}${actorIco || holderIco}`; // A decision's dialog is its sole hover/focus detail surface. - inner = decision ? `${content}` : `${content}${esc(fullTip)}`; + inner = decision ? `${content}` : `${content}${esc(fullTip)}`; } else inner = stageTrackerIcon(sg.number, 'ham-ico'); return `
  • ${inner}
  • `; }).join(''); @@ -219,7 +219,7 @@ const activityFreshMS = 2 * 60 * 1000; const clock = Number(nowMs) || Date.now(); const working = code && code.head === item.head && code.source === 'fix-dispatch+successful-edit+verified-git-worktree' && code.active && code.state === 'fixing' && Number.isFinite(observed) && observed <= clock && clock - observed <= activityFreshMS; - const word = !working && decidedInfo.word === 'Fixing' ? 'Fix requested' : decidedInfo.word; + const word = !working && ['Fixing', 'Remediating'].includes(decidedInfo.word) ? 'Fix requested' : decidedInfo.word; text = word + (decidedInfo.detail ? ' · ' + decidedInfo.detail : '') + (regressed ? ' · ' + regressed : ''); } const tracks = (item.kind === 'pr' || item.via_pr) && item.head ? ['ci', 'review'].map(kind => { diff --git a/src/pkg/dashboard/static-src/js/tracker-row.js b/src/pkg/dashboard/static-src/js/tracker-row.js index 741ecf3c14..5ec30c2c51 100644 --- a/src/pkg/dashboard/static-src/js/tracker-row.js +++ b/src/pkg/dashboard/static-src/js/tracker-row.js @@ -29,7 +29,7 @@ const activityFreshMS = 2 * 60 * 1000; const clock = Number(nowMs) || Date.now(); const codeWorking = codeMatches && code.source === 'fix-dispatch+successful-edit+verified-git-worktree' && code.active && Number.isFinite(codeObserved) && codeObserved <= clock && clock - codeObserved <= activityFreshMS; - const codeCaption = codeMatches ? (!codeWorking && code.state === 'fixing' ? 'Fix task assigned · activity unknown' : code.caption) : 'Code activity unknown'; + const codeCaption = codeMatches ? (!codeWorking && code.state === 'fixing' ? 'Fix task assigned · activity unknown' : (code.state === 'fixing' ? String(code.caption || '').replace(/^Fixing\b/, 'Remediating') : code.caption)) : 'Code activity unknown'; if (detour && !code && cur === 70 && !detour.sentinel) detour.text = 'Waiting for fixer · activity unknown'; if (detour && code && [70, 71, 72].includes(cur)) detour.text = codeCaption || detour.text; if (detour && code && cur === 74 && codeWorking) detour.text += ' · ' + codeCaption; diff --git a/src/pkg/dashboard/static-src/js/tracker-words-core.js b/src/pkg/dashboard/static-src/js/tracker-words-core.js index f3c9d3328d..c353c06c12 100644 --- a/src/pkg/dashboard/static-src/js/tracker-words-core.js +++ b/src/pkg/dashboard/static-src/js/tracker-words-core.js @@ -232,7 +232,7 @@ // the chevron and the caption name one blocker (hive's own #15577 read // "Merge queued · 1st" while its caption said "check build-and-test // still running"). Keys below STAGE_TRACKER_MERGE_READY only. - const STAGE_TRACKER_PROVISIONAL_STAGE_WORD = { 10: 'Actionable', 20: 'Claimed', 30: 'PR in progress', 40: 'Covered by PR', 45: 'Needs human decision', 50: 'CI / Review', 60: 'Review passed', 70: 'Fixing', 71: 'Needs author', 72: 'Returned to contributor', 74: 'Adopted by hive' }; + const STAGE_TRACKER_PROVISIONAL_STAGE_WORD = { 10: 'Actionable', 20: 'Claimed', 30: 'PR in progress', 40: 'Covered by PR', 45: 'Needs human decision', 50: 'CI / Review', 60: 'Review passed', 70: 'Remediating', 71: 'Needs author', 72: 'Returned to contributor', 74: 'Adopted by hive' }; // Pure: true when the row's queue slot is a forecast — the server says // so (merge_train.provisional), or, from an older server, the row's // own stage is short of the merge gate. @@ -339,7 +339,7 @@ // (mergeTrainHead* in Go) — short enough for a chevron. A head on a // person says what the person has to do (the owner's ask: "waiting on // #15425 (needs maintainer merge)"), not "waiting for a maintainer". - const STAGE_TRACKER_TRAIN_HEAD_STALL_WORD = { 'needs-human': 'needs maintainer merge', ci: 'waiting for CI', soaking: 'soak overran', ready: 'waiting for the next merge pass', merging: 'merge call in flight', fixing: 'being fixed by its author', unknown: 'head not in this view' }; + const STAGE_TRACKER_TRAIN_HEAD_STALL_WORD = { 'needs-human': 'needs maintainer merge', ci: 'waiting for CI', soaking: 'soak overran', ready: 'waiting for the next merge pass', merging: 'merge call in flight', fixing: 'being remediated by its author', unknown: 'head not in this view' }; // Pure: the short reason a stalled head is stuck — the head_state // table, a human-decision head told apart by its reason, else the // head's own plain-word reason cut at its first clause. diff --git a/src/pkg/dashboard/static-src/js/tracker-words-gate.js b/src/pkg/dashboard/static-src/js/tracker-words-gate.js index 3c7690a726..4ad0fed27f 100644 --- a/src/pkg/dashboard/static-src/js/tracker-words-gate.js +++ b/src/pkg/dashboard/static-src/js/tracker-words-gate.js @@ -19,7 +19,8 @@ if (!d || d.effect !== 'pending' || !d.text) return null; nowMs = typeof nowMs === 'number' ? nowMs : Date.now(); const sep = String(d.text).indexOf(' · '); - const word = sep > 0 ? d.text.slice(0, sep) : (d.word || d.text); + const rawWord = sep > 0 ? d.text.slice(0, sep) : (d.word || d.text); + const word = rawWord === 'Fixing' ? 'Remediating' : rawWord; let detail = sep > 0 ? d.text.slice(sep + 3) : ''; const until = d.next_at ? Date.parse(d.next_at) : 0; if (until > nowMs) detail += (detail ? ' · ' : '') + 'in ' + stageTrackerShortLeft(until - nowMs); diff --git a/src/pkg/dashboard/static-src/js/tracker-words-stage.js b/src/pkg/dashboard/static-src/js/tracker-words-stage.js index 0cbacc9c46..814078faca 100644 --- a/src/pkg/dashboard/static-src/js/tracker-words-stage.js +++ b/src/pkg/dashboard/static-src/js/tracker-words-stage.js @@ -135,7 +135,7 @@ case 45: return 'Needs a human decision'; case 50: return 'Waiting for review' + viaPR; case 60: return 'Reviewed' + viaPR; - case 70: return 'Fixing review findings' + viaPR; + case 70: return 'Remediating CI or review findings' + viaPR; case 71: return 'Waiting on the author' + viaPR; case 72: return 'Back with the contributor' + viaPR; case 74: return 'Hive took it over' + viaPR; @@ -227,7 +227,7 @@ // Stage → operator phrase, mirrored from stageTrackerStagePhrase // (stage_tracker_vocabulary.go): every string the page renders names a // stage by its chevron's words, never by a code ("060 reviewed"). - const STAGE_TRACKER_STAGE_PHRASE = { 10: 'actionable', 15: 'waiting for triage', 17: 'waiting for the author to confirm the gap (prior art found)', 20: 'claimed', 30: 'a PR in progress', 40: 'covered by a PR', 45: 'waiting for a human decision', 50: 'in CI / review', 60: 'review passed · waiting for merge admission', 70: 'being fixed by hive', 71: 'waiting for its author', 72: 'returned to the contributor', 74: 'adopted by hive', 80: 'at the merge queue', 85: 'waiting for a human decision', 90: 'ready for human merge', 95: 'soaking before merge', 100: 'in the merge queue' }; + const STAGE_TRACKER_STAGE_PHRASE = { 10: 'actionable', 15: 'waiting for triage', 17: 'waiting for the author to confirm the gap (prior art found)', 20: 'claimed', 30: 'a PR in progress', 40: 'covered by a PR', 45: 'waiting for a human decision', 50: 'in CI / review', 60: 'review passed · waiting for merge admission', 70: 'being remediated by hive', 71: 'waiting for its author', 72: 'returned to the contributor', 74: 'adopted by hive', 80: 'at the merge queue', 85: 'waiting for a human decision', 90: 'ready for human merge', 95: 'soaking before merge', 100: 'in the merge queue' }; // Pure: a stage's name in plain words for cues and tooltips — its short // word when the stages table has one, else its label with the lane's // "stage/060-" slug prefix dropped and the slug humanised ("Reviewed"). diff --git a/src/pkg/dashboard/static/index.html b/src/pkg/dashboard/static/index.html index aeeca570a4..aff2c936bc 100644 --- a/src/pkg/dashboard/static/index.html +++ b/src/pkg/dashboard/static/index.html @@ -1720,7 +1720,7 @@ outside the clipped polygon; keyboard focus exposes the same full text. */ .ham-strip[aria-label="Pipeline progress"] { grid-auto-rows: calc(var(--ham-chevron-text-lines) * var(--ham-chevron-line-height) * 1em + 2 * var(--sp-2) + 2 * var(--line-width)); } .ham-strip[aria-label="Pipeline progress"] > .ham-seg { box-sizing: border-box; height: 100%; line-height: var(--ham-chevron-line-height); padding: var(--sp-2) calc(var(--ham-notch) + var(--sp-2)); } - .ham-chevron-info.config-info, .ham-chevron-info.ham-chevron-decision { display: flex; align-items: center; justify-content: center; gap: var(--sp-1); width: 100%; height: 100%; min-width: 0; flex-shrink: 1; margin: 0; padding: 0; border: 0; border-radius: 0; background: transparent; color: inherit; font: inherit; line-height: inherit; position: static; } + .ham-chevron-info.config-info, .ham-chevron-info.ham-chevron-decision { display: flex; align-items: center; justify-content: center; gap: var(--sp-1); width: 100%; height: 100%; min-width: 0; flex-shrink: 1; margin: 0; padding: 0; border: 0; background: transparent; color: inherit; font: inherit; line-height: inherit; position: static; } .ham-chevron-info.config-info:hover { background: transparent; border: 0; color: inherit; } .ham-chevron-info:focus-visible, .ham-chevron-decision:focus-within { outline: var(--line-width) solid currentColor; outline-offset: var(--sp-1); } .ham-chevron-copy { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: var(--ham-chevron-text-lines); line-clamp: var(--ham-chevron-text-lines); max-height: calc(var(--ham-chevron-text-lines) * var(--ham-chevron-line-height) * 1em); flex: 1 1 auto; min-width: 0; overflow: hidden; white-space: normal; overflow-wrap: anywhere; } @@ -15431,7 +15431,7 @@

    Where to get help

    // the chevron and the caption name one blocker (hive's own #15577 read // "Merge queued · 1st" while its caption said "check build-and-test // still running"). Keys below STAGE_TRACKER_MERGE_READY only. - const STAGE_TRACKER_PROVISIONAL_STAGE_WORD = { 10: 'Actionable', 20: 'Claimed', 30: 'PR in progress', 40: 'Covered by PR', 45: 'Needs human decision', 50: 'CI / Review', 60: 'Review passed', 70: 'Fixing', 71: 'Needs author', 72: 'Returned to contributor', 74: 'Adopted by hive' }; + const STAGE_TRACKER_PROVISIONAL_STAGE_WORD = { 10: 'Actionable', 20: 'Claimed', 30: 'PR in progress', 40: 'Covered by PR', 45: 'Needs human decision', 50: 'CI / Review', 60: 'Review passed', 70: 'Remediating', 71: 'Needs author', 72: 'Returned to contributor', 74: 'Adopted by hive' }; // Pure: true when the row's queue slot is a forecast — the server says // so (merge_train.provisional), or, from an older server, the row's // own stage is short of the merge gate. @@ -15538,7 +15538,7 @@

    Where to get help

    // (mergeTrainHead* in Go) — short enough for a chevron. A head on a // person says what the person has to do (the owner's ask: "waiting on // #15425 (needs maintainer merge)"), not "waiting for a maintainer". - const STAGE_TRACKER_TRAIN_HEAD_STALL_WORD = { 'needs-human': 'needs maintainer merge', ci: 'waiting for CI', soaking: 'soak overran', ready: 'waiting for the next merge pass', merging: 'merge call in flight', fixing: 'being fixed by its author', unknown: 'head not in this view' }; + const STAGE_TRACKER_TRAIN_HEAD_STALL_WORD = { 'needs-human': 'needs maintainer merge', ci: 'waiting for CI', soaking: 'soak overran', ready: 'waiting for the next merge pass', merging: 'merge call in flight', fixing: 'being remediated by its author', unknown: 'head not in this view' }; // Pure: the short reason a stalled head is stuck — the head_state // table, a human-decision head told apart by its reason, else the // head's own plain-word reason cut at its first clause. @@ -16057,7 +16057,7 @@

    Where to get help

    case 45: return 'Needs a human decision'; case 50: return 'Waiting for review' + viaPR; case 60: return 'Reviewed' + viaPR; - case 70: return 'Fixing review findings' + viaPR; + case 70: return 'Remediating CI or review findings' + viaPR; case 71: return 'Waiting on the author' + viaPR; case 72: return 'Back with the contributor' + viaPR; case 74: return 'Hive took it over' + viaPR; @@ -16149,7 +16149,7 @@

    Where to get help

    // Stage → operator phrase, mirrored from stageTrackerStagePhrase // (stage_tracker_vocabulary.go): every string the page renders names a // stage by its chevron's words, never by a code ("060 reviewed"). - const STAGE_TRACKER_STAGE_PHRASE = { 10: 'actionable', 15: 'waiting for triage', 17: 'waiting for the author to confirm the gap (prior art found)', 20: 'claimed', 30: 'a PR in progress', 40: 'covered by a PR', 45: 'waiting for a human decision', 50: 'in CI / review', 60: 'review passed · waiting for merge admission', 70: 'being fixed by hive', 71: 'waiting for its author', 72: 'returned to the contributor', 74: 'adopted by hive', 80: 'at the merge queue', 85: 'waiting for a human decision', 90: 'ready for human merge', 95: 'soaking before merge', 100: 'in the merge queue' }; + const STAGE_TRACKER_STAGE_PHRASE = { 10: 'actionable', 15: 'waiting for triage', 17: 'waiting for the author to confirm the gap (prior art found)', 20: 'claimed', 30: 'a PR in progress', 40: 'covered by a PR', 45: 'waiting for a human decision', 50: 'in CI / review', 60: 'review passed · waiting for merge admission', 70: 'being remediated by hive', 71: 'waiting for its author', 72: 'returned to the contributor', 74: 'adopted by hive', 80: 'at the merge queue', 85: 'waiting for a human decision', 90: 'ready for human merge', 95: 'soaking before merge', 100: 'in the merge queue' }; // Pure: a stage's name in plain words for cues and tooltips — its short // word when the stages table has one, else its label with the lane's // "stage/060-" slug prefix dropped and the slug humanised ("Reviewed"). @@ -16196,7 +16196,8 @@

    Where to get help

    if (!d || d.effect !== 'pending' || !d.text) return null; nowMs = typeof nowMs === 'number' ? nowMs : Date.now(); const sep = String(d.text).indexOf(' · '); - const word = sep > 0 ? d.text.slice(0, sep) : (d.word || d.text); + const rawWord = sep > 0 ? d.text.slice(0, sep) : (d.word || d.text); + const word = rawWord === 'Fixing' ? 'Remediating' : rawWord; let detail = sep > 0 ? d.text.slice(sep + 3) : ''; const until = d.next_at ? Date.parse(d.next_at) : 0; if (until > nowMs) detail += (detail ? ' · ' : '') + 'in ' + stageTrackerShortLeft(until - nowMs); @@ -17250,7 +17251,7 @@

    Where to get help

    const activityFreshMS = 2 * 60 * 1000; const clock = Number(nowMs) || Date.now(); const codeWorking = codeMatches && code.source === 'fix-dispatch+successful-edit+verified-git-worktree' && code.active && Number.isFinite(codeObserved) && codeObserved <= clock && clock - codeObserved <= activityFreshMS; - const codeCaption = codeMatches ? (!codeWorking && code.state === 'fixing' ? 'Fix task assigned · activity unknown' : code.caption) : 'Code activity unknown'; + const codeCaption = codeMatches ? (!codeWorking && code.state === 'fixing' ? 'Fix task assigned · activity unknown' : (code.state === 'fixing' ? String(code.caption || '').replace(/^Fixing\b/, 'Remediating') : code.caption)) : 'Code activity unknown'; if (detour && !code && cur === 70 && !detour.sentinel) detour.text = 'Waiting for fixer · activity unknown'; if (detour && code && [70, 71, 72].includes(cur)) detour.text = codeCaption || detour.text; if (detour && code && cur === 74 && codeWorking) detour.text += ' · ' + codeCaption; @@ -17612,7 +17613,7 @@

    Where to get help

    let decided = kind === 'review' && sg.state === 'active' && item.decided && typeof stageTrackerMergeGateWordHtml === 'function' ? stageTrackerMergeGateWordHtml(item, nowMs) : ''; 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(?=\s|<)/g, '>Fix requested'); + if (!codeFresh) decided = decided.replace(/>(?:Fixing|Remediating)(?=\s|<)/g, '>Fix requested'); const word = esc(caption); const evidenceURL = matches && /^https?:\/\//i.test(String(a.url || '')) ? a.url : ''; const evidenceLink = ownsPR && evidenceURL ? `${word}` : word; @@ -17626,7 +17627,7 @@

    Where to get help

    const icon = stageTrackerIcon(50, 'ham-ico', name); const content = known ? `${evidenceLink}` : icon; const linkedIcon = !known && ownsPR && evidenceURL ? `${icon}` : content; - return `
  • ${linkedIcon}${esc(fullTip)}${decided ? `${decided}` : ''}
  • `; + return `
  • ${linkedIcon}${esc(fullTip)}${decided ? `${decided}` : ''}
  • `; } // Chevrons for one item. range bounds the columns the item owns (an @@ -17759,7 +17760,7 @@

    Where to get help

    const text = decision ? stageTrackerDecisionTriggerHtml(decision, caption, fullTip) : caption; const content = `${gateCue}${workIco}${text}${actorIco || holderIco}`; // A decision's dialog is its sole hover/focus detail surface. - inner = decision ? `${content}` : `${content}${esc(fullTip)}`; + inner = decision ? `${content}` : `${content}${esc(fullTip)}`; } else inner = stageTrackerIcon(sg.number, 'ham-ico'); return `
  • ${inner}
  • `; }).join(''); @@ -17784,7 +17785,7 @@

    Where to get help

    const activityFreshMS = 2 * 60 * 1000; const clock = Number(nowMs) || Date.now(); const working = code && code.head === item.head && code.source === 'fix-dispatch+successful-edit+verified-git-worktree' && code.active && code.state === 'fixing' && Number.isFinite(observed) && observed <= clock && clock - observed <= activityFreshMS; - const word = !working && decidedInfo.word === 'Fixing' ? 'Fix requested' : decidedInfo.word; + const word = !working && ['Fixing', 'Remediating'].includes(decidedInfo.word) ? 'Fix requested' : decidedInfo.word; text = word + (decidedInfo.detail ? ' · ' + decidedInfo.detail : '') + (regressed ? ' · ' + regressed : ''); } const tracks = (item.kind === 'pr' || item.via_pr) && item.head ? ['ci', 'review'].map(kind => { @@ -18356,7 +18357,7 @@

    Where to get help

    function stageTrackerHeadColsHtml(prRefs, leadHtml, chipsHtml, prTargetKey) { const wide = !(prRefs && prRefs.length); const prStart = STAGE_TRACKER_PATH.indexOf(STAGE_TRACKER_PR_COLUMN) + 1; - return `
    1. ${leadHtml || ''}
    2. ${wide ? '' : `
    3. ${prRefs.join('')}
    4. `}
    5. ${chipsHtml || ''}
    `; + return `
    1. ${leadHtml || ''}
    2. ${wide ? '' : `
    3. ${prRefs.join('')}
    4. `}
    5. ${chipsHtml || ''}
    `; } function stageTrackerSinceHtml(item, nowMs) { @@ -19575,6 +19576,12 @@

    Where to get help

    tpl.innerHTML = html; const node = tpl.content.firstElementChild; node.dataset.hamKey = key; + // Bind canonical lane geometry when materializing root and nested rows. + if (typeof node.querySelectorAll === 'function') { + for (const header of node.querySelectorAll('.ham-head-cols[data-ham-pr-start]')) { + header.style.setProperty('--ham-pr-start', header.dataset.hamPrStart); + } + } if (_stageTrackerRowSrc) _stageTrackerRowSrc.set(node, stageTrackerRowSrcKey(html)); return node; } @@ -22285,6 +22292,10 @@

    All labels

    if (_stageTrackerDecisionPop && _stageTrackerDecisionPop.key === key) { if (pin) _stageTrackerDecisionPop.pinned = true; clearTimeout(_stageTrackerDecisionPop.timer); + if (pin && pin.focus) { + const first = _stageTrackerDecisionPop.el.querySelector('.ham-decision-act:not([aria-disabled="true"])'); + (first || _stageTrackerDecisionPop.el).focus(); + } return; } stageTrackerCloseDecisionPop(false); diff --git a/src/pkg/dashboard/webstatic/testdata/tracker-header-geometry.js b/src/pkg/dashboard/webstatic/testdata/tracker-header-geometry.js index 7aed7940b7..985c1a151a 100644 --- a/src/pkg/dashboard/webstatic/testdata/tracker-header-geometry.js +++ b/src/pkg/dashboard/webstatic/testdata/tracker-header-geometry.js @@ -5,7 +5,7 @@ if (!dedicatedPreview) throw new Error('Use a dedicated published-preview tab, not the user’s live dashboard'); const tolerance = 1; const failures = []; - const coverage = { issueOnly: 0, linked: 0, prOnly: 0, nested: 0, multiIssue: 0, unknown: 0, queuedApproved: 0, wrapped: 0, controls: 0, controlTargets: 0, hitTested: 0 }; + const coverage = { issueOnly: 0, linked: 0, prOnly: 0, nested: 0, multiIssue: 0, unknown: 0, queuedApproved: 0, wrapped: 0, controls: 0, controlTargets: 0, hitTested: 0, currentRows: 0, preparation: 0, superseded: 0, states: {} }; const near = (a, b) => Math.abs(a - b) <= tolerance; const visible = el => el && el.getClientRects().length && getComputedStyle(el).display !== 'none'; const rect = el => el.getBoundingClientRect(); @@ -41,7 +41,7 @@ } }; const rows = [...document.querySelectorAll('#activity-monitor-section .ham-row, #activity-monitor-section .ham-sub')]; - let reference = null; + const references = new Map(); for (const [index, row] of rows.entries()) { const header = row.querySelector(':scope > .ham-row-head > .ham-head-cols'); const strip = row.querySelector(':scope > .ham-strip-row > ol[aria-label="Pipeline progress"]'); @@ -58,11 +58,18 @@ else if (row.dataset.hamKind === 'pr') coverage.prOnly++; else if (pr) coverage.linked++; else coverage.issueOnly++; + if (row.matches('.ham-preparation-member')) coverage.preparation++; + if ([...row.querySelectorAll(':scope > .ham-current-stage, :scope > .ham-human-context')] + .some(context => /superseded/i.test(context.textContent))) coverage.superseded++; if (row.matches('.ham-row') && row.querySelectorAll(':scope > .ham-sub').length > 1) coverage.multiIssue++; const signature = columns.map(cell => ({ left: rect(cell).left - rect(strip).left, width: rect(cell).width, height: rect(cell).height })); const stripLeft = rect(strip.parentElement).left; - if (!reference) reference = { signature, left: stripLeft }; - assert(near(stripLeft, reference.left), name + 'root/nested progress containers share one horizontal origin'); + // Recorded preparation roots retain the existing rail gutter. Compare + // like gutters across rows; header-to-lane checks below remain exact. + const gutter = row.closest('.ham-row.ham-train') ? 'train' : 'ordinary'; + if (!references.has(gutter)) references.set(gutter, { signature, left: stripLeft }); + const reference = references.get(gutter); + assert(near(stripLeft, reference.left), name + 'root/nested progress containers with the same rail gutter share one horizontal origin'); for (const [lane, box] of signature.entries()) { assert(near(box.left, reference.signature[lane].left) && near(box.width, reference.signature[lane].width), name + 'physical lane ' + lane + ' aligns across issue, PR-only and multi-PR rows'); assert(near(box.height, reference.signature[lane].height), name + 'physical lane ' + lane + ' has the same compact height across rows'); @@ -124,10 +131,18 @@ assert(Math.max(...heights) - Math.min(...heights) <= tolerance, name + 'all physical chevrons have uniform height'); const ci = strip.querySelector('[data-track="ci"]'); const review = strip.querySelector('[data-track="review"]'); + const current = columns.filter(cell => !cell.classList.contains('cap') && + (cell.classList.contains('active') || cell.classList.contains('ham-current'))); + const delegated = row.matches('.ham-row') && row.querySelector(':scope > .ham-sub ol[aria-label="Pipeline progress"]'); + assert(current.length > 0 || !!delegated, name + 'every actionable row owns a visible current-phase location or delegates to drawn PR children'); + if (current.length) coverage.currentRows++; if (ci?.dataset.activityState === 'queued' && review?.dataset.activityState === 'approved') coverage.queuedApproved++; for (const cell of columns) { + if (cell.dataset.activityState) coverage.states[cell.dataset.activityState] = (coverage.states[cell.dataset.activityState] || 0) + 1; if (cell.dataset.routeState?.split(' ').includes('active')) { assert(cell.classList.contains('ham-current'), name + 'current phase remains highlighted independently of work'); + const style = getComputedStyle(cell); + assert(Number(style.opacity) >= 0.9 && style.boxShadow !== 'none', name + 'queued/unknown/assigned/completed current tracks retain a visible steady outline'); } if (cell.dataset.displayState === 'unknown') { coverage.unknown++; @@ -170,6 +185,10 @@ } assert(coverage.issueOnly > 0 && coverage.linked > 0 && coverage.prOnly > 0, 'preview must contain issue-only, linked, and PR-only fixtures'); assert(coverage.multiIssue > 0 && coverage.nested >= 2, 'preview must contain a real multi-PR issue with independent nested rows'); + assert(coverage.preparation >= 2 && coverage.superseded > 0, 'preview must contain recorded/unverified preparation fronts and an actionable superseded-human-decision row'); + for (const state of ['queued', 'unknown', 'assigned', 'approved', 'waiting', 'failing', 'passing', 'running']) { + assert(coverage.states[state] > 0, 'preview must exercise current-head activity state ' + state); + } assert(coverage.unknown > 0 && coverage.queuedApproved > 0 && coverage.wrapped > 0 && coverage.controls > 0, 'preview must include unknown, queued-CI/approved-review, long wrapped text and action/history controls'); assert(coverage.controlTargets > 0 && coverage.controlTargets === coverage.hitTested, 'every relevant header control must be hit-tested, never skipped as offscreen'); if (failures.length) throw new Error(JSON.stringify({ viewport: innerWidth, coverage, failures })); diff --git a/src/scripts/dashboard-mobile-shots.mjs b/src/scripts/dashboard-mobile-shots.mjs index 08733f234c..f0427229a2 100644 --- a/src/scripts/dashboard-mobile-shots.mjs +++ b/src/scripts/dashboard-mobile-shots.mjs @@ -21,13 +21,16 @@ // clipped-by-strip: a topbar chip whose box pokes outside an overflow-clipping // ancestor strip (how the ≡ drawer toggle lost its left edge on phones, #15476). // -// This is a reporting tool, not a gate: it exits 0 even when findings exist and -// exits 1 only when the harness itself errors. Chrome missing prints SKIP and exits 0. +// General overflow findings remain reporting-only. Preparation/activity acceptance +// violations exit 1; the existing workflow remains non-required/reporting-only. +// Chrome missing is a local SKIP but a canonical CI failure. import { spawn } from 'node:child_process'; import fs from 'node:fs'; import http from 'node:http'; import path from 'node:path'; +import { createHash } from 'node:crypto'; import { preparationRailLayoutFixture } from './fixtures/dashboard-preparation-rail.mjs'; +import { activityDensityFixture } from './fixtures/dashboard-activity-density.mjs'; const CHROME_CANDIDATES = [ process.env.CHROME_BIN, @@ -45,6 +48,8 @@ const PROFILE_DIR = path.join(process.cwd(), '.chrome-dashboard-mobile-shots'); const IOS_UA = 'Mozilla/5.0 (iPhone; CPU iPhone OS 17_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.4 Mobile/15E148 Safari/604.1'; const IPAD_UA = 'Mozilla/5.0 (iPad; CPU OS 17_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.4 Mobile/15E148 Safari/604.1'; const ANDROID_UA = 'Mozilla/5.0 (Linux; Android 14; Pixel 8) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Mobile Safari/537.36'; +const DESKTOP_UA = 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36'; +const ACTIVITY_DESKTOP_WIDTHS = [2400, 1440, 1110, 1024]; const VIEWPORTS = [ { name: '390x844@3', width: 390, height: 844, dpr: 3, mobile: true, ua: IOS_UA }, @@ -56,6 +61,8 @@ const VIEWPORTS = [ { name: '932x430@3', width: 932, height: 430, dpr: 3, mobile: true, ua: IOS_UA }, { name: '667x375@2', width: 667, height: 375, dpr: 2, mobile: true, ua: IOS_UA }, { name: '740x360@3', width: 740, height: 360, dpr: 3, mobile: true, ua: ANDROID_UA }, + ...ACTIVITY_DESKTOP_WIDTHS.map(width => ({ name: width + 'x1200@1', width, height: 1200, + dpr: 1, mobile: false, ua: DESKTOP_UA, activityOnly: true })), ]; const THEMES = ['light', 'dark']; @@ -220,6 +227,7 @@ async function main() { const themes = opts.theme ? [opts.theme] : THEMES; const bin = chromePath(); if (!bin) { + if (process.env.CI) throw new Error('Canonical browser proof requires Chrome/Chromium; none found'); console.log('SKIP: Chrome/Chromium not found (set CHROME_BIN or install google-chrome/chromium)'); return; } @@ -254,6 +262,18 @@ async function main() { const report = []; const preparationRailReport = []; + const activityReport = []; + const activityFailures = []; + const fixtureRoot = path.join(process.cwd(), 'src/pkg/dashboard/webstatic/testdata'); + const density = JSON.parse(fs.readFileSync(path.join(fixtureRoot, 'tracker-activity-density.json'), 'utf8')); + const probes = ['tracker-header-geometry', 'tracker-decision-interaction'].map(name => ({ + name, source: fs.readFileSync(path.join(fixtureRoot, name + '.js'), 'utf8'), + })); + const event = process.env.GITHUB_EVENT_PATH ? JSON.parse(fs.readFileSync(process.env.GITHUB_EVENT_PATH, 'utf8')) : {}; + const provenance = { head: event.pull_request?.head?.sha || process.env.GITHUB_SHA || 'unpublished-local', + checkoutSHA: process.env.GITHUB_SHA || 'unpublished-local', + generatedAssetSHA256: createHash('sha256').update(fs.readFileSync('src/pkg/dashboard/static/index.html')).digest('hex'), + mockEvidence: true, fixtureSource: density.source }; let socket; try { const tabs = await waitForTabs(); @@ -280,6 +300,63 @@ async function main() { if (result.result.exceptionDetails) throw new Error(result.result.exceptionDetails.exception?.description || 'evaluate failed'); return result.result.result.value; }; + const screenshot = async file => { + const shot = await send('Page.captureScreenshot', { format: 'png', captureBeyondViewport: true }); + if (shot.error) throw new Error(shot.error.message); + fs.writeFileSync(path.join(opts.out, file), Buffer.from(shot.result.data, 'base64')); + }; + const nativeDecisionInput = async prefix => { + const failures = []; + const point = await evaluate(`(async () => { + const trigger = [...document.querySelectorAll('.ham-chevron-decision .ham-decision-trigger')] + .find(button => Number(button.closest('[data-ham-stage]')?.dataset.hamStage) === 80); + if (!trigger) throw new Error('Missing native stage-80 decision trigger'); + trigger.scrollIntoView({ block: 'center', inline: 'nearest', behavior: 'instant' }); + await new Promise(requestAnimationFrame); + const help = document.querySelector('.ham-chevron-info.config-info'); + help.focus({ preventScroll: true }); + const box = trigger.getBoundingClientRect(); + const portal = document.getElementById('config-tooltip-portal'); + return { x: (box.left + box.right) / 2, y: (box.top + box.bottom) / 2, + tooltipWasOpen: !!portal && !portal.hidden && getComputedStyle(portal).display !== 'none' }; + })()`); + if (!point.tooltipWasOpen) failures.push('Native pointer precondition: ordinary tooltip was not open'); + const moved = await send('Input.dispatchMouseEvent', { type: 'mouseMoved', x: point.x, y: point.y, pointerType: 'mouse' }); + if (moved.error) throw new Error(moved.error.message); + await sleep(STATE_SETTLE_MS); + const inspect = async mode => { + const result = await evaluate(`(() => { + const dialogs = [...document.querySelectorAll('.ham-decision-pop')]; + const portal = document.getElementById('config-tooltip-portal'); + return { dialogs: dialogs.length, + tooltipOpen: !!portal && !portal.hidden && getComputedStyle(portal).display !== 'none', + focusInside: !!dialogs[0]?.contains(document.activeElement) }; + })()`); + if (result.dialogs !== 1 || result.tooltipOpen) failures.push(mode + ': one unobscured decision dialog required'); + if (mode !== 'native pointer' && !result.focusInside) failures.push(mode + ': keyboard must enter the existing dialog'); + return { mode, ...result }; + }; + const observations = [await inspect('native pointer')]; + await screenshot(prefix + '-decision-pointer.png'); + const keys = [{ key: 'ArrowDown', code: 'ArrowDown', keyCode: 40 }, + { key: 'Enter', code: 'Enter', keyCode: 13 }, { key: ' ', code: 'Space', keyCode: 32 }]; + for (const { key, code, keyCode } of keys) { + await evaluate(`(() => { + const trigger = [...document.querySelectorAll('.ham-chevron-decision .ham-decision-trigger')] + .find(button => Number(button.closest('[data-ham-stage]')?.dataset.hamStage) === 80); + trigger.focus({ preventScroll: true }); + return true; + })()`); + for (const type of ['keyDown', 'keyUp']) { + const pressed = await send('Input.dispatchKeyEvent', { type, key, code, windowsVirtualKeyCode: keyCode }); + if (pressed.error) throw new Error(pressed.error.message); + } + observations.push(await inspect('native keyboard ' + JSON.stringify(key))); + } + await screenshot(prefix + '-decision-keyboard.png'); + await evaluate('stageTrackerCloseDecisionPop(false); true'); + return { observations, failures }; + }; await send('Page.enable'); await send('Runtime.enable'); @@ -287,6 +364,7 @@ async function main() { // Each state callback is best-effort: a missing helper yields a skipped shot, not a harness error. const setThemeJS = (theme) => `document.body.classList.toggle('light-mode', ${theme === 'light'}); document.documentElement.style.colorScheme = '${theme}'; true`; const resetJS = `(() => { + window.__activityDensityCleanup?.(); document.getElementById('preparation-rail-layout-fixture')?.remove(); document.querySelectorAll('.config-overlay, .modal-overlay').forEach((el) => { el.classList.add('hidden'); }); document.documentElement.classList.remove('modal-open'); document.body.classList.remove('modal-open'); @@ -319,7 +397,7 @@ async function main() { screenOrientation: { type: landscape ? 'landscapePrimary' : 'portraitPrimary', angle: landscape ? 90 : 0 }, }); await send('Emulation.setUserAgentOverride', { userAgent: vp.ua }); - await send('Emulation.setTouchEmulationEnabled', { enabled: true }); + await send('Emulation.setTouchEmulationEnabled', { enabled: vp.mobile }); for (const theme of themes) { await send('Page.navigate', { url: `file://${process.cwd()}/src/pkg/dashboard/static/index.html` }); await sleep(PAGE_SETTLE_MS); @@ -352,10 +430,48 @@ async function main() { if (result.failures.length) throw new Error('Preparation rail layout: ' + result.failures.join('; ')); return true; } }); + if (vp.activityOnly) states.length = 0; + states.push({ name: 'activity-density', run: async () => { + await evaluate(collapseAllJS); + if (!await evaluate(expandOneJS('activity-monitor-section'))) throw new Error('Cannot expand actual Activity Monitor'); + const fixture = await evaluate('(' + activityDensityFixture.toString() + ')(' + JSON.stringify(density) + ')'); + const results = []; + for (const probe of probes) { + const result = await evaluate(`(async () => { + try { return { ok: true, result: await (${probe.source})({ dedicatedPreview: true }) }; } + catch (error) { + let result; + try { result = JSON.parse(error.message); } catch (_) { result = { failures: [String(error.stack || error)] }; } + return { ok: false, result }; + } + })()`); + results.push({ probe: probe.name, ...result }); + if (!result.ok) activityFailures.push(vp.name + ' ' + theme + ' ' + probe.name); + } + let native; + try { native = await nativeDecisionInput(`${vp.name}-${theme}-activity`); } + catch (error) { native = { failures: [String(error.stack || error)] }; } + const nativeOK = native.failures.length === 0; + results.push({ probe: 'native-CDP-pointer-keyboard', ok: nativeOK, result: native }); + if (!nativeOK) activityFailures.push(vp.name + ' ' + theme + ' native input'); + const result = { viewport: vp.name, theme, provenance, fixture, results }; + activityReport.push(result); + fs.writeFileSync(path.join(opts.out, `${vp.name}-${theme}-activity-probes.json`), JSON.stringify(result, null, 2) + '\n'); + return true; + } }); for (const state of states) { await evaluate(resetJS); - const ok = await state.run(); + let ok; + try { ok = await state.run(); } + catch (error) { + if (state.name !== 'activity-density') throw error; + activityFailures.push(vp.name + ' ' + theme + ' fixture/harness'); + const result = { viewport: vp.name, theme, provenance, failures: [String(error.stack || error)] }; + activityReport.push(result); + fs.writeFileSync(path.join(opts.out, `${vp.name}-${theme}-activity-probes.json`), JSON.stringify(result, null, 2) + '\n'); + ok = true; // Capture the broken fixture too; fail after all viewports. + } if (!ok) { console.log(`skip ${vp.name} ${theme} ${state.name}: not available`); continue; @@ -363,21 +479,22 @@ async function main() { await sleep(STATE_SETTLE_MS); const findings = await evaluate(SCAN_EXPRESSION); for (const f of findings) report.push({ viewport: vp.name, theme, state: state.name, ...f }); - const shot = await send('Page.captureScreenshot', { format: 'png', captureBeyondViewport: true }); - if (shot.error) throw new Error(shot.error.message); const file = `${vp.name}-${theme}-${state.name}.png`.replace(/[^A-Za-z0-9._@-]/g, '_'); - fs.writeFileSync(path.join(opts.out, file), Buffer.from(shot.result.data, 'base64')); + await screenshot(file); console.log(`shot ${file}: ${findings.length} finding(s)`); } + await evaluate(resetJS); } } } finally { if (socket) socket.close(); fs.writeFileSync(path.join(opts.out, 'overflow-report.json'), JSON.stringify(report, null, 2) + '\n'); fs.writeFileSync(path.join(opts.out, 'preparation-rail-layout.json'), JSON.stringify(preparationRailReport, null, 2) + '\n'); + fs.writeFileSync(path.join(opts.out, 'activity-layout.json'), JSON.stringify({ provenance, runs: activityReport }, null, 2) + '\n'); await cleanup(); } console.log(`wrote ${report.length} finding(s) to ${path.join(opts.out, 'overflow-report.json')}`); + if (activityFailures.length) throw new Error('Activity browser acceptance failed: ' + activityFailures.join('; ')); } main().catch((err) => { diff --git a/src/scripts/fixtures/dashboard-activity-density.mjs b/src/scripts/fixtures/dashboard-activity-density.mjs new file mode 100644 index 0000000000..b1a3c7d421 --- /dev/null +++ b/src/scripts/fixtures/dashboard-activity-density.mjs @@ -0,0 +1,162 @@ +// Dedicated file:// acceptance page only. All evidence/permissions are mocks; +// real production renderers and delegated interaction handlers remain in use. +export function activityDensityFixture(input) { + const panel = document.getElementById('activity-monitor-panel'); + if (!panel) throw new Error('Actual Activity Monitor panel is missing'); + const nowMs = Date.now(), observed = new Date(nowMs).toISOString(); + const saved = { data: _stageTracker, rows: _stageTrackerRows, + role: window._hiveRole, user: window._hiveUser, + preparation: [_stageTrackerPreparationShown, _stageTrackerPreparationRendered, + _stageTrackerPreparationInline, _stageTrackerPreparationNow] }; + const items = structuredClone(input.rows); + const rebase = item => { + item.state = 'open'; + item.stage_since = observed; + for (const key of ['ci_activity', 'review_activity', 'code_activity']) { + if (item[key]) item[key].observed_at = observed; + } + if (item.decision_needed && !item.decision_needed.options) { + item.decision_needed.options = [{ action: 'decide:approve', enabled: true, + label: 'Review mock decision', consequence: 'Mock fixture only' }]; + } + for (const child of item.linked_prs || []) rebase(child); + }; + items.forEach(rebase); + const mockPR = (number, stage, extra = {}) => ({ + repo: 'fixture/activity', kind: 'pr', number, stage, state: 'open', + title: 'Mock acceptance projection — not a live PR', + head: 'mock-current-head-' + number, stage_since: observed, + url: 'https://example.invalid/activity/' + number, ...extra, + }); + const track = (item, state, caption) => ({ + head: item.head, state, caption, observed_at: observed, source: 'acceptance-fixture', + }); + const unknown = mockPR(9001, 50, { caption: 'Current-head evidence unavailable' }); + const conflict = mockPR(9002, 80, { + merge_gate: { state: 'claim-conflict:9003', duplicate_issue: 9000 }, + decision_needed: { question: 'Which mock implementation should be kept?', + blocker: 'Both claim mock issue #9000; neither is admitted.', + options: [{ action: 'decide:approve', enabled: true, label: 'Keep this implementation', consequence: 'Mock fixture only' }] }, + }); + const longHandle = 'thatguywob'.repeat(12); + const waiting = mockPR(9004, 71, { display_column: 30, + caption: 'Waiting for @' + longHandle + ' · not observed coding', + author: longHandle, author_kind: 'human', + code_activity: { state: 'waiting_owner', head: 'mock-current-head-9004', + caption: 'Waiting for @' + longHandle + ' · not observed coding', source: 'native-author-wait' }, + push: { state: 'waiting', login: longHandle, since: observed, next: 're-review' }, + }); + const running = mockPR(9005, 50); + running.ci_activity = track(running, 'running', 'CI running'); + running.ci_activity.active = true; + running.review_activity = track(running, 'approved', 'Review approved'); + const held = mockPR(9006, 70, { caption: 'Waiting for fixer · no observed code work', + hold: { by: 'hanthor', pill: 'Held by @hanthor', reason: 'Mock human hold' }, + modifiers: ['hold'] }); + const coding = mockPR(9007, 70, { display_column: 30 }); + coding.code_activity = { ...track(coding, 'fixing', 'Remediating · fixer'), active: true, + since: observed, source: 'fix-dispatch+successful-edit+verified-git-worktree' }; + coding.ci_activity = { ...track(coding, 'running', 'CI running'), active: true }; + coding.review_activity = { ...track(coding, 'reviewing', 'Review working · reviewer'), active: true }; + const triage = { repo: 'fixture/activity', kind: 'issue', number: 9008, stage: 15, + state: 'open', title: 'Mock issue-only triage controls and long wrapping metadata', + url: 'https://example.invalid/activity/9008', operator_action_count: 7 }; + items.push(unknown, conflict, waiting, running, held, coding, triage); + const prUnder = (repo, issueNumber, pr, title) => ({ + repo, kind: 'issue', number: issueNumber, stage: 40, state: 'open', + title, url: 'https://example.invalid/activity/' + issueNumber, linked_prs: [pr], + }); + const prepFront = (number, base, ciState, reviewState) => { + const item = mockPR(number, 74, { repo: 'hivecommons/hive', base_ref: base, + caption: 'Head changed; preparation unverified; CI/re-review queued', + push: { state: 'pushed', login: 'fixture-owner', since: observed, next: 're-review' } }); + item.ci_activity = track(item, ciState, ciState === 'unknown' ? 'Required checks not observed' : 'CI waiting · test not observed'); + item.review_activity = track(item, reviewState, 'Review ' + reviewState + ' · ' + (reviewState === 'assigned' ? 'adjudicator' : 'unassigned')); + return item; + }; + const front16450 = prepFront(16450, 'v6', 'unknown', 'assigned'); + const front16451 = prepFront(16451, 'v5', 'waiting', 'queued'); + const issue16420 = items.find(item => item.kind === 'issue' && item.number === 16420); + issue16420.stage = 40; + issue16420.linked_prs = [front16450, { number: 16436, stage: 74, state: 'closed', + title: 'Mock closed adopted original', superseded_by: 16450, base_ref: 'v6' }]; + items.push(prUnder('hivecommons/hive', 16363, front16451, 'Mock preparation front on a one-to-one issue')); + const pluk = mockPR(436, 50, { repo: 'hivecommons/pluk' }); + pluk.ci_activity = track(pluk, 'passing', 'CI passed'); + pluk.review_activity = track(pluk, 'assigned', 'Review assigned · ci-maintainer'); + items.push(prUnder(pluk.repo, 435, pluk, 'Mock CI-passed / review-assigned linked row')); + const pr16437Index = items.findIndex(item => item.kind === 'pr' && item.number === 16437); + const pr16437 = items.splice(pr16437Index, 1)[0]; + pr16437.stage = 60; + pr16437.manual_merge = false; + pr16437.ci_activity = track(pr16437, 'unknown', 'Required checks not observed'); + pr16437.review_activity = track(pr16437, 'approved', 'Review approved'); + items.push(prUnder(pr16437.repo, 16421, pr16437, 'Mock approved-review / unknown-CI linked row')); + const superseded = items.find(item => item.number === 16438).linked_prs.find(pr => pr.number === 16446); + superseded.stage = 70; + superseded.display_column = 50; + superseded.superseded = true; + superseded.human_attention = { kind: 'pr', number: superseded.number, head: superseded.head, + reason: 'Superseded by #16449 — a maintainer decides whether to close this mock implementation' }; + superseded.code_activity = { ...track(superseded, 'waiting_fixer', 'Waiting for fixer · no observed code work') }; + superseded.decision_needed = { question: 'Close this mock implementation as superseded by #16449?', + options: [{ action: 'decide:close-superseded', enabled: true, label: 'Close mock superseded PR' }] }; + superseded.review_activity = track(superseded, 'changes_requested', 'Review findings · human decision'); + const base_preparation = [front16450, front16451].map(front => ({ + repo: front.repo, base_ref: front.base_ref, state: 'observed', + owner: { number: front.number, role: 'owner', state: 'current', + head_sha: 'mock-previous-head-' + front.number, current_head: front.head, + since: observed, detail: 'Head changed; current preparation unverified' }, waiting: [], + })); + const host = document.createElement('div'); + host.id = 'activity-density-layout-fixture'; + const note = document.createElement('p'); + note.textContent = 'Acceptance fixture: screenshot-shaped identities with MOCK stages/evidence/permissions; not authenticated live projection.'; + host.appendChild(note); + window.__activityDensityCleanup = () => { + stageTrackerCloseDecisionPop(false); + if (typeof hideConfigTooltip === 'function') hideConfigTooltip(); + host.remove(); + _stageTracker = saved.data; + _stageTrackerRows = saved.rows; + window._hiveRole = saved.role; + window._hiveUser = saved.user; + [_stageTrackerPreparationShown, _stageTrackerPreparationRendered, + _stageTrackerPreparationInline, _stageTrackerPreparationNow] = saved.preparation; + delete window.__activityDensityCleanup; + }; + _stageTracker = { items, base_preparation }; + _stageTrackerRows = items; + window._hiveRole = 'owner'; + window._hiveUser = 'fixture-owner'; + // Display labels are fixture inputs; physical order/boundaries stay canonical. + const labels = { 0: 'Open', 10: 'Actionable', 20: 'Claimed', 30: 'PR in progress', + 50: 'CI / Review', 80: 'Merge queue' }; + const stages = STAGE_TRACKER_PATH.map(number => ({ number, short: labels[number] || String(number) })).concat([ + { number: 15, short: 'Triage needed', branch_from: 10 }, + { number: 70, short: 'Remediating', branch_from: 50 }, + { number: 71, short: 'Needs author', branch_from: 30 }, + { number: 72, short: 'Returned to contributor', branch_from: 30 }, + { number: 74, short: 'Adopted by hive', branch_from: 50 }, + { number: 85, short: 'Needs human decision', branch_from: 80 }, + { number: 90, short: 'Ready for human merge', branch_from: 80 }, + ]); + const ctx = { nowMs, items, events: {}, noteTuck: false, sharedPRs: {}, workers: {} }; + try { + host.appendChild(stageTrackerRowNode('fixture-columns', stageTrackerHeaderHtml(stages))); + const ordered = stageTrackerPreparationOrderRows(_stageTracker, items, stages); + _stageTrackerRows = ordered; + stageTrackerPreparationVisualSync(_stageTracker, ordered, ordered, stages, nowMs); + const rows = ordered.map(item => ({ key: stageTrackerItemKey(item), html: stageTrackerRowHtml(item, stages, ctx) })); + for (const row of stageTrackerPreparationInlineRows(rows, ordered, stages)) host.appendChild(stageTrackerRowNode(row.key, row.html)); + panel.appendChild(host); + if (panel.dataset.hamWired !== '1') stageTrackerWireRowActions(panel); + } catch (error) { + window.__activityDensityCleanup(); + throw error; + } + host.scrollIntoView(); + return { provenance: input.provenance, mockEvidence: true, observedAt: observed, + additionalScreenshotShape: 'Screenshot 2026-11-03 at 12.36.31 PM.png', + rows: items.map(item => stageTrackerItemKey(item)) }; +} diff --git a/src/scripts/fixtures/dashboard-preparation-rail.mjs b/src/scripts/fixtures/dashboard-preparation-rail.mjs index 06950a23f4..648c512df9 100644 --- a/src/scripts/fixtures/dashboard-preparation-rail.mjs +++ b/src/scripts/fixtures/dashboard-preparation-rail.mjs @@ -23,9 +23,7 @@ export function preparationRailLayoutFixture() { html: stageTrackerRowHtml(item, [], { ...ctx, prevRow: items[i - 1], nextRow: items[i + 1] }) })); const block = document.createElement('div'); const rendered = stageTrackerPreparationInlineRows(rows, items, []); - block.innerHTML = rendered.map(row => row.html).join(''); - // The production reconciler stamps keys separately from the row renderer. - [...block.children].forEach((element, index) => { element.dataset.hamKey = rendered[index].key; }); + for (const row of rendered) block.appendChild(stageTrackerRowNode(row.key, row.html)); host.appendChild(block); return block; }; From 791ab1f80ed13038ef1b9a35c8f4c025f84fbca6 Mon Sep 17 00:00:00 2001 From: Andrew Anderson Date: Tue, 3 Nov 2026 13:32:41 -0500 Subject: [PATCH 3/4] =?UTF-8?q?=F0=9F=90=9B=20Repair=20activity=20monitor?= =?UTF-8?q?=20assertions=20and=20browser=20focus=20checks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Andrew Anderson --- .github/scripts/integration-governance.cjs | 2 +- src/docs/dashboard-source-layout.md | 5 ++++- src/pkg/dashboard/stage_tracker_activity.test.js | 5 +++++ .../dashboard/stage_tracker_sentinel_lane_test.go | 3 ++- src/pkg/dashboard/stage_tracker_ui_rows_test.go | 6 +++--- .../testdata/tracker-decision-interaction.js | 3 +++ .../webstatic/testdata/tracker-header-geometry.js | 7 +++++-- src/scripts/dashboard-mobile-shots.mjs | 14 +++++++++----- 8 files changed, 32 insertions(+), 13 deletions(-) diff --git a/.github/scripts/integration-governance.cjs b/.github/scripts/integration-governance.cjs index eda94c1d6b..0c81763599 100644 --- a/.github/scripts/integration-governance.cjs +++ b/.github/scripts/integration-governance.cjs @@ -9,7 +9,7 @@ const MAX_COMMITS = 1000; const MAX_AUTHOR_BATCH = 50; // This literal is inside the enrolled .github closure. A caller-supplied // preparedBy.sourceSHA must never choose a new executable verifier tree. -const TRUSTED_SCRIPTS_TREE = '95d9a33da1c179412d8c5ef1d63ba626806de619'; +const TRUSTED_SCRIPTS_TREE = '6c2555e0d9e809e48a8fb91e98992a2c31a4e679'; const SOURCE = 'https://github.com/kubernetes-sigs/kubebuilder-release-tools/tree/012269a88fa4c034a0acf1ba84c26b195c0dbab4'; const sha = value => crypto.createHash('sha256').update(value).digest('hex'); const git = (args, cwd = process.cwd()) => diff --git a/src/docs/dashboard-source-layout.md b/src/docs/dashboard-source-layout.md index a4ab39bfc6..a1add4a292 100644 --- a/src/docs/dashboard-source-layout.md +++ b/src/docs/dashboard-source-layout.md @@ -54,7 +54,10 @@ the existing reporting-only workflow policy and permissions are unchanged. In addition to the DOM-handler probes, real CDP mouse movement and ArrowDown/Enter/Space key dispatch check tooltip takeover and entry into an already-open decision dialog. `*-activity-decision-pointer.png` and -`*-activity-decision-keyboard.png` capture those actual browser interactions; +`*-activity-decision-keyboard.png` capture the actual viewport during those +browser interactions, rather than a full-document composite of fixed dialogs; +the isolated headless page owns emulated focus, recorded in pointer preconditions. +Geometry failures include the actual control hit target or measured content gap; no decision action is activated. Fixture/probe failures remain failures, not skipped or string-assertion substitutes for browser proof. The 12:36 screenshot shapes additionally exercise nested #16450 and root diff --git a/src/pkg/dashboard/stage_tracker_activity.test.js b/src/pkg/dashboard/stage_tracker_activity.test.js index 0e24b6bfc2..677c506329 100644 --- a/src/pkg/dashboard/stage_tracker_activity.test.js +++ b/src/pkg/dashboard/stage_tracker_activity.test.js @@ -264,6 +264,11 @@ test('canonical activity browser wiring is retained (not browser/visual proof)', } assert.match(harness, /Input\.dispatchMouseEvent/); assert.match(harness, /Input\.dispatchKeyEvent/); + assert.match(harness, /Emulation\.setFocusEmulationEnabled', \{ enabled: true \}/); + assert.match(harness, /documentFocused: document\.hasFocus\(\), helpFocused: document\.activeElement === help/); + assert.match(harness, /captureBeyondViewport: !viewportOnly/); + assert.match(harness, /screenshot\(prefix \+ '-decision-pointer\.png', true\)/); + assert.match(harness, /screenshot\(prefix \+ '-decision-keyboard\.png', true\)/); assert.match(harness, /preparationRailLayoutFixture\.toString/); assert.match(harness, /if \(activityFailures\.length\) throw new Error/); assert.match(harness, /activity-probes\.json/); diff --git a/src/pkg/dashboard/stage_tracker_sentinel_lane_test.go b/src/pkg/dashboard/stage_tracker_sentinel_lane_test.go index dd673a02e3..6f50d99382 100644 --- a/src/pkg/dashboard/stage_tracker_sentinel_lane_test.go +++ b/src/pkg/dashboard/stage_tracker_sentinel_lane_test.go @@ -371,7 +371,8 @@ const parked = stageTrackerRowHtml(P('o/r', 109, 85, flagged), stages, ctx); const lit = /
  • ]*)>([\s\S]*?)<\/li>/.exec(parked); assert.ok(lit, 'the lit merge-gate chevron carries ham-sentinel: ' + parked); assert.ok(lit[2].includes('Sentinel alert · needs human'), 'lane text: ' + lit[2]); -const visibleChevron = lit[2].replace(/]*class="config-tooltip ham-chevron-tip"[^>]*>[^<]*<\/span>/g, ''); +const visibleChevron = lit[2].replace(/]*class="config-tooltip ham-chevron-tip"[^>]*>[^<]*<\/span>/g, '').replace(/<[^>]+>/g, ''); +assert.ok(visibleChevron.includes('Sentinel alert · needs human'), 'visible chevron names the sentinel gate'); assert.ok(!visibleChevron.includes('Needs human decision'), 'the plain word is replaced, not appended in visible copy; full context remains in the tooltip'); assert.ok(lit[1].includes('title="' + TIP + ' — '), 'the chevron tooltip leads with the reason: ' + lit[1]); assert.ok(lit[1].includes('aria-current="step"')); diff --git a/src/pkg/dashboard/stage_tracker_ui_rows_test.go b/src/pkg/dashboard/stage_tracker_ui_rows_test.go index 2fbe205a8b..de27130353 100644 --- a/src/pkg/dashboard/stage_tracker_ui_rows_test.go +++ b/src/pkg/dashboard/stage_tracker_ui_rows_test.go @@ -334,7 +334,7 @@ assert.ok(row.includes('Review unknown') && row.includes('CI unknown'), 'legacy // 071 needs-author: the owner wait returns to PR in progress without pretending coding. row = stageTrackerRowHtml({ repo: 'acme/console', number: 109, kind: 'pr', stage: 71, author: 'sam', author_kind: 'human', history: [{number:50,slug:'review-pending'},{number:71,slug:'needs-author',from:50}] }, stages, ctx); assert.deepStrictEqual(segStates(row), [D, D, D, 'active detoured', T, T, 'todo cap']); -assert.ok(row.includes('aria-label="Next move: human"') && row.includes('Needs @samNeeds @samReady for human mergeReady for human merge]*>[\s\S]*?<\/svg>([^<]*)<\/span>]*aria-label="Next move: ([a-z]+)"[^>]*>/.exec(r); + const m = /aria-current="step">]*>]*>[\s\S]*?<\/svg>([^<]*)<\/span><\/span>]*aria-label="Next move: ([a-z]+)"[^>]*>/.exec(r); assert.ok(m, 'stage ' + st + ' has no active word + actor: ' + r); assert.deepStrictEqual([m[1], m[2]], [word, actor === 'author' ? 'clanker' : actor], 'stage ' + st); prWords[st] = m[1]; diff --git a/src/pkg/dashboard/webstatic/testdata/tracker-decision-interaction.js b/src/pkg/dashboard/webstatic/testdata/tracker-decision-interaction.js index 9be65679fd..9f517aec10 100644 --- a/src/pkg/dashboard/webstatic/testdata/tracker-decision-interaction.js +++ b/src/pkg/dashboard/webstatic/testdata/tracker-decision-interaction.js @@ -61,6 +61,7 @@ close(); trigger.scrollIntoView({ block: 'center', inline: 'nearest', behavior: 'instant' }); await frame(); + await frame(); hit(trigger, 'decision trigger'); assert(!trigger.closest('.config-info') && !trigger.closest('.ham-chevron-info').querySelector('.config-tooltip'), 'decision has no generic tooltip ancestor/source'); help.focus({ preventScroll: true }); @@ -71,6 +72,7 @@ await new Promise(resolve => setTimeout(resolve, hoverSettleMS)); inspectDialog(trigger, 'pointer hover'); close(); + trigger.blur(); trigger.focus({ preventScroll: true }); inspectDialog(trigger, 'keyboard focus'); for (const key of ['ArrowDown', 'Enter', ' ']) { @@ -92,6 +94,7 @@ originalFocus?.focus?.({ preventScroll: true }); close(); for (const [el, position] of scrollParents) el.scrollTo({ ...position, behavior: 'instant' }); + await frame(); } if (failures.length) throw new Error(JSON.stringify({ viewport: innerWidth, tested: targets.length, failures })); return { viewport: innerWidth, tested: targets.length, failures }; diff --git a/src/pkg/dashboard/webstatic/testdata/tracker-header-geometry.js b/src/pkg/dashboard/webstatic/testdata/tracker-header-geometry.js index 985c1a151a..9cf1a6f921 100644 --- a/src/pkg/dashboard/webstatic/testdata/tracker-header-geometry.js +++ b/src/pkg/dashboard/webstatic/testdata/tracker-header-geometry.js @@ -35,9 +35,11 @@ assert(box.top >= -tolerance && box.bottom <= innerHeight + tolerance, name + 'entire control is vertically reachable after deliberate scrolling'); const hit = document.elementFromPoint((box.left + box.right) / 2, (box.top + box.bottom) / 2); coverage.hitTested++; - assert(hit === control || control.contains(hit), name + 'every control center hits that control, not an overlay or offscreen null'); + assert(hit === control || control.contains(hit), name + 'every control center hits that control, not an overlay or offscreen null: ' + + JSON.stringify({ control: control.className, box: box.toJSON(), hit: hit?.className || hit?.tagName || null })); } finally { for (const { el, left, top } of scrollParents) el.scrollTo({ left, top, behavior: 'instant' }); + await new Promise(requestAnimationFrame); } }; const rows = [...document.querySelectorAll('#activity-monitor-section .ham-row, #activity-monitor-section .ham-sub')]; @@ -80,7 +82,8 @@ const previous = flow[child - 1], next = flow[child]; const spacing = rowGap + (parseFloat(getComputedStyle(previous).marginBottom) || 0) + (parseFloat(getComputedStyle(next).marginTop) || 0); const measured = rect(next).top - rect(previous).bottom; - assert(measured >= -tolerance && measured <= spacing + tolerance, name + 'no overlap or unexplained vertical gap between successive content/sub-rows'); + assert(measured >= -tolerance && measured <= spacing + tolerance, name + 'no overlap or unexplained vertical gap between successive content/sub-rows: ' + + JSON.stringify({ previous: previous.className, next: next.className, measured, allowed: spacing })); } if (matchMedia('(min-width: 1101px)').matches) { assert(near(rect(lead).left, rect(columns[0]).left), name + 'issue starts at Open'); diff --git a/src/scripts/dashboard-mobile-shots.mjs b/src/scripts/dashboard-mobile-shots.mjs index f0427229a2..9e6d1d2893 100644 --- a/src/scripts/dashboard-mobile-shots.mjs +++ b/src/scripts/dashboard-mobile-shots.mjs @@ -300,8 +300,8 @@ async function main() { if (result.result.exceptionDetails) throw new Error(result.result.exceptionDetails.exception?.description || 'evaluate failed'); return result.result.result.value; }; - const screenshot = async file => { - const shot = await send('Page.captureScreenshot', { format: 'png', captureBeyondViewport: true }); + const screenshot = async (file, viewportOnly = false) => { + const shot = await send('Page.captureScreenshot', { format: 'png', captureBeyondViewport: !viewportOnly }); if (shot.error) throw new Error(shot.error.message); fs.writeFileSync(path.join(opts.out, file), Buffer.from(shot.result.data, 'base64')); }; @@ -318,6 +318,7 @@ async function main() { const box = trigger.getBoundingClientRect(); const portal = document.getElementById('config-tooltip-portal'); return { x: (box.left + box.right) / 2, y: (box.top + box.bottom) / 2, + documentFocused: document.hasFocus(), helpFocused: document.activeElement === help, tooltipWasOpen: !!portal && !portal.hidden && getComputedStyle(portal).display !== 'none' }; })()`); if (!point.tooltipWasOpen) failures.push('Native pointer precondition: ordinary tooltip was not open'); @@ -337,7 +338,7 @@ async function main() { return { mode, ...result }; }; const observations = [await inspect('native pointer')]; - await screenshot(prefix + '-decision-pointer.png'); + await screenshot(prefix + '-decision-pointer.png', true); const keys = [{ key: 'ArrowDown', code: 'ArrowDown', keyCode: 40 }, { key: 'Enter', code: 'Enter', keyCode: 13 }, { key: ' ', code: 'Space', keyCode: 32 }]; for (const { key, code, keyCode } of keys) { @@ -353,13 +354,16 @@ async function main() { } observations.push(await inspect('native keyboard ' + JSON.stringify(key))); } - await screenshot(prefix + '-decision-keyboard.png'); + await screenshot(prefix + '-decision-keyboard.png', true); await evaluate('stageTrackerCloseDecisionPop(false); true'); - return { observations, failures }; + return { pointerPrecondition: point, observations, failures }; }; await send('Page.enable'); await send('Runtime.enable'); + // Headless input must own focus for native focusin and keyboard delivery. + await send('Page.bringToFront'); + await send('Emulation.setFocusEmulationEnabled', { enabled: true }); // Each state callback is best-effort: a missing helper yields a skipped shot, not a harness error. const setThemeJS = (theme) => `document.body.classList.toggle('light-mode', ${theme === 'light'}); document.documentElement.style.colorScheme = '${theme}'; true`; From 8f21451ba47520753b122f8ce97f55c7b247812b Mon Sep 17 00:00:00 2001 From: Andrew Anderson Date: Tue, 3 Nov 2026 14:04:56 -0500 Subject: [PATCH 4/4] =?UTF-8?q?=F0=9F=90=9B=20Isolate=20activity=20browser?= =?UTF-8?q?=20fixtures=20and=20verify=20captured=20pixels?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Andrew Anderson --- .github/scripts/integration-governance.cjs | 2 +- src/docs/dashboard-source-layout.md | 8 +++ .../dashboard/stage_tracker_activity.test.js | 9 ++++ .../dashboard/stage_tracker_ui_rows_test.go | 22 ++++++-- src/scripts/dashboard-mobile-shots.mjs | 54 ++++++++++++++++--- 5 files changed, 85 insertions(+), 10 deletions(-) diff --git a/.github/scripts/integration-governance.cjs b/.github/scripts/integration-governance.cjs index 436c117ead..84de24ec01 100644 --- a/.github/scripts/integration-governance.cjs +++ b/.github/scripts/integration-governance.cjs @@ -9,7 +9,7 @@ const MAX_COMMITS = 1000; const MAX_AUTHOR_BATCH = 50; // This literal is inside the enrolled .github closure. A caller-supplied // preparedBy.sourceSHA must never choose a new executable verifier tree. -const TRUSTED_SCRIPTS_TREE = '285b665731e1ce1f00125bbea7fba3ffb5cc17b7'; +const TRUSTED_SCRIPTS_TREE = '55bc8023d6e79acf4b3eeb284bd4c2f927537630'; const SOURCE = 'https://github.com/kubernetes-sigs/kubebuilder-release-tools/tree/012269a88fa4c034a0acf1ba84c26b195c0dbab4'; const sha = value => crypto.createHash('sha256').update(value).digest('hex'); const git = (args, cwd = process.cwd()) => diff --git a/src/docs/dashboard-source-layout.md b/src/docs/dashboard-source-layout.md index ebc7e9c6f5..e3066e0b92 100644 --- a/src/docs/dashboard-source-layout.md +++ b/src/docs/dashboard-source-layout.md @@ -67,6 +67,14 @@ focuses decision actions without scrolling, which would otherwise close the dialog through its scroll-away listener. Control probes await a bounded stable scroll/visual viewport before every mandatory hit-test; native pointer/keyboard reports also retain each decision action's bounds and actual hit target. +Fixture transitions close the preceding terminal/export dialog through its +native close API, releasing its captured keyboard listener instead of leaving +an unrelated modal over the activity controls. Native pointer preconditions +also hit-test the trigger itself. Viewport captures explicitly target the +current document scroll rectangle; density and pointer/keyboard reports inspect +their actual PNG pixels, excluding scrollbars, and fail a uniform-background +capture. This paint check only rejects empty evidence; nonblank images still +require visual inspection and do not replace geometry or interaction checks. The 12:36 screenshot shapes additionally exercise nested #16450 and root #16451 recorded/unverified preparation fronts, #16446 awaiting a superseding human decision, pluk #436 assigned review after passing CI, #16437 approved diff --git a/src/pkg/dashboard/stage_tracker_activity.test.js b/src/pkg/dashboard/stage_tracker_activity.test.js index adcbdc2fa2..40be0adeb4 100644 --- a/src/pkg/dashboard/stage_tracker_activity.test.js +++ b/src/pkg/dashboard/stage_tracker_activity.test.js @@ -270,6 +270,15 @@ test('canonical activity browser wiring is retained (not browser/visual proof)', assert.match(harness, /Emulation\.setFocusEmulationEnabled', \{ enabled: true \}/); assert.match(harness, /documentFocused: document\.hasFocus\(\), helpFocused: document\.activeElement === help/); assert.match(harness, /captureBeyondViewport: !viewportOnly/); + assert.match(harness, /x: scrollX, y: scrollY, width: innerWidth, height: innerHeight/); + assert.match(harness, /getImageData\(0, 0, width, height\)/); + assert.match(harness, /probe: 'viewport-paint', ok: capture\.painted/); + assert.match(harness, /if \(!capture\.painted\) activityFailures\.push/); + assert.match(harness, /failures\.push\(\.\.\.pointerCapture\.failures\)/); + assert.match(harness, /failures\.push\(\.\.\.keyboardCapture\.failures\)/); + assert.match(harness, /if \(!point\.triggerReachable\) failures\.push/); + assert.match(harness, /document\.querySelectorAll\('\.hive-dialog-overlay'\)[\s\S]*?el\.hiveDialogClose\(\)/); + assert.match(harness, /Prior fixture dialog survived native cleanup/); assert.match(harness, /screenshot\(prefix \+ '-decision-pointer\.png', true\)/); assert.match(harness, /screenshot\(prefix \+ '-decision-keyboard\.png', true\)/); assert.match(harness, /every native decision action must be reachable and unobscured/); diff --git a/src/pkg/dashboard/stage_tracker_ui_rows_test.go b/src/pkg/dashboard/stage_tracker_ui_rows_test.go index de27130353..625e2d013b 100644 --- a/src/pkg/dashboard/stage_tracker_ui_rows_test.go +++ b/src/pkg/dashboard/stage_tracker_ui_rows_test.go @@ -606,12 +606,28 @@ assert.deepStrictEqual(stageTrackerVisible(g, { kind: 'issue', repo: '' }).map(i assert.deepStrictEqual(stageTrackerVisible(g, { kind: 'pr', repo: '' }).map(it => it.number), [21, 31, 32, 40], 'Pull requests filter flattens every PR once'); // Hover text budget per row (owner request): only the #N link, the PR link, -// the item title and the active chevron carry title="…". The row container, +// the item title and the active chevron carry nonempty title="…". The row container, // sub-row container, kind / author / actor icons, chips, since cells and // every non-active chevron carry none; icons expose their label via aria-label. +// Accessible chevron wrappers use title="" only to suppress inherited native +// hover text while the shared portal exposes their full details. const tags = (html) => Array.from(html.matchAll(/<(\w+)\b([^>]*)>/g)).map(m => ({ tag: m[1], attrs: m[2] })); -const titled = (html) => tags(html).filter(t => / title="/.test(t.attrs) && !t.attrs.includes('data-track=')); -const expectTitles = (html, want, what) => assert.deepStrictEqual(titled(html).map(t => t.tag + '.' + ((/class="([^" ]+)/.exec(t.attrs) || [])[1] || '')), want, what + ': ' + html); +const titleAttribute = (tag) => (/(?:^|\s)title="([^"]*)"/.exec(tag.attrs) || [])[1]; +const chevronHelp = (tag) => tag.tag === 'span' && /(?:^|\s)class="ham-chevron-info config-info"/.test(tag.attrs); +const titled = (html) => tags(html).filter(t => titleAttribute(t) !== undefined && !t.attrs.includes('data-track=') && + !(chevronHelp(t) && titleAttribute(t) === '')); +const expectTitles = (html, want, what) => { + for (const tag of tags(html).filter(chevronHelp)) { + assert.strictEqual(titleAttribute(tag), '', what + ': portal wrapper must suppress inherited native hover text'); + assert.match(tag.attrs, /(?:^|\s)tabindex="0"/, what + ': full details remain keyboard reachable'); + assert.match(tag.attrs, /(?:^|\s)aria-label="[^"]+"/, what + ': full accessible caption remains'); + assert.match(tag.attrs, /(?:^|\s)aria-describedby="ham-(?:chevron|track)-tip-[^"]+"/, what + ': shared tooltip stays associated'); + } + assert.deepStrictEqual(titled(html).map(t => t.tag + '.' + ((/class="([^" ]+)/.exec(t.attrs) || [])[1] || '')), want, what + ': ' + html); +}; +assert.strictEqual(titled('').length, 0, 'only the exact empty portal suppressor is exempt'); +assert.strictEqual(titled('').length, 1, 'nonempty wrapper titles still violate the exact hover budget'); +assert.strictEqual(titled('
  • ').length, 2, 'unrelated title-bearing extras are never whitelisted'); assert.ok(!/]*>\s*/.test(golden), 'no svg <title> tooltips anywhere in the tracker'); assert.ok(!/<(div|span)[^>]*class="ham-(row|sub|since|badge|kind-ico)[^>]*title="/.test(golden), 'containers, since cells, chips and kind icons carry no title'); for (const r of golden.split('<div class="ham-row"').slice(1)) { diff --git a/src/scripts/dashboard-mobile-shots.mjs b/src/scripts/dashboard-mobile-shots.mjs index ec37643258..2e35d1cfd5 100644 --- a/src/scripts/dashboard-mobile-shots.mjs +++ b/src/scripts/dashboard-mobile-shots.mjs @@ -301,13 +301,41 @@ async function main() { return result.result.result.value; }; const screenshot = async (file, viewportOnly = false) => { - const shot = await send('Page.captureScreenshot', { format: 'png', captureBeyondViewport: !viewportOnly }); + const viewport = viewportOnly ? await evaluate(`({ + x: scrollX, y: scrollY, width: innerWidth, height: innerHeight, + clientWidth: document.documentElement.clientWidth, + clientHeight: document.documentElement.clientHeight + })`) : null; + const clip = viewport ? { x: viewport.x, y: viewport.y, width: viewport.width, height: viewport.height, scale: 1 } : undefined; + const shot = await send('Page.captureScreenshot', { format: 'png', captureBeyondViewport: !viewportOnly, ...(clip ? { clip } : {}) }); if (shot.error) throw new Error(shot.error.message); fs.writeFileSync(path.join(opts.out, file), Buffer.from(shot.result.data, 'base64')); + if (!viewport) return; + const pixels = await evaluate(`(async () => { + const image = new Image(); + image.src = ${JSON.stringify('data:image/png;base64,')} + ${JSON.stringify(shot.result.data)}; + await image.decode(); + const canvas = document.createElement('canvas'); + canvas.width = image.naturalWidth; canvas.height = image.naturalHeight; + const context = canvas.getContext('2d', { willReadFrequently: true }); + context.drawImage(image, 0, 0); + const width = Math.min(canvas.width, Math.floor(${viewport.clientWidth} * canvas.width / ${viewport.width})); + const height = Math.min(canvas.height, Math.floor(${viewport.clientHeight} * canvas.height / ${viewport.height})); + const data = context.getImageData(0, 0, width, height).data; + let painted = false; + for (let pixel = 4; pixel < data.length; pixel += 4) { + if (data[pixel] !== data[0] || data[pixel + 1] !== data[1] || + data[pixel + 2] !== data[2] || data[pixel + 3] !== data[3]) { painted = true; break; } + } + return { painted, width: canvas.width, height: canvas.height, inspectedWidth: width, inspectedHeight: height }; + })()`); + return { file, viewport, clip, ...pixels, + failures: pixels.painted ? [] : ['Viewport capture contains only a uniform background; DOM assertions are not visual proof'] }; }; const nativeDecisionInput = async prefix => { const failures = []; const point = await evaluate(`(async () => { + stageTrackerCloseDecisionPop(false); const trigger = [...document.querySelectorAll('.ham-chevron-decision .ham-decision-trigger')] .find(button => Number(button.closest('[data-ham-stage]')?.dataset.hamStage) === 80); if (!trigger) throw new Error('Missing native stage-80 decision trigger'); @@ -317,11 +345,15 @@ async function main() { help.focus({ preventScroll: true }); const box = trigger.getBoundingClientRect(); const portal = document.getElementById('config-tooltip-portal'); + const target = document.elementFromPoint((box.left + box.right) / 2, (box.top + box.bottom) / 2); return { x: (box.left + box.right) / 2, y: (box.top + box.bottom) / 2, documentFocused: document.hasFocus(), helpFocused: document.activeElement === help, + triggerReachable: target === trigger || trigger.contains(target), + target: target?.className || target?.tagName || null, tooltipWasOpen: !!portal && !portal.hidden && getComputedStyle(portal).display !== 'none' }; })()`); if (!point.tooltipWasOpen) failures.push('Native pointer precondition: ordinary tooltip was not open'); + if (!point.triggerReachable) failures.push('Native pointer precondition: trigger is intercepted by ' + point.target); const moved = await send('Input.dispatchMouseEvent', { type: 'mouseMoved', x: point.x, y: point.y, pointerType: 'mouse' }); if (moved.error) throw new Error(moved.error.message); await sleep(STATE_SETTLE_MS); @@ -351,7 +383,8 @@ async function main() { return { mode, ...result }; }; const observations = [await inspect('native pointer')]; - await screenshot(prefix + '-decision-pointer.png', true); + const pointerCapture = await screenshot(prefix + '-decision-pointer.png', true); + failures.push(...pointerCapture.failures); const keys = [{ key: 'ArrowDown', code: 'ArrowDown', keyCode: 40 }, { key: 'Enter', code: 'Enter', keyCode: 13 }, { key: ' ', code: 'Space', keyCode: 32 }]; for (const { key, code, keyCode } of keys) { @@ -367,9 +400,10 @@ async function main() { } observations.push(await inspect('native keyboard ' + JSON.stringify(key))); } - await screenshot(prefix + '-decision-keyboard.png', true); + const keyboardCapture = await screenshot(prefix + '-decision-keyboard.png', true); + failures.push(...keyboardCapture.failures); await evaluate('stageTrackerCloseDecisionPop(false); true'); - return { pointerPrecondition: point, observations, failures }; + return { pointerPrecondition: point, observations, captures: [pointerCapture, keyboardCapture], failures }; }; await send('Page.enable'); @@ -383,6 +417,13 @@ async function main() { const resetJS = `(() => { window.__activityDensityCleanup?.(); document.getElementById('preparation-rail-layout-fixture')?.remove(); + // The preceding terminal state owns a native dialog and capture listener. + // Close it through its API, not by hiding/removing its DOM. + document.querySelectorAll('.hive-dialog-overlay').forEach((el) => { + if (typeof el.hiveDialogClose !== 'function') throw new Error('Cannot clean up prior fixture dialog'); + el.hiveDialogClose(); + }); + if (document.querySelector('.hive-dialog-overlay')) throw new Error('Prior fixture dialog survived native cleanup'); document.querySelectorAll('.config-overlay, .modal-overlay').forEach((el) => { el.classList.add('hidden'); }); document.documentElement.classList.remove('modal-open'); document.body.classList.remove('modal-open'); return true; @@ -453,8 +494,9 @@ async function main() { if (!await evaluate(expandOneJS('activity-monitor-section'))) throw new Error('Cannot expand actual Activity Monitor'); const fixture = await evaluate('(' + activityDensityFixture.toString() + ')(' + JSON.stringify(density) + ')'); await sleep(STATE_SETTLE_MS); - await screenshot(`${vp.name}-${theme}-activity-density-viewport.png`, true); - const results = []; + const capture = await screenshot(`${vp.name}-${theme}-activity-density-viewport.png`, true); + const results = [{ probe: 'viewport-paint', ok: capture.painted, result: capture }]; + if (!capture.painted) activityFailures.push(vp.name + ' ' + theme + ' blank viewport capture'); for (const probe of probes) { const result = await evaluate(`(async () => { try { return { ok: true, result: await (${probe.source})({ dedicatedPreview: true }) }; }