diff --git a/.github/scripts/integration-governance.cjs b/.github/scripts/integration-governance.cjs index b82a4b1381..7344f0a980 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 = 'aa20dad41934337be58b07e3812d78e9c41310e2'; +const TRUSTED_SCRIPTS_TREE = '68aa6a3ea98f2ab257c8d492b39b8a661092786d'; 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/changelog.d/fixed-activity-chevron-height.md b/changelog.d/fixed-activity-chevron-height.md new file mode 100644 index 0000000000..f1c4ac7b35 --- /dev/null +++ b/changelog.d/fixed-activity-chevron-height.md @@ -0,0 +1 @@ +- Activity monitor: stage chevrons are again only as tall as their caption (one line of text → a one-line chevron, two lines → two, never more) with the caption centred instead of flush-left in a fixed two-line box, and the CI / Review lanes are notched chevrons like the other stages (state shown by fill and text colour) rather than bordered boxes. diff --git a/src/docs/dashboard-source-layout.md b/src/docs/dashboard-source-layout.md index 98c36cb959..e75eca06f9 100644 --- a/src/docs/dashboard-source-layout.md +++ b/src/docs/dashboard-source-layout.md @@ -120,16 +120,28 @@ 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 +The split CI/Review lanes are chevrons like every other stage — the same notch +polygon, padding and content-driven height as their neighbours, never a bordered +card (the boxed opt-out of #16384 is gone). They express lane state the way the +other chevrons do, through fill, tint and text colour: `done` (passed/approved), +dimmed `todo`, the lit `active` fill for fresh observed work, a muted amber tint +for `ham-current` occupancy, and an amber-on-tint treatment for failing CI or +changes requested. They also distinguish position from activity: a steady +current-phase tint 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 +All progress chevrons share a two-line text budget, wrapping even unbroken +handles, but a row is only as tall as its longest caption: one line of text gives +a one-line-tall chevron, two lines a two-line-tall one, never more (the grid row +sizes to content above a one-line floor; sibling cells stretch to the row's +tallest chevron, not to a fixed box). The caption, with its reserved icons, is +centred in the chevron both horizontally and vertically, as before the two-line +budget; a wrapped second line is centred under the first. 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 diff --git a/src/pkg/dashboard/stage_tracker_activity.test.js b/src/pkg/dashboard/stage_tracker_activity.test.js index 5e0f1cd250..d06a2f773f 100644 --- a/src/pkg/dashboard/stage_tracker_activity.test.js +++ b/src/pkg/dashboard/stage_tracker_activity.test.js @@ -545,8 +545,15 @@ test('genuine current-head source work still lights PR in progress; fix assignme test('current-phase styling is steady and undimmed, including compact/reduced-motion layouts', () => { const css = fs.readFileSync(path.join(__dirname, 'static-src/css/tracker.css'), 'utf8'); - assert.match(css, /\.ham-activity-track\.ham-current \{[^}]*opacity: 1;[^}]*box-shadow:/); + assert.match(css, /\.ham-activity-track\.ham-current \{[^}]*opacity: 1;[^}]*box-shadow: none/); assert.match(css, /\.ham-activity-track\.ham-current:not\(\.active\) \{ background: color-mix/); + // Lanes are chevrons like every other stage (#16384's boxed card is + // gone): no clip-path opt-out, no border/ring; state is fill and colour. + assert.doesNotMatch(css, /\.ham-activity-track \{/, 'no activity-track rule overrides the .ham-seg chevron shape'); + for (const block of css.match(/\.ham-(?:seg\.)?ham-activity-track[^{]*\{[^}]*\}/g)) { + assert.doesNotMatch(block, /clip-path|border(?!-radius)|box-shadow: inset/, block); + } + assert.match(css, /\.ham-seg\.ham-activity-track\[data-activity-state="failing"\], \.ham-seg\.ham-activity-track\[data-activity-state="changes_requested"\] \{ background: color-mix\(in srgb, var\(--amber\) \d+%, var\(--panel\)\); color: var\(--amber\);/); const current = css.match(/\.ham-activity-track\.ham-current \{([^}]*)\}/)[1]; assert.doesNotMatch(current, /animation|data-motion/); assert.ok(css.indexOf('.ham-activity-track.ham-current {') > css.indexOf('.ham-seg.todo {'), 'current occupancy overrides generic upcoming-track dimming'); diff --git a/src/pkg/dashboard/stage_tracker_header_spans.test.js b/src/pkg/dashboard/stage_tracker_header_spans.test.js index db59fbfb69..f2c3fc1c3b 100644 --- a/src/pkg/dashboard/stage_tracker_header_spans.test.js +++ b/src/pkg/dashboard/stage_tracker_header_spans.test.js @@ -145,6 +145,21 @@ test('spans share the physical lane grid, including independent concurrent CI/Re assert.match(ctx.stageTrackerHeadColsHtml(['PR']), /data-ham-pr-start="5"/, 'boundary derives from canonical stages, not a second hard-coded span'); }); +test('chevron height is content-driven (one-line floor, two-line clamp) and the caption stays centred', () => { + const strip = rule('.ham-strip[aria-label="Pipeline progress"]'); + const seg = rule('.ham-strip[aria-label="Pipeline progress"] > .ham-seg'); + const copy = rule('.ham-chevron-copy'); + assert.match(strip, /grid-auto-rows: minmax\(calc\(var\(--ham-chevron-line-height\) \* 1em \+ 2 \* var\(--sp-2\) \+ 2 \* var\(--line-width\)\), auto\)/, + 'rows size to their tallest caption above a one-line floor'); + assert.doesNotMatch(strip, /grid-auto-rows: calc\(var\(--ham-chevron-text-lines\)/, 'no fixed two-line row height around one line of text'); + assert.match(seg, /align-self: stretch/); + assert.doesNotMatch(seg, /height: 100%/, 'siblings follow the row, the row follows its content'); + assert.match(copy, /max-height: calc\(var\(--ham-chevron-text-lines\) \* var\(--ham-chevron-line-height\) \* 1em\)/, 'the two-line clamp stays'); + assert.match(copy, /flex: 0 1 auto/, 'the copy shrink-wraps its text so justify-content: center centres it'); + assert.match(copy, /text-align: center/, 'a wrapped second line is centred under the first'); + assert.match(rule('.ham-chevron-info.config-info, .ham-chevron-info.ham-chevron-decision'), /align-items: center; justify-content: center/); +}); + 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/); diff --git a/src/pkg/dashboard/static-src/css/tracker.css b/src/pkg/dashboard/static-src/css/tracker.css index 744c16e076..156832a78b 100644 --- a/src/pkg/dashboard/static-src/css/tracker.css +++ b/src/pkg/dashboard/static-src/css/tracker.css @@ -318,9 +318,12 @@ .ham-badge-reroute.ham-reroute-online .ham-presence-dot { background: var(--status-ok); } .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); white-space: normal; } + /* The concurrent CI / Review lanes are chevrons like every other stage + (same clip-path, padding and height — the boxed card opt-out of + #16384 is gone); their lane state reads through fill, tint and text + colour exactly as done / todo / active do, never a border or ring, + which the notched polygon would clip anyway. */ .ham-track-state a { color: inherit; } - .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; } .ham-seg.active.merged { background: var(--green); color: var(--surface-0); animation: none; } @@ -346,9 +349,15 @@ 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)); } + tracks keep a steady current-phase tint (a muted amber fill, full + opacity, no dimming ring), never a work pulse; only fresh observed + work earns the lit .active fill. */ + .ham-activity-track.ham-current { opacity: 1; box-shadow: none; } + .ham-activity-track.ham-current:not(.active) { background: color-mix(in srgb, var(--amber) 28%, var(--panel)); color: var(--text); } + /* Findings (red CI, changes requested) are an amber-tinted chevron with + amber words — full opacity, still not the hive's own work; the finding + outranks the current-phase tint when both apply. */ + .ham-seg.ham-activity-track[data-activity-state="failing"], .ham-seg.ham-activity-track[data-activity-state="changes_requested"] { background: color-mix(in srgb, var(--amber) 18%, var(--panel)); color: var(--amber); box-shadow: none; opacity: 1; } .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; } @@ -379,14 +388,22 @@ .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; } .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)); } + /* All physical chevrons share a two-line text budget, but a row is only + as tall as its longest caption: one line of text → a one-line chevron, + two lines → two (the clamp below caps it there). The grid row sizes + to content with a one-line floor so icon-only cells and siblings + stretch to the row's tallest chevron, never to a fixed box. The + portal tooltip is outside the clipped polygon; keyboard focus + exposes the same full text. */ + .ham-strip[aria-label="Pipeline progress"] { grid-auto-rows: minmax(calc(var(--ham-chevron-line-height) * 1em + 2 * var(--sp-2) + 2 * var(--line-width)), auto); } + .ham-strip[aria-label="Pipeline progress"] > .ham-seg { box-sizing: border-box; align-self: stretch; 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; 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; } + /* The copy shrink-wraps its text (flex 0 1 auto) so the words, with + their icons, sit centred in the chevron as before; a wrapped second + line is centred under the first rather than ragged-left. */ + .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: 0 1 auto; min-width: 0; overflow: hidden; white-space: normal; overflow-wrap: anywhere; text-align: center; } .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; } diff --git a/src/pkg/dashboard/static/index.html b/src/pkg/dashboard/static/index.html index 4d21b27133..fe8727cac5 100644 --- a/src/pkg/dashboard/static/index.html +++ b/src/pkg/dashboard/static/index.html @@ -1655,9 +1655,12 @@ .ham-badge-reroute.ham-reroute-online .ham-presence-dot { background: var(--status-ok); } .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); white-space: normal; } + /* The concurrent CI / Review lanes are chevrons like every other stage + (same clip-path, padding and height — the boxed card opt-out of + #16384 is gone); their lane state reads through fill, tint and text + colour exactly as done / todo / active do, never a border or ring, + which the notched polygon would clip anyway. */ .ham-track-state a { color: inherit; } - .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; } .ham-seg.active.merged { background: var(--green); color: var(--surface-0); animation: none; } @@ -1683,9 +1686,15 @@ 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)); } + tracks keep a steady current-phase tint (a muted amber fill, full + opacity, no dimming ring), never a work pulse; only fresh observed + work earns the lit .active fill. */ + .ham-activity-track.ham-current { opacity: 1; box-shadow: none; } + .ham-activity-track.ham-current:not(.active) { background: color-mix(in srgb, var(--amber) 28%, var(--panel)); color: var(--text); } + /* Findings (red CI, changes requested) are an amber-tinted chevron with + amber words — full opacity, still not the hive's own work; the finding + outranks the current-phase tint when both apply. */ + .ham-seg.ham-activity-track[data-activity-state="failing"], .ham-seg.ham-activity-track[data-activity-state="changes_requested"] { background: color-mix(in srgb, var(--amber) 18%, var(--panel)); color: var(--amber); box-shadow: none; opacity: 1; } .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; } @@ -1716,14 +1725,22 @@ .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; } .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)); } + /* All physical chevrons share a two-line text budget, but a row is only + as tall as its longest caption: one line of text → a one-line chevron, + two lines → two (the clamp below caps it there). The grid row sizes + to content with a one-line floor so icon-only cells and siblings + stretch to the row's tallest chevron, never to a fixed box. The + portal tooltip is outside the clipped polygon; keyboard focus + exposes the same full text. */ + .ham-strip[aria-label="Pipeline progress"] { grid-auto-rows: minmax(calc(var(--ham-chevron-line-height) * 1em + 2 * var(--sp-2) + 2 * var(--line-width)), auto); } + .ham-strip[aria-label="Pipeline progress"] > .ham-seg { box-sizing: border-box; align-self: stretch; 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; 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; } + /* The copy shrink-wraps its text (flex 0 1 auto) so the words, with + their icons, sit centred in the chevron as before; a wrapped second + line is centred under the first rather than ragged-left. */ + .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: 0 1 auto; min-width: 0; overflow: hidden; white-space: normal; overflow-wrap: anywhere; text-align: center; } .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; } diff --git a/src/pkg/dashboard/webstatic/testdata/tracker-header-geometry.js b/src/pkg/dashboard/webstatic/testdata/tracker-header-geometry.js index 17bf403c66..25b0ea6dea 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, currentRows: 0, preparation: 0, superseded: 0, states: {} }; + const coverage = { issueOnly: 0, linked: 0, prOnly: 0, nested: 0, multiIssue: 0, unknown: 0, queuedApproved: 0, wrapped: 0, singleLineRows: 0, wrappedRows: 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(); @@ -150,6 +150,29 @@ } const heights = columns.map(cell => rect(cell).height); assert(Math.max(...heights) - Math.min(...heights) <= tolerance, name + 'all physical chevrons have uniform height'); + // Content-driven height: the row is exactly as tall as its longest + // caption (one or two text lines plus the chevron's own padding and + // border), with a one-line floor for icon-only rows — never a fixed + // two-line box around one line of text. + const lineWidth = parseFloat(getComputedStyle(strip).getPropertyValue('--line-width')) || 0; + const cellBudget = (cell, lines, border) => { + const style = getComputedStyle(cell); + return lines * parseFloat(style.lineHeight) + parseFloat(style.paddingTop) + parseFloat(style.paddingBottom) + + (border === undefined ? parseFloat(style.borderTopWidth) + parseFloat(style.borderBottomWidth) : border); + }; + let rowLines = 0, expectedHeight = cellBudget(columns[0], 1, 2 * lineWidth); + for (const cell of columns) { + for (const copy of cell.querySelectorAll('.ham-chevron-copy, .cue-acting-cap')) { + if (!visible(copy)) continue; + const lines = Math.max(1, Math.round(rect(copy).height / parseFloat(getComputedStyle(copy).lineHeight))); + rowLines = Math.max(rowLines, lines); + expectedHeight = Math.max(expectedHeight, cellBudget(cell, lines)); + } + } + assert(near(Math.max(...heights), expectedHeight), name + 'chevron height is content-driven (' + (rowLines || 1) + ' text line(s) + padding), not a fixed two-line box: ' + + JSON.stringify({ measured: Math.max(...heights), expected: expectedHeight, lines: rowLines })); + if (rowLines === 1) coverage.singleLineRows++; + if (rowLines === 2) coverage.wrappedRows++; const ci = strip.querySelector('[data-track="ci"]'); const review = strip.querySelector('[data-track="review"]'); const current = columns.filter(cell => !cell.classList.contains('cap') && @@ -163,7 +186,18 @@ 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'); + assert(Number(style.opacity) >= 0.9 && style.backgroundColor !== 'rgba(0, 0, 0, 0)' && style.backgroundColor !== 'transparent', name + 'queued/unknown/assigned/completed current tracks retain a visible steady fill'); + } + if (cell.dataset.track) { + // CI / Review lanes are chevrons like their neighbours: same notch + // polygon, padding and height, state expressed by fill, not a box. + const style = getComputedStyle(cell); + const peer = columns.find(other => other !== cell && !other.dataset.track && !other.classList.contains('cap') && other !== columns[0]); + const peerStyle = getComputedStyle(peer); + assert(style.clipPath !== 'none' && style.clipPath === peerStyle.clipPath, name + 'activity track keeps the chevron notch polygon: ' + JSON.stringify({ track: style.clipPath, peer: peerStyle.clipPath })); + assert(style.borderTopWidth === '0px' && style.borderLeftWidth === '0px' && style.borderRadius === peerStyle.borderRadius, name + 'activity track is not a bordered box'); + assert(style.paddingLeft === peerStyle.paddingLeft && style.paddingRight === peerStyle.paddingRight && style.paddingTop === peerStyle.paddingTop, name + 'activity track shares chevron padding'); + assert(near(rect(cell).height, rect(peer).height), name + 'activity track shares chevron height'); } if (cell.dataset.displayState === 'unknown') { coverage.unknown++; @@ -192,6 +226,30 @@ 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'); + // Centred as before the two-line budget: the glyphs sit centred in + // their copy box (a stretched copy with start-aligned text fails + // here), and the copy together with its reserved icons sits centred + // in the chevron's content box, both horizontally and vertically. + const content = { left: rect(cell).left + parseFloat(getComputedStyle(cell).paddingLeft), right: rect(cell).right - parseFloat(getComputedStyle(cell).paddingRight), + top: rect(cell).top + parseFloat(getComputedStyle(cell).paddingTop), bottom: rect(cell).bottom - parseFloat(getComputedStyle(cell).paddingBottom) }; + const range = document.createRange(); + range.selectNodeContents(copy); + const glyphs = [...range.getClientRects()].filter(line => line.width > 0 && line.top >= bounds.top - tolerance && line.bottom <= bounds.bottom + tolerance); + const glyphTolerance = parseFloat(style.fontSize) / 2; // a trailing wrap space, never a ragged-left line + if (glyphs.length) { + const text = { left: Math.min(...glyphs.map(line => line.left)), right: Math.max(...glyphs.map(line => line.right)) }; + assert(Math.abs((text.left + text.right) / 2 - (bounds.left + bounds.right) / 2) <= glyphTolerance, name + 'caption text is horizontally centred within its copy box: ' + + JSON.stringify({ text, copy: { left: bounds.left, right: bounds.right } })); + } + const group = copy.parentElement === info + ? [...info.children].filter(child => visible(child) && !child.classList.contains('config-tooltip')).map(rect) + : [bounds]; + const union = { left: Math.min(...group.map(box => box.left)), right: Math.max(...group.map(box => box.right)), + top: Math.min(...group.map(box => box.top)), bottom: Math.max(...group.map(box => box.bottom)) }; + assert(Math.abs((union.left + union.right) / 2 - (content.left + content.right) / 2) <= tolerance, name + 'caption and icons are horizontally centred in the chevron: ' + + JSON.stringify({ union, content })); + assert(Math.abs((union.top + union.bottom) / 2 - (content.top + content.bottom) / 2) <= tolerance, name + 'caption and icons are vertically centred in the chevron: ' + + JSON.stringify({ union, content })); 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); @@ -211,6 +269,7 @@ 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.singleLineRows > 0 && coverage.wrappedRows > 0, 'preview must include both a one-line-caption row (one-line-tall chevrons) and a two-line-caption row (two-line-tall chevrons)'); 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 }; diff --git a/src/scripts/fixtures/dashboard-activity-density.mjs b/src/scripts/fixtures/dashboard-activity-density.mjs index b1a3c7d421..f9a9076d7a 100644 --- a/src/scripts/fixtures/dashboard-activity-density.mjs +++ b/src/scripts/fixtures/dashboard-activity-density.mjs @@ -61,7 +61,13 @@ export function activityDensityFixture(input) { 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); + // One short caption ("Open · hold") → a one-line-tall chevron row; the + // long-handle row above wraps to two. Both heights are probed. + const parked = { repo: 'fixture/activity', kind: 'issue', number: 9009, stage: 0, + state: 'open', title: 'Mock held issue with a one-line chevron caption', + url: 'https://example.invalid/activity/9009', modifiers: ['hold'], + hold: { by: 'hanthor', pill: 'Held by @hanthor', reason: 'Mock human hold' } }; + items.push(unknown, conflict, waiting, running, held, coding, triage, parked); 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],