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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/scripts/integration-governance.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '9204e9706f4019d5be4010ae939812f00133a146';
const TRUSTED_SCRIPTS_TREE = '8cf9edcab6cfbe4e8a847b03209cbca0c604889f';
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()) =>
Expand Down
1 change: 1 addition & 0 deletions changelog.d/fixed-preparation-train-lone-ticket-header.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Activity Monitor no longer draws a "Preparation train · 0 confirmed PRs" header over a single base-preparation ticket; one owner is the refresh lock holder, not a train, and its row comment already carries its state.
6 changes: 6 additions & 0 deletions src/docs/dashboard-sections/activity-monitor.md
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,12 @@ one header and a continuous connector through expanded captions, row padding and
nested PR spacing. An unrelated row or child ends the rail rather than acquiring
misleading membership. A missing, closed or stale front is never synthesized as a
verified owner; recorded/unverified metadata remains explicit.
A lone ticket draws no header: one owner (or one waiter) is the base-refresh lock
holder, not a train, so its row comment carries the role and verification state and
the header's count and front only appear once two recorded tickets share the base.
A refreshed owner is the usual lone ticket — `update-branch` moves its head, so the
ticket reads *Recorded preparation owner · unverified · Head changed* until it merges
or is released; that is expected, not a dropped batch.

