diff --git a/changelog.d/added-merge-queue-position.md b/changelog.d/added-merge-queue-position.md index 5512436b71..24ff0aad59 100644 --- a/changelog.d/added-merge-queue-position.md +++ b/changelog.d/added-merge-queue-position.md @@ -1,2 +1,3 @@ -- Activity Monitor: a merge-train member's chip reads its place in the queue — "In merge queue · 2 of 6 · ~4m" — with a countdown to its estimated auto-merge turn that survives poll re-renders, the same words whether or not a merge sweep is evaluating it (the sweep is the spinning glyph and a "Checking now…" hover line), a hover that names what the head waits on (soak left, CI, a maintainer) and the estimate's basis, a ⛓ Merge queue popover listing every train in merge order, and a stall warning ("Merge queue stalled · head #15253 waiting for CI 3h", one activity-log line per train per hour) past `governor.merge_train_stall_warn_s` (default 3600). `/api/stage-tracker` `merge_train` gains `length`, `head_number`, `head_state`, `head_reason`, `head_since`, `eta_s`, `eta_at`, `eta_basis`, `late`, `stalled`, `stalled_s` (#15395). +- Activity Monitor: a merge-train member's chip reads its place in the queue in ordinal words — "Merge queued · 1st", "Merge queued · 2nd · ~4m" (never the `front` / `queued-behind` slugs; hover "2nd of 6 in the merge queue · behind #15253 · ETA ~4m") — with a countdown to its estimated auto-merge turn that survives poll re-renders, the same words whether or not a merge sweep is evaluating it (the sweep is the spinning glyph and a "Checking now…" hover line), a hover that names what the head waits on (soak left, CI, a maintainer) and the estimate's basis, a Merge queue popover listing every train in merge order, a readable inline-SVG train icon on the train header chip ("merge train · 2 PRs · 1st: #15400"), the Merge queue column header and the 080 chevron, and a stall warning ("Merge queue stalled · head #15253 waiting for CI 3h", one activity-log line per train per hour) past `governor.merge_train_stall_warn_s` (default 3600). `/api/stage-tracker` `merge_train` gains `length`, `head_number`, `head_state`, `head_reason`, `head_since`, `eta_s`, `eta_at`, `eta_basis`, `late`, `stalled`, `stalled_s` (#15395). - Merge queue: one PR per issue — when two open PRs declare the same `Fixes #N`, the sweep keeps one (a green head first, then the earlier-opened) and holds the other out of every train with gate state `duplicate-of:` (chip "Duplicate of #15402 · needs a pick", `merge_gate.duplicate_of` / `duplicate_issue`, `needs-decision`); "Let hive decide" on either PR takes the existing supersede path (rule `one-pr-per-issue`: the held one closes as superseded with credit, the kept one is released) (#15395). +- Activity Monitor: the "Merge gate" column is now "Merge queue" everywhere a person reads it (header, hovers, legend, decision copy; ids, classes and JSON keys unchanged), and every merge-train state — the 1st in line included — lights that column even while the lane holds the head at 050/070 (hive's own #15400 lit CI / Review beside its 2nd-place sibling) (#15395). diff --git a/changelog.d/fixed-merge-train-conflicting-excluded.md b/changelog.d/fixed-merge-train-conflicting-excluded.md new file mode 100644 index 0000000000..845c2d1b5a --- /dev/null +++ b/changelog.d/fixed-merge-train-conflicting-excluded.md @@ -0,0 +1 @@ +- Merge train: a PR GitHub reports conflicting on its own, or one at 072 returned-to-contributor (label or stage record), is no longer admitted to or counted in a merge train and draws no train idle comment — hive's own conflicting #15307 read `queued-behind#15424:4/6`; a conflicting PR rides only while the train itself is repairing it (#15395). diff --git a/src/docs/api-reference/dashboard-misc.md b/src/docs/api-reference/dashboard-misc.md index 90add518a2..4955e54ec8 100644 --- a/src/docs/api-reference/dashboard-misc.md +++ b/src/docs/api-reference/dashboard-misc.md @@ -39,7 +39,7 @@ Part of the [Dashboard REST API reference](../api-reference.md); see that page f | `GET` | `/api/budget-ignore` | Dashboard auth/session | Budget Ignore Get | `pkg/dashboard/api.go:172` | | `POST` | `/api/budget-ignore` | Owner only | Budget Ignore Set | `pkg/dashboard/api.go:173` | | `GET` | `/api/summaries` | Dashboard auth/session | Summaries | `pkg/dashboard/api.go:185` | -| `GET` | `/api/stage-tracker` | Dashboard auth/session | Stage Tracker: every open issue and pull request of the watched repos for the Hive activity monitor — actionable, held, claimed, in-progress, covered-by-PR, filtered (`needs-*`), draft and exempt-labelled items alike, each with `stage`, `stage_since`, `labels`, `created_at`, `author_kind`, `modifiers`, `claimant: {kind: hive-agent|clanker|person, login, agent, hive, since, source: claim-comment|assignee|kick-history|author}` naming who holds a claimed / in-progress issue or a PR under review or rework (absent when nobody is named; mirrored onto `linked_prs[]`), (PRs) `sentinel_alert` / `sentinel_findings` / `sentinel_reason` when the sentinel flagged the PR, `decision_needed` on a row parked on a person (085 / 045 / 015, the needs-human pill; mirrored onto the issue's `linked_prs[]` entry): `{question, asked_by, since, blocker, blocker_reason, options: [{action, label, enabled, reason_if_disabled}]}` — the reviewer's own decision question when the verdict record has one, the blocker in plain words, and the applicable actions under the row context menu's action ids (`decide:delegate` first), (PRs) `lineage` on the hive's copy of an adopted PR — `{kind: adopted|superseded|rebased-by-hive, from_number, from_url, from_author, from_author_kind, to_number, to_url, at, reason}`, derived from the stage store's adoption record or the `hive/adopt-` head branch, mirrored onto the issue's `linked_prs[]` entry; absent on every other row — and (issues) `linked_prs`; items with no stage yet report stage `0` "Open"; `needs_human_labels` is the "a person must act" label set behind the monitor's Needs human facet (the same list as `/api/status.labelPresets[needs-human]`); `recently_merged` lists the PRs (`repo`, `number`, `merged_at`) whose `pr_merged` audit entry is under 30 minutes old, so a client diffing two payloads can tell a merge from a close; a PR in a conflict-aware merge train carries `merge_train` `{id, state, front, position, size, attempt, max_attempts, overlap_files, ahead, length, head_number, head_state, head_reason, head_since, eta_s, eta_at, eta_basis, late, stalled, stalled_s}` — `head_state` one of `needs-human` / `ci` / `soaking` / `ready` / `merging` / `fixing` / `unknown` with `head_reason` in plain words; `eta_s` / `eta_at` the estimated wait for this member's own merge attempt (own remaining soak + each PR ahead's remaining soak or one sweep + the next sweep tick; absent while the head waits on a person or CI), `eta_at` anchored to the member's first estimate at its position so a countdown survives polls, `eta_basis` its short reading ("2 ahead · head soaking 12m · next sweep in 40s"), `late` once now has overrun the first estimate twice over, `stalled` / `stalled_s` once the head has sat longer than `governor.merge_train_stall_warn_s` ([#15395](https://github.com/hivecommons/hive/issues/15395)); a PR the queue holds because another open PR declares the same `Fixes #N` carries no `merge_train` and a `merge_gate` of `{state: "duplicate-of:", duplicate_of, duplicate_issue}` plus the `needs-decision` modifier (the queue keeps one PR per issue: green first, then the earlier-opened). Served from a server-side cache rebuilt at most every `dashboard.stage_tracker.cache_ttl_s` (default `governor.eval_interval_s`) from the spoke's existing snapshot — a request never calls GitHub. Carries `generated_at`, `source` (`cache` or `fresh`), `cache_ttl_s`, an `ETag` and `Cache-Control: private, max-age=`; `If-None-Match` yields 304. Each hit is recorded under REST caller `dashboard:stage-tracker` so `/api/gh-rate-limits` shows it charged nothing. | `pkg/dashboard/api.go:186` | +| `GET` | `/api/stage-tracker` | Dashboard auth/session | Stage Tracker: every open issue and pull request of the watched repos for the Hive activity monitor — actionable, held, claimed, in-progress, covered-by-PR, filtered (`needs-*`), draft and exempt-labelled items alike, each with `stage`, `stage_since`, `labels`, `created_at`, `author_kind`, `modifiers`, `claimant: {kind: hive-agent|clanker|person, login, agent, hive, since, source: claim-comment|assignee|kick-history|author}` naming who holds a claimed / in-progress issue or a PR under review or rework (absent when nobody is named; mirrored onto `linked_prs[]`), (PRs) `sentinel_alert` / `sentinel_findings` / `sentinel_reason` when the sentinel flagged the PR, `decision_needed` on a row parked on a person (085 / 045 / 015, the needs-human pill; mirrored onto the issue's `linked_prs[]` entry): `{question, asked_by, since, blocker, blocker_reason, options: [{action, label, enabled, reason_if_disabled}]}` — the reviewer's own decision question when the verdict record has one, the blocker in plain words, and the applicable actions under the row context menu's action ids (`decide:delegate` first), (PRs) `lineage` on the hive's copy of an adopted PR — `{kind: adopted|superseded|rebased-by-hive, from_number, from_url, from_author, from_author_kind, to_number, to_url, at, reason}`, derived from the stage store's adoption record or the `hive/adopt-` head branch, mirrored onto the issue's `linked_prs[]` entry; absent on every other row — and (issues) `linked_prs`; items with no stage yet report stage `0` "Open"; `needs_human_labels` is the "a person must act" label set behind the monitor's Needs human facet (the same list as `/api/status.labelPresets[needs-human]`); `recently_merged` lists the PRs (`repo`, `number`, `merged_at`) whose `pr_merged` audit entry is under 30 minutes old, so a client diffing two payloads can tell a merge from a close; a PR in a conflict-aware merge train carries `merge_train` `{id, state, front, position, size, attempt, max_attempts, overlap_files, ahead, length, head_number, head_state, head_reason, head_since, eta_s, eta_at, eta_basis, late, stalled, stalled_s}` — `head_state` one of `needs-human` / `ci` / `soaking` / `ready` / `merging` / `fixing` / `unknown` with `head_reason` in plain words; `eta_s` / `eta_at` the estimated wait for this member's own merge attempt (own remaining soak + each PR ahead's remaining soak or one sweep + the next sweep tick; absent while the head waits on a person or CI), `eta_at` anchored to the member's first estimate at its position so a countdown survives polls, `eta_basis` its short reading ("2 ahead · head soaking 12m · next sweep in 40s"), `late` once now has overrun the first estimate twice over, `stalled` / `stalled_s` once the head has sat longer than `governor.merge_train_stall_warn_s` ([#15395](https://github.com/hivecommons/hive/issues/15395)); a PR the queue holds because another open PR declares the same `Fixes #N` carries no `merge_train` and a `merge_gate` of `{state: "duplicate-of:", duplicate_of, duplicate_issue}` plus the `needs-decision` modifier (the queue keeps one PR per issue: green first, then the earlier-opened); a PR GitHub reports conflicting on its own, or one at stage/072, carries no `merge_train` and is not counted in any member's `size` / `length` — the state slugs (`front`, `queued-behind`) are payload values only, the SPA renders ordinal places ("Merge queued · 1st"). Served from a server-side cache rebuilt at most every `dashboard.stage_tracker.cache_ttl_s` (default `governor.eval_interval_s`) from the spoke's existing snapshot — a request never calls GitHub. Carries `generated_at`, `source` (`cache` or `fresh`), `cache_ttl_s`, an `ETag` and `Cache-Control: private, max-age=`; `If-None-Match` yields 304. Each hit is recorded under REST caller `dashboard:stage-tracker` so `/api/gh-rate-limits` shows it charged nothing. | `pkg/dashboard/api.go:186` | | `POST` | `/api/prs/{owner}/{repo}/{number}/queue-automerge` | Merger/owner role | Queue PRAuto Merge | `pkg/dashboard/api.go:187` | | `GET` | `/api/inference/models/{backend}` | Dashboard auth/session | Inference Models | `pkg/dashboard/api.go:363` | | `GET` | `/api/hive-id` | Dashboard auth/session | Hive IDGet | `pkg/dashboard/api.go:425` | diff --git a/src/docs/dashboard-copy-inventory.md b/src/docs/dashboard-copy-inventory.md index ed389e86fb..b16d4052a1 100644 --- a/src/docs/dashboard-copy-inventory.md +++ b/src/docs/dashboard-copy-inventory.md @@ -80,3 +80,26 @@ The new hover, verbatim (title line omitted): - The stage descriptions in `stagelabels.Table` are shared with the labels and the docs and were not shortened; the 090 chevron tip simply stopped appending them. + +## Merge queue (hivecommons/hive#15395) + +The owner read the train's slugs on the page — "front", "queued-behind" — +and asked what they meant. Every place the train's position appears now +uses the same words, and no user-facing train string carries either slug +(`TestStageTrackerMergeTrainOrdinalWords` and the Go `Sentence` test fail +on one). The column itself is **Merge queue** (was *Merge gate*; ids, +classes and JSON keys — `merge_gate`, `trackerColumnMergeGate` — keep the +old name). + +| Builder | Reaches | Before | After | Held by | +|---|---|---|---|---| +| `STAGE_TRACKER_TRAIN_STATE_WORD` (`tracker-words.js`) | chevron label, gate pill | `front` → *Next to merge*, `queued-behind` → *In merge queue* | both *Merge queued*; the place tells them apart | `TestStageTrackerMergeTrainStateSlugsNeverLeak` | +| `stageTrackerTrainWord` | chevron label | *In merge queue · 2 of 6* / *front* (leaked) | *Merge queued · 1st* / *· 2nd* / *· 3rd* … + *· ~4m* countdown | `TestStageTrackerMergeTrainOrdinalWords` | +| `stageTrackerOrdinal` | chevron, hover, popover | — | `1st 2nd 3rd 4th … 11th 12th 13th 21st 22nd 23rd` | same | +| `stageTrackerTrainQueueTip` | chevron hover | *Behind #15253 … Estimated turn: ~25m.* / *Front of the merge queue* | *2nd of 6 in the merge queue · behind #15253 · ETA ~25m.* / *1st of 6 in the merge queue · merges next · ETA ~4m.*; *· merge sweep running* lives here only (one label per chevron, #15416) | same | +| `stageTrackerTrainHeaderText` + `stageTrackerTrainIconHtml` | train header chip | `⛓ merge train · 2 PRs · front #15400` | 🚆 (inline-SVG railcar, hover *Merge queue*) `merge train · 2 PRs · 1st: #15400` | `TestStageTrackerMergeTrain` | +| `stageTrackerQueueMemberState` (`tracker-queue.js`) | Merge queue popover | *front of the queue* | *merges next* | `TestStageTrackerMergeQueuePopover` | +| `stageTrackerAnchor` (`tracker-row.js`) | which column lights | a 1st-in-train head at 050/070 lit **CI / Review** | every train state lights **Merge queue** | `TestStageTrackerMergeTrainStatesLightMergeColumn` | +| `stageTrackerHeaderHtml` | column header | *Merge gate* | 🚆 *Merge queue* (same icon as the chip and the 080 chevron) | `TestStageTrackerHeader…` | +| Go: `prstage.MergeTrain.Sentence`, `stageTrackerMergeTrainFrontCaption`, `eta_basis` | gate reason, caption, hover | *front of the merge train (1st of 3)*, *Front of a merge train of N PRs* | *1st in the merge queue; merges next (1st of 3)*, *1st in a merge queue of N PRs* | `TestParseMergeTrainRejectsMalformed` | +| "merge gate" in decision copy (`delegatedecision` glossary, ladder, dashboard decided/new/vocabulary) | glossary, ⋯ hints, PR comments | *the merge gate merges it once every check passes* | *the merge queue merges it …* | `TestStageTrackerDecisionGlossaryMirrorsGo` | diff --git a/src/docs/dashboard-sections.md b/src/docs/dashboard-sections.md index f93f5102f8..c5107acef8 100644 --- a/src/docs/dashboard-sections.md +++ b/src/docs/dashboard-sections.md @@ -756,7 +756,7 @@ For terminology such as stage, lane, sentinel, adoption and ratchet, use the [re The column header names the shared route: -`Open → Actionable (010) → Claimed (020) → PR in progress (030/040) → CI / Review (050) → Merge gate (060/080/095/100) → merged` +`Open → Actionable (010) → Claimed (020) → PR in progress (030/040) → CI / Review (050) → Merge queue (060/080/095/100) → merged` Only the current chevron is coloured and named. Passed steps have a neutral fill; future steps have a faint outline. The final cap has a history mark (clock with counter-clockwise arrow, “History — decisions and actions on this item”) until merge, then a green ✓. @@ -768,8 +768,8 @@ Side stages share a column rather than adding columns: | 045 Needs human decision | Actionable on an issue. A pre-045 issue still wearing 085 is drawn here until reconciliation. | | 070 Fixing / 071 Needs author / 072 Returned to contributor | CI / Review: Hive repairs its own PR at 070; a human author acts at 071; a contributor agent gets its PR back at 072. `needs-rebase` explains a repair here, not at 050. | | 074 Adopted by hive | CI / Review while the Hive repairs adopted work; pending, green or red pushes remain 074 until the merge gate takes it. | -| 085 Needs human decision / 090 Ready for human merge | Merge gate on a PR. Read the decision or merge reason rather than assuming Hive will merge it. | -| 060 / 080 / 095 / 100 | Separate gate states; use the [merge-gate reference](#merge-gate-pills--legend) below for exact words and countdowns. | +| 085 Needs human decision / 090 Ready for human merge | Merge queue on a PR. Read the decision or merge reason rather than assuming Hive will merge it. | +| 060 / 080 / 095 / 100 | Separate gate states; use the [merge-gate reference](#merge-queue-pills--legend) below for exact words and countdowns. | The author legend is a blue Hive hexagon, purple contributor-agent robot or teal human silhouette. The kind is `author/*`, inferred from the snapshot if its label is absent; the link tooltip names the login. On Claimed, the actor is the claim holder; on PR in progress and Returned to contributor it is the author. Hive owns review, adoption and auto-merge work; a human owns a human decision or manual merge. The payload's `stage_actor` is the authoritative actor (see [Who is on it](#who-is-on-it-actor-icons)). @@ -909,16 +909,17 @@ It counts under **Needs attention**. Before the merge gate only the held-workflo #### Merge train -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 · front #15074` (overlapping files listed beside it). Pill wording per state: the front reads "Next to merge · 1 of 4 · ~13m" (its own soak left plus the next sweep); siblings "In merge queue · 2 of 4 · ~4m" (position, length, countdown to its turn); 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". +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 "Merge queued · 1st · ~13m" (its own soak left plus the next sweep); the others "Merge queued · 2nd · ~4m", "Merge queued · 3rd", … (`1st 2nd 3rd 4th … 11th 12th 13th 21st`, countdown to its turn); 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". The tooltip lists the PRs ahead and the overlapping files. Waiting siblings are never red, never `needs human`; a `needs-rebase` label on one is reported under `stale_labels`, the train repairs it. Each item carries `merge_gate.state` (`queued-behind` / `rebasing` / `rebase-exhausted` / `front`, with an honest `reason` such as `behind #15074 in merge train (3rd of 4, overlapping files: stage_tracker.go, index.html)`) and `merge_train{id, state, front, position, size, attempt, max_attempts, overlap_files, ahead}`; the id is `#`. -**Queue position, countdown, stall** ([#15395](https://github.com/hivecommons/hive/issues/15395)). The queued chip is its place in the queue and nothing else — **In merge queue · 2 of 6 · ~4m** — so it reads the same whether or not a merge sweep is evaluating it: the sweep is the spinning ⬡ glyph and a *Checking now…* line in the hover, never a change of words, and no state slug (`queued-behind`) ever reaches the page. The hover names what the row waits on — *Behind #15253 (soaking, 12m left) and 1 more. Hive merges one at a time, in order. Estimated turn: ~25m (2 ahead · head soaking 12m · next sweep in 40s).* — or, when the head is on a person or on CI, the blocker instead of a clock: *Head #15253 is waiting for a maintainer (untrusted author); no estimate until it moves.* The server adds to each member's `merge_train`: `length`, `head_number`, `head_state` (`needs-human` / `ci` / `soaking` / `ready` / `merging` / `fixing` / `unknown`), `head_reason` (plain words), `head_since`, `eta_s`, `eta_at`, `eta_basis`, `late`, `stalled`, `stalled_s`. +**Queue position, countdown, stall** ([#15395](https://github.com/hivecommons/hive/issues/15395)). The queued chip is its place in the queue and nothing else — **Merge queued · 2nd · ~4m** — so it reads the same whether or not a merge sweep is evaluating it: the sweep is the spinning ⬡ glyph and a *Checking now…* line in the hover, never a change of words (one label per chevron), and no state slug (`queued-behind`, `front`) ever reaches the page. The hover is the place sentence — *2nd of 6 in the merge queue · behind #15253 (soaking, 12m left) · ETA ~25m (2 ahead · head soaking 12m · next sweep in 40s). Hive merges one at a time, in order.*; the head's reads *1st of 6 in the merge queue · merges next · ETA ~13m.* — or, when the head is on a person or on CI, the blocker instead of a clock: *… behind #15253 (waiting for a maintainer (untrusted author)) · no estimate until #15253 moves.* Every train state — the 1st included — lights the **Merge queue** column, whatever numeric stage the lane holds the head at (the train's facts are mirrored onto a head still at 050/070; hive's own #15400 once lit CI / Review beside its 2nd-place sibling). The server adds to each member's `merge_train`: `length`, `head_number`, `head_state` (`needs-human` / `ci` / `soaking` / `ready` / `merging` / `fixing` / `unknown`), `head_reason` (plain words), `head_since`, `eta_s`, `eta_at`, `eta_basis`, `late`, `stalled`, `stalled_s`. **One PR per issue** ([#15395](https://github.com/hivecommons/hive/issues/15395)). Two open PRs declaring the same `Fixes #N` never both ride the queue (hive's own #15402 and #15407, both for #15396, once sat side by side as "waiting its turn"). Before the trains are grouped the sweep keeps one PR per closing issue — a green head (not conflicting, not blocked on a red required check) beats a red one; among equals the earlier-opened wins — and holds the other out of every train with the stage reason `merge-train:duplicate-of#:/0:0/0:`. The held row's gate reads `duplicate-of:` (`merge_gate.duplicate_of`, `merge_gate.duplicate_issue`), its chip **Duplicate of #15402 · needs a pick** with no clock, it carries no `merge_train`, and it wears `needs-decision` so both PRs sit under their issue with the hold visible. *Let hive decide* on either row takes the existing supersede path (rule `one-pr-per-issue`): on the held PR it closes it as superseded by the kept one with a credit comment, through the same write gate as every delegate close; on the kept PR it releases it and names the duplicate the queue holds (or, if the kept PR has since gone red, only recommends the fix — the queue re-picks on its next pass, so an earlier red PR yields to a later green one). - **Countdown to auto-merge.** `eta_s` is the member's own remaining soak, plus — for each PR ahead — its remaining soak or, with no clock of its own, one sweep (the lanes' floor cadence), plus the wait for the next sweep tick; `eta_basis` is the short reading ("2 ahead · head soaking 12m · next sweep in 40s"). The chip's `· ~4m` counts down in place from `eta_at` on the same tick as the soak clock, and `eta_at` is anchored server-side to the member's first estimate at its position (re-anchored only when a fresh estimate runs more than a sweep longer), so a poll re-render never resets it. Past the estimate it reads *any sweep now*; past twice the first estimate `late` is set and the chip reads *running late* with the estimate kept in the hover. Always a `~`: an estimate, not a promise. A head on a person, on CI or being fixed — or a member that is itself a person's — carries no estimate and the blocker instead. -- **Merge queue popover.** The sticky bar's **⛓ Merge queue N** chip (hidden with no train) opens a popover listing every train in merge order — ordinal, #, title, state in words, ETA — with the head's blocker on the front row; same pattern as the **Merged** popover (click outside / Escape closes). +- **Merge queue popover.** The sticky bar's **🚆 Merge queue N** chip (hidden with no train) opens a popover listing every train in merge order — ordinal, #, title, state in words, ETA — with the head's blocker on the front row; same pattern as the **Merged** popover (click outside / Escape closes). +- **Who rides.** A PR GitHub reports conflicting (`mergeable: CONFLICTING` / `DIRTY`) on its own, or one at **072 Returned to contributor** (by label or by the hive's stage record), is neither a member nor counted in the queue's length and draws no train idle comment — hive's own #15307 once read `queued-behind#15424:4/6` while conflicting at 072. A conflicting PR rides only while the train itself is repairing it (its rebase was requested behind a merged head and the loop guard still has attempts). - **Stall warning.** Once the head has sat in one stage longer than `governor.merge_train_stall_warn_s` (default 3600) and is not merging — a soaking head counts only once its own clock has overrun — every member's chip turns to **Merge queue stalled · head #15253 waiting for CI 3h**, the popover marks the train, and the activity log records one `merge train stalled` line per train per hour. #### Pills before the merge gate @@ -1051,7 +1052,7 @@ A filled neutral pill once an action is recorded; **amber** when the item is sti The in-flight spinner on the chevron is a different cue: that is the request still on the wire; the badge appears once the server has recorded it. Hover or focus (the badge is in the Tab order) opens an in-app tooltip — never a native `title` — written in plain words, no stage codes, in the order every cue on the row uses: **what it is waiting on → what you chose → what the hive did next**. -E.g. `At Merge gate — waiting on CI.` / `You chose Approve · 15:55 (5 min ago) · done — released to the hive.` / `Then the hive moved it to Merged — a reviewer approved it · 1 min ago.` Once the item moves on, the badge stays and the first line reads `Addressed — now at `; while stuck it reads `Still at 42 min after you asked — hive says: `. Another operator's action is named (`@someone chose …`); your note and "N earlier actions on this item" follow. The **Decisions** select in the toolbar narrows the list: *Awaiting my decision* (parked on a person, no action recorded yet, or the last one failed), *I acted* (any badge), *Acted, still stuck* (amber badges only). +E.g. `At Merge queue — waiting on CI.` / `You chose Approve · 15:55 (5 min ago) · done — released to the hive.` / `Then the hive moved it to Merged — a reviewer approved it · 1 min ago.` Once the item moves on, the badge stays and the first line reads `Addressed — now at `; while stuck it reads `Still at 42 min after you asked — hive says: `. Another operator's action is named (`@someone chose …`); your note and "N earlier actions on this item" follow. The **Decisions** select in the toolbar narrows the list: *Awaiting my decision* (parked on a person, no action recorded yet, or the last one failed), *I acted* (any badge), *Acted, still stuck* (amber badges only). #### Legend — the three cues a row may carry @@ -1063,7 +1064,7 @@ Plain words throughout — working / waiting on X / set back by Y / merged — n Right-clicking a row — or a nested PR sub-row — opens an in-app context menu of the actions that fit that item's current state; the ⋯ button in the row's left gutter (every nested PR sub-row has its own gutter with its own checkbox and ⋯) opens the same menu for pointer-free use, and so do **Shift+F10** and the context-menu key while the row or anything in it has focus (every row is a tab stop). -The menu is positioned at the pointer, clamped to the viewport, uses `menu` / `menuitem` roles, moves focus with ↑ ↓ Home End, opens the *Decide…* group with → and closes it with ←, and closes on Esc, Tab, click-away, scroll or resize, returning focus to the row. Shift+right-click keeps the browser's own menu. Entries, each shown only when it applies: **Decide…** on a row waiting on a person — a PR wearing the *Needs human decision* pill at 085 on the Merge gate column (the primary case: e.g. two competing `dibs` PRs), an issue row whose one nested PR is parked there (the menu reads *Decide PR #458…* and acts on that PR, since the issue's own stage is only mirrored from it), or an issue parked at 045. +The menu is positioned at the pointer, clamped to the viewport, uses `menu` / `menuitem` roles, moves focus with ↑ ↓ Home End, opens the *Decide…* group with → and closes it with ←, and closes on Esc, Tab, click-away, scroll or resize, returning focus to the row. Shift+right-click keeps the browser's own menu. Entries, each shown only when it applies: **Decide…** on a row waiting on a person — a PR wearing the *Needs human decision* pill at 085 on the Merge queue column (the primary case: e.g. two competing `dibs` PRs), an issue row whose one nested PR is parked there (the menu reads *Decide PR #458…* and acts on that PR, since the issue's own stage is only mirrored from it), or an issue parked at 045. **PR-scoped actions on nested PRs** ([#15009](https://github.com/hivecommons/hive/issues/15009): one issue, two PRs — [#15017](https://github.com/hivecommons/hive/pull/15017) *Ready for human merge · untrusted author* and [#15020](https://github.com/hivecommons/hive/pull/15020) *Needs human decision* — and no way to decide one without the other): every nested PR sub-row carries its own ⋯ menu, and its *Decide…* (Let hive decide, Approve, Close as superseded by…, Won't fix…, Give direction…), *Hold* / *Release hold* and the rest act on **that PR** — `runRowAction(action, row)` receives the PR's own row object (number, repo, head), never the parent issue's, and the needs-human popover opened from a sub-row's chevron does the same. @@ -1169,9 +1170,9 @@ A person's hold names them in the blocker instead (*On hold (set by @login) — A hive-authored PR never keeps a hive-set reporter-trust hold: the same pass releases it, so the pill is normally seen only on contributor PRs. -#### **Merge gate pills — legend** +#### **Merge queue pills — legend** -Stages 080, 095 and 100 share the **Merge gate** column (060 *reviewed* is pre-admission — it can still regress to 070 — so it lights **CI / Review** with the word *Review passed*), but they do not mean the same thing. Use the stage word and live detail, not the presence of a working glyph, to judge merge progress ([#15073](https://github.com/hivecommons/hive/issues/15073)). +Stages 080, 095 and 100 share the **Merge queue** column (the column was *Merge gate* until [#15395](https://github.com/hivecommons/hive/issues/15395); ids, classes and JSON keys — `merge_gate`, `trackerColumnMergeGate` — keep the old name) (060 *reviewed* is pre-admission — it can still regress to 070 — so it lights **CI / Review** with the word *Review passed*), but they do not mean the same thing. Use the stage word and live detail, not the presence of a working glyph, to judge merge progress ([#15073](https://github.com/hivecommons/hive/issues/15073)). Every PR at the gate now carries `merge_gate: {state, reason, sweep_running, last_sweep_at, next_sweep_at, soak_until, soak_remaining_seconds}` in the payload (mirrored on the issue's nested `linked_prs`), and the lit chevron reads one word per state, in pipeline order, with the live detail after a `·`: @@ -1181,13 +1182,13 @@ Every PR at the gate now carries `merge_gate: {state, reason, sweep_running, las | 080 awaiting merge admission | **Ready for auto merge** | *next sweep in 42s* (counts down in place; *sweep due now* once past) | 🕓 clock — *Approved and green; waiting for hive's merge sweep — next sweep in 42s. …* | | 095 pre-merge soak | **Soaking** | *7m left* (counts down; *soak window complete* once past) | 🕓 clock — *Admitted by the automerge lane; waiting for the soak window: 7m left. hive merges on its first sweep after that.* | | any of the above while a pass is evaluating this PR | the stage's word | *merge sweep running* | ⟳ (static) — *hive's merge sweep is running on this PR now.* | -| 080 in a merge train (`merge_gate.state: queued-behind` / `front`) | **In merge queue · 2 of 6** (position of length; **Merge queue stalled · head #15253 waiting for CI 3h** once stalled) | *~4m* (counts down to its estimated turn from `merge_train.eta_at`; *any sweep now* once past; *running late* past twice the first estimate; nothing while the head is on a person or CI) — the words never change with the sweep | 🕓 clock, or ⟳ spinning while a sweep evaluates it — *Behind #15253 (soaking, 12m left) and 1 more. Hive merges one at a time, in order. Estimated turn: ~25m (2 ahead · head soaking 12m · next sweep in 40s). Checking now… Last checked 12s ago.* | +| 080 in a merge train (`merge_gate.state: queued-behind` / `front`) | **Merge queued · 2nd · ~4m** / **Merge queued · 1st** (ordinal place and countdown; **Merge queue stalled · head #15253 waiting for CI 3h** once stalled) | *~4m* (counts down to its estimated turn from `merge_train.eta_at`; *any sweep now* once past; *running late* past twice the first estimate; nothing while the head is on a person or CI) — the words never change with the sweep | 🕓 clock, or ⟳ spinning while a sweep evaluates it — *Behind #15253 (soaking, 12m left) and 1 more. Hive merges one at a time, in order. Estimated turn: ~25m (2 ahead · head soaking 12m · next sweep in 40s). Checking now… Last checked 12s ago.* | | 100 merge queue | **Merging** | — | ⟳ (static) — *Admitted and soaked; hive is merging it now (GitHub merge queue / merge window).* | | any stage while hive's merge call is in flight (`merge_gate.merging_since`, `merge_path`) | **Merging** | *merge call in flight*, then *merge landed* while the SPA holds the row | ⟳ (static) — *hive is merging it now (automerge sweep) — the merge call has been in flight since 3s ago.* | | any stage after GitHub refused hive's merge call (`merge_gate.state: merge-failed`, `merge_failed`, `merge_failed_kind`, `merge_failed_text`, `merge_failed_at`) | **Merge failed** | the refusal translated to a short phrase — *branch protection*, *needs rebase*, *not allowed*, *review required*, or *retrying* while the sweep is on it; never GitHub's raw text | 🕓 clock — *hive tried to merge this (maintainer merge from the dashboard) 9s ago and GitHub refused — branch protection blocks it. The lane re-evaluates it on its next pass. Details: 405 Pull Request is not mergeable* | | any stage after the merge call drew *N of M required status checks are expected* (`merge_failed_kind: checks-pending`, `merge_failed_checks`) | **Waiting for CI** | *4 checks* | ⟳ while the sweep is on it, else 🕓 — *hive tried to merge this (automerge sweep) 1m ago before its required checks had reported — 4 required checks haven't finished. It merges once they pass.* | -A merge outcome (**Merging**, **Merge failed**, **Waiting for CI**) always lights the **Merge gate** column, whatever numeric stage the lane fell back to (hivecommons/docs#512 drew "Merge failed" in CI / Review because the PR sat at 060). +A merge outcome (**Merging**, **Merge failed**, **Waiting for CI**) always lights the **Merge queue** column, whatever numeric stage the lane fell back to (hivecommons/docs#512 drew "Merge failed" in CI / Review because the PR sat at 060). | 110 | **Merged** (the ✓ cap) | — | — | #### Merging is held for the toast's lifetime diff --git a/src/docs/labels-and-control-signals.md b/src/docs/labels-and-control-signals.md index f41013123b..936716640f 100644 --- a/src/docs/labels-and-control-signals.md +++ b/src/docs/labels-and-control-signals.md @@ -2370,7 +2370,7 @@ The plain-words comment the delegate posts has four lines — **Hive decided** ( | `flaky-test` | a flaky test, quarantined with a retry | The failure is a flaky test: it is quarantined with a retry and a separate deflake task is filed, so it blocks nothing. | | `hive-policy` | this changes the hive's own rules | This changes the hive's own settings, governance or security posture; the hive only recommends and the owner confirms. | | `llm-delegate` | decided by the hive's model under the owner's rules | No mechanical rule applied, so the hive's model decided under the owner's standing rules; the same safety rails applied. | -| `mergeable-as-is` | mergeable and green as it is; handed to the merge gate | The head is mergeable with green CI, so no adoption is needed: the hive approves it and the merge gate takes it as it is. | +| `mergeable-as-is` | mergeable and green as it is; handed to the merge queue | The head is mergeable with green CI, so no adoption is needed: the hive approves it and the merge queue takes it as it is. | | `one-pr-per-issue` | two PRs fix the same issue; the merge queue keeps one | Two open PRs declare the same closing issue. The merge queue carries one PR per issue — a green head first, then the earlier-opened — and the other closes as superseded with credit. | | `owner-only`, `owner_only` | only the hive owner can do this | This needs a secret, token or organization permission that only the hive owner holds; the hive cannot do it for you. | | `prefer-contributor` | a contributor's PR and a hive PR do the same work | A contributor's PR and a hive-authored PR cover the same work; the hive prefers the contributor's when it is mergeable and current. | @@ -2391,7 +2391,7 @@ The plain-words comment the delegate posts has four lines — **Hive decided** ( | `accept-ratchet` | accepted as a ratchet | Accepted as a ratchet: baseline recorded now, failures only on increases. | | `adopt` | hive takes over finishing this PR | Adopt means the hive takes over finishing this PR: it rebases, fixes CI and merges it, keeping the author's commits and sign-off. | | `adopt-supersede`, `adopted`, `adoption/supersede`, `supersede`, `supersede-now` | close this PR and open a fresh hive-authored PR with the same commits | Supersede means the hive closes this PR and opens a fresh hive-authored PR carrying the same commits and sign-off, then finishes it itself. | -| `approve`, `approve-review`, `approved` | approved for merge | The hive approved it; the merge gate merges it once every check passes. | +| `approve`, `approve-review`, `approved` | approved for merge | The hive approved it; the merge queue merges it once every check passes. | | `close-as-duplicate`, `close-duplicate` | closed as a duplicate | Closed because an older item already tracks the same work. | | `close-superseded`, `closed`, `superseded` | closed because another PR carries the work | Closed because another PR carries the same work; the author is credited there. | | `comment-decision` | recorded the decision on GitHub | The hive posted the decision as a `/hive decision` comment, the way a maintainer would. | @@ -2417,7 +2417,7 @@ The plain-words comment the delegate posts has four lines — **Hive decided** ( | `author-online` | the author's clanker or hive is connected, so hive won't take the PR over | Adoption is for authors whose clanker or hive has gone offline; this author's is connected, so the hive leaves the PR with them. | | `blocker`, `capability`, `human-only` | the hive can't do this itself | The item is blocked on something the hive cannot do: a permission the GitHub App lacks, or a step only a person may take. No decision clears it; grant the permission (and re-check) or do the step by hand (hivecommons/hive#15099). | | `behind` | the branch is behind the base branch | The branch is behind the base branch and must be updated before it can merge. | -| `changes-requested`, `changes_requested`, `contributor-lane:changes-requested`, `human-changes-requested`, `request_changes`, `reviewer-verdict:request_changes` | a reviewer asked for changes; inspect whether the objection is from the swarm or a human | A new commit can address the objection. A trusted human's GitHub APPROVED review on the exact head can override any non-approved **swarm** outcome at the merge review gate, including `changes_requested`/`reject`; for swarm-review purposes, `/hive decision approve` only answers `requires_human`. This does not bypass an independent human change request or any other merge gate. | +| `changes-requested`, `changes_requested`, `contributor-lane:changes-requested`, `human-changes-requested`, `request_changes`, `reviewer-verdict:request_changes` | a reviewer asked for changes; inspect whether the objection is from the swarm or a human | A new commit can address the objection. A trusted human's GitHub APPROVED review on the exact head can override any non-approved **swarm** outcome at the merge review gate, including `changes_requested`/`reject`; for swarm-review purposes, `/hive decision approve` only answers `requires_human`. This does not bypass an independent human change request or any other merge queue. | | `checks-failing`, `ci-failing`, `ci-red`, `red` | CI is failing on this branch | Required checks are failing on this branch; nothing merges until they are green. | | `conflict`, `conflicting`, `dirty` | the branch conflicts with the base branch | The branch has merge conflicts with the base branch; it needs a rebase before anything can merge. | | `contributor-lane:sentinel-blocked`, `sentinel`, `sentinel-alert`, `sentinel-blocked` | security-sensitive files changed; a maintainer must approve | Security-sensitive files changed. The hive never merges until a maintainer reviews and removes the sentinel label. | @@ -2428,8 +2428,8 @@ The plain-words comment the delegate posts has four lines — **Hive decided** ( | `no-effect` | the decision hasn't taken effect | The hive recorded this decision, but what it was supposed to cause has not happened within the expected time. | | `no-new-commit` | no new commit has been pushed | The hive gave direction, but no new commit has been pushed yet. | | `not-closed-yet` | the close didn't land | The hive decided to close it, but it is still open; the close call did not land. | -| `not-merged-yet` | the merge gate hasn't merged it | The hive approved it but the merge gate has not merged it; its lane reason says what still blocks it. | -| `self-decision-read-as-changes` | hive's own decision comment was read as a reviewer asking for changes | The merge gate read the hive's own `/hive decision` comment as a reviewer asking for changes, so the decision blocked the PR it meant to advance (hivecommons/hive#14822). A new commit or a maintainer merge clears it. | +| `not-merged-yet` | the merge queue hasn't merged it | The hive approved it but the merge queue has not merged it; its lane reason says what still blocks it. | +| `self-decision-read-as-changes` | hive's own decision comment was read as a reviewer asking for changes | The merge queue read the hive's own `/hive decision` comment as a reviewer asking for changes, so the decision blocked the PR it meant to advance (hivecommons/hive#14822). A new commit or a maintainer merge clears it. | | `still-parked` | the item is still waiting on a person | The item is still parked for a person's decision; the recorded decision did not move it. | A `/hive decision …` comment the hive itself wrote as the owner's delegate (it carries the delegated-decision marker) is never read as a maintainer's command: not as a change request on the PR, not as an approval. [#14822](https://github.com/hivecommons/hive/pull/14822) fixes the parse of `/hive decision approve `; the marker guard covers every other decision text the delegate can post, whichever login it was posted under. diff --git a/src/docs/operator-reference.md b/src/docs/operator-reference.md index d4c7758a47..246d42f5f1 100644 --- a/src/docs/operator-reference.md +++ b/src/docs/operator-reference.md @@ -432,7 +432,7 @@ advanced into the merge path. | `auto_merge.human_merge_paths` | unset | Per-repo map of `owner/repo` to glob patterns (same syntax as `intent.guardrail_path_patterns`) for paths a person must merge, e.g. `Danathar/goodreads-mcp: [".claude/settings.json", ".claude/hooks/**"]`. Every App merge path honors it: the automerge sweep lanes (App self-merge, trusted-author, label-queued) and the agent merge-request relay refuse a PR that touches a listed path, add `hold`, and post one `` comment naming the path(s); a person must merge it. If the changed-file list cannot be fetched completely for a configured repo, the merge is withheld (#11038, #11039). | | `auto_merge.require_current_base` | unset (off) | Repo list (`owner/repo`) whose App self-merge, trusted-author and contributor lanes only merge a head that contains the current base tip. A green head tested against an older base is updated with GitHub update-branch (a merge commit; no author commit is rewritten) and merges once CI is green on the new head, so a semantic conflict with work merged since turns that PR red instead of breaking the base (#13634). Costs one compare call per merge candidate. | | `auto_merge.merge_forward_trusted_human` | unset (off) | Repo list (`owner/repo`) where a `role/trusted` + `author/human` PR on a same-repo branch that GitHub reports as conflicting (`dirty`) gets the base merged into its head as one App-authored, signed-off merge commit via the GitHub merges API (no human commit is rewritten), then merges once CI is green on the new head. A real conflict pushes nothing and posts one `` note naming the files both sides changed. Fork heads are never written. Attempted once per head (#13636). | -| `auto_merge.merge_train.enabled` | `true` | Conflict-aware merge train in every automerge lane (hive, trusted-author, contributor) ([#15117](https://github.com/hivecommons/hive/issues/15117)). Each sweep groups the open approved / mergeable-pending PRs of one repo+base by overlapping changed files (`GET /pulls/{n}/files`, cached per head SHA) and lets ONE front per group merge — the clean-mergeable PR approved earliest — while the others wait at stage/080 with lane reason `merge-train:queued-behind#:/:…` (tracker pill "In merge queue · 3 of 4 · ~4m", never a human stage, never `needs-rebase` as a human flag). The moment the front merges, every sibling whose branch is merely `behind` gets `PUT /pulls/{n}/update-branch`; a `dirty` one is handed to the fixer's rebase-resolve episode (`requested_by: merge-train`, the shared two-attempt guard of [#15104](https://github.com/hivecommons/hive/pull/15104); the fixer router still requires a head the hive can push to, so a fork without maintainer edits stays on the plain `conflicting` path for a person). A head the lane last saw blocked on its own (red required check, terminal hold, permanent merge refusal) never fronts, and a group whose best member is blocked imposes no ordering (fail-open) — nobody waits behind a PR that is not moving. One INFO line `merge train` per order change, not per cycle. The queue carries one PR per issue: when two open PRs declare the same `Fixes #N`, the sweep keeps one (green first, then the earlier-opened) and holds the other with lane reason `merge-train:duplicate-of#:/0:0/0:` (tracker pill "Duplicate of #15402 · needs a pick"; *Let hive decide* supersedes, [#15395](https://github.com/hivecommons/hive/issues/15395)). `false` restores independent per-PR evaluation. | +| `auto_merge.merge_train.enabled` | `true` | Conflict-aware merge train in every automerge lane (hive, trusted-author, contributor) ([#15117](https://github.com/hivecommons/hive/issues/15117)). Each sweep groups the open approved / mergeable-pending PRs of one repo+base by overlapping changed files (`GET /pulls/{n}/files`, cached per head SHA) and lets ONE front per group merge — the clean-mergeable PR approved earliest — while the others wait at stage/080 with lane reason `merge-train:queued-behind#:/:…` (tracker pill "In merge queue · 3 of 4 · ~4m", never a human stage, never `needs-rebase` as a human flag). The moment the front merges, every sibling whose branch is merely `behind` gets `PUT /pulls/{n}/update-branch`; a `dirty` one is handed to the fixer's rebase-resolve episode (`requested_by: merge-train`, the shared two-attempt guard of [#15104](https://github.com/hivecommons/hive/pull/15104); the fixer router still requires a head the hive can push to, so a fork without maintainer edits stays on the plain `conflicting` path for a person). A head the lane last saw blocked on its own (red required check, terminal hold, permanent merge refusal) never fronts, and a group whose best member is blocked imposes no ordering (fail-open) — nobody waits behind a PR that is not moving. One INFO line `merge train` per order change, not per cycle. The queue carries one PR per issue: when two open PRs declare the same `Fixes #N`, the sweep keeps one (green first, then the earlier-opened) and holds the other with lane reason `merge-train:duplicate-of#:/0:0/0:` (tracker pill "Duplicate of #15402 · needs a pick"; *Let hive decide* supersedes, [#15395](https://github.com/hivecommons/hive/issues/15395)). `false` restores independent per-PR evaluation. A PR GitHub reports conflicting on its own, or one at stage/072 returned-to-contributor (label or stage record), is never a member nor counted in the train's size and draws no train idle comment; a conflicting PR rides only while the train itself is repairing it (its rebase requested behind a merged front, loop guard not spent) ([#15395](https://github.com/hivecommons/hive/issues/15395)). | | `auto_merge.merge_train.max_rebase_attempts` | `2` | Loop guard: how many rebase-resolve requests the train makes for one PR behind one front. Past it the PR moves to stage/085 with the pill "Needs human decision · rebase failed twice" and the decision option "Rebase, then merge as maintainer". | | `auto_merge.squash_only` | unset (no repo) | Repo list (`owner/repo`) whose branch policy forbids merge commits. Elsewhere, a `role/trusted` PR whose head mixes the contributor's commits with App-linked, App-signed ones (the hive's own in-place adoption fixes), every commit self-signed, is labelled `merge-method/merge` and merged with a merge commit instead of parking at `stage/085` as `adoption-stalled:hive-signoff-attribution`; a listed repo keeps squash-only policy and re-homes an in-place adoption to an App-authored superseder instead (#13975). | | `auto_merge.credit_issue_authors` | `true` | Append `Co-authored-by: ` for the human authors of the issues a PR closes (`Fixes|Closes|Resolves #N`) to the squash (or merge) commit message on every hive-performed merge, so reporters land on the contributor graph when an external clanker fixed their issue. Bots, the PR author and logins already credited on the branch are skipped; the logins are recorded as `issue_authors=` on the merge audit entry and in review evidence. One cached `GET /issues/{n}` per newly referenced issue. `false` leaves GitHub's default squash message untouched (#14581). | @@ -556,7 +556,7 @@ session agent sat `dirty` with nobody kicked to fix it. Now: clears as soon as the PR is no longer conflicting. The row payload carries `rebase: {attempt, max, exhausted, head, text}`. - **Approve on a PR that is behind or conflicting** no longer promises that - "the merge gate takes it from here" (the gate skips `conflicting` for + "the merge queue takes it from here" (the gate skips `conflicting` for good). The approval is recorded, the rebase episode opens in your name (`requested_by`, which admits the PR to the fixer router whoever opened it, as long as the hive can push to it; a hive-authored PR that is merely diff --git a/src/pkg/dashboard/api_repo_item_decide_delegated_plan.go b/src/pkg/dashboard/api_repo_item_decide_delegated_plan.go index b2c0e25c9d..a3be71b55c 100644 --- a/src/pkg/dashboard/api_repo_item_decide_delegated_plan.go +++ b/src/pkg/dashboard/api_repo_item_decide_delegated_plan.go @@ -189,7 +189,7 @@ func delegatedPlanWording(in delegatedecision.Input, d delegatedecision.Decision ref + " is closed as superseded; the author keeps the credit.", } case d.Verdict == delegatedecision.VerdictApprove: - return "Approve " + ref + " as it is and let the merge gate merge it.", + return "Approve " + ref + " as it is and let the merge queue merge it.", []string{"Hive approves the current commit.", ref + " merges once CI is green and it has soaked."} case d.Verdict == delegatedecision.VerdictCloseDuplicate && target > 0: return "Close " + ref + " as a duplicate of #" + strconv.Itoa(target) + ".", []string{ref + " is closed with a comment pointing at #" + strconv.Itoa(target) + "."} diff --git a/src/pkg/dashboard/api_repo_item_decide_delegated_plan_test.go b/src/pkg/dashboard/api_repo_item_decide_delegated_plan_test.go index 6d9abc6505..09b9db9168 100644 --- a/src/pkg/dashboard/api_repo_item_decide_delegated_plan_test.go +++ b/src/pkg/dashboard/api_repo_item_decide_delegated_plan_test.go @@ -102,7 +102,7 @@ func TestDelegatedDecisionPlanMergeableAsIsOffersMerge(t *testing.T) { if plan.Would != string(delegatedecision.VerdictApprove) || plan.Ladder == nil || plan.Ladder.Decision != delegatedecision.RuleMergeableAsIs || !plan.MergeableAsIs { t.Fatalf("plan = %+v ladder=%+v", plan, plan.Ladder) } - if plan.Summary != "Approve #8 as it is and let the merge gate merge it." || strings.Contains(plan.Summary, "Hive would") { + if plan.Summary != "Approve #8 as it is and let the merge queue merge it." || strings.Contains(plan.Summary, "Hive would") { t.Fatalf("summary %q", plan.Summary) } if len(plan.Alternatives) == 0 || plan.Alternatives[0].Action != decisionActionMergeNow || plan.Alternatives[0].Label != delegatedPlanAlternativeLabel || !plan.Alternatives[0].Enabled { diff --git a/src/pkg/dashboard/api_repo_item_decision.go b/src/pkg/dashboard/api_repo_item_decision.go index 05e83d78d8..d21aeaea98 100644 --- a/src/pkg/dashboard/api_repo_item_decision.go +++ b/src/pkg/dashboard/api_repo_item_decision.go @@ -595,7 +595,7 @@ func (s *Server) handlePullRequestMergeDecision(ctx context.Context, w http.Resp // renderRepoItemDecisionMergeComment is the attributed note left on the PR // before the hive's App merges it for the operator. func renderRepoItemDecisionMergeComment(user, comment string) string { - body := fmt.Sprintf("Merged as maintainer by @%s from the Hive dashboard: the merge gate parked this pull request for a human because its author is not a trusted merger on this repository.", strings.TrimSpace(user)) + body := fmt.Sprintf("Merged as maintainer by @%s from the Hive dashboard: the merge queue parked this pull request for a human because its author is not a trusted merger on this repository.", strings.TrimSpace(user)) if c := strings.TrimSpace(comment); c != "" { body += "\n\n> " + strings.ReplaceAll(c, "\n", "\n> ") } @@ -756,7 +756,7 @@ func approveNeedsRebaseResult(out *RowActionResult, number int, ms ghpkg.PRMerge out.Next = "Resolve the conflict on the branch yourself, or adopt it into a fresh branch / close it as superseded from the row menu." return } - out.Next = "The merge gate skips a conflicting PR, so your approval alone would not land it. Once the rebased head is green the gate takes it — or have hive merge it for you right after the rebase:" + out.Next = "The merge queue skips a conflicting PR, so your approval alone would not land it. Once the rebased head is green the gate takes it — or have hive merge it for you right after the rebase:" opt := decisionOption(decisionActionMergeNow, rebaseMergeFollowThroughLabel, true, "") opt.Consequence = rebaseMergeFollowThroughConsequence(number, ms.BaseRef) out.Options = []StageTrackerDecisionOption{opt} diff --git a/src/pkg/dashboard/features_grouping_test.go b/src/pkg/dashboard/features_grouping_test.go index b92176cd5f..3354f72f88 100644 --- a/src/pkg/dashboard/features_grouping_test.go +++ b/src/pkg/dashboard/features_grouping_test.go @@ -67,15 +67,15 @@ func TestReviewGateKeepsItsSubgroups(t *testing.T) { } section := rest[:next] - for _, want := range []string{`
Merge gate
`, `
Reviewers
`} { + for _, want := range []string{`
Merge queue
`, `
Reviewers
`} { if !strings.Contains(section, want) { t.Errorf("the Review Gate section is missing %s — its controls read as one flat list again", want) } } // Ordering matters: the gate controls come before the reviewer controls. - if strings.Index(section, "Merge gate") > strings.Index(section, ">Reviewers<") { - t.Error("the Merge gate sub-group must precede Reviewers") + if strings.Index(section, "Merge queue") > strings.Index(section, ">Reviewers<") { + t.Error("the Merge queue sub-group must precede Reviewers") } } diff --git a/src/pkg/dashboard/row_action_result.go b/src/pkg/dashboard/row_action_result.go index e0e763894e..2b5ce4574d 100644 --- a/src/pkg/dashboard/row_action_result.go +++ b/src/pkg/dashboard/row_action_result.go @@ -144,7 +144,7 @@ func delegatedRowActionResult(in delegatedecision.Input, d delegatedecision.Deci out.Next = "The hive's copy rebases, soaks and merges unattended; " + ref + " closes when it lands." } else { out.Outcome = "Adopted — hive will re-author " + ref + " as a hive PR with the same commits and merge it next pass; " + ref + " will be closed as superseded." - out.Next = "Until the copy opens the row reads Adopted at the merge gate; the copy then carries the chevron and " + ref + " is listed under it as superseded." + out.Next = "Until the copy opens the row reads Adopted at the merge queue; the copy then carries the chevron and " + ref + " is listed under it as superseded." } if hasLadderOutcome { out.Outcome += " " + ladderOutcome diff --git a/src/pkg/dashboard/stage_tracker.go b/src/pkg/dashboard/stage_tracker.go index 0ac1cd0a27..398cd85fa0 100644 --- a/src/pkg/dashboard/stage_tracker.go +++ b/src/pkg/dashboard/stage_tracker.go @@ -830,7 +830,7 @@ func stageTrackerShort(s stagelabels.Stage) string { case stagelabels.AdoptedByHive: return "Adopted by hive" case stagelabels.AwaitingMergeAdmission: - return "Merge gate" + return "Merge queue" case stagelabels.NeedsDecision: return "Needs human decision" case stagelabels.ReadyForHumanMerge: diff --git a/src/pkg/dashboard/stage_tracker_decided.go b/src/pkg/dashboard/stage_tracker_decided.go index 716767784b..11a86e7a45 100644 --- a/src/pkg/dashboard/stage_tracker_decided.go +++ b/src/pkg/dashboard/stage_tracker_decided.go @@ -114,7 +114,7 @@ type decidedVerb struct { var decidedVerbs = map[string]decidedVerb{ string(delegatedecision.VerdictAdoptSupersede): {Word: "Adopted", Text: "Adopted · hive rebases & merges next pass", Acting: "Adopting · opening hive copy…", Plain: "adopted (supersede)", Stage: stagelabels.AwaitingMergeAdmission}, - string(delegatedecision.VerdictApprove): {Word: "Approved", Text: "Approved · merge gate takes it", Acting: "Approving…", Plain: "approved", Stage: stagelabels.AwaitingMergeAdmission}, + string(delegatedecision.VerdictApprove): {Word: "Approved", Text: "Approved · merge queue takes it", Acting: "Approving…", Plain: "approved", Stage: stagelabels.AwaitingMergeAdmission}, string(delegatedecision.VerdictDirection): {Word: "Sent back", Text: "Sent back · waiting for a new commit", Acting: "Sending back…", Plain: "direction given", Stage: stagelabels.None}, string(delegatedecision.VerdictCloseDuplicate): {Word: "Closing", Text: "Closing · duplicate, leaves the tracker next refresh", Acting: "Closing…", Plain: "closed as duplicate", Stage: stagelabels.None}, string(delegatedecision.VerdictCloseSuperseded): {Word: "Closing", Text: "Closing · superseded, leaves the tracker next refresh", Acting: "Closing…", Plain: "closed as superseded", Stage: stagelabels.None}, diff --git a/src/pkg/dashboard/stage_tracker_merge_gate_test.go b/src/pkg/dashboard/stage_tracker_merge_gate_test.go index 068ed4d23c..90c5f1a36b 100644 --- a/src/pkg/dashboard/stage_tracker_merge_gate_test.go +++ b/src/pkg/dashboard/stage_tracker_merge_gate_test.go @@ -162,7 +162,7 @@ func TestStageTrackerMergeGateNode(t *testing.T) { if err != nil { t.Fatal(err) } - for _, want := range []string{"**Merge gate pills — legend**", "Awaiting merge gate", "Ready for auto merge", "**Soaking**", "**Merging**", "next sweep in"} { + for _, want := range []string{"**Merge queue pills — legend**", "Awaiting merge gate", "Ready for auto merge", "**Soaking**", "**Merging**", "next sweep in"} { if !strings.Contains(string(docs), want) { t.Errorf("docs/dashboard-sections.md missing merge-gate legend %q", want) } @@ -422,7 +422,7 @@ assert.strictEqual(stageTrackerCoveringPR(pr15090), null, 'PR rows have no cover // The cover reason parser. assert.strictEqual(stageTrackerCoverReasonText({ reason: 'open PR #15090 covers it (PR at 060-reviewed)' }), 'open PR #15090 covers it · its PR is review passed · waiting for merge admission'); -assert.strictEqual(stageTrackerCoverReasonText({ reason: 'open PR #15090 covers it (PR at stage/080-awaiting-merge-admission)' }), 'open PR #15090 covers it · its PR is at the merge gate'); +assert.strictEqual(stageTrackerCoverReasonText({ reason: 'open PR #15090 covers it (PR at stage/080-awaiting-merge-admission)' }), 'open PR #15090 covers it · its PR is at the merge queue'); assert.strictEqual(stageTrackerCoverReasonText({ reason: 'open PR #7 covers it' }), 'open PR #7 covers it'); assert.strictEqual(stageTrackerCoverReasonText({ reason: 'check-pending' }), ''); assert.strictEqual(stageTrackerCoverReasonText({}), ''); diff --git a/src/pkg/dashboard/stage_tracker_merge_train.go b/src/pkg/dashboard/stage_tracker_merge_train.go index fa895ccc2d..6d713bc3d8 100644 --- a/src/pkg/dashboard/stage_tracker_merge_train.go +++ b/src/pkg/dashboard/stage_tracker_merge_train.go @@ -234,7 +234,7 @@ func stageTrackerMergeTrainPostPass(items []StageTrackerItem, opts mergeTrainQue front.MergeGate.State = MergeGateStateTrainFront } if front.MergeGate.Reason == "" { - front.MergeGate.Reason = "front of merge train (1st of " + strconv.Itoa(sample.Size) + ", overlapping files: " + strings.Join(sample.OverlapFiles, ", ") + ")" + front.MergeGate.Reason = "1st in the merge queue; merges next (1st of " + strconv.Itoa(sample.Size) + ", overlapping files: " + strings.Join(sample.OverlapFiles, ", ") + ")" } if front.Stage == stagelabels.AwaitingMergeAdmission.Number() { front.Caption = stageTrackerMergeTrainFrontCaption(sample) @@ -380,7 +380,7 @@ func mergeTrainEtaBasis(aheadN int, headState string, headLeft, own, tick time.D var parts []string switch aheadN { case 0: - parts = append(parts, "front") + parts = append(parts, "1st in queue") case 1: parts = append(parts, "1 ahead") default: @@ -588,7 +588,7 @@ func stageTrackerMergeTrainFrontCaption(mt *StageTrackerMergeTrain) string { if len(mt.OverlapFiles) > 0 { files = " (overlapping files: " + strings.Join(mt.OverlapFiles, ", ") + ")" } - return "Front of a merge train of " + strconv.Itoa(mt.Size) + " PRs; merges first, then the lane updates or rebases the others" + files + return "1st in a merge queue of " + strconv.Itoa(mt.Size) + " PRs; merges next, then the lane updates or rebases the others" + files } // stageTrackerMergeTrainCaption is the caption for a sibling's train diff --git a/src/pkg/dashboard/stage_tracker_merge_train_queue_test.go b/src/pkg/dashboard/stage_tracker_merge_train_queue_test.go index 6411864e03..170e13ed86 100644 --- a/src/pkg/dashboard/stage_tracker_merge_train_queue_test.go +++ b/src/pkg/dashboard/stage_tracker_merge_train_queue_test.go @@ -216,7 +216,9 @@ func TestStageTrackerMergeQueueChipNode(t *testing.T) { jsConstLine(t, html, "STAGE_TRACKER_TERMINAL")+"\n"+ jsConstLine(t, html, "STAGE_TRACKER_PRE_MERGE_SOAK")+"\n"+ jsConstLine(t, html, "STAGE_TRACKER_MERGE_GATE_WORD")+"\n"+ - jsConstLine(t, html, "STAGE_TRACKER_TRAIN_GLYPH")+"\n"+ + jsConstLine(t, html, "STAGE_TRACKER_TRAIN_ICON_PATH")+"\n"+ + jsConstLine(t, html, "STAGE_TRACKER_TRAIN_ICON_TITLE")+"\n"+ + jsFunc(t, html, "stageTrackerTrainIconHtml")+"\n"+ jsConstBlock(t, html, "STAGE_TRACKER_GATE_REASON_WORDS")+"\n"+ jsConstBlock(t, html, "STAGE_TRACKER_ICONS")+"\n"+ jsFunc(t, html, "stageTrackerIcon")+"\n"+ @@ -240,22 +242,22 @@ const quiet = mk(15319, 'fleetreport: slog feed', Object.assign({ state: 'queued const busy = mk(15319, 'fleetreport: slog feed', Object.assign({ state: 'queued-behind', position: 2, ahead: [15315] }, headFacts), { sweep_running: true }); const a = stageTrackerMergeGateInfo(quiet, now), b = stageTrackerMergeGateInfo(busy, now); // Stability: the sweep flag changes neither the word nor the detail. -assert.strictEqual(a.word, 'In merge queue · 2 of 3'); +assert.strictEqual(a.word, 'Merge queued · 2nd'); assert.strictEqual(b.word, a.word, 'sweep_running must not change the chip label'); assert.strictEqual(a.detail, ''); assert.strictEqual(b.detail, ''); assert.strictEqual(stageTrackerMergeGateWordHtml(quiet, now), stageTrackerMergeGateWordHtml(busy, now), 'identical chip markup'); -assert.ok(!/queued-behind|merge sweep running/.test(a.word + a.detail + b.word + b.detail), 'no slug, no sweep words in the label'); +assert.ok(!/queued-behind|front|merge sweep running/i.test(a.word + a.detail + b.word + b.detail), 'no slug, no "front", no sweep words in the label'); // The sweep lives in the glyph and the tooltip. assert.strictEqual(a.cue, 'waiting'); assert.strictEqual(b.cue, 'running'); assert.ok(b.tip.includes('Checking now…') && !a.tip.includes('Checking now…'), b.tip); -assert.ok(a.tip.startsWith('Behind #15315 (waiting for a maintainer (untrusted author)). Hive merges one at a time, in order. Head #15315 is waiting for a maintainer (untrusted author); no estimate until it moves.'), a.tip); +assert.ok(a.tip.startsWith('2nd of 3 in the merge queue · behind #15315 (waiting for a maintainer (untrusted author)) · no estimate until #15315 moves. Hive merges one at a time, in order.'), a.tip); assert.ok(a.tip.includes('Last checked'), a.tip); assert.ok(stageTrackerGateCueHtml(busy, now).includes('cue-spin') && !stageTrackerGateCueHtml(quiet, now).includes('cue-spin')); // A soaking head: the estimate is the head's soak plus one slot per PR ahead. const soakHead = mk(15374, 'tracker: queue', { state: 'queued-behind', position: 3, ahead: [15315, 15319], head_state: 'soaking', head_reason: 'soaking, 12m left', eta_s: 25 * 60 }, { sweep_running: true }); const s = stageTrackerMergeGateInfo(soakHead, now); -assert.strictEqual(s.word, 'In merge queue · 3 of 3'); -assert.ok(s.tip.startsWith('Behind #15315 (soaking, 12m left) and 1 more. Hive merges one at a time, in order. Estimated turn: ~25m. Checking now…'), s.tip); +assert.strictEqual(s.word, 'Merge queued · 3rd'); +assert.ok(s.tip.startsWith('3rd of 3 in the merge queue · behind #15315 (soaking, 12m left) · ETA ~25m. Hive merges one at a time, in order. Checking now…'), s.tip); // Stalled: the chip says so, names the head and how long; the markup wears the stalled class. const stalled = mk(15374, 'tracker: queue', Object.assign({ state: 'queued-behind', position: 3, ahead: [15315, 15319], stalled: true, stalled_s: 3 * 3600 }, headFacts), { sweep_running: true }); const st = stageTrackerMergeGateInfo(stalled, now); @@ -264,28 +266,28 @@ assert.ok(stageTrackerMergeGateWordHtml(stalled, now).includes('class="ham-seg-t assert.strictEqual(stageTrackerMergeGateInfo(mk(15374, 't', Object.assign({ state: 'queued-behind', position: 3, stalled: true, stalled_s: 3 * 3600 }, headFacts), { sweep_running: false }), now).word, st.word, 'stalled label is sweep-stable too'); // The front row reads its place too. const head = mk(15315, 'fleetreport: head', Object.assign({ state: 'front', position: 1, ahead: [] }, headFacts)); -assert.strictEqual(stageTrackerMergeGateInfo(head, now).word, 'Next to merge · 1 of 3'); -assert.ok(stageTrackerMergeGateInfo(head, now).tip.startsWith('Front of the merge queue (2 more behind it): waiting for a maintainer (untrusted author).'), stageTrackerMergeGateInfo(head, now).tip); +assert.strictEqual(stageTrackerMergeGateInfo(head, now).word, 'Merge queued · 1st'); +assert.ok(stageTrackerMergeGateInfo(head, now).tip.startsWith('1st of 3 in the merge queue · merges next (waiting for a maintainer (untrusted author)). Hive merges one at a time, in order.'), stageTrackerMergeGateInfo(head, now).tip); // hive's own #15406 read the bare slug "front" while the front sat in its // soak (the mirrored soak clock returned the raw state). A front in soak // keeps its place word and its countdown (own soak left + next sweep). const frontSoak = mk(15406, 'in soak at the front', { state: 'front', position: 1, size: 4, length: 4, head_number: 15406, front: 15406, ahead: [], head_state: 'soaking', head_reason: 'soaking, 12m left', eta_s: 760, eta_at: new Date(now + 760 * 1000).toISOString(), eta_basis: 'own soak 12m · next sweep in 40s' }, { state: 'front', soak_until: new Date(now + 12 * 60 * 1000).toISOString(), soak_started_at: new Date(now - 18 * 60 * 1000).toISOString(), sweep_running: true }); const fs = stageTrackerMergeGateInfo(frontSoak, now); -assert.strictEqual(fs.word, 'Next to merge · 1 of 4', fs.word); assert.strictEqual(fs.detail, '~13m'); +assert.strictEqual(fs.word, 'Merge queued · 1st', fs.word); assert.strictEqual(fs.detail, '~13m'); assert.strictEqual(stageTrackerMergeGateInfo(Object.assign({}, frontSoak, { merge_gate: Object.assign({}, frontSoak.merge_gate, { sweep_running: false }) }), now).word, fs.word); -assert.strictEqual(stageTrackerMergeGateWordHtml(frontSoak, now).replace(/<[^>]+>/g, ''), 'Next to merge · 1 of 4 · ~13m'); +assert.strictEqual(stageTrackerMergeGateWordHtml(frontSoak, now).replace(/<[^>]+>/g, ''), 'Merge queued · 1st · ~13m'); // Countdown to auto-merge: eta_at drives "· ~4m" on the chip; the detail carries // the clock so the shared tick keeps counting and a re-render lands on the same // instant (no reset on poll). const etaAt = new Date(now + 4 * 60 * 1000).toISOString(); const timed = mk(15319, 'fleetreport: slog feed', { state: 'queued-behind', position: 2, ahead: [15315], head_state: 'soaking', head_reason: 'soaking, 3m left', eta_s: 240, eta_at: etaAt, eta_basis: '1 ahead · head soaking 3m · next sweep in 40s' }, { sweep_running: false }); const ti = stageTrackerMergeGateInfo(timed, now); -assert.strictEqual(ti.word, 'In merge queue · 2 of 3'); assert.strictEqual(ti.detail, '~4m'); assert.strictEqual(ti.until, now + 4 * 60 * 1000); -assert.ok(ti.tip.includes('Estimated turn: ~4m (1 ahead · head soaking 3m · next sweep in 40s).'), ti.tip); +assert.strictEqual(ti.word, 'Merge queued · 2nd'); assert.strictEqual(ti.detail, '~4m'); assert.strictEqual(ti.until, now + 4 * 60 * 1000); +assert.ok(ti.tip.includes('· ETA ~4m (1 ahead · head soaking 3m · next sweep in 40s).'), ti.tip); const chipHtml = stageTrackerMergeGateWordHtml(timed, now); -assert.ok(chipHtml.includes('>In merge queue · 2 of 3 · ~4m'), chipHtml); -assert.strictEqual(chipHtml.replace(/<[^>]+>/g, ''), 'In merge queue · 2 of 3 · ~4m'); +assert.ok(chipHtml.includes('>Merge queued · 2nd · ~4m'), chipHtml); +assert.strictEqual(chipHtml.replace(/<[^>]+>/g, ''), 'Merge queued · 2nd · ~4m'); // The same payload 90s later (a poll re-render) reads 2m30s, not 4m again. assert.strictEqual(stageTrackerMergeGateInfo(timed, now + 90 * 1000).detail, '~3m'); assert.strictEqual(stageTrackerMergeGateInfo(timed, now + 150 * 1000).detail, '~2m'); @@ -346,7 +348,9 @@ func TestStageTrackerMergeTrainStateSlugsNeverLeak(t *testing.T) { jsConstLine(t, html, "STAGE_TRACKER_TERMINAL")+"\n"+ jsConstLine(t, html, "STAGE_TRACKER_PRE_MERGE_SOAK")+"\n"+ jsConstLine(t, html, "STAGE_TRACKER_MERGE_GATE_WORD")+"\n"+ - jsConstLine(t, html, "STAGE_TRACKER_TRAIN_GLYPH")+"\n"+ + jsConstLine(t, html, "STAGE_TRACKER_TRAIN_ICON_PATH")+"\n"+ + jsConstLine(t, html, "STAGE_TRACKER_TRAIN_ICON_TITLE")+"\n"+ + jsFunc(t, html, "stageTrackerTrainIconHtml")+"\n"+ jsConstBlock(t, html, "STAGE_TRACKER_GATE_REASON_WORDS")+"\n"+ jsConstBlock(t, html, "STAGE_TRACKER_ICONS")+"\n"+ jsFunc(t, html, "stageTrackerIcon")+"\n"+ @@ -364,6 +368,9 @@ const now = Date.parse('2026-10-29T15:06:00Z'); // case-sensitive: slugs are lowercase, "Rebasing · attempt 1/2" is words) // or a hyphenated slug anywhere. const leaks = (s, state) => { s = String(s || ''); return s.trim() === state || s.split(/\s*·\s*/).some(seg => seg.trim() === state) || (state.includes('-') && s.includes(state)); }; +// Owner (hive #15400 / #15425 rows): neither "front" nor "queued-behind" +// anywhere a person reads, whatever the state. +const ownerBanned = s => /front|queued-behind/i.test(String(s || '')); const soak = { soak_until: new Date(now + 9 * 60 * 1000).toISOString(), soak_started_at: new Date(now - 60 * 1000).toISOString() }; for (const state of slugs) { for (const sweep of [true, false]) for (const clock of [null, soak]) { @@ -378,11 +385,12 @@ for (const state of slugs) { assert.ok(info.word && !leaks(info.word, state) && !leaks(info.detail, state), state + ' chip: ' + JSON.stringify(info)); assert.ok(!leaks(stageTrackerMergeGateWordHtml(item, now).replace(/<[^>]+>/g, ''), state), state + ' html'); assert.ok(!leaks(stageTrackerQueueMemberState(item, now), state), state + ' popover'); + for (const [what, text] of [['word', word], ['chip', info.word + ' ' + info.detail], ['hover', info.tip], ['popover', stageTrackerQueueMemberState(item, now)]]) assert.ok(!ownerBanned(text), state + ' ' + what + ' says front/queued-behind: ' + JSON.stringify(text)); } } // The word table covers the slugs and an unmapped state still spells out. for (const state of slugs) assert.ok(STAGE_TRACKER_TRAIN_STATE_WORD[state], state); -assert.strictEqual(stageTrackerMergeGateStateWord('front'), 'Next to merge'); +assert.strictEqual(stageTrackerMergeGateStateWord('front'), 'Merge queued'); assert.strictEqual(stageTrackerMergeGateStateWord('duplicate-of:15402'), 'Duplicate of #15402'); // The held duplicate's chip: "Duplicate of #15402 · needs a pick", the hover names the issue and the pick rule. const heldDup = { repo: 'hivecommons/hive', number: 15407, kind: 'pr', title: 't', stage: 80, modifiers: ['needs-decision'], merge_gate: { state: 'duplicate-of:15402', duplicate_of: 15402, duplicate_issue: 15396, sweep_running: true } }; diff --git a/src/pkg/dashboard/stage_tracker_merge_train_test.go b/src/pkg/dashboard/stage_tracker_merge_train_test.go index 00303b6bb1..1b383e15ec 100644 --- a/src/pkg/dashboard/stage_tracker_merge_train_test.go +++ b/src/pkg/dashboard/stage_tracker_merge_train_test.go @@ -49,7 +49,7 @@ func TestStageTrackerMergeTrainPayload(t *testing.T) { if front.MergeTrain == nil || front.MergeTrain.State != MergeGateStateTrainFront || front.MergeTrain.Position != 1 || front.MergeTrain.Size != 4 || front.MergeTrain.ID != "v5#15074" { t.Fatalf("front merge_train = %+v", front.MergeTrain) } - if front.MergeGate == nil || front.MergeGate.State != MergeGateStateTrainFront || !strings.Contains(front.Caption, "Front of a merge train of 4 PRs") { + if front.MergeGate == nil || front.MergeGate.State != MergeGateStateTrainFront || !strings.Contains(front.Caption, "1st in a merge queue of 4 PRs") { t.Fatalf("front gate %+v caption %q", front.MergeGate, front.Caption) } if hasMod(front, modNeedsRebase) || len(front.MergeTrain.Ahead) != 0 { @@ -205,7 +205,9 @@ func TestStageTrackerMergeTrainSPA(t *testing.T) { jsConstLine(t, html, "STAGE_TRACKER_GATE_DUPLICATE_PREFIX"), jsFunc(t, html, "stageTrackerGateDuplicateOf"), jsFunc(t, html, "stageTrackerMergeGateStateWord"), - jsConstLine(t, html, "STAGE_TRACKER_TRAIN_GLYPH"), + jsConstLine(t, html, "STAGE_TRACKER_TRAIN_ICON_PATH"), + jsConstLine(t, html, "STAGE_TRACKER_TRAIN_ICON_TITLE"), + jsFunc(t, html, "stageTrackerTrainIconHtml"), jsConstBlock(t, html, "STAGE_TRACKER_ICONS"), stageTrackerManualMergeJS(t, html), stageTrackerSentinelJS(t, html), @@ -252,7 +254,7 @@ func TestStageTrackerMergeTrainSPA(t *testing.T) { }, "\n") + ` var _stageTracker = { stages: [] }; const now = Date.parse('2026-10-27T14:00:00Z'); -const stages = [{ number: 50, label: 'Review pending', short: 'CI / Review' }, { number: 80, label: 'Awaiting merge admission', short: 'Merge gate' }, { number: 85, label: 'Needs human decision', short: 'Needs decision' }, { number: 100, label: 'Merge queue', short: 'Merge queue' }]; +const stages = [{ number: 50, label: 'Review pending', short: 'CI / Review' }, { number: 80, label: 'Awaiting merge admission', short: 'Merge queue' }, { number: 85, label: 'Needs human decision', short: 'Needs decision' }, { number: 100, label: 'Merge queue', short: 'Merge queue' }]; const files = ['stage_tracker.go', 'index.html']; const mk = (n, stage, mt, extra) => Object.assign({ repo: 'hivecommons/hive', number: n, kind: 'pr', title: 'PR ' + n, stage, stage_since: '2026-10-27T13:00:00Z', base_ref: 'v5', modifiers: [], merge_train: Object.assign({ id: 'v5#15074', front: 15074, size: 4, overlap_files: files }, mt) }, extra || {}); const front = mk(15074, 80, { state: 'front', position: 1 }); @@ -261,28 +263,29 @@ const third = mk(15087, 80, { state: 'rebasing', position: 3, attempt: 1, max_at const fourth = mk(15097, 85, { state: 'rebase-exhausted', position: 4, attempt: 2, max_attempts: 2, ahead: [15074, 15085, 15087] }, { modifiers: ['needs-rebase'] }); const other = { repo: 'hivecommons/hive', number: 15100, kind: 'pr', title: 'Docs', stage: 80, modifiers: [] }; -// Pill wording per state. -assert.strictEqual(stageTrackerTrainWord(front), 'Next to merge · 1 of 4'); -assert.strictEqual(stageTrackerTrainWord(second), 'In merge queue · 2 of 4'); +// Pill wording per state: the place in the owner's words (#15395 — +// "'front' should be 'merge queued - 1st' and so on"). +assert.strictEqual(stageTrackerTrainWord(front), 'Merge queued · 1st'); +assert.strictEqual(stageTrackerTrainWord(second), 'Merge queued · 2nd'); assert.strictEqual(stageTrackerTrainWord(third), 'Rebasing · attempt 1/2'); assert.strictEqual(stageTrackerTrainWord(fourth), 'Needs human decision · rebase failed twice'); assert.strictEqual(stageTrackerTrainWord(other), ''); for (const [n, w] of [[1, '1st'], [2, '2nd'], [3, '3rd'], [4, '4th'], [11, '11th'], [12, '12th'], [13, '13th'], [21, '21st'], [22, '22nd'], [111, '111th']]) assert.strictEqual(stageTrackerOrdinal(n), w, 'ordinal ' + n); // The lit chevron carries the word: 080 for the members, the 085 detour for the exhausted one. const lit = it => stageTrackerSegments(it, stages, now).find(s => s.state === 'active'); -assert.strictEqual(lit(front).short, 'Next to merge · 1 of 4'); -assert.strictEqual(lit(second).short, 'In merge queue · 2 of 4'); +assert.strictEqual(lit(front).short, 'Merge queued · 1st'); +assert.strictEqual(lit(second).short, 'Merge queued · 2nd'); assert.strictEqual(lit(third).short, 'Rebasing · attempt 1/2'); assert.strictEqual(lit(fourth).detour.text, 'Needs human decision · rebase failed twice'); assert.strictEqual(lit(other).short, 'Ready for auto merge'); // Tooltip: the queue ahead and the overlapping files. const tip = stageTrackerTooltip(third, now); -assert.ok(tip.includes('Merge train: 4 PRs to v5 touch the same files; they merge one at a time, front first (front #15074)'), tip); +assert.ok(tip.includes('Merge train: 4 PRs to v5 touch the same files; they merge one at a time, in order (1st: #15074)'), tip); assert.ok(tip.includes('Position: 3rd of 4 · ahead: #15074, #15085'), tip); -assert.ok(tip.includes('Front merged; rebase attempt 1 of 2 in progress'), tip); +assert.ok(tip.includes('The PR ahead merged; rebase attempt 1 of 2 in progress'), tip); assert.ok(tip.includes('Overlapping files: stage_tracker.go, index.html'), tip); -assert.ok(stageTrackerTooltip(front, now).includes('Position: front — merges first'), 'front tip'); +assert.ok(stageTrackerTooltip(front, now).includes('Position: 1st — merges next'), 'front tip'); assert.ok(stageTrackerTooltip(fourth, now).includes('Rebase failed 2 of 2 times — a maintainer rebases, then merges')); assert.ok(!stageTrackerTooltip(other, now).includes('Merge train')); @@ -292,23 +295,49 @@ const sorted = [fourth, other, third, { repo: 'x/y', number: 1, kind: 'issue', s // Queue facts (#15395): the chip is the position, never the slug; the // hover sentence names the head, what it waits on and the estimate. const queued = mk(15319, 80, { state: 'queued-behind', position: 2, ahead: [15315], length: 3, head_number: 15315, head_state: 'soaking', head_reason: 'soaking, 12m left', eta_s: 1500 }); -assert.strictEqual(stageTrackerTrainWord(queued), 'In merge queue · 2 of 3'); -assert.strictEqual(stageTrackerTrainQueueTip(queued.merge_train), 'Behind #15315 (soaking, 12m left). Hive merges one at a time, in order. Estimated turn: ~25m.'); +assert.strictEqual(stageTrackerTrainWord(queued), 'Merge queued · 2nd'); +assert.strictEqual(stageTrackerTrainQueueTip(queued.merge_train), '2nd of 3 in the merge queue · behind #15315 (soaking, 12m left) · ETA ~25m. Hive merges one at a time, in order.'); +const firstQ = mk(15315, 80, { state: 'front', position: 1, length: 3, head_number: 15315, head_state: 'soaking', head_reason: 'soaking, 12m left', eta_s: 780 }); +assert.strictEqual(stageTrackerTrainQueueTip(firstQ.merge_train), '1st of 3 in the merge queue · merges next (soaking, 12m left) · ETA ~13m. Hive merges one at a time, in order.'); const thirdQ = mk(15374, 80, { state: 'queued-behind', position: 3, ahead: [15315, 15319], length: 3, head_number: 15315, head_state: 'needs-human', head_reason: 'waiting for a maintainer (untrusted author)', eta_s: 0 }); -assert.strictEqual(stageTrackerTrainWord(thirdQ), 'In merge queue · 3 of 3'); -assert.strictEqual(stageTrackerTrainQueueTip(thirdQ.merge_train), 'Behind #15315 (waiting for a maintainer (untrusted author)) and 1 more. Hive merges one at a time, in order. Head #15315 is waiting for a maintainer (untrusted author); no estimate until it moves.'); +assert.strictEqual(stageTrackerTrainWord(thirdQ), 'Merge queued · 3rd'); +assert.strictEqual(stageTrackerTrainQueueTip(thirdQ.merge_train), '3rd of 3 in the merge queue · behind #15315 (waiting for a maintainer (untrusted author)) · no estimate until #15315 moves. Hive merges one at a time, in order.'); const stalledQ = mk(15374, 80, { state: 'queued-behind', position: 3, ahead: [15315, 15319], length: 3, head_number: 15315, head_state: 'ci', head_reason: 'waiting for CI', stalled: true, stalled_s: 3 * 3600 }); assert.strictEqual(stageTrackerTrainWord(stalledQ), 'Merge queue stalled · head #15315 waiting for CI 3h'); -assert.ok(stageTrackerTrainQueueTip(stalledQ.merge_train).includes('head #15315 has not moved for 3h'), stageTrackerTrainQueueTip(stalledQ.merge_train)); -for (const it of [queued, thirdQ, stalledQ, front, second]) assert.ok(!/queued-behind|rebase-exhausted/.test(stageTrackerTrainWord(it) + stageTrackerTrainQueueTip(it.merge_train)), 'no slug: ' + it.number); +assert.ok(stageTrackerTrainQueueTip(stalledQ.merge_train).includes('#15315 has not moved for 3h'), stageTrackerTrainQueueTip(stalledQ.merge_train)); +// Neither slug nor the word "front" reaches a person: chevron word, hover, +// tooltip lines, header chip and the ⛓-era header text (owner: "i dont +// know what queued - behind means at all"). +for (const it of [queued, firstQ, thirdQ, stalledQ, front, second, third, fourth]) { + const seen = [stageTrackerTrainWord(it), stageTrackerTrainQueueTip(it.merge_train), stageTrackerTrainLines(it).join(' '), stageTrackerTrainHeaderText(it.merge_train), stageTrackerTooltip(it, now)].join(' | '); + assert.ok(!/front|queued-behind|rebase-exhausted/i.test(seen), 'no slug or "front" for #' + it.number + ': ' + seen); +} +// Ordinal places beyond the first few. +for (const [pos, w] of [[11, '11th'], [12, '12th'], [13, '13th'], [21, '21st'], [22, '22nd'], [23, '23rd']]) assert.strictEqual(stageTrackerTrainWord(mk(1, 80, { state: 'queued-behind', position: pos, length: 30 })), 'Merge queued · ' + w); +// Every train state — the 1st included — lights the Merge queue column, +// whatever stage the lane holds the head at (hive #15400 at 050 lit CI / Review). +for (const st of ['front', 'queued-behind', 'rebasing', 'rebase-exhausted']) for (const stage of [50, 60, 70, 74, 80, 95]) assert.strictEqual(stageTrackerAnchor(stage, stages, 'pr', mk(2, stage, { state: st, position: 1 })), 80, st + ' at ' + stage); +assert.strictEqual(stageTrackerAnchor(50, stages, 'pr', other), 50, 'no train: stage rules as before'); +// The 1st-in-train head at 050 lights its word in the Merge queue column. +const headAt50 = mk(15400, 50, { state: 'front', position: 1 }); +assert.strictEqual(lit(headAt50).number, 80); +assert.strictEqual(lit(headAt50).short, 'Merge queued · 1st'); const grouped = stageTrackerTrainContiguous(sorted).map(it => it.number); assert.deepStrictEqual(grouped, [15074, 15085, 15087, 15097, 15100, 1]); // Header line before the run, once; rail classes on members, last closes it. const rows = stageTrackerTrainRows(stageTrackerTrainContiguous(sorted), (it) => ({ key: String(it.number), html: '' })); assert.deepStrictEqual(rows.map(r => r.key), ['train:hivecommons/hive|v5#15074', '15074', '15085', '15087', '15097', '15100', '1']); -assert.ok(rows[0].html.includes('⛓ merge train · 4 PRs · front #15074'), rows[0].html); +assert.ok(rows[0].html.includes(' merge train · 4 PRs · 1st: #15074'), rows[0].html); assert.ok(rows[0].html.includes('class="ham-train-chip"') && rows[0].html.includes('overlapping: stage_tracker.go, index.html'), rows[0].html); -assert.strictEqual(stageTrackerTrainHeaderText(front.merge_train), '⛓ merge train · 4 PRs · front #15074'); +assert.strictEqual(stageTrackerTrainHeaderText(front.merge_train), 'merge train · 4 PRs · 1st: #15074'); +// The train icon: an inline SVG (currentColor, 16-unit box) titled "Merge +// queue", one path shared with the Merge queue column / 080 chevron. +const ico = stageTrackerTrainIconHtml('ham-train-icon'); +assert.ok(ico.startsWith('Merge queue') && ico.includes('aria-label="Merge queue"'), ico); +assert.ok(ico.includes(STAGE_TRACKER_TRAIN_ICON_PATH) && (ico.match(/([^<]*)<\/span>/g)).map(m => m[1]), ['Open', 'Actionable', 'Claimed', 'PR in progress', 'CI / Review', 'Merge gate']); +assert.deepStrictEqual(Array.from(head.matchAll(/(?:)?([^<]*)<\/span>/g)).map(m => m[1]), ['Open', 'Actionable', 'Claimed', 'PR in progress', 'CI / Review', 'Merge queue']); +// The Merge queue column wears the train icon (hover "Merge queue"), the +// same railcar as the train header chip and the 080 chevron (#15395). +assert.ok(head.includes('' + stageTrackerTrainIconHtml('ham-ico ham-train-icon ham-col-ico') + 'Merge queue'), head); +assert.strictEqual((head.match(/Merge queue<\/title>/g) || []).length, 1); assert.ok(head.includes('<span class="ham-since">since</span>')); // Unknown / zero stage lights "Open". diff --git a/src/pkg/dashboard/stage_tracker_vocabulary.go b/src/pkg/dashboard/stage_tracker_vocabulary.go index 3c134721bc..ba4f1d737d 100644 --- a/src/pkg/dashboard/stage_tracker_vocabulary.go +++ b/src/pkg/dashboard/stage_tracker_vocabulary.go @@ -82,7 +82,7 @@ func stageTrackerStagePhrase(stage stagelabels.Stage) string { case stagelabels.AdoptedByHive: return "adopted by hive" case stagelabels.AwaitingMergeAdmission: - return "at the merge gate" + return "at the merge queue" case stagelabels.ReadyForHumanMerge: return "ready for human merge" case stagelabels.PreMergeSoak: diff --git a/src/pkg/dashboard/stage_tracker_vocabulary_test.go b/src/pkg/dashboard/stage_tracker_vocabulary_test.go index e884fe0ea7..24230aee29 100644 --- a/src/pkg/dashboard/stage_tracker_vocabulary_test.go +++ b/src/pkg/dashboard/stage_tracker_vocabulary_test.go @@ -33,7 +33,7 @@ func TestStageTrackerVocabularyTable(t *testing.T) { stagelabels.NeedsAuthor: {trackerColumnReview, "waiting for its author"}, stagelabels.ReturnedToContributor: {trackerColumnReview, "returned to the contributor"}, stagelabels.AdoptedByHive: {trackerColumnReview, "adopted by hive"}, - stagelabels.AwaitingMergeAdmission: {trackerColumnMergeGate, "at the merge gate"}, + stagelabels.AwaitingMergeAdmission: {trackerColumnMergeGate, "at the merge queue"}, stagelabels.NeedsDecision: {trackerColumnMergeGate, "waiting for a human decision"}, stagelabels.ReadyForHumanMerge: {trackerColumnMergeGate, "ready for human merge"}, stagelabels.PreMergeSoak: {trackerColumnMergeGate, "soaking before merge"}, diff --git a/src/pkg/dashboard/static-src/css/tracker.css b/src/pkg/dashboard/static-src/css/tracker.css index 971a06c5ec..f1704a1ef7 100644 --- a/src/pkg/dashboard/static-src/css/tracker.css +++ b/src/pkg/dashboard/static-src/css/tracker.css @@ -174,6 +174,9 @@ .ham-train-head { display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-2) var(--sp-2) 0 var(--sp-5); margin-top: var(--sp-2); font-size: var(--fs-xs); color: var(--muted); min-width: 0; position: relative; } .ham-train-head::before { content: ''; position: absolute; left: calc(var(--sp-2) + 2px); top: 50%; bottom: 0; border-left: var(--line-width) solid var(--line-strong); } .ham-train-chip { display: inline-flex; align-items: center; gap: 0.4em; padding: 0 0.6em; border: var(--line-width) solid var(--line-strong); border-radius: var(--r-pill); line-height: 1.6; color: var(--text); font-size: var(--fs-xs); white-space: nowrap; } + /* The train icon (hivecommons/hive issue 15395): 14px, currentColor, so it reads at chip size. */ + .ham-train-icon { width: 14px; height: 14px; flex: 0 0 auto; vertical-align: -2px; } + .ham-seg-t .ham-col-ico { display: inline-block; margin-right: 0.3em; } .ham-train-files { color: var(--text-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .ham-row.ham-train { padding-left: var(--sp-5); position: relative; } .ham-row.ham-train::before { content: ''; position: absolute; left: calc(var(--sp-2) + 2px); top: 0; bottom: 0; border-left: var(--line-width) solid var(--line-strong); } diff --git a/src/pkg/dashboard/static-src/js/config-features.js b/src/pkg/dashboard/static-src/js/config-features.js index a458cb447a..9c35791c7a 100644 --- a/src/pkg/dashboard/static-src/js/config-features.js +++ b/src/pkg/dashboard/static-src/js/config-features.js @@ -408,7 +408,7 @@ ${featuresSectionHtml('review', ` <div class="settings-subsection"> <div class="settings-subsection-title">Review Gate ${settingHelpMark('review-swarm', 'configuration', 'Review Gate', `The review swarm gate runs designated reviewer agents on each PR and blocks merge until they approve. Used at ACMM L4+.`)}</div> - <div class="config-subgroup">Merge gate</div> + <div class="config-subgroup">Merge queue</div> <div class="config-toggle"> <div class="config-toggle-switch ${rv.require_approval ? 'on' : ''}" data-action="toggleConfigSwitch" data-section="review" data-key="require_approval"></div> <span class="config-toggle-label">Require review-swarm approval before merge ${settingHelpMark('review-swarm', 'configuration', 'Require review-swarm approval before merge', `When on, a PR is not merge-eligible until the reviewer agents record an aggregate approval. Off by default, which preserves the existing behaviour of not consulting review verdicts at all. Typically used at ACMM L4 and above.`)}</span> @@ -474,7 +474,7 @@ </div> <div class="config-toggle mt-4"> <div class="config-toggle-switch ${rv.post_comments ? 'on' : ''}" data-action="toggleConfigSwitch" data-section="review" data-key="post_comments"></div> - <span class="config-toggle-label">Post review comments ${yamlHint('review.post_comments')} ${settingHelpMark('review-swarm', 'configuration', 'Post review comments', `OFF by default. Reviewers publish their verdict as a PR comment through the hive-review relay, in addition to returning it to the merge gate. Off, the verdict stays internal, which on a hive without auto-merge means nobody reads it. Turn this on so a review reaches the human who has to decide.`)}</span> + <span class="config-toggle-label">Post review comments ${yamlHint('review.post_comments')} ${settingHelpMark('review-swarm', 'configuration', 'Post review comments', `OFF by default. Reviewers publish their verdict as a PR comment through the hive-review relay, in addition to returning it to the merge queue. Off, the verdict stays internal, which on a hive without auto-merge means nobody reads it. Turn this on so a review reaches the human who has to decide.`)}</span> </div> <div class="config-toggle" style="margin-top:10px"> <div class="config-toggle-switch ${rv.acknowledge_no_findings ? 'on' : ''}" data-action="toggleConfigSwitch" data-section="review" data-key="acknowledge_no_findings"></div> diff --git a/src/pkg/dashboard/static-src/js/tracker-actions.js b/src/pkg/dashboard/static-src/js/tracker-actions.js index 4f44bf1a60..754c2b9502 100644 --- a/src/pkg/dashboard/static-src/js/tracker-actions.js +++ b/src/pkg/dashboard/static-src/js/tracker-actions.js @@ -181,7 +181,7 @@ return { user, canHold, canHuman: user && dashboardRoleAtLeast(role, 'merger'), login: String(window._hiveUser || ''), governor: (window._lastStatus && window._lastStatus.governor) || null }; } // Pure: the item a row's "Decide…" acts on. A PR parked at 085 (the - // "Needs human decision" pill on the Merge gate column) decides itself; + // "Needs human decision" pill on the Merge queue column) decides itself; // an issue row decides a nested PR parked at 085 when it has one (its // own stage is only mirrored from that PR), else itself when parked at // 045. null when nothing on the row is waiting on a person. @@ -232,7 +232,7 @@ // Pure: the decision choices for one decision target. On an issue // parked at 045 the verbs are /hive approve and /hive decision. On a PR // parked at 085, Approve posts the /lgtm + /approve commands as the - // operator (the merge gate decides from there — nothing merges here), + // operator (the merge queue decides from there — nothing merges here), // Close as superseded names the PR that won, and Give direction is the // /hive decision fix lane. function stageTrackerDecideOptions(item, ctx) { @@ -1432,7 +1432,7 @@ return (await stageTrackerAsk(id, 'confirm', { title: 'Close as partially addressed', message: 'Label ' + refs + ' hive/partially-addressed and close ' + (items.length > 1 ? 'them' : 'it') + ' as ' + who + '? The remaining work stays described in the closing comment; nothing is merged.', confirmLabel: 'Close as partial', danger: true })) ? {} : null; case 'decide:approve': if (prs) { - return (await stageTrackerAsk(id, 'confirm', { title: 'Approve pull request' + (items.length > 1 ? 's' : ''), message: preface + 'Post "/lgtm" and "/approve" on ' + refs + ' as ' + who + '? The merge gate takes it from there — the dashboard does not merge.', confirmLabel: 'Post /lgtm + /approve', danger: !!sentinel })) ? {} : null; + return (await stageTrackerAsk(id, 'confirm', { title: 'Approve pull request' + (items.length > 1 ? 's' : ''), message: preface + 'Post "/lgtm" and "/approve" on ' + refs + ' as ' + who + '? The merge queue takes it from there — the dashboard does not merge.', confirmLabel: 'Post /lgtm + /approve', danger: !!sentinel })) ? {} : null; } return (await stageTrackerAsk(id, 'confirm', { title: 'Approve direction', message: 'Record "/hive approve" on ' + refs + ' as ' + who + '? The hive un-parks the issue' + (items.length > 1 ? 's' : '') + ' and carries on; nothing is merged.', confirmLabel: 'Approve' })) ? {} : null; case 'decide:direction': { diff --git a/src/pkg/dashboard/static-src/js/tracker-filter.js b/src/pkg/dashboard/static-src/js/tracker-filter.js index 2e4116dc21..8ea99f87c3 100644 --- a/src/pkg/dashboard/static-src/js/tracker-filter.js +++ b/src/pkg/dashboard/static-src/js/tracker-filter.js @@ -805,9 +805,9 @@ "adoption-undone": {"kind": "reason", "plain": "the hive's copy was closed without merging and the adoption was undone", "detail": "The hive opened its copy, but the copy was closed without merging and a fresh one could not be opened, so the adoption was undone and the PR is back in its normal flow. Re-run the decision to adopt it again, or act on GitHub."}, "adoption/supersede": {"kind": "action", "plain": "close this PR and open a fresh hive-authored PR with the same commits", "detail": "Supersede means the hive closes this PR and opens a fresh hive-authored PR carrying the same commits and sign-off, then finishes it itself."}, "already-fixed": {"kind": "rule", "plain": "the issue was already fixed by a merged PR; closed as superseded", "detail": "The issue this PR fixes is already closed and a merged PR closed it (or a merged PR declares it supersedes this one), so nothing is left to deliver. The hive closes the PR as superseded with a note naming the merging PR; it never adopts it."}, - "approve": {"kind": "action", "plain": "approved for merge", "detail": "The hive approved it; the merge gate merges it once every check passes.", "issue_plain": "approved to proceed — an agent may claim it", "issue_detail": "The hive approved the direction; the issue leaves Needs decision and an agent may claim it. Nothing is merged."}, - "approve-review": {"kind": "action", "plain": "approved for merge", "detail": "The hive approved it; the merge gate merges it once every check passes.", "issue_plain": "approved to proceed — an agent may claim it", "issue_detail": "The hive approved the direction; the issue leaves Needs decision and an agent may claim it. Nothing is merged."}, - "approved": {"kind": "action", "plain": "approved for merge", "detail": "The hive approved it; the merge gate merges it once every check passes.", "issue_plain": "approved to proceed — an agent may claim it", "issue_detail": "The hive approved the direction; the issue leaves Needs decision and an agent may claim it. Nothing is merged."}, + "approve": {"kind": "action", "plain": "approved for merge", "detail": "The hive approved it; the merge queue merges it once every check passes.", "issue_plain": "approved to proceed — an agent may claim it", "issue_detail": "The hive approved the direction; the issue leaves Needs decision and an agent may claim it. Nothing is merged."}, + "approve-review": {"kind": "action", "plain": "approved for merge", "detail": "The hive approved it; the merge queue merges it once every check passes.", "issue_plain": "approved to proceed — an agent may claim it", "issue_detail": "The hive approved the direction; the issue leaves Needs decision and an agent may claim it. Nothing is merged."}, + "approved": {"kind": "action", "plain": "approved for merge", "detail": "The hive approved it; the merge queue merges it once every check passes.", "issue_plain": "approved to proceed — an agent may claim it", "issue_detail": "The hive approved the direction; the issue leaves Needs decision and an agent may claim it. Nothing is merged."}, "author-association": {"kind": "reason", "plain": "no merge lane vouches for this PR's author; a maintainer merges", "detail": "The PR is ready, but its author is not a collaborator and holds no trusted or merger tier, so no merge lane vouches for them and the hive never merges it unattended. A maintainer merges it (Approve \u0026 merge as maintainer, or Approve — let hive merge), or trusts the author under 👥 Contributors."}, "author-online": {"kind": "reason", "plain": "the author's clanker or hive is connected, so hive won't take the PR over", "detail": "Adoption is for authors whose clanker or hive has gone offline; this author's is connected, so the hive leaves the PR with them."}, "behind": {"kind": "reason", "plain": "the branch is behind the base branch", "detail": "The branch is behind the base branch and must be updated before it can merge."}, @@ -856,12 +856,12 @@ "labels-remove": {"kind": "action", "plain": "removed labels", "detail": "The hive removed labels from the item."}, "link": {"kind": "action", "plain": "cross-linked a related item", "detail": "The hive left a comment linking a related issue or PR."}, "llm-delegate": {"kind": "rule", "plain": "decided by the hive's model under the owner's rules", "detail": "No mechanical rule applied, so the hive's model decided under the owner's standing rules; the same safety rails applied."}, - "mergeable-as-is": {"kind": "rule", "plain": "mergeable and green as it is; handed to the merge gate", "detail": "The head is mergeable with green CI, so no adoption is needed: the hive approves it and the merge gate takes it as it is."}, + "mergeable-as-is": {"kind": "rule", "plain": "mergeable and green as it is; handed to the merge queue", "detail": "The head is mergeable with green CI, so no adoption is needed: the hive approves it and the merge queue takes it as it is."}, "needs-human": {"kind": "reason", "plain": "marked needs-human; a person must remove the label", "detail": "The item is marked needs-human: automated fixes ran out or a person flagged it. The hive waits until the label is removed."}, "no-effect": {"kind": "reason", "plain": "the decision hasn't taken effect", "detail": "The hive recorded this decision, but what it was supposed to cause has not happened within the expected time."}, "no-new-commit": {"kind": "reason", "plain": "no new commit has been pushed", "detail": "The hive gave direction, but no new commit has been pushed yet."}, "not-closed-yet": {"kind": "reason", "plain": "the close didn't land", "detail": "The hive decided to close it, but it is still open; the close call did not land."}, - "not-merged-yet": {"kind": "reason", "plain": "the merge gate hasn't merged it", "detail": "The hive approved it but the merge gate has not merged it; its lane reason says what still blocks it."}, + "not-merged-yet": {"kind": "reason", "plain": "the merge queue hasn't merged it", "detail": "The hive approved it but the merge queue has not merged it; its lane reason says what still blocks it."}, "not-now": {"kind": "action", "plain": "declined for now; closed as not planned", "detail": "The hive declined the proposal for now and closed it as not planned, with the reason and what evidence would reopen it."}, "operator-action": {"kind": "action", "plain": "told the spoke owner what to do; nothing for an agent here", "detail": "The hive named the spoke owner and the one action they take (for example re-authenticate the provider). The item stays parked, gets no approved-direction, and clears when the report stops recurring."}, "one-pr-per-issue": {"kind": "rule", "plain": "two PRs fix the same issue; the merge queue keeps one", "detail": "Two open PRs declare the same closing issue. The merge queue carries one PR per issue — a green head first, then the earlier-opened — and the other closes as superseded with credit."}, @@ -886,7 +886,7 @@ "return-to-contributor": {"kind": "rule", "plain": "the author's clanker or hive is connected; returned to them with the fix list", "detail": "The author's clanker or hive is connected (or has picked the rework up), so the hive hands the PR back to them with the exact fix list instead of adopting it."}, "review-backlog": {"kind": "rule", "plain": "the PR closed without merging, so the issue stays open", "detail": "The fixing PR closed unmerged; the issue stays open and is re-triaged rather than auto-closed."}, "reviewer-verdict:request_changes": {"kind": "reason", "plain": "a reviewer asked for changes; a new commit is needed", "detail": "A reviewer asked for changes on this branch. Approving cannot override that: only a new commit, or a maintainer merging by hand, moves it."}, - "self-decision-read-as-changes": {"kind": "reason", "plain": "hive's own decision comment was read as a reviewer asking for changes", "detail": "The merge gate read the hive's own `/hive decision` comment as a reviewer asking for changes, so the decision blocked the PR it meant to advance (hivecommons/hive#14822). A new commit or a maintainer merge clears it."}, + "self-decision-read-as-changes": {"kind": "reason", "plain": "hive's own decision comment was read as a reviewer asking for changes", "detail": "The merge queue read the hive's own `/hive decision` comment as a reviewer asking for changes, so the decision blocked the PR it meant to advance (hivecommons/hive#14822). A new commit or a maintainer merge clears it."}, "selfreport-operator-action": {"kind": "rule", "plain": "a spoke self-report only its operator can fix; not code work", "detail": "The issue is a fleet self-report (expired login, credentials, disk, network, App setup) whose remedy is on the reporting spoke. The hive tells that spoke's owner what to do and keeps it out of the actionable set; no agent is sent to code."}, "sentinel": {"kind": "reason", "plain": "security-sensitive files changed; a maintainer must approve", "detail": "Security-sensitive files changed. The hive never merges until a maintainer reviews and removes the sentinel label."}, "sentinel-alert": {"kind": "reason", "plain": "security-sensitive files changed; a maintainer must approve", "detail": "Security-sensitive files changed. The hive never merges until a maintainer reviews and removes the sentinel label."}, diff --git a/src/pkg/dashboard/static-src/js/tracker-queue.js b/src/pkg/dashboard/static-src/js/tracker-queue.js index 0ea78036e2..fa92803270 100644 --- a/src/pkg/dashboard/static-src/js/tracker-queue.js +++ b/src/pkg/dashboard/static-src/js/tracker-queue.js @@ -26,7 +26,7 @@ // Pure: one member's state in plain words — never the state slug. function stageTrackerQueueMemberState(it, nowMs) { const mt = it.merge_train || {}; - if (mt.state === STAGE_TRACKER_TRAIN_STATE_FRONT || (Number(mt.position) || 0) === 1) return String(mt.head_reason || '').trim() || 'front of the queue'; + if (mt.state === STAGE_TRACKER_TRAIN_STATE_FRONT || (Number(mt.position) || 0) === 1) return String(mt.head_reason || '').trim() || 'merges next'; if (mt.state === STAGE_TRACKER_TRAIN_STATE_REBASING) return 'being rebased · attempt ' + (Number(mt.attempt) || 0) + '/' + (Number(mt.max_attempts) || 0); if (mt.state === STAGE_TRACKER_TRAIN_STATE_EXHAUSTED) return 'needs a human rebase'; const mg = it.merge_gate || {}; @@ -42,7 +42,7 @@ const place = stageTrackerTrainPlace(t.mt); const stalled = stageTrackerTrainStalledWord(t.mt); const base = String(t.mt.id || '').split('#')[0] || 'base'; - const title = `<div class="ham-queue-train${stalled ? ' ham-queue-stalled' : ''}">${esc(STAGE_TRACKER_TRAIN_GLYPH)} ${esc(String(t.repo || ''))} → ${esc(base)} · ${esc(String(place.len))} PRs · head #${esc(String(place.head))}${stalled ? ' · ' + esc(stalled.replace(/^Merge queue stalled · /, 'stalled: ')) : ''}</div>`; + const title = `<div class="ham-queue-train${stalled ? ' ham-queue-stalled' : ''}">${stageTrackerTrainIconHtml('ham-train-icon')} ${esc(String(t.repo || ''))} → ${esc(base)} · ${esc(String(place.len))} PRs · head #${esc(String(place.head))}${stalled ? ' · ' + esc(stalled.replace(/^Merge queue stalled · /, 'stalled: ')) : ''}</div>`; const rows = t.members.map(it => { const mt = it.merge_train || {}; const n = esc(String(it.number || '')); diff --git a/src/pkg/dashboard/static-src/js/tracker-row.js b/src/pkg/dashboard/static-src/js/tracker-row.js index 4be085ba19..6a170b32ef 100644 --- a/src/pkg/dashboard/static-src/js/tracker-row.js +++ b/src/pkg/dashboard/static-src/js/tracker-row.js @@ -14,6 +14,11 @@ if (cur >= STAGE_TRACKER_TERMINAL) return STAGE_TRACKER_TERMINAL; const mg = item && item.merge_gate; if (mg && (mg.state === 'merging' || mg.state === 'merge-failed') && cur > STAGE_TRACKER_PR_COLUMN) return STAGE_TRACKER_MERGE_COLUMN; + // A merge-train member is a Merge queue matter too, 1st included: + // the train's facts are mirrored onto its head while the head still + // sits at 050/070, and hive's own #15400 ("1st") lit CI / Review + // next to its 2nd-place sibling in Merge queue (hivecommons/hive#15395). + if (item && item.merge_train && item.merge_train.state && cur > STAGE_TRACKER_PR_COLUMN) return STAGE_TRACKER_MERGE_COLUMN; if (cur === STAGE_TRACKER_ISSUE_NEEDS_DECISION || cur === STAGE_TRACKER_TRIAGE_NEEDED || cur === STAGE_TRACKER_POSSIBLY_EXISTS) return STAGE_TRACKER_ISSUE_DECISION_COLUMN; if (cur === STAGE_TRACKER_NEEDS_DECISION && kind === 'issue') return STAGE_TRACKER_ISSUE_DECISION_COLUMN; if (STAGE_TRACKER_PATH.indexOf(cur) >= 0) return cur; @@ -107,7 +112,9 @@ 30: '<circle cx="4" cy="3" r="1.5"/><circle cx="4" cy="13" r="1.5"/><circle cx="12" cy="5" r="1.5"/><path d="M4 4.5v7M12 6.5c0 3-8 1-8 4"/>', 40: '<circle cx="4" cy="3" r="1.5"/><circle cx="4" cy="13" r="1.5"/><circle cx="12" cy="12" r="1.5"/><path d="M4 4.5v7M4 6c0 3 6 2 6.5 5"/>', 50: '<path d="M1 8s2.5-5 7-5 7 5 7 5-2.5 5-7 5-7-5-7-5z"/><circle cx="8" cy="8" r="2"/>', - 80: '<path d="M8 1l6 2v5c0 3.5-2.5 6-6 7-3.5-1-6-3.5-6-7V3z"/>', + // Merge queue: the same railcar as the column header and train chip + // (STAGE_TRACKER_TRAIN_ICON_PATH in tracker-words.js; a test keeps them equal). + 80: '<rect x="2" y="3.5" width="12" height="7" rx="1.5"/><path d="M2 7.5h12M6.5 3.5v4M10.5 3.5v4M4 13.5l-1.5 1.5M12 13.5l1.5 1.5"/><circle cx="5" cy="12.5" r="1.5"/><circle cx="11" cy="12.5" r="1.5"/>', 100: '<path d="M3 5h10M3 8h10M3 11h10"/>', 110: '<path d="M3 8l3 3 7-7"/>', history: '<path d="M2 8a6 6 0 1 0 6-6 6.5 6.5 0 0 0-4.5 1.83L2 5.33"/><path d="M2 2v3.33h3.33"/><path d="M8 4.67V8l2.67 1.33"/>', @@ -283,7 +290,9 @@ (stages || []).forEach(st => { byNum[st.number] = st; }); const cols = STAGE_TRACKER_PATH.map(n => { const name = n === 0 ? 'Open' : ((byNum[n] || {}).short || (byNum[n] || {}).label || String(n)); - return `<li class="ham-seg"><span class="ham-seg-t">${esc(name)}</span></li>`; + // The Merge queue column wears the same train as the train header chip. + const ico = n === 80 && typeof stageTrackerTrainIconHtml === 'function' ? stageTrackerTrainIconHtml('ham-ico ham-train-icon ham-col-ico') : ''; + return `<li class="ham-seg"><span class="ham-seg-t">${ico}${esc(name)}</span></li>`; }).join(''); return `<div class="ham-cols" aria-hidden="true"><div class="ham-strip-row"><ol class="ham-strip">${cols}<li class="ham-seg cap ham-history-head" title="History — decisions and actions on this item">${stageTrackerIcon('history', 'ham-ico ham-history-ico', 'History — decisions and actions on this item')}</li></ol><span class="ham-since">since</span></div></div>`; } diff --git a/src/pkg/dashboard/static-src/js/tracker-words.js b/src/pkg/dashboard/static-src/js/tracker-words.js index 9fb99d7caf..eab7cd8d41 100644 --- a/src/pkg/dashboard/static-src/js/tracker-words.js +++ b/src/pkg/dashboard/static-src/js/tracker-words.js @@ -137,11 +137,24 @@ const STAGE_TRACKER_TRAIN_STATE_QUEUED = 'queued-behind'; const STAGE_TRACKER_TRAIN_STATE_REBASING = 'rebasing'; const STAGE_TRACKER_TRAIN_STATE_EXHAUSTED = 'rebase-exhausted'; - const STAGE_TRACKER_TRAIN_GLYPH = '⛓'; + // The merge-queue icon: a side-view railcar on two wheels (14px, + // currentColor) — the owner read the old ⛓ as a scribble. One path for + // the Merge queue column header, the train header chip and the queue + // popover, so the picture means the same thing everywhere. + const STAGE_TRACKER_TRAIN_ICON_PATH = '<rect x="2" y="3.5" width="12" height="7" rx="1.5"/><path d="M2 7.5h12M6.5 3.5v4M10.5 3.5v4M4 13.5l-1.5 1.5M12 13.5l1.5 1.5"/><circle cx="5" cy="12.5" r="1.5"/><circle cx="11" cy="12.5" r="1.5"/>'; + const STAGE_TRACKER_TRAIN_ICON_TITLE = 'Merge queue'; + // Pure: the inline-SVG train with its "Merge queue" hover. + function stageTrackerTrainIconHtml(cls) { + return `<svg class="${esc(cls || 'ham-train-icon')}" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" role="img" aria-label="${esc(STAGE_TRACKER_TRAIN_ICON_TITLE)}"><title>${esc(STAGE_TRACKER_TRAIN_ICON_TITLE)}${STAGE_TRACKER_TRAIN_ICON_PATH}`; + } + // Pure: ordinal place words — "1st", "2nd", "3rd", "4th", "11th", + // "21st" (the owner's wording for the queue: "Merge queued · 1st"). // Every merge_train / merge_gate train state in words. A slug reaches a // chip only through this table (or stageTrackerTrainWord), never raw: // hive's own #15406 once read "front" (hivecommons/hive#15395). - const STAGE_TRACKER_TRAIN_STATE_WORD = { front: 'Next to merge', 'queued-behind': 'In merge queue', rebasing: 'Rebasing', 'rebase-exhausted': 'Needs human decision', 'duplicate-of': 'Duplicate of' }; + // Both queue states read "Merge queued"; the place ("· 1st", "· 2nd") + // is what tells them apart — the owner could not parse "queued-behind". + const STAGE_TRACKER_TRAIN_STATE_WORD = { front: 'Merge queued', 'queued-behind': 'Merge queued', rebasing: 'Rebasing', 'rebase-exhausted': 'Needs human decision', 'duplicate-of': 'Duplicate of' }; // merge_gate.state of a PR the queue holds because another open PR // fixes the same issue: "duplicate-of:15402" (merge_gate.duplicate_of // / duplicate_issue carry the numbers). @@ -192,9 +205,9 @@ return 'Merge queue stalled · head #' + p.head + (why ? ' ' + why : '') + (dur ? ' ' + dur : ''); } // The chevron word for a train member ('' for a row not in a train). - // The queued word is the position only — "In merge queue · 2 of 6" — - // so it reads the same with the merge sweep on or off (#15395); never - // the state slug. + // The queued word is the place only — "Merge queued · 2nd" — so it + // reads the same with the merge sweep on or off (#15395); never the + // state slug, never "front" or "queued-behind". function stageTrackerTrainWord(item) { const mt = stageTrackerTrain(item); if (!mt) return ''; @@ -202,17 +215,13 @@ if (stalled && (mt.state === STAGE_TRACKER_TRAIN_STATE_FRONT || mt.state === STAGE_TRACKER_TRAIN_STATE_QUEUED)) return stalled; const p = stageTrackerTrainPlace(mt); switch (mt.state) { - case STAGE_TRACKER_TRAIN_STATE_FRONT: return STAGE_TRACKER_TRAIN_STATE_WORD[mt.state] + ' · 1 of ' + p.len; - case STAGE_TRACKER_TRAIN_STATE_QUEUED: return STAGE_TRACKER_TRAIN_STATE_WORD[mt.state] + ' · ' + p.pos + ' of ' + p.len; + case STAGE_TRACKER_TRAIN_STATE_FRONT: return STAGE_TRACKER_TRAIN_STATE_WORD[mt.state] + ' · ' + stageTrackerOrdinal(1); + case STAGE_TRACKER_TRAIN_STATE_QUEUED: return STAGE_TRACKER_TRAIN_STATE_WORD[mt.state] + ' · ' + stageTrackerOrdinal(p.pos || 2); case STAGE_TRACKER_TRAIN_STATE_REBASING: return 'Rebasing · attempt ' + (Number(mt.attempt) || 0) + '/' + (Number(mt.max_attempts) || 0); case STAGE_TRACKER_TRAIN_STATE_EXHAUSTED: return 'Needs human decision · rebase failed ' + (Number(mt.attempt) === 2 ? 'twice' : (Number(mt.attempt) || 0) + ' times'); } return STAGE_TRACKER_TRAIN_STATE_WORD[mt.state] || stageTrackerMergeGateStateWord(mt.state); } - // Pure: the queued row's hover sentence — "Behind #15253 (soaking, 12m - // left) and 1 more. Hive merges one at a time, in order. Estimated - // turn: ~25m." A head on a person or CI has no estimate, so the - // sentence names what the head waits on instead. // Pure: the member's countdown target in ms (eta_at, else now+eta_s); // 0 with no estimate. function stageTrackerTrainEtaAt(mt, nowMs) { @@ -222,8 +231,8 @@ const s = Number(mt.eta_s) || 0; return s > 0 ? nowMs + s * 1000 : 0; } - // Pure: the "Estimated turn" sentence — "~25m (2 ahead · next sweep in - // 40s)", "running late — estimated ~25m, still waiting", or '' with no + // Pure: the ETA words — "ETA ~25m (2 ahead · next sweep in 40s)", + // "running late — estimated ~25m, still waiting", or '' with no // estimate. Always a "~": an estimate, not a promise. function stageTrackerTrainEtaWords(mt, nowMs) { const at = stageTrackerTrainEtaAt(mt, nowMs); @@ -231,25 +240,33 @@ const left = stageTrackerShortLeft(at - nowMs); const basis = String(mt.eta_basis || '').trim(); if (mt.late) return 'Running late — estimated ~' + stageTrackerShortLeft((Number(mt.eta_s) || 0) * 1000) + ', still waiting' + (basis ? ' (' + basis + ')' : '') + '.'; - return 'Estimated turn: ' + (left ? '~' + left : 'any sweep now') + (basis ? ' (' + basis + ')' : '') + '.'; + return 'ETA ' + (left ? '~' + left : 'any sweep now') + (basis ? ' (' + basis + ')' : '') + '.'; } + // Pure: the queued row's hover — "2nd of 6 in the merge queue · behind + // #15253 (soaking, 12m left) · ETA ~25m. Hive merges one at a time, in + // order." / "1st of 6 in the merge queue · merges next · ETA ~4m." A + // head on a person or CI has no estimate, so the hover names what the + // head waits on instead. Never "front" or "queued-behind". function stageTrackerTrainQueueTip(mt, nowMs) { if (!mt) return ''; nowMs = typeof nowMs === 'number' ? nowMs : Date.now(); const p = stageTrackerTrainPlace(mt); const why = String(mt.head_reason || '').trim(); - const etaWords = stageTrackerTrainEtaWords(mt, nowMs); + const etaWords = stageTrackerTrainEtaWords(mt, nowMs).replace(/\.$/, ''); const stalledFor = stageTrackerShortLeft((Number(mt.stalled_s) || 0) * 1000); - const order = 'Hive merges one at a time, in order.'; - if (mt.state === STAGE_TRACKER_TRAIN_STATE_FRONT) { - return 'Front of the merge queue' + (p.len > 1 ? ' (' + (p.len - 1) + ' more behind it)' : '') + (why ? ': ' + why : '') + '. ' + order + (mt.stalled ? ' Stalled: the head has not moved for ' + stalledFor + '.' : (etaWords ? ' ' + etaWords : '')); + const order = ' Hive merges one at a time, in order.'; + const first = mt.state === STAGE_TRACKER_TRAIN_STATE_FRONT || (p.pos === 1 && mt.state === STAGE_TRACKER_TRAIN_STATE_QUEUED); + if (first) { + let tip = stageTrackerOrdinal(1) + ' of ' + Math.max(p.len, 1) + ' in the merge queue · merges next' + (why ? ' (' + why + ')' : ''); + if (mt.stalled) tip += ' · stalled: it has not moved for ' + stalledFor; + else if (etaWords) tip += ' · ' + etaWords; + return tip + '.' + order; } - const more = Math.max(0, p.pos - 2); - let tip = 'Behind #' + p.head + (why ? ' (' + why + ')' : '') + (more ? ' and ' + more + ' more' : '') + '. ' + order; - if (mt.stalled) tip += ' Merge queue stalled: head #' + p.head + ' has not moved for ' + stalledFor + (why ? ' — ' + why : '') + '. No estimate until the head moves.'; - else if (etaWords) tip += ' ' + etaWords; - else if (why) tip += ' Head #' + p.head + ' is ' + why + '; no estimate until it moves.'; - return tip; + let tip = stageTrackerOrdinal(p.pos || 2) + ' of ' + Math.max(p.len, p.pos || 2) + ' in the merge queue · behind #' + p.head + (why ? ' (' + why + ')' : ''); + if (mt.stalled) tip += ' · merge queue stalled: #' + p.head + ' has not moved for ' + stalledFor + (why ? ' — ' + why : '') + '; no estimate until it moves'; + else if (etaWords) tip += ' · ' + etaWords; + else if (why) tip += ' · no estimate until #' + p.head + ' moves'; + return tip + '.' + order; } // Tooltip lines: the queue ahead and the overlapping files. function stageTrackerTrainLines(item) { @@ -257,10 +274,10 @@ if (!mt) return []; const ahead = Array.isArray(mt.ahead) ? mt.ahead.filter(n => Number(n) > 0) : []; const files = Array.isArray(mt.overlap_files) ? mt.overlap_files.filter(Boolean) : []; - const lines = ['Merge train: ' + (Number(mt.size) || 0) + ' PRs to ' + (String(mt.id || '').split('#')[0] || 'the same base') + ' touch the same files; they merge one at a time, front first' + (mt.front ? ' (front #' + mt.front + ')' : '')]; - if (mt.state === STAGE_TRACKER_TRAIN_STATE_FRONT) lines.push('Position: front — merges first; the lane then updates or rebases the others'); + const lines = ['Merge train: ' + (Number(mt.size) || 0) + ' PRs to ' + (String(mt.id || '').split('#')[0] || 'the same base') + ' touch the same files; they merge one at a time, in order' + (mt.front ? ' (1st: #' + mt.front + ')' : '')]; + if (mt.state === STAGE_TRACKER_TRAIN_STATE_FRONT) lines.push('Position: 1st — merges next; the lane then updates or rebases the others'); else lines.push('Position: ' + stageTrackerOrdinal(mt.position) + ' of ' + (Number(mt.size) || 0) + (ahead.length ? ' · ahead: ' + ahead.map(n => '#' + n).join(', ') : '')); - if (mt.state === STAGE_TRACKER_TRAIN_STATE_REBASING) lines.push('Front merged; rebase attempt ' + (Number(mt.attempt) || 0) + ' of ' + (Number(mt.max_attempts) || 0) + ' in progress'); + if (mt.state === STAGE_TRACKER_TRAIN_STATE_REBASING) lines.push('The PR ahead merged; rebase attempt ' + (Number(mt.attempt) || 0) + ' of ' + (Number(mt.max_attempts) || 0) + ' in progress'); if (mt.state === STAGE_TRACKER_TRAIN_STATE_EXHAUSTED) lines.push('Rebase failed ' + (Number(mt.attempt) || 0) + ' of ' + (Number(mt.max_attempts) || 0) + ' times — a maintainer rebases, then merges'); if (files.length) lines.push('Overlapping files: ' + files.join(', ')); return lines; @@ -286,9 +303,10 @@ }); return out; } - // Header line over a train's rows: "⛓ merge train · 4 PRs · front #15074". + // Header line over a train's rows: "merge train · 4 PRs · 1st: #15074" + // (the train icon sits in front of it in the HTML). function stageTrackerTrainHeaderText(mt) { - return STAGE_TRACKER_TRAIN_GLYPH + ' merge train · ' + (Number(mt.size) || 0) + ' PRs · front #' + (Number(mt.front) || 0); + return 'merge train · ' + (Number(mt.size) || 0) + ' PRs · 1st: #' + (Number(mt.front) || 0); } function stageTrackerTrainHeaderHtml(item) { const mt = stageTrackerTrain(item); @@ -296,7 +314,7 @@ const files = Array.isArray(mt.overlap_files) ? mt.overlap_files.filter(Boolean) : []; const tip = stageTrackerTrainLines(item).join('\n'); return `
- ${esc(stageTrackerTrainHeaderText(mt))}${files.length ? `overlapping: ${esc(files.join(', '))}` : ''} + ${stageTrackerTrainIconHtml('ham-train-icon')} ${esc(stageTrackerTrainHeaderText(mt))}${files.length ? `overlapping: ${esc(files.join(', '))}` : ''}
`; } // Row classes for a train member: the rail, and whether it leads / ends @@ -354,7 +372,7 @@ // step) because the PR has not reached the gate yet: nothing a person // does now moves the row, so no pill is drawn and the row stays out of // "Needs attention"; the row tooltip alone names what waits at the gate. - const STAGE_TRACKER_DEFERRED_NOTE = 'Pending at merge gate: '; + const STAGE_TRACKER_DEFERRED_NOTE = 'Pending at merge queue: '; function stageTrackerDeferredMods(item) { return Array.isArray(item && item.deferred_modifiers) ? item.deferred_modifiers : []; } @@ -551,7 +569,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 gate', 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 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' }; // 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"). @@ -710,7 +728,7 @@ const trainSrc = stageTrackerTrain(src) ? src : (stageTrackerTrain(item) ? item : null); const mt = trainSrc ? stageTrackerTrain(trainSrc) : null; if (mt && (state === STAGE_TRACKER_TRAIN_STATE_FRONT || state === STAGE_TRACKER_TRAIN_STATE_QUEUED || state === STAGE_TRACKER_TRAIN_STATE_REBASING || state === STAGE_TRACKER_TRAIN_STATE_EXHAUSTED)) { - const trainWord = stageTrackerTrainWord(trainSrc) || 'In merge queue'; + const trainWord = stageTrackerTrainWord(trainSrc) || STAGE_TRACKER_TRAIN_STATE_WORD[STAGE_TRACKER_TRAIN_STATE_QUEUED]; const queued = state === STAGE_TRACKER_TRAIN_STATE_FRONT || state === STAGE_TRACKER_TRAIN_STATE_QUEUED; const queueTip = queued ? stageTrackerTrainQueueTip(mt, nowMs) : stageTrackerTrainLines(trainSrc).join('. ') + '.'; const checking = mg.sweep_running ? ' Checking now…' : ''; diff --git a/src/pkg/dashboard/static/index.html b/src/pkg/dashboard/static/index.html index 2dee85cc4c..e36d4fef22 100644 --- a/src/pkg/dashboard/static/index.html +++ b/src/pkg/dashboard/static/index.html @@ -1497,6 +1497,9 @@ .ham-train-head { display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-2) var(--sp-2) 0 var(--sp-5); margin-top: var(--sp-2); font-size: var(--fs-xs); color: var(--muted); min-width: 0; position: relative; } .ham-train-head::before { content: ''; position: absolute; left: calc(var(--sp-2) + 2px); top: 50%; bottom: 0; border-left: var(--line-width) solid var(--line-strong); } .ham-train-chip { display: inline-flex; align-items: center; gap: 0.4em; padding: 0 0.6em; border: var(--line-width) solid var(--line-strong); border-radius: var(--r-pill); line-height: 1.6; color: var(--text); font-size: var(--fs-xs); white-space: nowrap; } + /* The train icon (hivecommons/hive issue 15395): 14px, currentColor, so it reads at chip size. */ + .ham-train-icon { width: 14px; height: 14px; flex: 0 0 auto; vertical-align: -2px; } + .ham-seg-t .ham-col-ico { display: inline-block; margin-right: 0.3em; } .ham-train-files { color: var(--text-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .ham-row.ham-train { padding-left: var(--sp-5); position: relative; } .ham-row.ham-train::before { content: ''; position: absolute; left: calc(var(--sp-2) + 2px); top: 0; bottom: 0; border-left: var(--line-width) solid var(--line-strong); } @@ -14298,11 +14301,24 @@

Where to get help

const STAGE_TRACKER_TRAIN_STATE_QUEUED = 'queued-behind'; const STAGE_TRACKER_TRAIN_STATE_REBASING = 'rebasing'; const STAGE_TRACKER_TRAIN_STATE_EXHAUSTED = 'rebase-exhausted'; - const STAGE_TRACKER_TRAIN_GLYPH = '⛓'; + // The merge-queue icon: a side-view railcar on two wheels (14px, + // currentColor) — the owner read the old ⛓ as a scribble. One path for + // the Merge queue column header, the train header chip and the queue + // popover, so the picture means the same thing everywhere. + const STAGE_TRACKER_TRAIN_ICON_PATH = ''; + const STAGE_TRACKER_TRAIN_ICON_TITLE = 'Merge queue'; + // Pure: the inline-SVG train with its "Merge queue" hover. + function stageTrackerTrainIconHtml(cls) { + return `${esc(STAGE_TRACKER_TRAIN_ICON_TITLE)}${STAGE_TRACKER_TRAIN_ICON_PATH}`; + } + // Pure: ordinal place words — "1st", "2nd", "3rd", "4th", "11th", + // "21st" (the owner's wording for the queue: "Merge queued · 1st"). // Every merge_train / merge_gate train state in words. A slug reaches a // chip only through this table (or stageTrackerTrainWord), never raw: // hive's own #15406 once read "front" (hivecommons/hive#15395). - const STAGE_TRACKER_TRAIN_STATE_WORD = { front: 'Next to merge', 'queued-behind': 'In merge queue', rebasing: 'Rebasing', 'rebase-exhausted': 'Needs human decision', 'duplicate-of': 'Duplicate of' }; + // Both queue states read "Merge queued"; the place ("· 1st", "· 2nd") + // is what tells them apart — the owner could not parse "queued-behind". + const STAGE_TRACKER_TRAIN_STATE_WORD = { front: 'Merge queued', 'queued-behind': 'Merge queued', rebasing: 'Rebasing', 'rebase-exhausted': 'Needs human decision', 'duplicate-of': 'Duplicate of' }; // merge_gate.state of a PR the queue holds because another open PR // fixes the same issue: "duplicate-of:15402" (merge_gate.duplicate_of // / duplicate_issue carry the numbers). @@ -14353,9 +14369,9 @@

Where to get help

return 'Merge queue stalled · head #' + p.head + (why ? ' ' + why : '') + (dur ? ' ' + dur : ''); } // The chevron word for a train member ('' for a row not in a train). - // The queued word is the position only — "In merge queue · 2 of 6" — - // so it reads the same with the merge sweep on or off (#15395); never - // the state slug. + // The queued word is the place only — "Merge queued · 2nd" — so it + // reads the same with the merge sweep on or off (#15395); never the + // state slug, never "front" or "queued-behind". function stageTrackerTrainWord(item) { const mt = stageTrackerTrain(item); if (!mt) return ''; @@ -14363,17 +14379,13 @@

Where to get help

if (stalled && (mt.state === STAGE_TRACKER_TRAIN_STATE_FRONT || mt.state === STAGE_TRACKER_TRAIN_STATE_QUEUED)) return stalled; const p = stageTrackerTrainPlace(mt); switch (mt.state) { - case STAGE_TRACKER_TRAIN_STATE_FRONT: return STAGE_TRACKER_TRAIN_STATE_WORD[mt.state] + ' · 1 of ' + p.len; - case STAGE_TRACKER_TRAIN_STATE_QUEUED: return STAGE_TRACKER_TRAIN_STATE_WORD[mt.state] + ' · ' + p.pos + ' of ' + p.len; + case STAGE_TRACKER_TRAIN_STATE_FRONT: return STAGE_TRACKER_TRAIN_STATE_WORD[mt.state] + ' · ' + stageTrackerOrdinal(1); + case STAGE_TRACKER_TRAIN_STATE_QUEUED: return STAGE_TRACKER_TRAIN_STATE_WORD[mt.state] + ' · ' + stageTrackerOrdinal(p.pos || 2); case STAGE_TRACKER_TRAIN_STATE_REBASING: return 'Rebasing · attempt ' + (Number(mt.attempt) || 0) + '/' + (Number(mt.max_attempts) || 0); case STAGE_TRACKER_TRAIN_STATE_EXHAUSTED: return 'Needs human decision · rebase failed ' + (Number(mt.attempt) === 2 ? 'twice' : (Number(mt.attempt) || 0) + ' times'); } return STAGE_TRACKER_TRAIN_STATE_WORD[mt.state] || stageTrackerMergeGateStateWord(mt.state); } - // Pure: the queued row's hover sentence — "Behind #15253 (soaking, 12m - // left) and 1 more. Hive merges one at a time, in order. Estimated - // turn: ~25m." A head on a person or CI has no estimate, so the - // sentence names what the head waits on instead. // Pure: the member's countdown target in ms (eta_at, else now+eta_s); // 0 with no estimate. function stageTrackerTrainEtaAt(mt, nowMs) { @@ -14383,8 +14395,8 @@

Where to get help

const s = Number(mt.eta_s) || 0; return s > 0 ? nowMs + s * 1000 : 0; } - // Pure: the "Estimated turn" sentence — "~25m (2 ahead · next sweep in - // 40s)", "running late — estimated ~25m, still waiting", or '' with no + // Pure: the ETA words — "ETA ~25m (2 ahead · next sweep in 40s)", + // "running late — estimated ~25m, still waiting", or '' with no // estimate. Always a "~": an estimate, not a promise. function stageTrackerTrainEtaWords(mt, nowMs) { const at = stageTrackerTrainEtaAt(mt, nowMs); @@ -14392,25 +14404,33 @@

Where to get help

const left = stageTrackerShortLeft(at - nowMs); const basis = String(mt.eta_basis || '').trim(); if (mt.late) return 'Running late — estimated ~' + stageTrackerShortLeft((Number(mt.eta_s) || 0) * 1000) + ', still waiting' + (basis ? ' (' + basis + ')' : '') + '.'; - return 'Estimated turn: ' + (left ? '~' + left : 'any sweep now') + (basis ? ' (' + basis + ')' : '') + '.'; + return 'ETA ' + (left ? '~' + left : 'any sweep now') + (basis ? ' (' + basis + ')' : '') + '.'; } + // Pure: the queued row's hover — "2nd of 6 in the merge queue · behind + // #15253 (soaking, 12m left) · ETA ~25m. Hive merges one at a time, in + // order." / "1st of 6 in the merge queue · merges next · ETA ~4m." A + // head on a person or CI has no estimate, so the hover names what the + // head waits on instead. Never "front" or "queued-behind". function stageTrackerTrainQueueTip(mt, nowMs) { if (!mt) return ''; nowMs = typeof nowMs === 'number' ? nowMs : Date.now(); const p = stageTrackerTrainPlace(mt); const why = String(mt.head_reason || '').trim(); - const etaWords = stageTrackerTrainEtaWords(mt, nowMs); + const etaWords = stageTrackerTrainEtaWords(mt, nowMs).replace(/\.$/, ''); const stalledFor = stageTrackerShortLeft((Number(mt.stalled_s) || 0) * 1000); - const order = 'Hive merges one at a time, in order.'; - if (mt.state === STAGE_TRACKER_TRAIN_STATE_FRONT) { - return 'Front of the merge queue' + (p.len > 1 ? ' (' + (p.len - 1) + ' more behind it)' : '') + (why ? ': ' + why : '') + '. ' + order + (mt.stalled ? ' Stalled: the head has not moved for ' + stalledFor + '.' : (etaWords ? ' ' + etaWords : '')); - } - const more = Math.max(0, p.pos - 2); - let tip = 'Behind #' + p.head + (why ? ' (' + why + ')' : '') + (more ? ' and ' + more + ' more' : '') + '. ' + order; - if (mt.stalled) tip += ' Merge queue stalled: head #' + p.head + ' has not moved for ' + stalledFor + (why ? ' — ' + why : '') + '. No estimate until the head moves.'; - else if (etaWords) tip += ' ' + etaWords; - else if (why) tip += ' Head #' + p.head + ' is ' + why + '; no estimate until it moves.'; - return tip; + const order = ' Hive merges one at a time, in order.'; + const first = mt.state === STAGE_TRACKER_TRAIN_STATE_FRONT || (p.pos === 1 && mt.state === STAGE_TRACKER_TRAIN_STATE_QUEUED); + if (first) { + let tip = stageTrackerOrdinal(1) + ' of ' + Math.max(p.len, 1) + ' in the merge queue · merges next' + (why ? ' (' + why + ')' : ''); + if (mt.stalled) tip += ' · stalled: it has not moved for ' + stalledFor; + else if (etaWords) tip += ' · ' + etaWords; + return tip + '.' + order; + } + let tip = stageTrackerOrdinal(p.pos || 2) + ' of ' + Math.max(p.len, p.pos || 2) + ' in the merge queue · behind #' + p.head + (why ? ' (' + why + ')' : ''); + if (mt.stalled) tip += ' · merge queue stalled: #' + p.head + ' has not moved for ' + stalledFor + (why ? ' — ' + why : '') + '; no estimate until it moves'; + else if (etaWords) tip += ' · ' + etaWords; + else if (why) tip += ' · no estimate until #' + p.head + ' moves'; + return tip + '.' + order; } // Tooltip lines: the queue ahead and the overlapping files. function stageTrackerTrainLines(item) { @@ -14418,10 +14438,10 @@

Where to get help

if (!mt) return []; const ahead = Array.isArray(mt.ahead) ? mt.ahead.filter(n => Number(n) > 0) : []; const files = Array.isArray(mt.overlap_files) ? mt.overlap_files.filter(Boolean) : []; - const lines = ['Merge train: ' + (Number(mt.size) || 0) + ' PRs to ' + (String(mt.id || '').split('#')[0] || 'the same base') + ' touch the same files; they merge one at a time, front first' + (mt.front ? ' (front #' + mt.front + ')' : '')]; - if (mt.state === STAGE_TRACKER_TRAIN_STATE_FRONT) lines.push('Position: front — merges first; the lane then updates or rebases the others'); + const lines = ['Merge train: ' + (Number(mt.size) || 0) + ' PRs to ' + (String(mt.id || '').split('#')[0] || 'the same base') + ' touch the same files; they merge one at a time, in order' + (mt.front ? ' (1st: #' + mt.front + ')' : '')]; + if (mt.state === STAGE_TRACKER_TRAIN_STATE_FRONT) lines.push('Position: 1st — merges next; the lane then updates or rebases the others'); else lines.push('Position: ' + stageTrackerOrdinal(mt.position) + ' of ' + (Number(mt.size) || 0) + (ahead.length ? ' · ahead: ' + ahead.map(n => '#' + n).join(', ') : '')); - if (mt.state === STAGE_TRACKER_TRAIN_STATE_REBASING) lines.push('Front merged; rebase attempt ' + (Number(mt.attempt) || 0) + ' of ' + (Number(mt.max_attempts) || 0) + ' in progress'); + if (mt.state === STAGE_TRACKER_TRAIN_STATE_REBASING) lines.push('The PR ahead merged; rebase attempt ' + (Number(mt.attempt) || 0) + ' of ' + (Number(mt.max_attempts) || 0) + ' in progress'); if (mt.state === STAGE_TRACKER_TRAIN_STATE_EXHAUSTED) lines.push('Rebase failed ' + (Number(mt.attempt) || 0) + ' of ' + (Number(mt.max_attempts) || 0) + ' times — a maintainer rebases, then merges'); if (files.length) lines.push('Overlapping files: ' + files.join(', ')); return lines; @@ -14447,9 +14467,10 @@

Where to get help

}); return out; } - // Header line over a train's rows: "⛓ merge train · 4 PRs · front #15074". + // Header line over a train's rows: "merge train · 4 PRs · 1st: #15074" + // (the train icon sits in front of it in the HTML). function stageTrackerTrainHeaderText(mt) { - return STAGE_TRACKER_TRAIN_GLYPH + ' merge train · ' + (Number(mt.size) || 0) + ' PRs · front #' + (Number(mt.front) || 0); + return 'merge train · ' + (Number(mt.size) || 0) + ' PRs · 1st: #' + (Number(mt.front) || 0); } function stageTrackerTrainHeaderHtml(item) { const mt = stageTrackerTrain(item); @@ -14457,7 +14478,7 @@

Where to get help

const files = Array.isArray(mt.overlap_files) ? mt.overlap_files.filter(Boolean) : []; const tip = stageTrackerTrainLines(item).join('\n'); return `
- ${esc(stageTrackerTrainHeaderText(mt))}${files.length ? `overlapping: ${esc(files.join(', '))}` : ''} + ${stageTrackerTrainIconHtml('ham-train-icon')} ${esc(stageTrackerTrainHeaderText(mt))}${files.length ? `overlapping: ${esc(files.join(', '))}` : ''}
`; } // Row classes for a train member: the rail, and whether it leads / ends @@ -14515,7 +14536,7 @@

Where to get help

// step) because the PR has not reached the gate yet: nothing a person // does now moves the row, so no pill is drawn and the row stays out of // "Needs attention"; the row tooltip alone names what waits at the gate. - const STAGE_TRACKER_DEFERRED_NOTE = 'Pending at merge gate: '; + const STAGE_TRACKER_DEFERRED_NOTE = 'Pending at merge queue: '; function stageTrackerDeferredMods(item) { return Array.isArray(item && item.deferred_modifiers) ? item.deferred_modifiers : []; } @@ -14712,7 +14733,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 gate', 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 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' }; // 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"). @@ -14871,7 +14892,7 @@

Where to get help

const trainSrc = stageTrackerTrain(src) ? src : (stageTrackerTrain(item) ? item : null); const mt = trainSrc ? stageTrackerTrain(trainSrc) : null; if (mt && (state === STAGE_TRACKER_TRAIN_STATE_FRONT || state === STAGE_TRACKER_TRAIN_STATE_QUEUED || state === STAGE_TRACKER_TRAIN_STATE_REBASING || state === STAGE_TRACKER_TRAIN_STATE_EXHAUSTED)) { - const trainWord = stageTrackerTrainWord(trainSrc) || 'In merge queue'; + const trainWord = stageTrackerTrainWord(trainSrc) || STAGE_TRACKER_TRAIN_STATE_WORD[STAGE_TRACKER_TRAIN_STATE_QUEUED]; const queued = state === STAGE_TRACKER_TRAIN_STATE_FRONT || state === STAGE_TRACKER_TRAIN_STATE_QUEUED; const queueTip = queued ? stageTrackerTrainQueueTip(mt, nowMs) : stageTrackerTrainLines(trainSrc).join('. ') + '.'; const checking = mg.sweep_running ? ' Checking now…' : ''; @@ -15490,6 +15511,11 @@

Where to get help

if (cur >= STAGE_TRACKER_TERMINAL) return STAGE_TRACKER_TERMINAL; const mg = item && item.merge_gate; if (mg && (mg.state === 'merging' || mg.state === 'merge-failed') && cur > STAGE_TRACKER_PR_COLUMN) return STAGE_TRACKER_MERGE_COLUMN; + // A merge-train member is a Merge queue matter too, 1st included: + // the train's facts are mirrored onto its head while the head still + // sits at 050/070, and hive's own #15400 ("1st") lit CI / Review + // next to its 2nd-place sibling in Merge queue (hivecommons/hive#15395). + if (item && item.merge_train && item.merge_train.state && cur > STAGE_TRACKER_PR_COLUMN) return STAGE_TRACKER_MERGE_COLUMN; if (cur === STAGE_TRACKER_ISSUE_NEEDS_DECISION || cur === STAGE_TRACKER_TRIAGE_NEEDED || cur === STAGE_TRACKER_POSSIBLY_EXISTS) return STAGE_TRACKER_ISSUE_DECISION_COLUMN; if (cur === STAGE_TRACKER_NEEDS_DECISION && kind === 'issue') return STAGE_TRACKER_ISSUE_DECISION_COLUMN; if (STAGE_TRACKER_PATH.indexOf(cur) >= 0) return cur; @@ -15583,7 +15609,9 @@

Where to get help

30: '', 40: '', 50: '', - 80: '', + // Merge queue: the same railcar as the column header and train chip + // (STAGE_TRACKER_TRAIN_ICON_PATH in tracker-words.js; a test keeps them equal). + 80: '', 100: '', 110: '', history: '', @@ -15759,7 +15787,9 @@

Where to get help

(stages || []).forEach(st => { byNum[st.number] = st; }); const cols = STAGE_TRACKER_PATH.map(n => { const name = n === 0 ? 'Open' : ((byNum[n] || {}).short || (byNum[n] || {}).label || String(n)); - return `
  • ${esc(name)}
  • `; + // The Merge queue column wears the same train as the train header chip. + const ico = n === 80 && typeof stageTrackerTrainIconHtml === 'function' ? stageTrackerTrainIconHtml('ham-ico ham-train-icon ham-col-ico') : ''; + return `
  • ${ico}${esc(name)}
  • `; }).join(''); return ``; } @@ -18110,9 +18140,9 @@

    All labels

    "adoption-undone": {"kind": "reason", "plain": "the hive's copy was closed without merging and the adoption was undone", "detail": "The hive opened its copy, but the copy was closed without merging and a fresh one could not be opened, so the adoption was undone and the PR is back in its normal flow. Re-run the decision to adopt it again, or act on GitHub."}, "adoption/supersede": {"kind": "action", "plain": "close this PR and open a fresh hive-authored PR with the same commits", "detail": "Supersede means the hive closes this PR and opens a fresh hive-authored PR carrying the same commits and sign-off, then finishes it itself."}, "already-fixed": {"kind": "rule", "plain": "the issue was already fixed by a merged PR; closed as superseded", "detail": "The issue this PR fixes is already closed and a merged PR closed it (or a merged PR declares it supersedes this one), so nothing is left to deliver. The hive closes the PR as superseded with a note naming the merging PR; it never adopts it."}, - "approve": {"kind": "action", "plain": "approved for merge", "detail": "The hive approved it; the merge gate merges it once every check passes.", "issue_plain": "approved to proceed — an agent may claim it", "issue_detail": "The hive approved the direction; the issue leaves Needs decision and an agent may claim it. Nothing is merged."}, - "approve-review": {"kind": "action", "plain": "approved for merge", "detail": "The hive approved it; the merge gate merges it once every check passes.", "issue_plain": "approved to proceed — an agent may claim it", "issue_detail": "The hive approved the direction; the issue leaves Needs decision and an agent may claim it. Nothing is merged."}, - "approved": {"kind": "action", "plain": "approved for merge", "detail": "The hive approved it; the merge gate merges it once every check passes.", "issue_plain": "approved to proceed — an agent may claim it", "issue_detail": "The hive approved the direction; the issue leaves Needs decision and an agent may claim it. Nothing is merged."}, + "approve": {"kind": "action", "plain": "approved for merge", "detail": "The hive approved it; the merge queue merges it once every check passes.", "issue_plain": "approved to proceed — an agent may claim it", "issue_detail": "The hive approved the direction; the issue leaves Needs decision and an agent may claim it. Nothing is merged."}, + "approve-review": {"kind": "action", "plain": "approved for merge", "detail": "The hive approved it; the merge queue merges it once every check passes.", "issue_plain": "approved to proceed — an agent may claim it", "issue_detail": "The hive approved the direction; the issue leaves Needs decision and an agent may claim it. Nothing is merged."}, + "approved": {"kind": "action", "plain": "approved for merge", "detail": "The hive approved it; the merge queue merges it once every check passes.", "issue_plain": "approved to proceed — an agent may claim it", "issue_detail": "The hive approved the direction; the issue leaves Needs decision and an agent may claim it. Nothing is merged."}, "author-association": {"kind": "reason", "plain": "no merge lane vouches for this PR's author; a maintainer merges", "detail": "The PR is ready, but its author is not a collaborator and holds no trusted or merger tier, so no merge lane vouches for them and the hive never merges it unattended. A maintainer merges it (Approve \u0026 merge as maintainer, or Approve — let hive merge), or trusts the author under 👥 Contributors."}, "author-online": {"kind": "reason", "plain": "the author's clanker or hive is connected, so hive won't take the PR over", "detail": "Adoption is for authors whose clanker or hive has gone offline; this author's is connected, so the hive leaves the PR with them."}, "behind": {"kind": "reason", "plain": "the branch is behind the base branch", "detail": "The branch is behind the base branch and must be updated before it can merge."}, @@ -18161,12 +18191,12 @@

    All labels

    "labels-remove": {"kind": "action", "plain": "removed labels", "detail": "The hive removed labels from the item."}, "link": {"kind": "action", "plain": "cross-linked a related item", "detail": "The hive left a comment linking a related issue or PR."}, "llm-delegate": {"kind": "rule", "plain": "decided by the hive's model under the owner's rules", "detail": "No mechanical rule applied, so the hive's model decided under the owner's standing rules; the same safety rails applied."}, - "mergeable-as-is": {"kind": "rule", "plain": "mergeable and green as it is; handed to the merge gate", "detail": "The head is mergeable with green CI, so no adoption is needed: the hive approves it and the merge gate takes it as it is."}, + "mergeable-as-is": {"kind": "rule", "plain": "mergeable and green as it is; handed to the merge queue", "detail": "The head is mergeable with green CI, so no adoption is needed: the hive approves it and the merge queue takes it as it is."}, "needs-human": {"kind": "reason", "plain": "marked needs-human; a person must remove the label", "detail": "The item is marked needs-human: automated fixes ran out or a person flagged it. The hive waits until the label is removed."}, "no-effect": {"kind": "reason", "plain": "the decision hasn't taken effect", "detail": "The hive recorded this decision, but what it was supposed to cause has not happened within the expected time."}, "no-new-commit": {"kind": "reason", "plain": "no new commit has been pushed", "detail": "The hive gave direction, but no new commit has been pushed yet."}, "not-closed-yet": {"kind": "reason", "plain": "the close didn't land", "detail": "The hive decided to close it, but it is still open; the close call did not land."}, - "not-merged-yet": {"kind": "reason", "plain": "the merge gate hasn't merged it", "detail": "The hive approved it but the merge gate has not merged it; its lane reason says what still blocks it."}, + "not-merged-yet": {"kind": "reason", "plain": "the merge queue hasn't merged it", "detail": "The hive approved it but the merge queue has not merged it; its lane reason says what still blocks it."}, "not-now": {"kind": "action", "plain": "declined for now; closed as not planned", "detail": "The hive declined the proposal for now and closed it as not planned, with the reason and what evidence would reopen it."}, "operator-action": {"kind": "action", "plain": "told the spoke owner what to do; nothing for an agent here", "detail": "The hive named the spoke owner and the one action they take (for example re-authenticate the provider). The item stays parked, gets no approved-direction, and clears when the report stops recurring."}, "one-pr-per-issue": {"kind": "rule", "plain": "two PRs fix the same issue; the merge queue keeps one", "detail": "Two open PRs declare the same closing issue. The merge queue carries one PR per issue — a green head first, then the earlier-opened — and the other closes as superseded with credit."}, @@ -18191,7 +18221,7 @@

    All labels

    "return-to-contributor": {"kind": "rule", "plain": "the author's clanker or hive is connected; returned to them with the fix list", "detail": "The author's clanker or hive is connected (or has picked the rework up), so the hive hands the PR back to them with the exact fix list instead of adopting it."}, "review-backlog": {"kind": "rule", "plain": "the PR closed without merging, so the issue stays open", "detail": "The fixing PR closed unmerged; the issue stays open and is re-triaged rather than auto-closed."}, "reviewer-verdict:request_changes": {"kind": "reason", "plain": "a reviewer asked for changes; a new commit is needed", "detail": "A reviewer asked for changes on this branch. Approving cannot override that: only a new commit, or a maintainer merging by hand, moves it."}, - "self-decision-read-as-changes": {"kind": "reason", "plain": "hive's own decision comment was read as a reviewer asking for changes", "detail": "The merge gate read the hive's own `/hive decision` comment as a reviewer asking for changes, so the decision blocked the PR it meant to advance (hivecommons/hive#14822). A new commit or a maintainer merge clears it."}, + "self-decision-read-as-changes": {"kind": "reason", "plain": "hive's own decision comment was read as a reviewer asking for changes", "detail": "The merge queue read the hive's own `/hive decision` comment as a reviewer asking for changes, so the decision blocked the PR it meant to advance (hivecommons/hive#14822). A new commit or a maintainer merge clears it."}, "selfreport-operator-action": {"kind": "rule", "plain": "a spoke self-report only its operator can fix; not code work", "detail": "The issue is a fleet self-report (expired login, credentials, disk, network, App setup) whose remedy is on the reporting spoke. The hive tells that spoke's owner what to do and keeps it out of the actionable set; no agent is sent to code."}, "sentinel": {"kind": "reason", "plain": "security-sensitive files changed; a maintainer must approve", "detail": "Security-sensitive files changed. The hive never merges until a maintainer reviews and removes the sentinel label."}, "sentinel-alert": {"kind": "reason", "plain": "security-sensitive files changed; a maintainer must approve", "detail": "Security-sensitive files changed. The hive never merges until a maintainer reviews and removes the sentinel label."}, @@ -18389,7 +18419,7 @@

    All labels

    return { user, canHold, canHuman: user && dashboardRoleAtLeast(role, 'merger'), login: String(window._hiveUser || ''), governor: (window._lastStatus && window._lastStatus.governor) || null }; } // Pure: the item a row's "Decide…" acts on. A PR parked at 085 (the - // "Needs human decision" pill on the Merge gate column) decides itself; + // "Needs human decision" pill on the Merge queue column) decides itself; // an issue row decides a nested PR parked at 085 when it has one (its // own stage is only mirrored from that PR), else itself when parked at // 045. null when nothing on the row is waiting on a person. @@ -18440,7 +18470,7 @@

    All labels

    // Pure: the decision choices for one decision target. On an issue // parked at 045 the verbs are /hive approve and /hive decision. On a PR // parked at 085, Approve posts the /lgtm + /approve commands as the - // operator (the merge gate decides from there — nothing merges here), + // operator (the merge queue decides from there — nothing merges here), // Close as superseded names the PR that won, and Give direction is the // /hive decision fix lane. function stageTrackerDecideOptions(item, ctx) { @@ -19640,7 +19670,7 @@

    All labels

    return (await stageTrackerAsk(id, 'confirm', { title: 'Close as partially addressed', message: 'Label ' + refs + ' hive/partially-addressed and close ' + (items.length > 1 ? 'them' : 'it') + ' as ' + who + '? The remaining work stays described in the closing comment; nothing is merged.', confirmLabel: 'Close as partial', danger: true })) ? {} : null; case 'decide:approve': if (prs) { - return (await stageTrackerAsk(id, 'confirm', { title: 'Approve pull request' + (items.length > 1 ? 's' : ''), message: preface + 'Post "/lgtm" and "/approve" on ' + refs + ' as ' + who + '? The merge gate takes it from there — the dashboard does not merge.', confirmLabel: 'Post /lgtm + /approve', danger: !!sentinel })) ? {} : null; + return (await stageTrackerAsk(id, 'confirm', { title: 'Approve pull request' + (items.length > 1 ? 's' : ''), message: preface + 'Post "/lgtm" and "/approve" on ' + refs + ' as ' + who + '? The merge queue takes it from there — the dashboard does not merge.', confirmLabel: 'Post /lgtm + /approve', danger: !!sentinel })) ? {} : null; } return (await stageTrackerAsk(id, 'confirm', { title: 'Approve direction', message: 'Record "/hive approve" on ' + refs + ' as ' + who + '? The hive un-parks the issue' + (items.length > 1 ? 's' : '') + ' and carries on; nothing is merged.', confirmLabel: 'Approve' })) ? {} : null; case 'decide:direction': { @@ -21010,7 +21040,7 @@

    All labels

    // Pure: one member's state in plain words — never the state slug. function stageTrackerQueueMemberState(it, nowMs) { const mt = it.merge_train || {}; - if (mt.state === STAGE_TRACKER_TRAIN_STATE_FRONT || (Number(mt.position) || 0) === 1) return String(mt.head_reason || '').trim() || 'front of the queue'; + if (mt.state === STAGE_TRACKER_TRAIN_STATE_FRONT || (Number(mt.position) || 0) === 1) return String(mt.head_reason || '').trim() || 'merges next'; if (mt.state === STAGE_TRACKER_TRAIN_STATE_REBASING) return 'being rebased · attempt ' + (Number(mt.attempt) || 0) + '/' + (Number(mt.max_attempts) || 0); if (mt.state === STAGE_TRACKER_TRAIN_STATE_EXHAUSTED) return 'needs a human rebase'; const mg = it.merge_gate || {}; @@ -21026,7 +21056,7 @@

    All labels

    const place = stageTrackerTrainPlace(t.mt); const stalled = stageTrackerTrainStalledWord(t.mt); const base = String(t.mt.id || '').split('#')[0] || 'base'; - const title = `
    ${esc(STAGE_TRACKER_TRAIN_GLYPH)} ${esc(String(t.repo || ''))} → ${esc(base)} · ${esc(String(place.len))} PRs · head #${esc(String(place.head))}${stalled ? ' · ' + esc(stalled.replace(/^Merge queue stalled · /, 'stalled: ')) : ''}
    `; + const title = `
    ${stageTrackerTrainIconHtml('ham-train-icon')} ${esc(String(t.repo || ''))} → ${esc(base)} · ${esc(String(place.len))} PRs · head #${esc(String(place.head))}${stalled ? ' · ' + esc(stalled.replace(/^Merge queue stalled · /, 'stalled: ')) : ''}
    `; const rows = t.members.map(it => { const mt = it.merge_train || {}; const n = esc(String(it.number || '')); @@ -55142,7 +55172,7 @@

    ${esc(s.title)}

    ${featuresSectionHtml('review', `
    Review Gate ${settingHelpMark('review-swarm', 'configuration', 'Review Gate', `The review swarm gate runs designated reviewer agents on each PR and blocks merge until they approve. Used at ACMM L4+.`)}
    -
    Merge gate
    +
    Merge queue
    Require review-swarm approval before merge ${settingHelpMark('review-swarm', 'configuration', 'Require review-swarm approval before merge', `When on, a PR is not merge-eligible until the reviewer agents record an aggregate approval. Off by default, which preserves the existing behaviour of not consulting review verdicts at all. Typically used at ACMM L4 and above.`)} @@ -55208,7 +55238,7 @@

    ${esc(s.title)}

    - Post review comments ${yamlHint('review.post_comments')} ${settingHelpMark('review-swarm', 'configuration', 'Post review comments', `OFF by default. Reviewers publish their verdict as a PR comment through the hive-review relay, in addition to returning it to the merge gate. Off, the verdict stays internal, which on a hive without auto-merge means nobody reads it. Turn this on so a review reaches the human who has to decide.`)} + Post review comments ${yamlHint('review.post_comments')} ${settingHelpMark('review-swarm', 'configuration', 'Post review comments', `OFF by default. Reviewers publish their verdict as a PR comment through the hive-review relay, in addition to returning it to the merge queue. Off, the verdict stays internal, which on a hive without auto-merge means nobody reads it. Turn this on so a review reaches the human who has to decide.`)}
    diff --git a/src/pkg/delegatedecision/decision_comment.go b/src/pkg/delegatedecision/decision_comment.go index 080694c079..295136979a 100644 --- a/src/pkg/delegatedecision/decision_comment.go +++ b/src/pkg/delegatedecision/decision_comment.go @@ -60,7 +60,7 @@ func ExpectedEffect(d Decision, kind Kind) Effect { return Effect{Waits: true, What: "the issue leaves Needs decision and an agent picks it up", IfNot: "Re-run the decision, or remove the park label by hand."} default: - return Effect{Waits: true, What: "the merge gate merges this PR once its checks are green", + return Effect{Waits: true, What: "the merge queue merges this PR once its checks are green", IfNot: "A maintainer can merge it by hand or send it back for a new commit; approving again does not help."} } } diff --git a/src/pkg/delegatedecision/decision_glossary.go b/src/pkg/delegatedecision/decision_glossary.go index 184256112d..91846cf370 100644 --- a/src/pkg/delegatedecision/decision_glossary.go +++ b/src/pkg/delegatedecision/decision_glossary.go @@ -7,7 +7,7 @@ import ( ) // The decision glossary: every rule slug, verdict/action and blocker reason -// the delegate (or the merge gate it hands off to) can name, in plain words +// the delegate (or the merge queue it hands off to) can name, in plain words // an operator who has never read the hive's source can act on. This is the // ONE source for operator-facing text — the dashboard toast and popover, // the PR comment, the tooltip and the JS mirror in index.html @@ -91,8 +91,8 @@ var glossary = []GlossaryEntry{ Detail: "The PR's author (or their clanker or hive) has been offline since the hive nudged them, so the hive takes the work over instead of waiting. The decision itself names which: the author's clanker, a connected hive, or the author."}, {Slug: RuleAlreadyFixed, Kind: GlossaryRule, Plain: "the issue was already fixed by a merged PR; closed as superseded", Detail: "The issue this PR fixes is already closed and a merged PR closed it (or a merged PR declares it supersedes this one), so nothing is left to deliver. The hive closes the PR as superseded with a note naming the merging PR; it never adopts it."}, - {Slug: RuleMergeableAsIs, Kind: GlossaryRule, Plain: "mergeable and green as it is; handed to the merge gate", - Detail: "The head is mergeable with green CI, so no adoption is needed: the hive approves it and the merge gate takes it as it is."}, + {Slug: RuleMergeableAsIs, Kind: GlossaryRule, Plain: "mergeable and green as it is; handed to the merge queue", + Detail: "The head is mergeable with green CI, so no adoption is needed: the hive approves it and the merge queue takes it as it is."}, {Slug: RuleRebaseThenMerge, Kind: GlossaryRule, Plain: "only conflicts block it; a rebase then merge", Detail: "Conflicts are the only blocker. The unattended rebase-then-merge path lands with hivecommons/hive#15104; until then the ladder records this rung and moves on."}, {Slug: RuleReturnToContributor, Kind: GlossaryRule, Plain: "the author's clanker or hive is connected; returned to them with the fix list", @@ -151,7 +151,7 @@ var glossary = []GlossaryEntry{ {Slug: GlossaryAdopt, Kind: GlossaryAction, Plain: "hive takes over finishing this PR", Detail: "Adopt means the hive takes over finishing this PR: it rebases, fixes CI and merges it, keeping the author's commits and sign-off."}, {Slug: string(VerdictApprove), Kind: GlossaryAction, Plain: "approved for merge", - Detail: "The hive approved it; the merge gate merges it once every check passes.", + Detail: "The hive approved it; the merge queue merges it once every check passes.", IssuePlain: "approved to proceed — an agent may claim it", IssueDetail: "The hive approved the direction; the issue leaves Needs decision and an agent may claim it. Nothing is merged.", Aliases: []string{"approved", string(ActionApproveReview)}}, @@ -193,7 +193,7 @@ var glossary = []GlossaryEntry{ Detail: "A reviewer asked for changes on this branch. Approving cannot override that: only a new commit, or a maintainer merging by hand, moves it.", Aliases: []string{"changes-requested", "contributor-lane:changes-requested", "human-changes-requested", "reviewer-verdict:request_changes", "request_changes"}}, {Slug: GlossarySelfDecision, Kind: GlossaryReason, Plain: "hive's own decision comment was read as a reviewer asking for changes", - Detail: "The merge gate read the hive's own `/hive decision` comment as a reviewer asking for changes, so the decision blocked the PR it meant to advance (hivecommons/hive#14822). A new commit or a maintainer merge clears it."}, + Detail: "The merge queue read the hive's own `/hive decision` comment as a reviewer asking for changes, so the decision blocked the PR it meant to advance (hivecommons/hive#14822). A new commit or a maintainer merge clears it."}, {Slug: GlossarySentinel, Kind: GlossaryReason, Plain: "security-sensitive files changed; a maintainer must approve", Detail: "Security-sensitive files changed. The hive never merges until a maintainer reviews and removes the sentinel label.", Aliases: []string{"sentinel-alert", "contributor-lane:sentinel-blocked", "sentinel-blocked"}}, @@ -229,8 +229,8 @@ var glossary = []GlossaryEntry{ Detail: "The hive approved the issue and applied approved-direction, but the stage/045-needs-decision park label was never removed, so the scanner still skips the issue. Lift the park (it removes the label through the hive's audited label path) or re-evaluate the issue so the stage engine re-reads it."}, {Slug: GlossaryStillParked, Kind: GlossaryReason, Plain: "the item is still waiting on a person", Detail: "The item is still parked for a person's decision; the recorded decision did not move it."}, - {Slug: GlossaryNotMergedYet, Kind: GlossaryReason, Plain: "the merge gate hasn't merged it", - Detail: "The hive approved it but the merge gate has not merged it; its lane reason says what still blocks it."}, + {Slug: GlossaryNotMergedYet, Kind: GlossaryReason, Plain: "the merge queue hasn't merged it", + Detail: "The hive approved it but the merge queue has not merged it; its lane reason says what still blocks it."}, {Slug: GlossaryNotClosedYet, Kind: GlossaryReason, Plain: "the close didn't land", Detail: "The hive decided to close it, but it is still open; the close call did not land."}, {Slug: GlossaryNoNewCommit, Kind: GlossaryReason, Plain: "no new commit has been pushed", diff --git a/src/pkg/delegatedecision/ladder.go b/src/pkg/delegatedecision/ladder.go index 6571c7a4a1..cc0cbe705c 100644 --- a/src/pkg/delegatedecision/ladder.go +++ b/src/pkg/delegatedecision/ladder.go @@ -23,7 +23,7 @@ const ( // closed it (or a merged PR declares it supersedes this one). The PR // is closed as superseded; it is never adopted. RuleAlreadyFixed = "already-fixed" - // RuleMergeableAsIs: the head is mergeable and green; the merge gate + // RuleMergeableAsIs: the head is mergeable and green; the merge queue // takes it with no adoption. RuleMergeableAsIs = "mergeable-as-is" // RuleRebaseThenMerge: conflicts are the only blocker. The unattended @@ -173,12 +173,12 @@ func decideLadder(in Input, ref string) (Decision, bool) { return Decision{}, false } - // Rung 2 — mergeable as-is: the merge gate takes it; no adoption. An + // Rung 2 — mergeable as-is: the merge queue takes it; no adoption. An // adoption that already stalled on a lane blocker (changes requested, // attribution) is not one the gate would take on a green head alone. if !in.Conflicting && in.CIGreen && !in.DCOMissing && !in.ReporterTrustHold && !in.AdoptionStalled { - d := releasePR(RuleMergeableAsIs, "approve "+ref+": the head is mergeable and green, so it goes to the merge gate as it is", "a mergeable, green head needs no adoption; the merge gate takes it (hivecommons/hive#15289)") - return out(d, "mergeable and green; handed to the merge gate") + d := releasePR(RuleMergeableAsIs, "approve "+ref+": the head is mergeable and green, so it goes to the merge queue as it is", "a mergeable, green head needs no adoption; the merge queue takes it (hivecommons/hive#15289)") + return out(d, "mergeable and green; handed to the merge queue") } skip(RuleMergeableAsIs, mergeBlockers(in)) @@ -273,7 +273,7 @@ func decideAlreadyFixed(in Input, ref string, c MergedCloser) (Decision, string) }, text } -// mergeBlockers names what keeps a head from the merge gate. +// mergeBlockers names what keeps a head from the merge queue. func mergeBlockers(in Input) string { var b []string if in.Conflicting { diff --git a/src/pkg/github/automerge/automerge_merge_train.go b/src/pkg/github/automerge/automerge_merge_train.go index e084fd5303..48e6417174 100644 --- a/src/pkg/github/automerge/automerge_merge_train.go +++ b/src/pkg/github/automerge/automerge_merge_train.go @@ -14,6 +14,7 @@ import ( hgithub "github.com/hivecommons/hive/pkg/github" "github.com/hivecommons/hive/pkg/stageengine/prstage" + "github.com/hivecommons/hive/pkg/stagelabels" ) // Merge train (hivecommons/hive#15117). @@ -362,6 +363,10 @@ func (c *Engine) planMergeTrains(ctx context.Context, lane, displayRepo, owner, if !mergeTrainCandidate(prefilter(pr)) { continue } + if c.mergeTrainReturnedToContributor(owner, repo, pr) { + c.mergeTrainSkipLogged(owner, repo, displayRepo, pr.GetNumber(), pr.GetHead().GetSHA(), "returned-to-contributor") + continue + } base := pr.GetBase().GetRef() perBase[base] = append(perBase[base], pr) } @@ -423,6 +428,13 @@ func (c *Engine) planMergeTrains(ctx context.Context, lane, displayRepo, owner, m.HeadSHA = live.GetHead().GetSHA() } } + for i := range members { + m := &members[i] + if m.Number > 0 && c.mergeTrainConflictOutsider(owner, repo, m.Base, *m) { + c.mergeTrainSkipLogged(owner, repo, displayRepo, m.Number, m.HeadSHA, "conflicting") + m.Number = 0 + } + } plan.groups = groupMergeTrains(members) for i := range plan.groups { g := &plan.groups[i] @@ -434,6 +446,55 @@ func (c *Engine) planMergeTrains(ctx context.Context, lane, displayRepo, owner, return plan } +// mergeTrainReturnedToContributor reports a PR at stage 072 +// returned-to-contributor (its label, or the stage store's record): the +// fix is the contributor's, so it never rides a train — hive's own #15307 +// (conflicting, returned) was counted "4 of 6" and drew the train's stall +// comments (hivecommons/hive#15395). +func (c *Engine) mergeTrainReturnedToContributor(owner, repo string, pr *gh.PullRequest) bool { + if pr == nil { + return false + } + want := stagelabels.ReturnedToContributor.Label() + for _, l := range labelNames(pr.Labels) { + if strings.EqualFold(strings.TrimSpace(l), want) { + return true + } + } + if store := c.stageStoreOrShared(); store != nil { + if rec, ok := store.Get(stagelabels.Key(owner+"/"+repo, pr.GetNumber())); ok && rec.Stage == stagelabels.ReturnedToContributor { + return true + } + } + return false +} + +// mergeTrainConflictOutsider reports a conflicting member the train must +// not carry: a PR GitHub says is dirty is admitted only while the train +// itself is repairing it — a rebase attempt is on record for it behind +// this base's last merged front and the loop guard is not spent. A PR +// that arrived conflicting on its own is the author's to fix, and it +// neither takes a place in the queue nor counts toward the queue's size. +func (c *Engine) mergeTrainConflictOutsider(owner, repo, base string, m mergeTrainMember) bool { + if !mergeTrainDirty(m.MergeableState) { + return false + } + behind := c.mergeTrainLastFront(owner, repo, base) + if behind <= 0 || c.rebaseResolver == nil { + return true + } + attempts := c.mergeTrainAttempts(owner, repo, m.Number, behind) + return attempts <= 0 || attempts >= c.mergeTrainPolicyNow().MaxRebaseAttempts +} + +// mergeTrainSkipLogged logs one INFO line per head for a PR kept out of +// every train. +func (c *Engine) mergeTrainSkipLogged(owner, repo, displayRepo string, number int, headSHA, why string) { + if c.markTerminalHoldLogged(owner, repo, number, headSHA, "merge-train-skip:"+why) { + c.info("merge train: PR left out of every train", "repo", displayRepo, "pr", number, "why", why) + } +} + // mergeTrainFiles lists a PR's changed paths, cached by head SHA. func (c *Engine) mergeTrainFiles(ctx context.Context, owner, repo string, number int, headSHA string) ([]string, error) { key := owner + "/" + repo + "#" + strconv.Itoa(number) diff --git a/src/pkg/github/automerge/automerge_merge_train_test.go b/src/pkg/github/automerge/automerge_merge_train_test.go index dbcabefc80..50cc91eedf 100644 --- a/src/pkg/github/automerge/automerge_merge_train_test.go +++ b/src/pkg/github/automerge/automerge_merge_train_test.go @@ -17,6 +17,7 @@ import ( gh "github.com/google/go-github/v72/github" "github.com/hivecommons/hive/pkg/stageengine/prstage" + "github.com/hivecommons/hive/pkg/stagelabels" ) func mtMember(n int, state string, created time.Time, files ...string) mergeTrainMember { @@ -198,34 +199,34 @@ func newMergeTrainEngine(t *testing.T, srvURL string, policy MergeTrainPolicy, r func TestPlanMergeTrainsSiblingsAndFront(t *testing.T) { t0 := time.Date(2026, 10, 20, 9, 0, 0, 0, time.UTC) api := &mergeTrainAPI{ - files: map[int][]string{10: {"tracker.go", "index.html"}, 11: {"tracker.go"}, 12: {"index.html", "x.go"}, 13: {"readme.md"}}, - state: map[int]string{10: "clean", 11: "dirty", 12: "behind"}, + files: map[int][]string{10: {"tracker.go", "index.html"}, 11: {"tracker.go"}, 12: {"index.html", "x.go"}, 13: {"readme.md"}, 14: {"x.go"}}, + state: map[int]string{10: "clean", 11: "behind", 12: "behind", 14: "clean"}, } srv := newMergeTrainServer(t, api) defer srv.Close() c, logs := newMergeTrainEngine(t, srv.URL, DefaultMergeTrainPolicy, nil) // The list API carries no mergeable state; the planner reads it. - prs := []*gh.PullRequest{mtPR(13, t0, ""), mtPR(11, t0.Add(time.Minute), ""), mtPR(10, t0.Add(2*time.Minute), ""), mtPR(12, t0.Add(3*time.Minute), "")} + prs := []*gh.PullRequest{mtPR(13, t0, ""), mtPR(11, t0.Add(time.Minute), ""), mtPR(10, t0.Add(2*time.Minute), ""), mtPR(12, t0.Add(3*time.Minute), ""), mtPR(14, t0.Add(4*time.Minute), "")} prefilter := func(pr *gh.PullRequest) string { if pr.GetNumber() == 11 { - return "label:needs-rebase" // admitted: the label is what the train repairs + return "label:needs-rebase" // admitted: a merely-behind head is what the train updates } return "" } plan := c.planMergeTrains(context.Background(), "self", "acme/widget", "acme", "widget", prs, prefilter) - if !plan.isFront(10) || !plan.isSibling(11) || !plan.isSibling(12) || plan.isSibling(13) || plan.isFront(13) { - t.Fatalf("front/siblings wrong: front10=%v sib11=%v sib12=%v 13 in train=%v", plan.isFront(10), plan.isSibling(11), plan.isSibling(12), plan.isSibling(13) || plan.isFront(13)) + if !plan.isFront(10) || !plan.isSibling(11) || !plan.isSibling(12) || !plan.isSibling(14) || plan.isSibling(13) || plan.isFront(13) { + t.Fatalf("front/siblings wrong: front10=%v sib11=%v sib12=%v sib14=%v 13 in train=%v", plan.isFront(10), plan.isSibling(11), plan.isSibling(12), plan.isSibling(14), plan.isSibling(13) || plan.isFront(13)) } g, _ := plan.group(10) - if !reflect.DeepEqual(g.Order, []int{10, 12, 11}) { - t.Fatalf("order = %v, want clean, behind, dirty", g.Order) + if !reflect.DeepEqual(g.Order, []int{10, 14, 11, 12}) { + t.Fatalf("order = %v, want clean (earliest first), then behind", g.Order) } - reason := c.mergeTrainSkip(plan, 11) + reason := c.mergeTrainSkip(plan, 12) mt, ok := prstage.ParseMergeTrain(reason) - if !ok || mt.State != prstage.MergeTrainStateQueuedBehind || mt.Front != 10 || mt.Position != 3 || mt.Size != 3 { + if !ok || mt.State != prstage.MergeTrainStateQueuedBehind || mt.Front != 10 || mt.Position != 4 || mt.Size != 4 { t.Fatalf("sibling reason %q parsed %+v", reason, mt) } - if got := mt.Sentence(); !strings.Contains(got, "behind #10 in merge train (3rd of 3, overlapping files: index.html, tracker.go)") { + if got := mt.Sentence(); !strings.Contains(got, "behind #10 in merge train (4th of 4, overlapping files: index.html, tracker.go, x.go)") { t.Fatalf("sentence = %q", got) } // A clean front is the lane's to merge on its normal path. @@ -245,13 +246,18 @@ func TestPlanMergeTrainsSiblingsAndFront(t *testing.T) { if api.gets <= gets { t.Fatalf("mergeable state must be re-read each pass") } - // A new front is a transition. + // A new front is a transition — and a head that went conflicting on + // its own leaves the train and its count (hivecommons/hive#15395). api.mu.Lock() api.state[10] = "dirty" api.mu.Unlock() plan = c.planMergeTrains(context.Background(), "self", "acme/widget", "acme", "widget", prs, prefilter) - if !plan.isFront(12) { - t.Fatalf("expected #12 to lead once #10 went dirty; order %v", plan.groups[0].Order) + if !plan.isFront(14) || plan.isSibling(10) || plan.isFront(10) { + t.Fatalf("expected #14 to lead and #10 to drop out once #10 went dirty; groups %+v", plan.groups) + } + // #11 only ever overlapped #10, so it is no longer anyone's sibling. + if g, _ := plan.group(14); !reflect.DeepEqual(g.Order, []int{14, 12}) || plan.isSibling(11) { + t.Fatalf("order = %v (11 sibling=%v), want the conflicting #10 gone", g.Order, plan.isSibling(11)) } if n := strings.Count(logs.String(), "msg=\"merge train\""); n != 2 { t.Fatalf("transition lines = %d, want 2", n) @@ -350,41 +356,108 @@ func TestMergeTrainFrontRebaseLoopGuard(t *testing.T) { return nil }) c, logs := newMergeTrainEngine(t, srv.URL, MergeTrainPolicy{Enabled: true, MaxRebaseAttempts: 2}, resolver) - // #29 merged earlier on this base: the dirty front is "behind" it. - c.noteMergeTrainFrontMerged("acme", "widget", "v5", 29) prs := []*gh.PullRequest{mtPR(30, t0, ""), mtPR(31, t0.Add(time.Minute), "")} - var states []string - for pass := 0; pass < 4; pass++ { - plan := c.planMergeTrains(context.Background(), "self", "acme/widget", "acme", "widget", prs, func(*gh.PullRequest) string { return "" }) - reason, handled := c.mergeTrainFront(context.Background(), plan, prs[0]) - if !handled { - t.Fatalf("pass %d: dirty front with a resolver must be handled", pass) - } - mt, ok := prstage.ParseMergeTrain(reason) - if !ok { - t.Fatalf("pass %d: reason %q", pass, reason) - } - states = append(states, mt.State+":"+strconv.Itoa(mt.Attempt)+"/"+strconv.Itoa(mt.MaxAttempts)) + // Two heads that arrived conflicting on their own are nobody's train: + // the planner carries neither (hivecommons/hive#15395, #15307). + if plan := plan0(c, prs); plan.isFront(30) || plan.isSibling(31) || len(plan.groups) != 0 { + t.Fatalf("conflicting outsiders must not form a train: %+v", plan.groups) + } + // #29 merged earlier on this base and the train asked for #30's rebase + // as its sibling: #30 is the train's own repair, so it stays a member + // while the loop guard has attempts left. + c.noteMergeTrainFrontMerged("acme", "widget", "v5", 29) + c.bumpMergeTrainAttempts("acme", "widget", 30, 29) + c.bumpMergeTrainAttempts("acme", "widget", 31, 29) + plan := plan0(c, prs) + if !plan.isFront(30) || !plan.isSibling(31) { + t.Fatalf("members under repair must ride the train: %+v", plan.groups) } - want := []string{"rebasing:1/2", "rebasing:2/2", "rebase-exhausted:2/2", "rebase-exhausted:2/2"} - if !reflect.DeepEqual(states, want) { - t.Fatalf("states = %v, want %v", states, want) + reason, handled := c.mergeTrainFront(context.Background(), plan, prs[0]) + if !handled { + t.Fatal("dirty front under repair with a resolver must be handled") + } + mt, ok := prstage.ParseMergeTrain(reason) + if !ok || mt.State+":"+strconv.Itoa(mt.Attempt)+"/"+strconv.Itoa(mt.MaxAttempts) != "rebasing:2/2" { + t.Fatalf("reason %q parsed %+v", reason, mt) + } + // Guard spent on #30: it leaves the train, and #31 alone is no train — + // the conflicting path for a person takes them, not a train slot. + plan = plan0(c, prs) + if len(plan.groups) != 0 { + t.Fatalf("exhausted members must leave the train: %+v", plan.groups) + } + if _, handled := c.mergeTrainFront(context.Background(), plan, prs[0]); handled { + t.Fatal("a PR outside every train is never handled as a front") } mu.Lock() defer mu.Unlock() - if calls != 2 { - t.Fatalf("resolver calls = %d, want 2 (loop guard)", calls) + if calls != 1 { + t.Fatalf("resolver calls = %d, want 1 (loop guard)", calls) } if !strings.Contains(logs.String(), "rebase requested for the front") { t.Fatalf("missing rebase log\n%s", logs.String()) } - // The exhausted reason classifies to a human stage with the action. - mt, _ := prstage.ParseMergeTrain(mergeTrainFrontReason(&plan0(c, prs).groups[0], prstage.MergeTrainStateRebaseExhausted, 2, 2)) + // The exhausted reason still classifies to a human stage with the action. + g := mergeTrainGroup{Base: "v5", Order: []int{30, 31}, OverlapFiles: []string{"a.go"}} + mt, _ = prstage.ParseMergeTrain(mergeTrainFrontReason(&g, prstage.MergeTrainStateRebaseExhausted, 2, 2)) if mt.Sentence() == "" || !strings.Contains(mt.Sentence(), "after 2 rebase attempts") { t.Fatalf("exhausted sentence = %q", mt.Sentence()) } } +// TestPlanMergeTrainsExcludesReturnedAndConflicting: hive's own #15307 +// (mergeable CONFLICTING, stage 072 returned-to-contributor) was counted +// "queued-behind#15424:4/6" and drew the train's idle comments +// (hivecommons/hive#15395). A PR at 072 — by label or by the stage store — +// or one GitHub says is conflicting on its own is neither a member nor +// part of the queue's size. +func TestPlanMergeTrainsExcludesReturnedAndConflicting(t *testing.T) { + t0 := time.Date(2026, 10, 29, 12, 0, 0, 0, time.UTC) + api := &mergeTrainAPI{ + files: map[int][]string{15424: {"a.go"}, 15307: {"a.go"}, 15430: {"a.go"}, 15431: {"a.go"}}, + state: map[int]string{15424: "clean", 15307: "dirty", 15430: "clean", 15431: "behind"}, + } + srv := newMergeTrainServer(t, api) + defer srv.Close() + c, logs := newMergeTrainEngine(t, srv.URL, DefaultMergeTrainPolicy, RebaseResolverFunc(func(context.Context, RebaseRequest) error { return nil })) + c.stageStore = stagelabels.NewStore("", func() time.Time { return t0 }) + c.stageStore.Observe(stagelabels.Key("acme/widget", 15431), stagelabels.ReturnedToContributor, "ci-red") + // A front merged on this base and other members were rebased: #15307 + // is still an outsider — the train never asked for its rebase. + c.noteMergeTrainFrontMerged("acme", "widget", "v5", 15300) + returned := mtPR(15430, t0.Add(2*time.Minute), "") + returned.Labels = []*gh.Label{{Name: gh.Ptr(stagelabels.ReturnedToContributor.Label())}} + prs := []*gh.PullRequest{mtPR(15424, t0, ""), mtPR(15307, t0.Add(time.Minute), ""), returned, mtPR(15431, t0.Add(3*time.Minute), "")} + plan := plan0(c, prs) + for _, n := range []int{15307, 15430, 15431} { + if plan.isSibling(n) || plan.isFront(n) { + t.Errorf("#%d must be out of every train: %+v", n, plan.groups) + } + } + if len(plan.groups) != 0 { + t.Fatalf("only #15424 is left, and one PR is no train: %+v", plan.groups) + } + for _, want := range []string{"why=returned-to-contributor", "why=conflicting"} { + if !strings.Contains(logs.String(), want) { + t.Errorf("missing skip log %q\n%s", want, logs.String()) + } + } + // With a clean partner the survivors form the train and the size counts + // members only: 2, not 4. + api.mu.Lock() + api.state[15307] = "clean" + api.mu.Unlock() + plan = plan0(c, prs) + g, ok := plan.group(15424) + if !ok || !reflect.DeepEqual(g.Order, []int{15424, 15307}) { + t.Fatalf("train = %+v", plan.groups) + } + mt, _ := prstage.ParseMergeTrain(c.mergeTrainSkip(plan, 15307)) + if mt.Size != 2 || mt.Position != 2 { + t.Fatalf("size/position = %d/%d, want 2/2", mt.Size, mt.Position) + } +} + func plan0(c *Engine, prs []*gh.PullRequest) *mergeTrainPlan { return c.planMergeTrains(context.Background(), "self", "acme/widget", "acme", "widget", prs, func(*gh.PullRequest) string { return "" }) } @@ -396,14 +469,19 @@ func TestMergeTrainFrontNoResolverFallsThroughOnce(t *testing.T) { defer srv.Close() c, logs := newMergeTrainEngine(t, srv.URL, DefaultMergeTrainPolicy, nil) prs := []*gh.PullRequest{mtPR(40, t0, ""), mtPR(41, t0.Add(time.Minute), "")} + // Without a resolver no dirty head is under repair, so two conflicting + // heads are no train at all and the lane's conflicting path takes them. for i := 0; i < 2; i++ { plan := plan0(c, prs) + if len(plan.groups) != 0 { + t.Fatalf("no resolver: conflicting heads form no train: %+v", plan.groups) + } if r, handled := c.mergeTrainFront(context.Background(), plan, prs[0]); handled || r != "" { t.Fatalf("no resolver: front must fall through, got handled=%v %q", handled, r) } } - if n := strings.Count(logs.String(), "no rebase resolver is wired"); n != 1 { - t.Fatalf("no-resolver line logged %d times, want once\n%s", n, logs.String()) + if n := strings.Count(logs.String(), "why=conflicting"); n != 2 { + t.Fatalf("skip line logged %d times, want once per head\n%s", n, logs.String()) } // Without a resolver a sibling's dirty state after the merge is a no-op. plan := plan0(c, prs) diff --git a/src/pkg/stageengine/prstage/merge_train.go b/src/pkg/stageengine/prstage/merge_train.go index 07580b0436..382818aa93 100644 --- a/src/pkg/stageengine/prstage/merge_train.go +++ b/src/pkg/stageengine/prstage/merge_train.go @@ -183,11 +183,11 @@ func (m MergeTrain) Sentence() string { slot := Ordinal(m.Position) + " of " + strconv.Itoa(m.Size) switch m.State { case MergeTrainStateRebasing: - return "front of the merge train, conflicting; the hive is rebasing it onto the base (attempt " + strconv.Itoa(m.Attempt) + "/" + strconv.Itoa(m.MaxAttempts) + "; " + slot + files + ")" + return "1st in the merge queue, conflicting; the hive is rebasing it onto the base (attempt " + strconv.Itoa(m.Attempt) + "/" + strconv.Itoa(m.MaxAttempts) + "; " + slot + files + ")" case MergeTrainStateRebaseExhausted: - return "front of the merge train, still conflicting after " + strconv.Itoa(m.MaxAttempts) + " rebase attempts; a person decides (" + slot + files + ")" + return "1st in the merge queue, still conflicting after " + strconv.Itoa(m.MaxAttempts) + " rebase attempts; a person decides (" + slot + files + ")" case MergeTrainStateFront: - return "front of the merge train (" + slot + files + ")" + return "1st in the merge queue; merges next (" + slot + files + ")" case MergeTrainStateDuplicateOf: issue := "" if m.Position > 0 { diff --git a/src/pkg/stageengine/prstage/merge_train_test.go b/src/pkg/stageengine/prstage/merge_train_test.go index f600816d84..1596934a0b 100644 --- a/src/pkg/stageengine/prstage/merge_train_test.go +++ b/src/pkg/stageengine/prstage/merge_train_test.go @@ -3,6 +3,7 @@ package prstage import ( "reflect" "strconv" + "strings" "testing" ) @@ -93,13 +94,21 @@ func TestParseMergeTrainRejectsMalformed(t *testing.T) { t.Fatalf("files capped wrong: %v", m.OverlapFiles) } for state, want := range map[string]string{ - MergeTrainStateRebasing: "front of the merge train, conflicting; the hive is rebasing it onto the base (attempt 1/2; 1st of 3)", - MergeTrainStateRebaseExhausted: "front of the merge train, still conflicting after 2 rebase attempts; a person decides (1st of 3)", - MergeTrainStateFront: "front of the merge train (1st of 3)", + MergeTrainStateRebasing: "1st in the merge queue, conflicting; the hive is rebasing it onto the base (attempt 1/2; 1st of 3)", + MergeTrainStateRebaseExhausted: "1st in the merge queue, still conflicting after 2 rebase attempts; a person decides (1st of 3)", + MergeTrainStateFront: "1st in the merge queue; merges next (1st of 3)", MergeTrainStateQueuedBehind: "behind #7 in merge train (1st of 3)", } { - if got := (MergeTrain{State: state, Front: 7, Position: 1, Size: 3, Attempt: 1, MaxAttempts: 2}).Sentence(); got != want { + got := (MergeTrain{State: state, Front: 7, Position: 1, Size: 3, Attempt: 1, MaxAttempts: 2}).Sentence() + if got != want { t.Errorf("Sentence(%s) = %q, want %q", state, got, want) } + // The owner read "front" / "queued-behind" as noise: no sentence a + // person sees carries either word (hivecommons/hive#15395). + for _, bad := range []string{"front", "queued-behind"} { + if strings.Contains(strings.ToLower(got), bad) { + t.Errorf("Sentence(%s) = %q leaks %q", state, got, bad) + } + } } }