diff --git a/changelog.d/changed-human-merge-reason.md b/changelog.d/changed-human-merge-reason.md new file mode 100644 index 0000000000..c241387738 --- /dev/null +++ b/changelog.d/changed-human-merge-reason.md @@ -0,0 +1 @@ +- Hive activity monitor: every `090 Ready for human merge` row and its tooltip now say why a person must merge (`· workflow files`, `· untrusted author`, `· branch protection`, `· auto-merge off`, `· unauthorized`, … falling back to `· policy`), derived from the stage record's lane reason; nested PR sub-rows and the needs-attention headline carry the same (#14658) diff --git a/src/docs/dashboard-sections.md b/src/docs/dashboard-sections.md index 51a917fdff..86ae0b77f7 100644 --- a/src/docs/dashboard-sections.md +++ b/src/docs/dashboard-sections.md @@ -640,7 +640,7 @@ More about the line: A progress strip per open issue and pull request showing which step of the pipeline it is on and who must act next. -Fed by `GET /api/stage-tracker`. Every issue and pull request follows the same pipeline, named once in the column header above the list: `Open → Actionable (010) → Claimed (020) → PR in progress (030/040) → CI / Review (050/060) → Merge gate (080/100) → ✓ merged`. Each entry is a title line over a thin chevron strip. Only the current step is coloured: it is filled amber and carries the step name in words; once the PR is merged the final ✓ chevron is the lit one, in green. Motion is reserved for what is running or needs a hand — the lit chevron falls into one of three buckets (`stageTrackerMotion()` in `index.html`): **static** (steady): Open, Open · on hold (any hold label wins over every other signal), Actionable (010), Claimed (020), PR in progress / Covered by PR (030/040) by a human author, Merged, and any unrecognised stage; **active** (gentle pulse): the hive is acting — 030/040 by a hive or clanker author, 050 review pending, 060 reviewed, 070 fixing, 074 adopted by hive, 080 merge gate, 095 pre-merge soak, 100 merge queue; **needs-human** (slower amber→red breathe): a person must move — 015 triage needed, 045/085 needs decision, 071 needs author, 072 returned to contributor, 090 ready for a human merge, or a `stalled` / `blocked` / `needs-human` / `needs-decision` / `needs-triage` modifier on any stage. Under `prefers-reduced-motion` nothing animates; a needs-human step keeps a steady red tint so it still stands out. Every other step is a low-contrast shape with a small grey glyph (circle, bolt, lock, branch, eye, shield, check) — passed steps a subtle neutral fill, steps ahead a faint outline. Side stages are not extra steps: `070 Fixing` (the author's move; the `needs-rebase` chip next to it says what is being fixed — the stage labeller always parks a needs-rebase PR at 070/071/072, never at CI / Review), `071 Needs author` (human-authored), `072 Returned to contributor` (clanker-authored) and `074 Adopted by hive` light *CI / Review* with their own name (an adopted PR stays on 074 through the hive's pushes going pending, green or red again, and moves on only when *Merge gate* takes it); `085 Needs human decision` (PR-only) and `090 Ready for human merge` light *Merge gate* with their own name (the 085 tooltip says what must be decided); an issue parked on a person wears `045 Needs human decision` and lights *Actionable* (the issue side) with that name — a pre-045 issue still wearing 085 is drawn the same way until the reconciler re-stages it; an actionable issue no maintainer has looked at yet wears `015 Triage needed` (carrying `needs-triage`, or held in the reporter-trust gate's `reporter_triage` bucket — never derived from who filed it) and lights *Actionable* as "Triage needed" (a human's move) — so the Actionable column reads "Actionable", "Triage needed" or "Needs human decision", and the Open column is untouched. An issue carrying a hold-class label (`hold`, `do-not-merge*`, `hive-pause/`) is never parked: it sits at *Open* as "Open · on hold" even beside `needs-human`, and the reconciler removes any 045 the hold caught it with ([#13012](https://github.com/hivecommons/hive/issues/13012)). The lit chevron ends with an ink-coloured icon of whose move it is — person (human), robot (clanker) or hexagon (hive): the claim holder on Claimed, the PR author on PR in progress and Returned to contributor, hive on CI / Review, Adopted by hive and Ready for auto merge, a human on Needs human decision and Ready for human merge. `040 Covered by PR` shares the *PR in progress* column with 030; `060 Reviewed`, `080 Awaiting merge admission` and `100 Merge queue` all light *Merge gate* as "Ready for auto merge" (the chevron tooltip says "not yet admitted — " for 060/080 and "admitted, merging" for 100); `095 Pre-merge soak` lights the same column as "Soaking" (hive's move; tooltip "admitted, soaking — Xm left", headline "Pre-merge soak — Xm left" from the payload's `soak_remaining_seconds`, aged from the lane's last sweep), so an admitted PR inside its soak window is no longer drawn as merging; the chevron's own tooltip names the exact stage. Covering pull requests nest under their issue. An issue with no PR yet draws the whole strip like any other row, lit at Open, Actionable or Claimed with the steps ahead faint. Once exactly one PR covers it, issue and PR are a single entry: the issue's `#N title` on the left, `↳ [author icon] #PR title` under the *PR in progress* header on the same title line (the ↳ marks a PR drawn on its issue's row; the PR link's tooltip says so — "linked PR, shown on its issue's row" — and, when two open issues list the same PR, every row but the lowest-numbered issue adds "also under #N"), and one continuous strip — Open, Actionable and Claimed passed, the PR's stage lighting the chevron from PR in progress through CI / Review, Merge gate and ✓; the chip, tooltip and `since` are the PR's. With two or more covering PRs the issue's own strip stops at Claimed — all passed, nothing on the issue line lit. Directly beneath, tighter than the gap between entries, sits one indented sub-row per open covering PR, furthest along first: `[author icon] #N title` at the *PR in progress* column, then that PR's own strip from there on — `PR in progress → CI / Review → Merge gate → ✓` — with its own lit chevron, chip, tooltip and `since`. So an issue with two PRs, one at 030, shows "PR in progress" lit on that sub-row, not on the issue. A PR linked to an open issue in the list has no top-level row of its own; a PR with no linked issue keeps a full-width row and shows the first steps as passed. A PR whose only linked issue is already closed — a superseded PR whose body still says `Fixes #N` after an earlier PR fixed it — keeps its own row with the closed issue in the issue slot: `#N title` as a link, muted and struck through, followed by a small `closed` chip, so the pairing reads at a glance; when the title cannot be resolved the slot says `#N (closed issue)` rather than a bare number (the title comes from the snapshot, or from one cached issue read the cycle makes once per issue — see [Linked issues](dashboard.md#pr-review-and-link-signals)). The *Pull requests* filter flattens the list — every PR as a top-level row; *Issues* and *All* show the nested view. Each row is named once on the left; a covering PR appears under the *PR in progress* header as `[author icon] #N title`. A pull request with no linked issue is named once: `[PR icon] [author icon] #N title` on the left over one continuous strip (first steps passed, its own step lit) and nothing in the *PR in progress* column, which is reserved for covering PRs — so a title never appears twice in a row. Pull requests are never issues here: when a number arrives through both the issues feed and the pulls feed the PR record wins and the issue copy is dropped on the server (pairing is keyed by repository, kind and number), and the *Issues* filter never lists a PR. The author icon is the one coloured legend: hive hexagon in blue, clanker robot in purple, human silhouette in teal (the `author/*` kind, inferred from the snapshot when the label is absent; the login is in the `#N` link's tooltip). The right-hand `since` column, in line with the chevron strip, is how long the item has been on its step (red when `stalled`). A plain *Open* step — no stage label yet and not on hold — also carries that age in its own words, "Open · since 3d" ("since 14h" under two days), taken from the same `stage_since` instant the column draws (falling back to the time the item was opened, which the chevron tooltip then marks "(opened)"); past `STAGE_TRACKER_OPEN_STALE_DAYS` (2) the chevron takes a subtle red tint. *Open · hold* never shows the age. An Open item carrying the `blocked` label is drawn the same way as a hold — "Open · blocked" with a ⛔ glyph in the hold's yellow — but keeps the age ("Open · blocked · since 7h"; a stale blocked item is exactly what should stand out, [#14194](https://github.com/hivecommons/hive/issues/14194)) and its chevron tooltip says why: "blocked on owner/repo#N" when the payload names the blocker (`blocked_on`), else "carries the blocked label"; when an item is both held and blocked, hold wins — it is a human instruction. At most one muted chip sits at the right end of the title line, directly over the strip's ✓ cap (on the last line when the title wraps; a hairline above each entry and a hover tint over the whole entry keep chip and `since` unambiguously with their own row — [#14640](https://github.com/hivecommons/hive/issues/14640)): the most important health modifier (`stalled`, `regressed`, `hold`, `needs-human`, `needs-decision` — shown as "needs human decision" —, `needs-triage` — shown as "triage needed" (amber) on an issue still carrying the `needs-triage` label before the claim (010, 017, 045; at 015 the lit chevron already says so); a `needs-triage` left on a claimed or later issue (020+) is stale, never shown as a chip or stage text, and reported instead as `stale_labels` in the payload with a muted *Stale label* line in the hover tooltip until the stage sweep removes it (hivecommons/hive#14586) —, `needs-rebase`, `blocked`, `draft`) with a `+N` for the rest. Everything else — the reason sentence, who must act, nudges sent, the repository, all flags and the last stage hops — is in the hover tooltip on the item's `#N` link (on a nested sub-row, on its `#N` PR link). Hover text in a row lives only on the `#N` link, the covering-PR link, the title and the lit chevron (its stage, and whose move it is); passed and upcoming chevrons, the kind and author icons, chips and the `since` column have none. Title lines wrap rather than push the strip out of alignment: the issue title stays before the *PR in progress* column (a clear gap always separates it from the PR entry, which starts at the column edge) and the PR title before the chip; hovering a title shows the full text. Rows are sorted furthest-along first by default — a covered issue ranks by its furthest-along PR — then longest on the step first; *Sort* also offers longest waiting, newest and number, and the arrow beside it reverses the order. Every open issue and pull request of the watched repositories is listed — actionable, held, claimed, in progress, covered by a PR, filtered by a `needs-*` label, reporter-triage, draft and exempt-labelled alike; an item without a stage label or journal entry sits at *Open*, and one in a scanner bucket with no label yet is placed from the bucket (claimed → 020, in progress → 030, covered → 040). Filters work on the cached payload in the browser and persist across reloads (the page number does not): kind chips, *Repo*, a search box (`#number` / number / title substring, also matching a covering PR), *Since* (any, over 1 hour / 1 day / 1 week on the current step, or past the stage's configured dwell — stalled items always qualify), *Author* kind, *Needs attention* (anything with a health modifier or on 071 / 072 / 085 / 090), and label chips built from every label present, each with its count: a **🙋 Needs human** facet first (attention-coloured; it matches any item carrying a label of the needs-human set — the server's `needs_human_labels`, the same list as the Projects *Needs human* preset: `stage/045-needs-decision`, `stage/085-needs-decision`, `needs-decision`, `needs-direction`, `needs-spec`, `needs-signal`, `needs-human` and `needs-human/*`, the hold labels, `stage/071-needs-author`, `sentinel-alert`, `needs-triage`; its count is the number of distinct items, not the sum of label counts), then every `stage/NNN-*` label in numerical order, then all other labels alphabetically (case-insensitive). When the row would overflow, the **+N more** button opens an in-app *All labels* dialog listing every label in the same order with counts, a type-to-filter box, the same toggles the chips use and a *Clear* button; a label selected there is promoted into the visible row. Chips of one family OR, families AND; *Needs human* ANDs with the label chips. *Clear filters* shows while anything is narrowed. The list is paged — 25 / 50 / 100 rows, default 50 — with Prev / Next and "showing X–Y of N (M filtered out)" above and below; the header count "N rows · M need attention" is for the filtered set, the **sidebar badge is the row count of the default view** (owner: the tracker counts rows, not items — a covering PR drawn on its issue's row is not a row of its own, and an issue with several PRs already has several), and both come from the same `stageTrackerCountsText()` call so they cannot disagree. When rows sit below the payload's open issues + PRs, the "showing" line's tooltip and the badge's footnote say why — "2 PRs shown on their issue's row" — rather than printing a second total.the chevron's own tooltip names the exact stage. Covering pull requests nest under their issue. An issue with no PR yet draws the whole strip like any other row, lit at Open, Actionable or Claimed with the steps ahead faint. Once exactly one PR covers it, issue and PR are a single entry: the issue's `#N title` on the left, `[author icon] #PR title` under the *PR in progress* header on the same title line, and one continuous strip — Open, Actionable and Claimed passed, the PR's stage lighting the chevron from PR in progress through CI / Review, Merge gate and ✓; the chip, tooltip and `since` are the PR's. With two or more covering PRs the issue's own strip stops at Claimed — all passed, nothing on the issue line lit. Directly beneath, tighter than the gap between entries, sits one indented sub-row per open covering PR, furthest along first: `[author icon] #N title` at the *PR in progress* column, then that PR's own strip from there on — `PR in progress → CI / Review → Merge gate → ✓` — with its own lit chevron, chip, tooltip and `since`. So an issue with two PRs, one at 030, shows "PR in progress" lit on that sub-row, not on the issue. A PR linked to an open issue in the list has no top-level row of its own; a PR with no linked issue keeps a full-width row and shows the first steps as passed. The *Pull requests* filter flattens the list — every PR as a top-level row; *Issues* and *All* show the nested view. Each row is named once on the left; a covering PR appears under the *PR in progress* header as `[author icon] #N title`. A pull request with no linked issue is named once: `[PR icon] [author icon] #N title` on the left over one continuous strip (first steps passed, its own step lit) and nothing in the *PR in progress* column, which is reserved for covering PRs — so a title never appears twice in a row. Pull requests are never issues here: when a number arrives through both the issues feed and the pulls feed the PR record wins and the issue copy is dropped on the server (pairing is keyed by repository, kind and number), and the *Issues* filter never lists a PR. The author icon is the one coloured legend: hive hexagon in blue, clanker robot in purple, human silhouette in teal (the `author/*` kind, inferred from the snapshot when the label is absent; the login is in the `#N` link's tooltip). The right-hand `since` column, in line with the chevron strip, is how long the item has been on its step (red when `stalled`). At most one muted chip sits at the right end of the title line, directly over the strip's ✓ cap (on the last line when the title wraps; a hairline above each entry and a hover tint over the whole entry keep chip and `since` unambiguously with their own row — [#14640](https://github.com/hivecommons/hive/issues/14640)): the most important health modifier (`stalled`, `regressed`, `hold`, `needs-human`, `needs-decision` — shown as "needs human decision" —, `needs-rebase`, `blocked`, `draft`) with a `+N` for the rest. A `regressed` chip is red only when the row is parked on a person (a human-gate modifier or stage 045 / 071 / 072 / 085 / 090); on a hive-driven stage with nothing waiting on a human it draws as a muted dashed `stage ↓` pill, yields the lead slot to any other modifier, keeps the row out of **Needs attention**, and its tooltip ends "the hive is handling it — no action needed; clears on the next forward step". The marker is set by a genuine backward hop (a lapsed claim 020 → 010, a 030 ↔ 020 flicker and a 040 → 010 after a partially-addressing merge are not regressions) and clears on the first forward hop; see "The regressed marker" in `labels-and-control-signals.md`. Everything else — the reason sentence, who must act, nudges sent, the repository, all flags and the last stage hops — is in the hover tooltip on the item's `#N` link (on a nested sub-row, on its `#N` PR link). Hover text in a row lives only on the `#N` link, the covering-PR link, the title and the lit chevron (its stage, and whose move it is); passed and upcoming chevrons, the kind and author icons, chips and the `since` column have none. Title lines wrap rather than push the strip out of alignment: the issue title stays before the *PR in progress* column (a clear gap always separates it from the PR entry, which starts at the column edge) and the PR title before the chip; hovering a title shows the full text. Rows are sorted furthest-along first by default — a covered issue ranks by its furthest-along PR — then longest on the step first; *Sort* also offers longest waiting, newest and number, and the arrow beside it reverses the order. Every open issue and pull request of the watched repositories is listed — actionable, held, claimed, in progress, covered by a PR, filtered by a `needs-*` label, reporter-triage, draft and exempt-labelled alike; an item without a stage label or journal entry sits at *Open*, and one in a scanner bucket with no label yet is placed from the bucket (claimed → 020, in progress → 030, covered → 040). Filters work on the cached payload in the browser and persist across reloads (the page number does not): kind chips, *Repo*, a search box (`#number` / number / title substring, also matching a covering PR), *Since* (any, over 1 hour / 1 day / 1 week on the current step, or past the stage's configured dwell — stalled items always qualify), *Author* kind, *Needs attention* (anything with a health modifier or on 071 / 072 / 085 / 090), and label chips built from every label present, each with its count: a **🙋 Needs human** facet first (attention-coloured; it matches any item carrying a label of the needs-human set — the server's `needs_human_labels`, the same list as the Projects *Needs human* preset: `stage/045-needs-decision`, `stage/085-needs-decision`, `needs-decision`, `needs-direction`, `needs-spec`, `needs-signal`, `needs-human` and `needs-human/*`, the hold labels, `stage/071-needs-author`, `sentinel-alert`, `needs-triage`; its count is the number of distinct items, not the sum of label counts), then every `stage/NNN-*` label in numerical order, then all other labels alphabetically (case-insensitive). When the row would overflow, the **+N more** button opens an in-app *All labels* dialog listing every label in the same order with counts, a type-to-filter box, the same toggles the chips use and a *Clear* button; a label selected there is promoted into the visible row. Chips of one family OR, families AND; *Needs human* ANDs with the label chips. *Clear filters* shows while anything is narrowed. The list is paged — 25 / 50 / 100 rows, default 50 — with Prev / Next and "showing X–Y of N (M filtered out)" above and below; the header reads "N items (I issues / P PRs) · M need attention" — N, I and P are the whole list, the same `openItems` set the Overview tile and its left-menu counter print, so N always equals the tile's **Total open issues + Total open PRs**; a "· X match filters" note follows while a filter is on. The sidebar counter beside **Hive activity monitor** is that same N — total open items, written in the same render pass as the header, so the two cannot drift apart; how many need attention is the warn-coloured header suffix and the counter's hover tooltip (counted over every item, filters or not). When covering pull requests are nested under their issue the "showing X–Y of R" line counts rows and adds "(P nested under their issues)" so R never reads as a different total. The small monospace strip beside the count — `engine enforce · N anomalies` — is the central stage engine ([ADR-0025](adr/0025-central-stage-engine.md)): `engine` names the current `governor.labels.stage.engine.mode` (green `enforce`, neutral `shadow` = paused, nothing written; hover for what the mode does and the derivation count), `anomalies` counts stage moves the engine's admission table did not expect (red when non-zero). The same numbers are `/api/status.stageEngine`; the mode is changed under **Settings → Labels → Central stage engine mode** and the operator notes are in [operator-reference.md](operator-reference.md#central-stage-engine-rollout). "updated Ns ago · cache" says how old the server-built payload is: the spoke rebuilds it at most every `dashboard.stage_tracker.cache_ttl_s` (default `governor.eval_interval_s`) from its existing snapshot and serves it with an `ETag`, so the browser's 30-second poll is a 304 and no request ever reaches GitHub (`/api/gh-rate-limits` lists the caller `dashboard:stage-tracker` with nothing charged). See [Stage labels](labels-and-control-signals.md#stage-labels-stagennn--the-pipeline-state-machine). +Fed by `GET /api/stage-tracker`. Every issue and pull request follows the same pipeline, named once in the column header above the list: `Open → Actionable (010) → Claimed (020) → PR in progress (030/040) → CI / Review (050/060) → Merge gate (080/100) → ✓ merged`. Each entry is a title line over a thin chevron strip. Only the current step is coloured: it is filled amber and carries the step name in words; once the PR is merged the final ✓ chevron is the lit one, in green. Motion is reserved for what is running or needs a hand — the lit chevron falls into one of three buckets (`stageTrackerMotion()` in `index.html`): **static** (steady): Open, Open · on hold (any hold label wins over every other signal), Actionable (010), Claimed (020), PR in progress / Covered by PR (030/040) by a human author, Merged, and any unrecognised stage; **active** (gentle pulse): the hive is acting — 030/040 by a hive or clanker author, 050 review pending, 060 reviewed, 070 fixing, 074 adopted by hive, 080 merge gate, 095 pre-merge soak, 100 merge queue; **needs-human** (slower amber→red breathe): a person must move — 015 triage needed, 045/085 needs decision, 071 needs author, 072 returned to contributor, 090 ready for a human merge, or a `stalled` / `blocked` / `needs-human` / `needs-decision` / `needs-triage` modifier on any stage. Under `prefers-reduced-motion` nothing animates; a needs-human step keeps a steady red tint so it still stands out. Every other step is a low-contrast shape with a small grey glyph (circle, bolt, lock, branch, eye, shield, check) — passed steps a subtle neutral fill, steps ahead a faint outline. Side stages are not extra steps: `070 Fixing` (the author's move; the `needs-rebase` chip next to it says what is being fixed — the stage labeller always parks a needs-rebase PR at 070/071/072, never at CI / Review), `071 Needs author` (human-authored), `072 Returned to contributor` (clanker-authored) and `074 Adopted by hive` light *CI / Review* with their own name (an adopted PR stays on 074 through the hive's pushes going pending, green or red again, and moves on only when *Merge gate* takes it); `085 Needs human decision` (PR-only) and `090 Ready for human merge` light *Merge gate* with their own name (the 085 tooltip says what must be decided); an issue parked on a person wears `045 Needs human decision` and lights *Actionable* (the issue side) with that name — a pre-045 issue still wearing 085 is drawn the same way until the reconciler re-stages it; an actionable issue no maintainer has looked at yet wears `015 Triage needed` (carrying `needs-triage`, or held in the reporter-trust gate's `reporter_triage` bucket — never derived from who filed it) and lights *Actionable* as "Triage needed" (a human's move) — so the Actionable column reads "Actionable", "Triage needed" or "Needs human decision", and the Open column is untouched. An issue carrying a hold-class label (`hold`, `do-not-merge*`, `hive-pause/`) is never parked: it sits at *Open* as "Open · on hold" even beside `needs-human`, and the reconciler removes any 045 the hold caught it with ([#13012](https://github.com/hivecommons/hive/issues/13012)). The lit chevron ends with an ink-coloured icon of whose move it is — person (human), robot (clanker) or hexagon (hive): the claim holder on Claimed, the PR author on PR in progress and Returned to contributor, hive on CI / Review, Adopted by hive and Ready for auto merge, a human on Needs human decision and Ready for human merge. A row at `090 Ready for human merge` always says *why* a person and not the hive merges it (#14658): the lit word ends `· workflow files`, `· tests removed`, `· manual-merge policy`, `· branch protection`, `· merge method`, `· auto-merge off`, `· untrusted author`, `· unauthorized`, `· reviewer deferred` or `· policy` (payload `human_merge_reason`, a `prstage.HumanMergeReason*` code derived from the stage record's lane reason — no second store), the chevron tooltip leads with the one-sentence `human_merge_reason_text` ("Changes .github/workflows/** — the hive never merges workflow changes …; click Merge on GitHub"), the manual-merge word reads `Awaiting human merge · workflow files · approved by @login`, the search / needs-attention headline carries the same tail, and a PR nested under its issue mirrors `human_approver`, `manual_merge`, `human_merge_reason` and `human_merge_reason_text` onto its `linked_prs` entry so the sub-row says the same. `040 Covered by PR` shares the *PR in progress* column with 030; `060 Reviewed`, `080 Awaiting merge admission` and `100 Merge queue` all light *Merge gate* as "Ready for auto merge" (the chevron tooltip says "not yet admitted — " for 060/080 and "admitted, merging" for 100); `095 Pre-merge soak` lights the same column as "Soaking" (hive's move; tooltip "admitted, soaking — Xm left", headline "Pre-merge soak — Xm left" from the payload's `soak_remaining_seconds`, aged from the lane's last sweep), so an admitted PR inside its soak window is no longer drawn as merging; the chevron's own tooltip names the exact stage. Covering pull requests nest under their issue. An issue with no PR yet draws the whole strip like any other row, lit at Open, Actionable or Claimed with the steps ahead faint. Once exactly one PR covers it, issue and PR are a single entry: the issue's `#N title` on the left, `↳ [author icon] #PR title` under the *PR in progress* header on the same title line (the ↳ marks a PR drawn on its issue's row; the PR link's tooltip says so — "linked PR, shown on its issue's row" — and, when two open issues list the same PR, every row but the lowest-numbered issue adds "also under #N"), and one continuous strip — Open, Actionable and Claimed passed, the PR's stage lighting the chevron from PR in progress through CI / Review, Merge gate and ✓; the chip, tooltip and `since` are the PR's. With two or more covering PRs the issue's own strip stops at Claimed — all passed, nothing on the issue line lit. Directly beneath, tighter than the gap between entries, sits one indented sub-row per open covering PR, furthest along first: `[author icon] #N title` at the *PR in progress* column, then that PR's own strip from there on — `PR in progress → CI / Review → Merge gate → ✓` — with its own lit chevron, chip, tooltip and `since`. So an issue with two PRs, one at 030, shows "PR in progress" lit on that sub-row, not on the issue. A PR linked to an open issue in the list has no top-level row of its own; a PR with no linked issue keeps a full-width row and shows the first steps as passed. A PR whose only linked issue is already closed — a superseded PR whose body still says `Fixes #N` after an earlier PR fixed it — keeps its own row with the closed issue in the issue slot: `#N title` as a link, muted and struck through, followed by a small `closed` chip, so the pairing reads at a glance; when the title cannot be resolved the slot says `#N (closed issue)` rather than a bare number (the title comes from the snapshot, or from one cached issue read the cycle makes once per issue — see [Linked issues](dashboard.md#pr-review-and-link-signals)). The *Pull requests* filter flattens the list — every PR as a top-level row; *Issues* and *All* show the nested view. Each row is named once on the left; a covering PR appears under the *PR in progress* header as `[author icon] #N title`. A pull request with no linked issue is named once: `[PR icon] [author icon] #N title` on the left over one continuous strip (first steps passed, its own step lit) and nothing in the *PR in progress* column, which is reserved for covering PRs — so a title never appears twice in a row. Pull requests are never issues here: when a number arrives through both the issues feed and the pulls feed the PR record wins and the issue copy is dropped on the server (pairing is keyed by repository, kind and number), and the *Issues* filter never lists a PR. The author icon is the one coloured legend: hive hexagon in blue, clanker robot in purple, human silhouette in teal (the `author/*` kind, inferred from the snapshot when the label is absent; the login is in the `#N` link's tooltip). The right-hand `since` column, in line with the chevron strip, is how long the item has been on its step (red when `stalled`). A plain *Open* step — no stage label yet and not on hold — also carries that age in its own words, "Open · since 3d" ("since 14h" under two days), taken from the same `stage_since` instant the column draws (falling back to the time the item was opened, which the chevron tooltip then marks "(opened)"); past `STAGE_TRACKER_OPEN_STALE_DAYS` (2) the chevron takes a subtle red tint. *Open · hold* never shows the age. An Open item carrying the `blocked` label is drawn the same way as a hold — "Open · blocked" with a ⛔ glyph in the hold's yellow — but keeps the age ("Open · blocked · since 7h"; a stale blocked item is exactly what should stand out, [#14194](https://github.com/hivecommons/hive/issues/14194)) and its chevron tooltip says why: "blocked on owner/repo#N" when the payload names the blocker (`blocked_on`), else "carries the blocked label"; when an item is both held and blocked, hold wins — it is a human instruction. At most one muted chip sits at the right end of the title line, directly over the strip's ✓ cap (on the last line when the title wraps; a hairline above each entry and a hover tint over the whole entry keep chip and `since` unambiguously with their own row — [#14640](https://github.com/hivecommons/hive/issues/14640)): the most important health modifier (`stalled`, `regressed`, `hold`, `needs-human`, `needs-decision` — shown as "needs human decision" —, `needs-triage` — shown as "triage needed" (amber) on an issue still carrying the `needs-triage` label before the claim (010, 017, 045; at 015 the lit chevron already says so); a `needs-triage` left on a claimed or later issue (020+) is stale, never shown as a chip or stage text, and reported instead as `stale_labels` in the payload with a muted *Stale label* line in the hover tooltip until the stage sweep removes it (hivecommons/hive#14586) —, `needs-rebase`, `blocked`, `draft`) with a `+N` for the rest. Everything else — the reason sentence, who must act, nudges sent, the repository, all flags and the last stage hops — is in the hover tooltip on the item's `#N` link (on a nested sub-row, on its `#N` PR link). Hover text in a row lives only on the `#N` link, the covering-PR link, the title and the lit chevron (its stage, and whose move it is); passed and upcoming chevrons, the kind and author icons, chips and the `since` column have none. Title lines wrap rather than push the strip out of alignment: the issue title stays before the *PR in progress* column (a clear gap always separates it from the PR entry, which starts at the column edge) and the PR title before the chip; hovering a title shows the full text. Rows are sorted furthest-along first by default — a covered issue ranks by its furthest-along PR — then longest on the step first; *Sort* also offers longest waiting, newest and number, and the arrow beside it reverses the order. Every open issue and pull request of the watched repositories is listed — actionable, held, claimed, in progress, covered by a PR, filtered by a `needs-*` label, reporter-triage, draft and exempt-labelled alike; an item without a stage label or journal entry sits at *Open*, and one in a scanner bucket with no label yet is placed from the bucket (claimed → 020, in progress → 030, covered → 040). Filters work on the cached payload in the browser and persist across reloads (the page number does not): kind chips, *Repo*, a search box (`#number` / number / title substring, also matching a covering PR), *Since* (any, over 1 hour / 1 day / 1 week on the current step, or past the stage's configured dwell — stalled items always qualify), *Author* kind, *Needs attention* (anything with a health modifier or on 071 / 072 / 085 / 090), and label chips built from every label present, each with its count: a **🙋 Needs human** facet first (attention-coloured; it matches any item carrying a label of the needs-human set — the server's `needs_human_labels`, the same list as the Projects *Needs human* preset: `stage/045-needs-decision`, `stage/085-needs-decision`, `needs-decision`, `needs-direction`, `needs-spec`, `needs-signal`, `needs-human` and `needs-human/*`, the hold labels, `stage/071-needs-author`, `sentinel-alert`, `needs-triage`; its count is the number of distinct items, not the sum of label counts), then every `stage/NNN-*` label in numerical order, then all other labels alphabetically (case-insensitive). When the row would overflow, the **+N more** button opens an in-app *All labels* dialog listing every label in the same order with counts, a type-to-filter box, the same toggles the chips use and a *Clear* button; a label selected there is promoted into the visible row. Chips of one family OR, families AND; *Needs human* ANDs with the label chips. *Clear filters* shows while anything is narrowed. The list is paged — 25 / 50 / 100 rows, default 50 — with Prev / Next and "showing X–Y of N (M filtered out)" above and below; the header count "N rows · M need attention" is for the filtered set, the **sidebar badge is the row count of the default view** (owner: the tracker counts rows, not items — a covering PR drawn on its issue's row is not a row of its own, and an issue with several PRs already has several), and both come from the same `stageTrackerCountsText()` call so they cannot disagree. When rows sit below the payload's open issues + PRs, the "showing" line's tooltip and the badge's footnote say why — "2 PRs shown on their issue's row" — rather than printing a second total.the chevron's own tooltip names the exact stage. Covering pull requests nest under their issue. An issue with no PR yet draws the whole strip like any other row, lit at Open, Actionable or Claimed with the steps ahead faint. Once exactly one PR covers it, issue and PR are a single entry: the issue's `#N title` on the left, `[author icon] #PR title` under the *PR in progress* header on the same title line, and one continuous strip — Open, Actionable and Claimed passed, the PR's stage lighting the chevron from PR in progress through CI / Review, Merge gate and ✓; the chip, tooltip and `since` are the PR's. With two or more covering PRs the issue's own strip stops at Claimed — all passed, nothing on the issue line lit. Directly beneath, tighter than the gap between entries, sits one indented sub-row per open covering PR, furthest along first: `[author icon] #N title` at the *PR in progress* column, then that PR's own strip from there on — `PR in progress → CI / Review → Merge gate → ✓` — with its own lit chevron, chip, tooltip and `since`. So an issue with two PRs, one at 030, shows "PR in progress" lit on that sub-row, not on the issue. A PR linked to an open issue in the list has no top-level row of its own; a PR with no linked issue keeps a full-width row and shows the first steps as passed. The *Pull requests* filter flattens the list — every PR as a top-level row; *Issues* and *All* show the nested view. Each row is named once on the left; a covering PR appears under the *PR in progress* header as `[author icon] #N title`. A pull request with no linked issue is named once: `[PR icon] [author icon] #N title` on the left over one continuous strip (first steps passed, its own step lit) and nothing in the *PR in progress* column, which is reserved for covering PRs — so a title never appears twice in a row. Pull requests are never issues here: when a number arrives through both the issues feed and the pulls feed the PR record wins and the issue copy is dropped on the server (pairing is keyed by repository, kind and number), and the *Issues* filter never lists a PR. The author icon is the one coloured legend: hive hexagon in blue, clanker robot in purple, human silhouette in teal (the `author/*` kind, inferred from the snapshot when the label is absent; the login is in the `#N` link's tooltip). The right-hand `since` column, in line with the chevron strip, is how long the item has been on its step (red when `stalled`). At most one muted chip sits at the right end of the title line, directly over the strip's ✓ cap (on the last line when the title wraps; a hairline above each entry and a hover tint over the whole entry keep chip and `since` unambiguously with their own row — [#14640](https://github.com/hivecommons/hive/issues/14640)): the most important health modifier (`stalled`, `regressed`, `hold`, `needs-human`, `needs-decision` — shown as "needs human decision" —, `needs-rebase`, `blocked`, `draft`) with a `+N` for the rest. A `regressed` chip is red only when the row is parked on a person (a human-gate modifier or stage 045 / 071 / 072 / 085 / 090); on a hive-driven stage with nothing waiting on a human it draws as a muted dashed `stage ↓` pill, yields the lead slot to any other modifier, keeps the row out of **Needs attention**, and its tooltip ends "the hive is handling it — no action needed; clears on the next forward step". The marker is set by a genuine backward hop (a lapsed claim 020 → 010, a 030 ↔ 020 flicker and a 040 → 010 after a partially-addressing merge are not regressions) and clears on the first forward hop; see "The regressed marker" in `labels-and-control-signals.md`. Everything else — the reason sentence, who must act, nudges sent, the repository, all flags and the last stage hops — is in the hover tooltip on the item's `#N` link (on a nested sub-row, on its `#N` PR link). Hover text in a row lives only on the `#N` link, the covering-PR link, the title and the lit chevron (its stage, and whose move it is); passed and upcoming chevrons, the kind and author icons, chips and the `since` column have none. Title lines wrap rather than push the strip out of alignment: the issue title stays before the *PR in progress* column (a clear gap always separates it from the PR entry, which starts at the column edge) and the PR title before the chip; hovering a title shows the full text. Rows are sorted furthest-along first by default — a covered issue ranks by its furthest-along PR — then longest on the step first; *Sort* also offers longest waiting, newest and number, and the arrow beside it reverses the order. Every open issue and pull request of the watched repositories is listed — actionable, held, claimed, in progress, covered by a PR, filtered by a `needs-*` label, reporter-triage, draft and exempt-labelled alike; an item without a stage label or journal entry sits at *Open*, and one in a scanner bucket with no label yet is placed from the bucket (claimed → 020, in progress → 030, covered → 040). Filters work on the cached payload in the browser and persist across reloads (the page number does not): kind chips, *Repo*, a search box (`#number` / number / title substring, also matching a covering PR), *Since* (any, over 1 hour / 1 day / 1 week on the current step, or past the stage's configured dwell — stalled items always qualify), *Author* kind, *Needs attention* (anything with a health modifier or on 071 / 072 / 085 / 090), and label chips built from every label present, each with its count: a **🙋 Needs human** facet first (attention-coloured; it matches any item carrying a label of the needs-human set — the server's `needs_human_labels`, the same list as the Projects *Needs human* preset: `stage/045-needs-decision`, `stage/085-needs-decision`, `needs-decision`, `needs-direction`, `needs-spec`, `needs-signal`, `needs-human` and `needs-human/*`, the hold labels, `stage/071-needs-author`, `sentinel-alert`, `needs-triage`; its count is the number of distinct items, not the sum of label counts), then every `stage/NNN-*` label in numerical order, then all other labels alphabetically (case-insensitive). When the row would overflow, the **+N more** button opens an in-app *All labels* dialog listing every label in the same order with counts, a type-to-filter box, the same toggles the chips use and a *Clear* button; a label selected there is promoted into the visible row. Chips of one family OR, families AND; *Needs human* ANDs with the label chips. *Clear filters* shows while anything is narrowed. The list is paged — 25 / 50 / 100 rows, default 50 — with Prev / Next and "showing X–Y of N (M filtered out)" above and below; the header reads "N items (I issues / P PRs) · M need attention" — N, I and P are the whole list, the same `openItems` set the Overview tile and its left-menu counter print, so N always equals the tile's **Total open issues + Total open PRs**; a "· X match filters" note follows while a filter is on. The sidebar counter beside **Hive activity monitor** is that same N — total open items, written in the same render pass as the header, so the two cannot drift apart; how many need attention is the warn-coloured header suffix and the counter's hover tooltip (counted over every item, filters or not). When covering pull requests are nested under their issue the "showing X–Y of R" line counts rows and adds "(P nested under their issues)" so R never reads as a different total. The small monospace strip beside the count — `engine enforce · N anomalies` — is the central stage engine ([ADR-0025](adr/0025-central-stage-engine.md)): `engine` names the current `governor.labels.stage.engine.mode` (green `enforce`, neutral `shadow` = paused, nothing written; hover for what the mode does and the derivation count), `anomalies` counts stage moves the engine's admission table did not expect (red when non-zero). The same numbers are `/api/status.stageEngine`; the mode is changed under **Settings → Labels → Central stage engine mode** and the operator notes are in [operator-reference.md](operator-reference.md#central-stage-engine-rollout). "updated Ns ago · cache" says how old the server-built payload is: the spoke rebuilds it at most every `dashboard.stage_tracker.cache_ttl_s` (default `governor.eval_interval_s`) from its existing snapshot and serves it with an `ETag`, so the browser's 30-second poll is a 304 and no request ever reaches GitHub (`/api/gh-rate-limits` lists the caller `dashboard:stage-tracker` with nothing charged). See [Stage labels](labels-and-control-signals.md#stage-labels-stagennn--the-pipeline-state-machine). **Repo chip.** Each row carries a small monospace chip before the number naming the repository it belongs to (`dibs #456`, `hive #13524`); the chip is tinted per repository from a fixed palette so one repo always looks the same, the configured primary repo is shown muted, and the full `owner/repo` is in the tooltip. Linked PR sub-rows carry the same chip. Clicking a chip sets the **Repo** filter to that repository (click it again, or pick "All repos", to clear). By default the chip appears only when the list spans more than one repository; the ⚙ settings modal's **Repositories** section offers **Show repo chip: always / only when multiple repos / never** (stored under `hive.tracker.repochip`). diff --git a/src/docs/hive-merge.md b/src/docs/hive-merge.md index 6b2beb20da..b67729c6a6 100644 --- a/src/docs/hive-merge.md +++ b/src/docs/hive-merge.md @@ -609,7 +609,16 @@ carrying the text ([#13041](https://github.com/hivecommons/hive/issues/13041)), hold / sentinel alert → `stage/085-needs-decision`, untrusted author with an approve verdict at the current head, green checks, DCO and soak done → `stage/090-ready-for-human-merge` (only a maintainer's `/lgtm` `/approve` is -missing), merged → no stage), plus one `role/*` label saying +missing; the dashboard derives a compact **human-merge reason code** from the +090 record's lane reason — `prstage.HumanMergeReason` — so the gate cell says +why a person merges: `workflow-files` (`contributor-lane:workflow-path`), +`tests-removed`, `manual-merge-policy` (`human-merge-path`), `branch-protection`, +`merge-method`, `auto-merge-off` (`repo-auto-merge-disabled`), `untrusted-author` +(every trust reason: `untrusted-author-role`, `claim-tier-untrusted`, `no-claim`, +`no-linked-issue`, `claim-unverified`, `claim-author-mismatch`, `claim-other-hive`, +`author-association`), `unauthorized` (the App's 403, #14595), `reviewer-deferred` +(`reviewer-verdict:requires_human` a trusted merger approved), and `policy` for +any other lane reason, quoted in the tooltip; #14658), merged → no stage), plus one `role/*` label saying which admission tier the lane actually used, one `author/*` label saying who wrote the PR (`human`, `clanker` = a contributor's hive, `hive` = this repo's own; #12581) and `stage/stalled` when nobody diff --git a/src/pkg/dashboard/stage_tracker.go b/src/pkg/dashboard/stage_tracker.go index c15ad57108..6d985decac 100644 --- a/src/pkg/dashboard/stage_tracker.go +++ b/src/pkg/dashboard/stage_tracker.go @@ -301,6 +301,15 @@ type StageTrackerItem struct { // the maintainer's merge click. HumanApprover string `json:"human_approver,omitempty"` ManualMerge bool `json:"manual_merge,omitempty"` + // HumanMergeReason is, at 090, the compact code naming why a person + // and not the hive merges this PR (prstage.HumanMergeReason*: + // "workflow-files", "untrusted-author", "branch-protection", …; + // "policy" when the lane reason has no more specific code), and + // HumanMergeReasonText the one-sentence tooltip for it, so the gate + // cell reads "Ready for human merge · workflow files" rather than + // leaving the owner to ask why (hivecommons/hive#14658). + HumanMergeReason string `json:"human_merge_reason,omitempty"` + HumanMergeReasonText string `json:"human_merge_reason_text,omitempty"` // UnauthorizedStep is set when the item wears hive:unauthorized: the // step the hive's GitHub App is not permitted to take, in words // ("approve workflow runs"), from the `unauthorized:` stage @@ -376,7 +385,14 @@ type StageTrackerLinkedPR struct { // so a sub-row under an issue names the alert too. SentinelAlert bool `json:"sentinel_alert,omitempty"` SentinelReason string `json:"sentinel_reason,omitempty"` - Head string `json:"head,omitempty"` + // HumanApprover / ManualMerge / HumanMergeReason(Text) mirror the + // nested PR's 090 fields so a sub-row's gate cell says why a person + // merges it, as the top-level row would (hivecommons/hive#14658). + HumanApprover string `json:"human_approver,omitempty"` + ManualMerge bool `json:"manual_merge,omitempty"` + HumanMergeReason string `json:"human_merge_reason,omitempty"` + HumanMergeReasonText string `json:"human_merge_reason_text,omitempty"` + Head string `json:"head,omitempty"` } // Stage numbers the tracker lays out by. Pinned to stagelabels.Table in @@ -856,6 +872,36 @@ func stageTrackerManualMergeReason(reason string) bool { return false } +// Gate-cell words and tooltips per prstage.HumanMergeReason* code: why a +// person, not the hive, merges a PR parked at 090 (hivecommons/hive#14658). +var stageTrackerHumanMergeReasonWords = map[string][2]string{ + stageengineprstage.HumanMergeReasonWorkflowFiles: {"workflow files", "Changes .github/workflows/** (or action files) — the hive never merges workflow changes and its GitHub App lacks the workflows permission; click Merge on GitHub"}, + stageengineprstage.HumanMergeReasonTestsRemoved: {"tests removed", "Deletes tests — the hive never merges a PR that removes tests unattended; a maintainer reviews the deletion and clicks Merge"}, + stageengineprstage.HumanMergeReasonManualMergePolicy: {"manual-merge policy", "Touches a path listed in auto_merge.human_merge_paths — the hive never merges it unattended; click Merge on GitHub"}, + stageengineprstage.HumanMergeReasonBranchProtection: {"branch protection", "Branch protection or a ruleset requires an approving review the hive's GitHub App cannot give; approve on GitHub (or let the App bypass) and the hive merges, or click Merge"}, + stageengineprstage.HumanMergeReasonMergeMethod: {"merge method", "The repository disallows the merge method this PR needs (a forward merge or merge-commit PR is never squashed); merge by hand with an allowed method or allow it in the repository settings"}, + stageengineprstage.HumanMergeReasonAutoMergeOff: {"auto-merge off", "Auto-merge is switched off for this repository or lane, so every merge is a person's; click Merge on GitHub"}, + stageengineprstage.HumanMergeReasonUntrustedAuthor: {"untrusted author", "No lane can vouch for the author (trust tier below require_tiers, no verified claim, or no trusted role), so the hive does not merge; a maintainer's /lgtm + /approve (or Merge) lands it"}, + stageengineprstage.HumanMergeReasonUnauthorized: {"unauthorized", "The hive's GitHub App is not permitted to take the merge step (GitHub answered 403); a maintainer merges by hand — see the hive:unauthorized note on the PR"}, + stageengineprstage.HumanMergeReasonReviewerDeferred: {"reviewer deferred", "The reviewer swarm returned requires_human on this head and a trusted merger approved it; the hive leaves the merge itself to a person"}, +} + +// stageTrackerHumanMergeReason derives, from a 090 stage reason, the +// compact code, the gate-cell word and the tooltip saying why a person +// must merge. An unrecognised lane reason falls back to the "policy" code +// with the raw reason in the tooltip; an empty reason yields "". +func stageTrackerHumanMergeReason(reason string) (code, word, tip string) { + code = stageengineprstage.HumanMergeReason(reason) + if code == "" { + return "", "", "" + } + if w, ok := stageTrackerHumanMergeReasonWords[code]; ok { + return code, w[0], w[1] + } + base, _ := stagelabels.HumanApprovedReason(reason) + return stageengineprstage.HumanMergeReasonPolicy, "policy", "The merge lane will not merge this unattended (lane reason `" + strings.TrimSpace(base) + "`); a maintainer merges by hand" +} + // trackerSoakRemainingRE pulls the time left out of the lane's // `contributor-lane:soaking(remaining=12m0s)` reason. var trackerSoakRemainingRE = regexp.MustCompile(`remaining=([0-9hms.]+)`) @@ -1188,6 +1234,9 @@ func (s *Server) buildStageTracker(status *StatusPayload, store *stagelabels.Sto base, approver := stagelabels.HumanApprovedReason(it.Reason) it.HumanApprover = approver it.ManualMerge = stageTrackerManualMergeReason(base) + if stage == stagelabels.ReadyForHumanMerge { + it.HumanMergeReason, _, it.HumanMergeReasonText = stageTrackerHumanMergeReason(it.Reason) + } if slices.Contains(it.Modifiers, modUnauthorized) { it.UnauthorizedStep, it.Unauthorized = stageTrackerUnauthorized(it.Reason) } @@ -1690,6 +1739,8 @@ func stageTrackerResolveLinkedPRs(items []StageTrackerItem) { lp.Title, lp.Author, lp.AuthorKind, lp.Stage = pr.Title, pr.Author, pr.AuthorKind, pr.Stage lp.StageSince, lp.Caption = pr.StageSince, pr.Caption lp.SentinelAlert, lp.SentinelReason, lp.Head = pr.SentinelAlert, pr.SentinelReason, pr.Head + lp.HumanApprover, lp.ManualMerge = pr.HumanApprover, pr.ManualMerge + lp.HumanMergeReason, lp.HumanMergeReasonText = pr.HumanMergeReason, pr.HumanMergeReasonText lp.BaseRef = pr.BaseRef if len(pr.Modifiers) > 0 { lp.Modifiers = append([]string(nil), pr.Modifiers...) diff --git a/src/pkg/dashboard/stage_tracker_sentinel_lane_test.go b/src/pkg/dashboard/stage_tracker_sentinel_lane_test.go index 9d3ac06197..6be5240d70 100644 --- a/src/pkg/dashboard/stage_tracker_sentinel_lane_test.go +++ b/src/pkg/dashboard/stage_tracker_sentinel_lane_test.go @@ -39,7 +39,10 @@ func stageTrackerManualMergeJS(t *testing.T, html string) string { return strings.Join([]string{ jsConstLine(t, html, "STAGE_TRACKER_READY_FOR_HUMAN_MERGE"), jsConstLine(t, html, "STAGE_TRACKER_MANUAL_MERGE_WORD"), + jsConstLine(t, html, "STAGE_TRACKER_HUMAN_MERGE_REASON_WORD"), + jsFunc(t, html, "stageTrackerHumanMergeReasonWord"), jsFunc(t, html, "stageTrackerManualMergeWord"), + jsFunc(t, html, "stageTrackerReadyForHumanWord"), jsConstLine(t, html, "STAGE_TRACKER_HUMAN_GATED"), jsConstLine(t, html, "STAGE_TRACKER_UNAUTHORIZED_WORD"), jsFunc(t, html, "stageTrackerUnauthorizedWord"), @@ -383,6 +386,23 @@ assert.ok(!manual.includes('entinel') && !manual.includes('Needs human decision' const plain090 = stageTrackerRowHtml(P('o/r', 402, 90, { reason: 'untrusted-author-role' }), stages, ctx); assert.ok(!plain090.includes('Awaiting human merge') && plain090.includes('Ready for human merge'), 'a trust-blocked 090 keeps the stage word: ' + plain090); +// Every 090 word says WHY a person merges (hivecommons/hive#14658): the +// payload's human_merge_reason code becomes the word's tail, its +// human_merge_reason_text leads the lit chevron's tooltip, and a nested +// linked PR carries the same. +assert.strictEqual(stageTrackerHumanMergeReasonWord({ human_merge_reason: 'workflow-files' }), 'workflow files'); +assert.strictEqual(stageTrackerHumanMergeReasonWord({ human_merge_reason: 'some-new-code' }), 'some new code'); +assert.strictEqual(stageTrackerHumanMergeReasonWord({}), ''); +assert.strictEqual(stageTrackerManualMergeWord({ human_approver: 'clubanderson', human_merge_reason: 'workflow-files' }), 'Awaiting human merge · workflow files · approved by @clubanderson'); +const whyTip = 'Changes .github/workflows/** — the hive never merges workflow changes; click Merge on GitHub'; +const why = stageTrackerRowHtml(P('o/r', 401, 90, { manual_merge: true, human_approver: 'clubanderson', human_merge_reason: 'workflow-files', human_merge_reason_text: whyTip }), stages, ctx); +assert.ok(why.includes('Awaiting human merge · workflow files · approved by @clubanderson'), 'manual-merge 090 word carries the reason: ' + why); +assert.ok(why.includes('title="Awaiting human merge · workflow files · approved by @clubanderson — ' + whyTip), 'the lit 090 chevron tooltip leads with the reason: ' + why); +const whyPlain = stageTrackerRowHtml(P('o/r', 402, 90, { human_merge_reason: 'untrusted-author', human_merge_reason_text: 'No lane can vouch for the author' }), stages, ctx); +assert.ok(whyPlain.includes('Ready for human merge · untrusted author') && whyPlain.includes('title="Ready for human merge · untrusted author — No lane can vouch for the author'), 'plain 090 word carries the reason: ' + whyPlain); +const whyNested = stageTrackerRowHtml(I('o/r', 400, 90, { linked_prs: [{ number: 401, stage: 90, title: 'Shard', manual_merge: true, human_approver: 'clubanderson', human_merge_reason: 'workflow-files', human_merge_reason_text: whyTip }] }), stages, ctx); +assert.ok(whyNested.includes('Awaiting human merge · workflow files · approved by @clubanderson'), 'nested 090 PR carries the reason: ' + whyNested); + // Decide… preface: one line per flagged PR, nothing for clean ones. assert.strictEqual(stageTrackerSentinelPreface([P('o/r', 109, 85, flagged), P('o/r', 104, 85)]), '⚠ o/r#109 — ' + TIP); assert.strictEqual(stageTrackerSentinelPreface([P('o/r', 104, 85)]), ''); diff --git a/src/pkg/dashboard/stage_tracker_test.go b/src/pkg/dashboard/stage_tracker_test.go index 15325b098c..e8c95bd651 100644 --- a/src/pkg/dashboard/stage_tracker_test.go +++ b/src/pkg/dashboard/stage_tracker_test.go @@ -189,14 +189,87 @@ func TestStageTrackerManualMergeApproved(t *testing.T) { if err != nil { t.Fatal(err) } - if !strings.Contains(string(raw), `"human_approver":"clubanderson","manual_merge":true`) { - t.Fatalf("payload lacks the manual-merge fields: %s", raw) + if !strings.Contains(string(raw), `"human_approver":"clubanderson","manual_merge":true,"human_merge_reason":"workflow-files","human_merge_reason_text":"Changes .github/workflows/**`) { + t.Fatalf("payload lacks the manual-merge / human-merge-reason fields: %s", raw) } - if clean := trackerItem(t, resp, "pr", 101); clean.HumanApprover != "" || clean.ManualMerge { + if clean := trackerItem(t, resp, "pr", 101); clean.HumanApprover != "" || clean.ManualMerge || clean.HumanMergeReason != "" || clean.HumanMergeReasonText != "" { t.Fatalf("PR 101 must not carry manual-merge fields: %+v", clean) } } +// TestStageTrackerHumanMergeReason: every 090 row names WHY a person and +// not the hive merges it (hivecommons/hive#14658) — a compact code from the +// lane reason already on the stage record plus a one-sentence tooltip; an +// unrecognised lane reason falls back to "policy" quoting it; a PR nested +// under its issue mirrors the fields onto the linked_prs entry; rows off +// 090 carry nothing. +func TestStageTrackerHumanMergeReason(t *testing.T) { + tests := []struct { + reason, wantCode, wantWord, wantTipPrefix string + }{ + {"contributor-lane:workflow-path:human-approved@clubanderson", "workflow-files", "workflow files", "Changes .github/workflows/**"}, + {"contributor-lane:tests-removed", "tests-removed", "tests removed", "Deletes tests"}, + {"human-merge-path:human-approved@octocat", "manual-merge-policy", "manual-merge policy", "Touches a path listed in auto_merge.human_merge_paths"}, + {"untrusted-author-role", "untrusted-author", "untrusted author", "No lane can vouch for the author"}, + {"contributor-lane:claim-tier-untrusted", "untrusted-author", "untrusted author", "No lane can vouch"}, + {"repo-auto-merge-disabled", "auto-merge-off", "auto-merge off", "Auto-merge is switched off"}, + {"reviewer-verdict:requires_human:human-approved@octocat", "reviewer-deferred", "reviewer deferred", "The reviewer swarm returned requires_human"}, + {"something-brand-new", "policy", "policy", "The merge lane will not merge this unattended (lane reason `something-brand-new`)"}, + {"", "", "", ""}, + } + for _, tt := range tests { + code, word, tip := stageTrackerHumanMergeReason(tt.reason) + if code != tt.wantCode || word != tt.wantWord || !strings.HasPrefix(tip, tt.wantTipPrefix) || (tt.wantTipPrefix == "" && tip != "") { + t.Fatalf("%q → code %q word %q tip %q; want %q %q prefix %q", tt.reason, code, word, tip, tt.wantCode, tt.wantWord, tt.wantTipPrefix) + } + } + + // Through the payload: a 090 PR whose body says `Fixes #400` nests under + // the open issue and the sub-row carries the same reason, approver and + // manual_merge; the issue line mirrors the PR's stage. + now := time.Date(2026, 10, 27, 18, 0, 0, 0, time.UTC) + s, store := stageTrackerFixture(t, now) + store.Observe(stagelabels.Key("acme/console", 401), stagelabels.ReadyForHumanMerge, "contributor-lane:workflow-path:human-approved@clubanderson") + store.Observe(stagelabels.Key("acme/console", 402), stagelabels.ReadyForHumanMerge, "no-such-lane-reason") + s.statusMu.Lock() + s.status.Repos[0].ActionableIssues = append(s.status.Repos[0].ActionableIssues, + github.Issue{Number: 400, Title: "Shard the nightly mutation run", Author: "pat", AuthorIsHuman: true, Labels: []string{"stage/090-ready-for-human-merge"}}) + s.status.Repos[0].OpenPrs = append(s.status.Repos[0].OpenPrs, + FrontendPR{PullRequest: github.PullRequest{Number: 401, Title: "ci(mutation): shard nightly Stryker", Author: "pat", Labels: []string{"stage/090-ready-for-human-merge", "lgtm"}, + LinkedIssues: []github.PRLinkedIssue{{Number: 400}}}}, + FrontendPR{PullRequest: github.PullRequest{Number: 402, Title: "Odd lane", Author: "pat", Labels: []string{"stage/090-ready-for-human-merge"}}}) + s.statusMu.Unlock() + resp := s.buildStageTracker(s.status, store, now) + + pr401 := trackerItem(t, resp, "pr", 401) + if pr401.HumanMergeReason != "workflow-files" || !strings.HasPrefix(pr401.HumanMergeReasonText, "Changes .github/workflows/**") || pr401.NestedUnder != 400 { + t.Fatalf("PR 401 = reason %q text %q nested %d", pr401.HumanMergeReason, pr401.HumanMergeReasonText, pr401.NestedUnder) + } + issue400 := trackerItem(t, resp, "issue", 400) + if len(issue400.LinkedPRs) != 1 { + t.Fatalf("issue 400 linked_prs = %+v", issue400.LinkedPRs) + } + lp := issue400.LinkedPRs[0] + if lp.Number != 401 || lp.Stage != 90 || !lp.ManualMerge || lp.HumanApprover != "clubanderson" || lp.HumanMergeReason != "workflow-files" || lp.HumanMergeReasonText != pr401.HumanMergeReasonText { + t.Fatalf("issue 400 nested PR lacks the human-merge fields: %+v", lp) + } + raw, err := json.Marshal(lp) + if err != nil { + t.Fatal(err) + } + if !strings.Contains(string(raw), `"human_approver":"clubanderson","manual_merge":true,"human_merge_reason":"workflow-files"`) { + t.Fatalf("linked_prs payload lacks the fields: %s", raw) + } + + pr402 := trackerItem(t, resp, "pr", 402) + if pr402.HumanMergeReason != "policy" || !strings.Contains(pr402.HumanMergeReasonText, "`no-such-lane-reason`") { + t.Fatalf("PR 402 fallback = reason %q text %q", pr402.HumanMergeReason, pr402.HumanMergeReasonText) + } + if soak := trackerItem(t, resp, "pr", 102); soak.HumanMergeReason != "" || soak.HumanMergeReasonText != "" { + t.Fatalf("PR 102 (095) must not carry a human-merge reason: %+v", soak) + } +} + func stageTrackerFixture(t *testing.T, now time.Time) (*Server, *stagelabels.Store) { t.Helper() s := newTestServer() diff --git a/src/pkg/dashboard/static/index.html b/src/pkg/dashboard/static/index.html index 635dfeec8b..d93ac6bc99 100644 --- a/src/pkg/dashboard/static/index.html +++ b/src/pkg/dashboard/static/index.html @@ -13735,9 +13735,27 @@

Where to get help

// (payload human_approver) instead of the generic stage word. const STAGE_TRACKER_READY_FOR_HUMAN_MERGE = 90; const STAGE_TRACKER_MANUAL_MERGE_WORD = 'Awaiting human merge'; + // Every 090 word also says WHY a person merges (payload + // human_merge_reason, a prstage.HumanMergeReason* code such as + // "workflow-files" / "untrusted-author" / "branch-protection", falling + // back to "policy"); the tooltip carries the payload's one-sentence + // human_merge_reason_text (hivecommons/hive#14658). + const STAGE_TRACKER_HUMAN_MERGE_REASON_WORD = { 'workflow-files': 'workflow files', 'tests-removed': 'tests removed', 'manual-merge-policy': 'manual-merge policy', 'branch-protection': 'branch protection', 'merge-method': 'merge method', 'auto-merge-off': 'auto-merge off', 'untrusted-author': 'untrusted author', 'unauthorized': 'unauthorized', 'reviewer-deferred': 'reviewer deferred', 'policy': 'policy' }; + function stageTrackerHumanMergeReasonWord(item) { + const code = String((item && item.human_merge_reason) || '').trim(); + if (!code) return ''; + return STAGE_TRACKER_HUMAN_MERGE_REASON_WORD[code] || code.replace(/-/g, ' '); + } function stageTrackerManualMergeWord(item) { const approver = String((item && item.human_approver) || '').trim(); - return STAGE_TRACKER_MANUAL_MERGE_WORD + (approver ? ' · approved by @' + approver : ''); + const why = stageTrackerHumanMergeReasonWord(item); + return STAGE_TRACKER_MANUAL_MERGE_WORD + (why ? ' · ' + why : '') + (approver ? ' · approved by @' + approver : ''); + } + // The plain 090 word (no manual-merge rule): the stage's short word + // plus the reason, "Ready for human merge · untrusted author". + function stageTrackerReadyForHumanWord(item, fallback) { + const why = stageTrackerHumanMergeReasonWord(item); + return why ? fallback + ' · ' + why : ''; } // 085 under hive:unauthorized (payload unauthorized_step, e.g. "approve // workflow runs"): the hive's GitHub App lacks the permission for that @@ -13910,7 +13928,7 @@

Where to get help

case 74: return 'Hive took it over' + viaPR; case 80: return 'Not yet admitted to auto merge' + viaPR; case 85: return 'Needs a human decision' + viaPR; - case 90: return 'Ready for a human merge' + viaPR; + case 90: return 'Ready for a human merge' + (stageTrackerHumanMergeReasonWord(item) ? ' · ' + stageTrackerHumanMergeReasonWord(item) : '') + viaPR; case 95: return 'Pre-merge soak' + stageTrackerSoakLeft(item) + viaPR; case 100: return 'Admitted — merging' + viaPR; case 110: return 'Merged'; @@ -13990,7 +14008,7 @@

Where to get help

const terminal = anchor >= STAGE_TRACKER_TERMINAL; const sentinelLane = stageTrackerSentinelInLane(item); const detour = (!terminal && STAGE_TRACKER_PATH.indexOf(cur) < 0 && cur !== STAGE_TRACKER_TRIAGE_NEEDED && cur !== STAGE_TRACKER_POSSIBLY_EXISTS && cur !== 40 && cur !== 60 && cur !== STAGE_TRACKER_PRE_MERGE_SOAK && cur !== 100) - ? { text: sentinelLane ? STAGE_TRACKER_SENTINEL_WORD : (cur === STAGE_TRACKER_READY_FOR_HUMAN_MERGE && item.manual_merge ? stageTrackerManualMergeWord(item) : (cur === STAGE_TRACKER_HUMAN_GATED && stageTrackerUnauthorizedWord(item)) || (STAGE_TRACKER_ACTIVE_WORD[cur] || curStage.short || curStage.label || String(cur))), sentinel: sentinelLane } : null; + ? { text: sentinelLane ? STAGE_TRACKER_SENTINEL_WORD : (cur === STAGE_TRACKER_READY_FOR_HUMAN_MERGE && item.manual_merge ? stageTrackerManualMergeWord(item) : (cur === STAGE_TRACKER_HUMAN_GATED && stageTrackerUnauthorizedWord(item)) || (cur === STAGE_TRACKER_READY_FOR_HUMAN_MERGE && stageTrackerReadyForHumanWord(item, STAGE_TRACKER_ACTIVE_WORD[cur] || curStage.short || curStage.label || String(cur))) || (STAGE_TRACKER_ACTIVE_WORD[cur] || curStage.short || curStage.label || String(cur))), sentinel: sentinelLane } : null; const segs = STAGE_TRACKER_PATH.map(n => { const st = n === 0 ? { label: 'Open', short: 'Open', description: 'Open, not yet in a stage' } : (byNum[n] || {}); let state = 'todo'; @@ -14128,6 +14146,8 @@

Where to get help

if (!sg.detour && (curStage === 60 || curStage === 80)) tip = sg.label + ' — not yet admitted' + (item.caption || item.reason ? ' — ' + (item.caption || item.reason) : ''); else if (curStage === STAGE_TRACKER_PRE_MERGE_SOAK) tip = sg.label + ' — admitted, soaking' + stageTrackerSoakLeft(item); else if (curStage === 100) tip = sg.label + ' — admitted, merging'; + // Why a person merges a 090 PR leads its tooltip (hivecommons/hive#14658). + else if (curStage === STAGE_TRACKER_READY_FOR_HUMAN_MERGE && item.human_merge_reason_text) tip = ((sg.detour && sg.detour.text) || sg.label) + ' — ' + String(item.human_merge_reason_text).trim() + (sg.description ? ' — ' + sg.description : ''); if (actorKind && !sg.cap) tip += ' · Next move: ' + actorKind; // The sentinel's reason leads the lane tooltip so the security // implication is read before the stage mechanics. @@ -14313,7 +14333,7 @@

Where to get help

function stageTrackerSubRowHtml(lp, issue, stages, nowMs, ctx) { const pr = { repo: issue.repo, number: lp.number, kind: 'pr', title: lp.title || '', url: lp.url || '', author: lp.author || '', author_kind: lp.author_kind || '', stage: lp.stage || 0, stage_since: lp.stage_since || '', modifiers: lp.modifiers || [], caption: lp.caption || '', reason: lp.reason || '', - sentinel_alert: !!lp.sentinel_alert, sentinel_reason: lp.sentinel_reason || '', head: lp.head || '' }; + human_approver: lp.human_approver || '', manual_merge: !!lp.manual_merge, human_merge_reason: lp.human_merge_reason || '', human_merge_reason_text: lp.human_merge_reason_text || '', sentinel_alert: !!lp.sentinel_alert, sentinel_reason: lp.sentinel_reason || '', head: lp.head || '' }; let ref = stageTrackerPRRef(pr.number, pr.url, pr.author_kind, pr.author, pr.title, (pr.title ? pr.title + ' · ' : '') + stageTrackerTooltip(pr, nowMs) + ' · ' + stageTrackerLinkedTip(issue, pr.number, ctx)); if (lp.base_ref) ref += ` ${esc(lp.base_ref)}`; const chip = ctx && ctx.repoChips ? stageTrackerRepoChipHtml(pr.repo, ctx) : ''; @@ -14492,7 +14512,7 @@

Where to get help

const who = (lp.author_kind || 'hive') + (lp.author ? ' · @' + lp.author : ''); prRefs = [STAGE_TRACKER_LINKED_GLYPH + stageTrackerPRRef(lp.number, lp.url, lp.author_kind || '', lp.author, lp.title, (lp.title ? lp.title + '\n' : '') + 'Author: ' + who + ' · ' + stageTrackerLinkedTip(item, lp.number, ctx)) + (lp.base_ref ? ` ${esc(lp.base_ref)}` : '')]; shown = Object.assign({}, item, { via_pr: true, stage: lp.stage || 40, stage_since: lp.stage_since || item.stage_since, modifiers: lp.modifiers || item.modifiers, caption: lp.caption || item.caption, reason: lp.reason || item.reason, - sentinel_alert: !!lp.sentinel_alert, sentinel_reason: lp.sentinel_reason || '', head: lp.head || '' }); + human_approver: lp.human_approver || '', manual_merge: !!lp.manual_merge, human_merge_reason: lp.human_merge_reason || '', human_merge_reason_text: lp.human_merge_reason_text || '', sentinel_alert: !!lp.sentinel_alert, sentinel_reason: lp.sentinel_reason || '', head: lp.head || '' }); } else if (linked.length) { // Several covering PRs: the issue strip ends at Claimed, all passed // and nothing lit; one sub-row per PR carries the live chevron. @@ -15745,7 +15765,7 @@

All labels

if (item.kind === 'pr') return parked(item) ? item : null; for (const lp of (Array.isArray(item.linked_prs) ? item.linked_prs : [])) { const pr = { repo: item.repo, number: lp.number, kind: 'pr', title: lp.title || '', url: lp.url || '', stage: lp.stage || 0, modifiers: lp.modifiers || [], author: lp.author || '', - sentinel_alert: !!lp.sentinel_alert, sentinel_reason: lp.sentinel_reason || '', head: lp.head || '' }; + human_approver: lp.human_approver || '', manual_merge: !!lp.manual_merge, human_merge_reason: lp.human_merge_reason || '', human_merge_reason_text: lp.human_merge_reason_text || '', sentinel_alert: !!lp.sentinel_alert, sentinel_reason: lp.sentinel_reason || '', head: lp.head || '' }; if (parked(pr)) return pr; } if (item.mirrored) return null; diff --git a/src/pkg/stageengine/prstage/reasons.go b/src/pkg/stageengine/prstage/reasons.go index 537a8f7d25..52eec6a154 100644 --- a/src/pkg/stageengine/prstage/reasons.go +++ b/src/pkg/stageengine/prstage/reasons.go @@ -1,5 +1,11 @@ package prstage +import ( + "strings" + + "github.com/hivecommons/hive/pkg/stagelabels" +) + // Lane reasons are shared by the producers and the stage classifier. const ( ReviewGateOutcomeAwaiting = "awaiting-review-approval" @@ -57,3 +63,82 @@ const ( TrustedBotLaneSkipReason = "trusted-bot-lane" WorkflowApprovalRequiredPrefix = "workflow-approval-required:" ) + +// HumanMergeReason codes: why a PR parked at 090 ready-for-human-merge +// needs a person's merge click rather than the hive's. Derived from the +// lane reason the stage record already carries, so the dashboard, the +// comments and the logs name the same cause (hivecommons/hive#14658). +const ( + // HumanMergeReasonWorkflowFiles: the PR edits .github/workflows/** or + // action files; the hive never merges those (and its App lacks the + // `workflows` permission). + HumanMergeReasonWorkflowFiles = "workflow-files" + // HumanMergeReasonTestsRemoved: the PR deletes tests. + HumanMergeReasonTestsRemoved = "tests-removed" + // HumanMergeReasonManualMergePolicy: the PR touches a configured + // human-merge path (auto_merge.human_merge_paths). + HumanMergeReasonManualMergePolicy = "manual-merge-policy" + // HumanMergeReasonBranchProtection: GitHub's branch protection or + // rulesets want an approving review the App cannot give. + HumanMergeReasonBranchProtection = "branch-protection" + // HumanMergeReasonMergeMethod: the repository disallows the merge + // method the hive must use for this PR. + HumanMergeReasonMergeMethod = "merge-method" + // HumanMergeReasonAutoMergeOff: auto-merge is switched off for the + // repository or the lane. + HumanMergeReasonAutoMergeOff = "auto-merge-off" + // HumanMergeReasonUntrustedAuthor: no lane can vouch for the author + // (tier below require_tiers, no verified claim, no trusted role). + HumanMergeReasonUntrustedAuthor = "untrusted-author" + // HumanMergeReasonUnauthorized: the hive's GitHub App lacks the + // permission for the merge or its intent could not be authorized. + HumanMergeReasonUnauthorized = "unauthorized" + // HumanMergeReasonReviewerDeferred: the reviewer swarm returned + // requires_human and a trusted merger approved the head; the hive + // leaves the merge itself to a person. + HumanMergeReasonReviewerDeferred = "reviewer-deferred" + // HumanMergeReasonPolicy: a lane rule no more specific code names. + HumanMergeReasonPolicy = "policy" +) + +// humanMergeReasonTrust are the admission reasons that mean no lane can +// vouch for the author (see stageengine.stageAdmissionReasons). +var humanMergeReasonTrust = map[string]bool{ + "untrusted-author-role": true, "author-permission-missing": true, "fork-non-member": true, "untrusted-merger": true, + ContributorLaneReasonNoClaim: true, ContributorLaneReasonClaimAuthor: true, ContributorLaneReasonClaimOtherHive: true, + ContributorLaneReasonNoLinkedIssue: true, ContributorLaneReasonClaimTier: true, ContributorLaneReasonClaimUnverified: true, + ContributorLaneReasonAuthorAssociation: true, +} + +// HumanMergeReason maps a 090 stage reason (with or without the +// `:human-approved@login` suffix) to its HumanMergeReason* code. An empty +// reason yields "" — the caller has nothing to explain; anything else is at +// least HumanMergeReasonPolicy. +func HumanMergeReason(reason string) string { + base, _ := stagelabels.HumanApprovedReason(reason) + base = strings.ToLower(strings.TrimSpace(base)) + switch { + case base == "": + return "" + case base == ContributorLaneReasonWorkflowPath: + return HumanMergeReasonWorkflowFiles + case base == ContributorLaneReasonTestsRemoved: + return HumanMergeReasonTestsRemoved + case base == AutoMergeReasonHumanMergePath, base == AutoMergeReasonHumanMergePathEvidence: + return HumanMergeReasonManualMergePolicy + case base == AutoMergeReasonMergeRefusedReview, strings.HasPrefix(base, AutoMergeReasonReviewGatePrefix): + return HumanMergeReasonBranchProtection + case base == AutoMergeReasonMergeRefusedMethod: + return HumanMergeReasonMergeMethod + case base == "repo-auto-merge-disabled", base == StageLaneContributor+":disabled", base == "disabled": + return HumanMergeReasonAutoMergeOff + case humanMergeReasonTrust[base]: + return HumanMergeReasonUntrustedAuthor + case strings.HasPrefix(base, StageReasonUnauthorizedPrefix), base == AutoMergeReasonIntentUnauthorized, + base == AutoMergeReasonIntentEvidence, base == "no-merger-authorizer": + return HumanMergeReasonUnauthorized + case strings.HasPrefix(base, "reviewer-verdict:requires_human"): + return HumanMergeReasonReviewerDeferred + } + return HumanMergeReasonPolicy +} diff --git a/src/pkg/stageengine/prstage/reasons_test.go b/src/pkg/stageengine/prstage/reasons_test.go new file mode 100644 index 0000000000..085bcfb4a9 --- /dev/null +++ b/src/pkg/stageengine/prstage/reasons_test.go @@ -0,0 +1,39 @@ +package prstage + +import "testing" + +// TestHumanMergeReason pins the 090 reason code for every lane reason that +// can land a PR at ready-for-human-merge (hivecommons/hive#14658): the +// workflow-path fence with and without the approver suffix, the trust +// admission reasons, GitHub refusals, the App's missing permission, and +// the policy fallback. +func TestHumanMergeReason(t *testing.T) { + cases := map[string]string{ + "": "", + " ": "", + ContributorLaneReasonWorkflowPath: HumanMergeReasonWorkflowFiles, + "contributor-lane:workflow-path:human-approved@clubanderson": HumanMergeReasonWorkflowFiles, + "Contributor-Lane:Workflow-Path": HumanMergeReasonWorkflowFiles, + ContributorLaneReasonTestsRemoved: HumanMergeReasonTestsRemoved, + AutoMergeReasonHumanMergePath: HumanMergeReasonManualMergePolicy, + AutoMergeReasonHumanMergePathEvidence: HumanMergeReasonManualMergePolicy, + AutoMergeReasonMergeRefusedReview: HumanMergeReasonBranchProtection, + AutoMergeReasonReviewGatePrefix + ReviewGateOutcomeAwaiting: HumanMergeReasonBranchProtection, + AutoMergeReasonMergeRefusedMethod: HumanMergeReasonMergeMethod, + "repo-auto-merge-disabled": HumanMergeReasonAutoMergeOff, + "untrusted-author-role": HumanMergeReasonUntrustedAuthor, + ContributorLaneReasonClaimTier: HumanMergeReasonUntrustedAuthor, + ContributorLaneReasonNoClaim: HumanMergeReasonUntrustedAuthor, + ContributorLaneReasonAuthorAssociation: HumanMergeReasonUntrustedAuthor, + StageReasonUnauthorizedPrefix + UnauthorizedStepApproveWorkflowRuns: HumanMergeReasonUnauthorized, + AutoMergeReasonIntentUnauthorized: HumanMergeReasonUnauthorized, + "reviewer-verdict:requires_human:human-approved@octocat": HumanMergeReasonReviewerDeferred, + "approval-desk-withheld": HumanMergeReasonPolicy, + "something-new": HumanMergeReasonPolicy, + } + for in, want := range cases { + if got := HumanMergeReason(in); got != want { + t.Errorf("HumanMergeReason(%q) = %q, want %q", in, got, want) + } + } +}