When several approved PRs to the same base touch the same files, the automerge lanes merge them one at a time ([#15117](https://github.com/hivecommons/hive/issues/15117)). The tracker renders every train contiguously, in merge order, with a thin left rail linking the rows and a header chip `🚆 merge train · 4 PRs · 1st: #15074` — the glyph is an inline-SVG railcar (14px, currentColor, hover *Merge queue*), the same icon the **Merge queue** column header and its chevrons wear; overlapping files are listed beside it. Pill wording per state is the PR's place in the queue (the owner's words — `front` and `queued-behind` appear nowhere a person reads): the head reads "Queued for merge · 1st of 4 · ~13m" (its own soak left plus the next pass); the others "Queued for merge · 2nd of 4 · ~4m", "Queued for merge · 3rd of 4", … (`1st 2nd 3rd 4th … 11th 12th 13th 21st`, always with the queue length, countdown to its turn); when the page draws more than one train each queue word ends with its train's tag — "Queued for merge · 1st of 2 · train main.go" (the first overlapping file's basename, else the head `#N`) — and the hover leads *Train of 2 PRs overlapping main.go; merges after #15567.*, so two "1st"s on one page tell apart (one train → no tag); the header and every member row of a train share one rail accent (`.ham-train-k0…k3`, cycling in page order); once the front merged and the hive is rebasing a conflicting sibling, "Rebasing · attempt 1/2"; when the loop guard (`auto_merge.merge_train.max_rebase_attempts`) is spent, "Needs human decision · rebase failed twice" at stage/085 with the decision option "Rebase, then merge as maintainer".

Expand Down
4 changes: 3 additions & 1 deletion src/docs/dashboard.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ the actual tracker items and the original train's thin gold side rail through
their rows. Existing train styling and theme tokens supply its spacing, border,
markers and font. A white marker identifies an exact-current preparation owner;
an outlined marker identifies unverified observations. Neither changes CI /
Review chevrons or creates a ready or native queue seat.
Review chevrons or creates a ready or native queue seat. The pill is drawn only
when two or more tickets are recorded for a base; a lone owner shows its state
in its row comment instead.

Subdued comments inside the corresponding PR row retain the current pipeline
caption and add base-refresh context, known ticket age, and the hosting issue
Expand Down
23 changes: 23 additions & 0 deletions src/pkg/dashboard/stage_tracker_preparation_visual.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,29 @@ test('comments dedupe current captions, retain current event detail, and use no
assert.match(actionHtml, /CI · failing current check · queued for base refresh/);
});

test('a lone ticket draws no train header: the owner row keeps its comment and rail, a second ticket brings the header back', () => {
const { ctx } = load(), f = fixture();
// hive #17151: the owner's base refresh moved its head, so the ticket is unverified and the only member.
f.owner.head = 'refreshed-45';
f.q.waiting = [];
f.data.items = [f.owner];
let rows = render(ctx, f), html = content(rows);
assert.deepEqual(rootKeys(rows), [REPO + '/pr#45']);
assert.doesNotMatch(html, /ham-preparation-head|Preparation train|0 confirmed PRs/);
assert.match(html, /ham-preparation-member/);
assert.match(html, /Recorded preparation owner · unverified/);
rows = render(ctx, f, [], []);
assert.doesNotMatch(content(rows), /ham-preparation-head/);
f.q.waiting = [f.first.preparation];
f.data.items = [f.owner, f.first];
html = content(render(ctx, f));
assert.equal((html.match(/ham-preparation-head/g) || []).length, 1);
assert.match(html, /Preparation train · 1 confirmed PRs · recorded front: #45/);
const issue = { kind: 'issue', repo: REPO, number: 500, stage: 40, linked_prs: [f.owner] };
f.q.waiting = []; f.data.items = [issue];
assert.doesNotMatch(content(render(ctx, f)), /ham-preparation-head/);
});

test('policy omission adds no preparation; read errors and missing snapshots explicitly say unavailable, not zero', () => {
const { ctx } = load(), f = fixture();
render(ctx, f);
Expand Down
13 changes: 10 additions & 3 deletions src/pkg/dashboard/static-src/js/tracker-preparation.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,15 @@
const id = 'ham-prep-head-' + encodeURIComponent((q.repo || '') + '|' + (q.base_ref || '') + '|' + suffix);
return `<div class="ham-train-head${stageTrackerTrainAccentClass(STAGE_TRACKER_PREPARATION_ACCENT)} ham-preparation-head"><span class="ham-train-chip">${stageTrackerTrainIconHtml('ham-train-icon', 'Preparation train')} ${esc(text)}</span>${stageTrackerPreparationTooltip(id, stageTrackerPreparationHelp(group), 'ham-preparation-help')}</div>`;
}
// A lone ticket is the base-refresh lock holder, not a train: its row
// comment already says owner/waiting and verified/unverified. The header
// (count + front) only earns its line once two recorded tickets share it.
function stageTrackerPreparationHeaderShown(group) {
return group.queue.state !== 'observed' || group.members.length >= 2;
}
function stageTrackerPreparationMissingRows() {
return _stageTrackerPreparationInline.flatMap((group, index) => group.queue.state !== 'observed'
|| (group.members.length && !group.members.some(e => e.location === 'page'))
return _stageTrackerPreparationInline.flatMap((group, index) => stageTrackerPreparationHeaderShown(group)
&& (group.queue.state !== 'observed' || !group.members.some(e => e.location === 'page'))
? [{ key: 'preparation-missing:' + index, html: stageTrackerPreparationHeaderHtml(group, 'missing', false) }] : []);
}
function stageTrackerPreparationInlineRows(rows, pageItems, stages) {
Expand All @@ -193,7 +199,7 @@
for (const row of rows) {
const item = byKey.get(row.key);
const info = stageTrackerPreparationRowInfo(item, stages);
if (info && !stageTrackerPreparationAdjacent(prev, info)) {
if (info && !stageTrackerPreparationAdjacent(prev, info) && stageTrackerPreparationHeaderShown(_stageTrackerPreparationInline[info.groupIndex])) {
out.push({ key: 'preparation:' + row.key, html: stageTrackerPreparationHeaderHtml(
_stageTrackerPreparationInline[info.groupIndex], row.key, seen.has(info.groupIndex)) });
}
Expand Down Expand Up @@ -258,6 +264,7 @@
const near = Object.assign({}, ctx, { preparationParent: parent, preparationInfo: info,
preparationPrev: infos[i - 1] || null, preparationNext: infos[i + 1] || null });
const heading = !parent && info && !stageTrackerPreparationAdjacent(infos[i - 1], info)
&& stageTrackerPreparationHeaderShown(_stageTrackerPreparationInline[info.groupIndex])
? stageTrackerPreparationHeaderHtml(_stageTrackerPreparationInline[info.groupIndex], 'nested-' + issue.number + '-' + lp.number, seen.has(info.groupIndex)) : '';
if (info) seen.add(info.groupIndex);
return heading + stageTrackerSubRowHtml(lp, issue, stages, nowMs, near);
Expand Down
13 changes: 10 additions & 3 deletions src/pkg/dashboard/static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -21907,9 +21907,15 @@ <h2 class="config-title" id="activity-monitor-labels-title">All labels</h2>
const id = 'ham-prep-head-' + encodeURIComponent((q.repo || '') + '|' + (q.base_ref || '') + '|' + suffix);
return `<div class="ham-train-head${stageTrackerTrainAccentClass(STAGE_TRACKER_PREPARATION_ACCENT)} ham-preparation-head"><span class="ham-train-chip">${stageTrackerTrainIconHtml('ham-train-icon', 'Preparation train')} ${esc(text)}</span>${stageTrackerPreparationTooltip(id, stageTrackerPreparationHelp(group), 'ham-preparation-help')}</div>`;
}
// A lone ticket is the base-refresh lock holder, not a train: its row
// comment already says owner/waiting and verified/unverified. The header
// (count + front) only earns its line once two recorded tickets share it.
function stageTrackerPreparationHeaderShown(group) {
return group.queue.state !== 'observed' || group.members.length >= 2;
}
function stageTrackerPreparationMissingRows() {
return _stageTrackerPreparationInline.flatMap((group, index) => group.queue.state !== 'observed'
|| (group.members.length && !group.members.some(e => e.location === 'page'))
return _stageTrackerPreparationInline.flatMap((group, index) => stageTrackerPreparationHeaderShown(group)
&& (group.queue.state !== 'observed' || !group.members.some(e => e.location === 'page'))
? [{ key: 'preparation-missing:' + index, html: stageTrackerPreparationHeaderHtml(group, 'missing', false) }] : []);
}
function stageTrackerPreparationInlineRows(rows, pageItems, stages) {
Expand All @@ -21919,7 +21925,7 @@ <h2 class="config-title" id="activity-monitor-labels-title">All labels</h2>
for (const row of rows) {
const item = byKey.get(row.key);
const info = stageTrackerPreparationRowInfo(item, stages);
if (info && !stageTrackerPreparationAdjacent(prev, info)) {
if (info && !stageTrackerPreparationAdjacent(prev, info) && stageTrackerPreparationHeaderShown(_stageTrackerPreparationInline[info.groupIndex])) {
out.push({ key: 'preparation:' + row.key, html: stageTrackerPreparationHeaderHtml(
_stageTrackerPreparationInline[info.groupIndex], row.key, seen.has(info.groupIndex)) });
}
Expand Down Expand Up @@ -21984,6 +21990,7 @@ <h2 class="config-title" id="activity-monitor-labels-title">All labels</h2>
const near = Object.assign({}, ctx, { preparationParent: parent, preparationInfo: info,
preparationPrev: infos[i - 1] || null, preparationNext: infos[i + 1] || null });
const heading = !parent && info && !stageTrackerPreparationAdjacent(infos[i - 1], info)
&& stageTrackerPreparationHeaderShown(_stageTrackerPreparationInline[info.groupIndex])
? stageTrackerPreparationHeaderHtml(_stageTrackerPreparationInline[info.groupIndex], 'nested-' + issue.number + '-' + lp.number, seen.has(info.groupIndex)) : '';
if (info) seen.add(info.groupIndex);
return heading + stageTrackerSubRowHtml(lp, issue, stages, nowMs, near);
Expand Down
5 changes: 3 additions & 2 deletions src/scripts/fixtures/dashboard-preparation-rail.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ export function preparationRailLayoutFixture() {
const inspect = (block, selector, name, count) => {
const members = [...block.querySelectorAll(selector)];
check(members.length === count, name + ': exact member count');
check(block.querySelectorAll('.ham-preparation-head').length === 1, name + ': one header');
// A lone ticket is the refresh lock holder, not a train: rail and comment only, no header.
check(block.querySelectorAll('.ham-preparation-head').length === (count >= 2 ? 1 : 0), name + (count >= 2 ? ': one header' : ': no header for a lone ticket'));
check(!block.textContent.includes('continuation'), name + ': no repeated continuation');
const lines = members.map(rail);
geometry.push({ name, lines });
Expand Down Expand Up @@ -80,7 +81,7 @@ export function preparationRailLayoutFixture() {
inspect(roots, '.ham-row.ham-preparation-member', 'root reverse-FIFO rows', 3);
check(roots.querySelector('.ham-preparation-member')?.dataset.hamKey === stageTrackerItemKey(owner), 'verified front is first despite scrambled source sort');
inspect(nested, '.ham-sub.ham-preparation-member', 'nested PRs with expanded captions', 2);
inspect(single, '.ham-row.ham-preparation-member', 'single-member train with multiline caption', 1);
inspect(single, '.ham-row.ham-preparation-member', 'single ticket with multiline caption', 1);
for (const [block, selector, name, count] of [
[roots, '.ham-row.ham-preparation-member', 'last root dynamic comment', 3],
[nested, '.ham-sub.ham-preparation-member', 'last nested dynamic comment', 2],
Expand Down
Loading