diff --git a/changelog.d/fixed-tracker-say-it-once.md b/changelog.d/fixed-tracker-say-it-once.md new file mode 100644 index 0000000000..d83dbdd597 --- /dev/null +++ b/changelog.d/fixed-tracker-say-it-once.md @@ -0,0 +1 @@ +- Activity monitor hovers, the merge-gate chip popover, the ⋯ menu hints and the server captions say each thing once in plain words: the 090 "Ready for human merge" popover is now one sentence of state, one primary action ("Merge it") plus "More ⋯", who asked and when, and a collapsed Details holding how to trust the author and the rails; the untrusted-author reason, caption, next-move line and menu consequences lost their config keys, stage numbers and internal nouns and no longer repeat each other ([#15394](https://github.com/hivecommons/hive/issues/15394)). diff --git a/src/docs/README.md b/src/docs/README.md index 5382a5912d..3ae7a54fc8 100644 --- a/src/docs/README.md +++ b/src/docs/README.md @@ -58,6 +58,7 @@ A terminal agent is a power tool: you hold it, aim it, and it stops when you sto - [Operator reference](operator-reference.md) - [GitHub webhooks: cadence, patch and reconcile](webhooks.md) — polling fallback, webhook patch and reconcile, and the state-accuracy guarantees. - [Dashboard sections explained](dashboard-sections.md) — what each dashboard section shows and what to do about it. +- [Activity monitor copy inventory](dashboard-copy-inventory.md) — every operator-visible string builder in the activity monitor, with before/after word counts and the hover budget. - [Hive on your iPhone Home Screen](ios-widget.md) — a Home Screen widget with issue/PR counts and sparklines (Scriptable, no server change). - [Dashboard settings explained](settings.md) — what each Settings tab controls and where each setting is documented. - [Maintainer commands](maintainer-commands.md) — slash commands for un-parking diff --git a/src/docs/dashboard-copy-inventory.md b/src/docs/dashboard-copy-inventory.md new file mode 100644 index 0000000000..ed389e86fb --- /dev/null +++ b/src/docs/dashboard-copy-inventory.md @@ -0,0 +1,82 @@ +# Activity monitor copy inventory + +Every string builder whose output an operator can read on an activity +monitor row, hover, chip popover, ⋯ menu, toast or feed line — with the +words it produced before and after [#15394](https://github.com/hivecommons/hive/issues/15394) +("this is WAY too much information … use easy to understand language and +much much less text"). + +Counts are the words the builder can emit for one row (the longest branch +where a builder has several), not the source size. The budget every hover +now meets: **one sentence of state, ≤ 40 visible words, one recommended +action, everything technical behind one collapsed Details, nothing said +twice.** The tests that hold the line are named in the last column. + +## The reference case: hive#15315, chip "Ready for human merge · untrusted author" + +| Surface part | Before (words) | After (words) | +|---|---:|---:| +| Question (`decisionForHumanMerge`) | 72 | 14 | +| Blocker (`decisionDCOBlocker` / hold) | 15 | 0 (folded into Details) | +| Action buttons | 7 buttons · 20 | 1 primary + "More ⋯" · 4 | +| Bulleted legend (`consequences`) | 120 | 0 (each line is now the ⋯ menu item's hint) | +| "Asked by the hive · 7 hours ago" | 7 | 7 | +| Stage line echo (`data-ham-tip`: caption + reason + "Next move") | 150 | 0 visible (deduplicated; what is new sits in Details) | +| Details (collapsed) | — | 27 | +| **Visible total** | **≈ 384** | **≈ 29** | + +The new hover, verbatim (title line omitted): + +> **Ready to merge. Hive won't merge it alone — @odttlnt isn't a trusted author yet.** +> [ Merge it ] [ More ⋯ ] +> Asked by the hive · 7 hours ago +> Details ▸ *Hive never merges this on its own; a maintainer merges here or on GitHub. To trust @odttlnt: add them as a merger under ⚙ Security → Authorized users. · Ready for human merge · untrusted author · Next move: human — a maintainer merges it* + +## Server-side builders (Go, `src/pkg/dashboard`) + +| Builder | Reaches | Before | After | Held by | +|---|---|---:|---:|---| +| `stageTrackerUntrustedAuthorWhy` (all 10 trust reasons, summed) | question, reason text, delegated outcome | 314 | 68 | `TestStageTrackerHumanMergeSaysItOnce` (no config keys, no jargon) | +| `stageTrackerUntrustedAuthorFix` (new; the how-to-trust line, Details only) | Details | — | 81 | same | +| `stageTrackerHumanMergeReasonWords` tips (9 codes, summed) | chip hover, 090 chevron tip | 227 | 101 | `TestStageTrackerHumanMergeReason` | +| `HumanMergeReasonText` composition (090 untrusted author) | chevron tip, row tooltip, feed | 43 + 24 ("Until then a maintainer merges — Approve & merge…") | 11 | `TestStageTrackerHumanMergeSaysItOnce` | +| `HumanMergeReasonText` admitted prefix | same | 41 | 9 | `TestStageTrackerDecisionForHumanMerge/admitted…` | +| `stageTrackerCaption` 090 | row caption, feed | 19 | 7 | `TestStageTrackerCaption…` cases in `stage_tracker_test.go` | +| `stageTrackerStageActor` 090 `Why` ("Next move: human — …") | chevron tip, row tooltip | 43 (echoed `HumanMergeReasonText`) | 4 | `TestStageTrackerHumanMergeSaysItOnce` (no echo) | +| `decisionForHumanMerge` (question + blocker + 7 consequences) | chip popover, ⋯ menu hints | 293 | 169 (of which Details 27, consequences ≤ 12 each) | `TestStageTrackerDecisionForHumanMerge` | +| `decisionMergeNowOption` consequence | popover title, menu hint | 11 | 8 | same | +| `decisionReauthorOption` consequence / disabled reason | menu hint | 31 / 29 | 12 / 14 | `TestStageTrackerDecisionForHumanMerge/unsigned…` | +| `decisionDCOBlocker` / `decisionDCOConsequence` | Details / menu hint | 39 / 17 | 29 / 8 | same | +| Other `decisionFor*` delegate / retry / close / resolve consequences (10 strings) | ⋯ menu hints | 112 | 66 | word budget in `TestStageTrackerDecisionForHumanMerge` | +| `delegatedHumanMergeOutcome` rationale | "Let hive decide" outcome | 43 | 11 + fix line | `TestDelegatedDecisionReadyForHumanMergeAnswersWithMergeOptions` | + +## SPA builders (`static-src/js`) + +| Builder | Reaches | Before | After | Held by | +|---|---|---:|---:|---| +| `stageTrackerDecisionPopHtml` (`tracker-actions.js`) | chip popover / chevron popover | question + blocker + N buttons + legend + meta + stage echo (≈ 384 on #15315) | question + 1 button + "More ⋯" + meta (≤ 40), Details collapsed | `TestStageTrackerDecisionPopoverContent` (≤ 40 visible words, no duplicate sentence, banned-jargon list, no `a.b.c` keys) | +| `stageTrackerSayOnce` (new) | popover Details | — | — | same | +| `stageTrackerStripItems` 090 chevron tip (`tracker-row.js`) | chevron `title` / popover Details | word + reason + stage description + actor (≈ 70) | word + reason + actor (≈ 20) | `TestStageTrackerSentinelLane…` whyTip case | +| `stageTrackerTooltip` author line | row tooltip | `@x (author/clanker, inferred)` | `@x (agent, inferred)`; duplicate lines dropped | `TestStageTrackerRows` | +| `stageTrackerDCOCaveat` | confirm dialogs | 55 | 46 | `TestStageTrackerReauthor…` in `stage_tracker_row_actions_test.go` | +| Confirm: Approve & merge as maintainer | dialog | 76 | 53 | same | +| Confirm: Approve — let hive merge | dialog | 62 | 49 | same | +| ⋯ menu hints (`stageTrackerLeadActions` → `ham-menu-hint`) | ⋯ menu | server consequences (11–31 each) | server consequences (≤ 12 each) | Go budget test | +| Toasts (`STAGE_TRACKER_ACTING_CAPTIONS`, acted labels) | toast | 2–4 each | unchanged | — | + +## Totals + +| | Before | After | +|---|---:|---:| +| Server builders above (sum of longest branches) | ≈ 1,350 | ≈ 620 (of which ≈ 110 only ever shown inside Details) | +| #15315 hover, visible | ≈ 384 | ≈ 29 | + +## Left as-is (follow-up) + +- Merge-gate (080/095/100) chip tips in `stageTrackerMergeGateInfo` still say + *sweep* and *soak* ("next sweep in 42s", "soak 12m left"); they are live + clocks, short already, and a rename touches the gate's own tests. Tracked + under the same issue. +- 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. diff --git a/src/docs/dashboard-sections.md b/src/docs/dashboard-sections.md index 5d480e43b0..f8d338a34f 100644 --- a/src/docs/dashboard-sections.md +++ b/src/docs/dashboard-sections.md @@ -31,6 +31,16 @@ These words have a special meaning in Hive. Each entry explains them again the f - **Needs-human:** waiting on a person, for example for a decision or a review. It is also the name of a label. - **Merge-eligible:** a pull request that passed every check Hive uses before it may merge it. +**Who is who in the activity monitor** ([#15394](https://github.com/hivecommons/hive/issues/15394)). Every hover, menu and caption uses these five nouns and no others: + +- **Agent:** any automated worker — one of Hive's own agents or a contributor's connected agent. Hover text says *the author's agent* for the latter; the product noun **clanker** appears only where it names the contributor relay itself (the Contributors page, presence chips). +- **Contributor:** a person outside the maintainer team whose issue or pull request Hive is tracking. +- **Author:** whoever opened the pull request — a person, an agent or Hive. A **trusted author** is one Hive may merge for without asking. +- **Reviewer:** a person or agent that reviews a pull request; Hive's own review swarm is *the reviewer*. +- **Merge:** the one word for landing a pull request. *Merge it* is you merging now; *Let hive merge it* is you approving so Hive merges on its next pass. + +Hover text follows one budget: one sentence of state in plain words, at most 40 visible words, one recommended action, and everything technical (config keys, stage numbers, how to change a setting) behind a single collapsed **Details**. The same sentence is never shown twice on one surface. The per-builder word counts live in [dashboard-copy-inventory.md](dashboard-copy-inventory.md). + **Dialogs on a phone.** Any dialog with a long body — the **What changed** release notes after an upgrade, alerts, the export viewer, the Level 6 auto-merge notice, settings bodies — fills the whole screen on a phone: title and a ✕ at the top, the text scrolls in the middle, and the buttons stay fixed at the bottom. A soft fade at the bottom edge means there is more to read; it disappears when you reach the end. Esc, the ✕, the buttons and tapping the backdrop close it. On a desktop the same dialogs keep their usual size and only gain the fade and a thin scrollbar. See [Long-content modals](dashboard-design-system.md#long-content-modals-modal-scroll-and-the-mobile-sheet) for the convention. ## Overview diff --git a/src/pkg/dashboard/api_repo_item_decide_delegated_test.go b/src/pkg/dashboard/api_repo_item_decide_delegated_test.go index 1509c951fe..a04fcbdee3 100644 --- a/src/pkg/dashboard/api_repo_item_decide_delegated_test.go +++ b/src/pkg/dashboard/api_repo_item_decide_delegated_test.go @@ -739,7 +739,7 @@ func TestDelegatedDecisionReadyForHumanMergeAnswersWithMergeOptions(t *testing.T } res := job.Result t.Logf("outcome: %s\nnext: %s\nwhy: %s", res.Outcome, res.Next, res.Why) - for _, want := range []string{"I can't merge this: author @someone is untrusted on testrepo", "not a collaborator", "trusted or merger tier", "👥 Contributors"} { + for _, want := range []string{"I can't merge this: author @someone is untrusted on testrepo", "isn't a trusted author yet", "trusted tier under 👥 Contributors"} { if !strings.Contains(res.Outcome, want) { t.Errorf("outcome %q missing %q", res.Outcome, want) } diff --git a/src/pkg/dashboard/delegated_decision_human_merge.go b/src/pkg/dashboard/delegated_decision_human_merge.go index 309c87d899..05068e5cc3 100644 --- a/src/pkg/dashboard/delegated_decision_human_merge.go +++ b/src/pkg/dashboard/delegated_decision_human_merge.go @@ -71,6 +71,9 @@ func (s *Server) delegatedHumanMergeOutcome(repoFull string, number int, itemTyp code = delegatedHumanMergeRule } why := stageTrackerUntrustedAuthorWhy(base, in.Author) + if fix := stageTrackerUntrustedAuthorFix(base, in.Author); why != "" && fix != "" { + why += ". " + strings.TrimSuffix(fix, ".") + } if why == "" { why = decisionPlainReason(base) if base == "" || why == base { diff --git a/src/pkg/dashboard/stage_tracker.go b/src/pkg/dashboard/stage_tracker.go index 174fdabbe8..4f1666ba2c 100644 --- a/src/pkg/dashboard/stage_tracker.go +++ b/src/pkg/dashboard/stage_tracker.go @@ -1440,16 +1440,17 @@ func stageTrackerManualMergeReason(reason string) bool { // Gate-cell words and tooltips per prstage.HumanMergeReason* code: why a // person, not the hive, merges a PR parked at 090 (hivecommons/hive#14658). +// Plain words, one short sentence each, no config keys (hivecommons/hive#15394). 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"}, + stageengineprstage.HumanMergeReasonWorkflowFiles: {"workflow files", "It changes GitHub workflow files, which hive never merges on its own"}, + stageengineprstage.HumanMergeReasonTestsRemoved: {"tests removed", "It removes tests, which hive never merges on its own"}, + stageengineprstage.HumanMergeReasonManualMergePolicy: {"manual-merge policy", "It touches files this repo reserves for a person to merge"}, + stageengineprstage.HumanMergeReasonBranchProtection: {"branch protection", "Branch protection wants a review hive cannot give; approve on GitHub or merge it"}, + stageengineprstage.HumanMergeReasonMergeMethod: {"merge method", "The repo does not allow the merge method this PR needs"}, + stageengineprstage.HumanMergeReasonAutoMergeOff: {"auto-merge off", "Auto-merge is off for this repo, so a person merges"}, + stageengineprstage.HumanMergeReasonUntrustedAuthor: {"untrusted author", "Hive won't merge it alone — the author isn't a trusted author yet"}, + stageengineprstage.HumanMergeReasonUnauthorized: {"unauthorized", "GitHub does not let hive merge here; a person merges"}, + stageengineprstage.HumanMergeReasonReviewerDeferred: {"reviewer deferred", "A reviewer asked for a person to merge this one"}, } // stageTrackerHumanMergeReason derives, from a 090 stage reason, the @@ -1465,47 +1466,73 @@ func stageTrackerHumanMergeReason(reason string) (code, word, tip string) { 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" + return stageengineprstage.HumanMergeReasonPolicy, "policy", "Hive's merge rules leave this one to a person (`" + strings.TrimSpace(base) + "`)" } // Where an operator makes an author trusted, in the words the ⚙ and 👥 -// sections use, for the untrusted-author tooltip. +// sections use. One line each, no config keys: the keys live on those +// pages (hivecommons/hive#15394). const ( - stageTrackerTrustFixTier = "give them the trusted or merger tier under 👥 Contributors (auto_merge.contributor_lane.require_tiers)" - stageTrackerTrustFixRole = "add them under Authorized users on ⚙ Security with the merger role (dashboard.authorized_users, auto_merge.trusted_authors.require_role)" - stageTrackerTrustFixCollab = "add them as a collaborator of the repository on GitHub" + stageTrackerTrustFixTier = "give them the trusted tier under 👥 Contributors" + stageTrackerTrustFixRole = "add them as a merger under ⚙ Security → Authorized users" + stageTrackerTrustFixCollab = "make them a collaborator on GitHub" ) -// stageTrackerUntrustedAuthorWhy says, in plain words, why the hive will -// not vouch for the PR's author under a trust-family 090 reason and what -// would make them trusted — the config key and where in the dashboard it -// is set (hivecommons/hive#15078). "" for any other reason. +// stageTrackerUntrustedAuthorWhy says, in one short plain sentence, why +// the hive will not merge the PR's author's work under a trust-family 090 +// reason (hivecommons/hive#15078, #15394). "" for any other reason. The +// how-to-fix line is stageTrackerUntrustedAuthorFix. func stageTrackerUntrustedAuthorWhy(base, author string) string { + who := "the author" + if a := strings.TrimSpace(author); a != "" { + who = "@" + a + } + switch strings.ToLower(strings.TrimSpace(base)) { + case stageengineprstage.ContributorLaneReasonAuthorAssociation, "untrusted-author-role", stageengineprstage.ContributorLaneReasonClaimTier, + stageengineprstage.ContributorLaneReasonNoClaim, stageengineprstage.ContributorLaneReasonNoLinkedIssue: + return who + " isn't a trusted author yet" + case "author-permission-missing": + return who + " has no write access to this repo" + case "fork-non-member": + return "it comes from a fork and " + who + " isn't a member of the org" + case "untrusted-merger": + return "the person who queued it isn't a merger" + case stageengineprstage.ContributorLaneReasonClaimUnverified: + return who + " hasn't verified their GitHub login yet" + case stageengineprstage.ContributorLaneReasonClaimAuthor: + return "the linked issue was claimed by someone other than " + who + case stageengineprstage.ContributorLaneReasonClaimOtherHive: + return "another hive owns the linked issue" + } + return "" +} + +// stageTrackerUntrustedAuthorFix is the one-line "how to trust them" for +// the Details fold under a trust-family 090 reason; "" when none applies. +func stageTrackerUntrustedAuthorFix(base, author string) string { who := "the author" if a := strings.TrimSpace(author); a != "" { who = "@" + a } switch strings.ToLower(strings.TrimSpace(base)) { case stageengineprstage.ContributorLaneReasonAuthorAssociation: - return who + " is not a collaborator of this repository on GitHub (no owner, member or collaborator association) and holds no trusted or merger tier in this hive's contributor registry, so the hive will not merge their PR unattended. To trust them: " + stageTrackerTrustFixTier + ", or " + stageTrackerTrustFixCollab + return "To trust " + who + ": " + stageTrackerTrustFixTier + ", or " + stageTrackerTrustFixCollab + "." case "untrusted-author-role": - return who + " does not hold the merger role under this hive's Authorized users, so the trusted-authors merge lane does not vouch for them. To trust them: " + stageTrackerTrustFixRole + return "To trust " + who + ": " + stageTrackerTrustFixRole + "." case "author-permission-missing": - return "GitHub reports no push, maintain or admin permission for " + who + " on this repository, which the trusted-authors lane requires (auto_merge.trusted_authors.require_github_permission). To trust them: grant them write access on GitHub, or turn that check off" + return "To trust " + who + ": grant them write access on GitHub." case "fork-non-member": - return "this PR comes from a fork and " + who + " is not a member of the organization, so the hive will not merge it unattended. To trust them: " + stageTrackerTrustFixCollab + return "To trust " + who + ": " + stageTrackerTrustFixCollab + "." case "untrusted-merger": - return "the person who queued this PR for auto-merge does not hold the merger role under this hive's Authorized users (dashboard.authorized_users). A merger or owner queues or merges it" - case stageengineprstage.ContributorLaneReasonClaimTier: - return who + "'s contributor tier is below the tiers the contributor lane merges for (auto_merge.contributor_lane.require_tiers, default trusted and merger). To trust them: " + stageTrackerTrustFixTier - case stageengineprstage.ContributorLaneReasonNoClaim, stageengineprstage.ContributorLaneReasonNoLinkedIssue: - return "no hive claim links this PR to an issue the hive handed out, and " + who + " holds no trusted or merger tier in the contributor registry, so no lane vouches for it. To trust them: " + stageTrackerTrustFixTier + return "A merger or owner queues or merges it." + case stageengineprstage.ContributorLaneReasonClaimTier, stageengineprstage.ContributorLaneReasonNoClaim, stageengineprstage.ContributorLaneReasonNoLinkedIssue: + return "To trust " + who + ": " + stageTrackerTrustFixTier + "." case stageengineprstage.ContributorLaneReasonClaimUnverified: - return who + "'s GitHub login is not verified against their contributor profile, so the contributor lane cannot vouch for them. They verify it on the hub (Contributors → Verify GitHub), or " + stageTrackerTrustFixTier + return "They verify it under Contributors → Verify GitHub, or " + stageTrackerTrustFixTier + "." case stageengineprstage.ContributorLaneReasonClaimAuthor: - return "the hive's claim on the linked issue names a different contributor than " + who + ", so the contributor lane does not vouch for this PR. A maintainer merges, or " + stageTrackerTrustFixTier + return "A maintainer merges, or " + stageTrackerTrustFixTier + "." case stageengineprstage.ContributorLaneReasonClaimOtherHive: - return "the linked issue is claimed by another hive, so this hive's contributor lane does not vouch for " + who + ". The owning hive merges it, or a maintainer merges here" + return "The owning hive merges it, or a maintainer merges here." } return "" } @@ -1700,13 +1727,13 @@ func stageTrackerCaption(stage stagelabels.Stage, reason, author string, kind st return joinClause("A human decision is owed", clause), "maintainer" case stagelabels.ReadyForHumanMerge: if base, approver := stagelabels.HumanApprovedReason(reason); stageTrackerManualMergeReason(base) { - c := "Awaiting human merge (" + humanizeStageReason(base) + ")" + c := "Ready to merge (" + humanizeStageReason(base) + ")" if approver != "" { c += " — approved by @" + approver } - return c + "; the hive never merges this itself: click Merge (or /lgtm + /approve for tide)", "maintainer" + return c + " — a person merges it", "maintainer" } - return joinClause("Ready for a maintainer's /lgtm /approve; the hive cannot merge it itself", clause), "maintainer" + return joinClause("Ready to merge — a maintainer merges it", clause), "maintainer" case stagelabels.PreMergeSoak: return joinClause("Admitted by the automerge lane; the pre-merge soak window is running", clause), "automerge lane" case stagelabels.MergeQueue: @@ -2050,12 +2077,12 @@ func (s *Server) buildStageTracker(status *StatusPayload, store *stagelabels.Sto // instead of the generic trust sentence (hivecommons/hive#15078). if it.HumanMergeReason == stageengineprstage.HumanMergeReasonUntrustedAuthor { if why := stageTrackerUntrustedAuthorWhy(base, it.Author); why != "" { - it.HumanMergeReasonText = "Untrusted author: " + why + ". Until then a maintainer merges — Approve & merge as maintainer, or Approve — let hive merge, from the row's ⋯ menu." + it.HumanMergeReasonText = "Hive won't merge it alone — " + why } } // A person already took the trust call for this head (#15136). if login := stagelabels.AdmissionLogin(it.AdmittedBy); login != "" { - it.HumanMergeReasonText = "Approved by @" + login + " as the owner decision (" + it.AdmittedBy + "): the hive merges this head as-is on its next pass once CI is green and the head has soaked, and does not adopt or re-author it. " + it.HumanMergeReasonText + it.HumanMergeReasonText = "@" + login + " approved it; hive merges it on its next pass" } } if slices.Contains(it.Modifiers, modUnauthorized) || slices.Contains(it.DeferredModifiers, modUnauthorized) { diff --git a/src/pkg/dashboard/stage_tracker_actor.go b/src/pkg/dashboard/stage_tracker_actor.go index ae35d51ddb..5b757000d9 100644 --- a/src/pkg/dashboard/stage_tracker_actor.go +++ b/src/pkg/dashboard/stage_tracker_actor.go @@ -197,11 +197,9 @@ func stageTrackerStageActor(it StageTrackerItem, workers map[string]stageTracker } return set(StageActorHuman, "", "a human decision is owed") case stagelabels.ReadyForHumanMerge: - why := "ready for a maintainer's merge; the hive never merges this itself" - if it.HumanMergeReasonText != "" { - why = strings.TrimSpace(it.HumanMergeReasonText) - } - return set(StageActorHuman, it.HumanApprover, why) + // The chevron and the popover already carry HumanMergeReasonText; + // the next-move line says only who moves (hivecommons/hive#15394). + return set(StageActorHuman, it.HumanApprover, "a maintainer merges it") case stagelabels.PreMergeSoak: return set(StageActorHive, "", "automerge lane — the pre-merge soak window is running") case stagelabels.MergeQueue: diff --git a/src/pkg/dashboard/stage_tracker_blocker_js_test.go b/src/pkg/dashboard/stage_tracker_blocker_js_test.go index 8eab5c2357..b2e49cd9a8 100644 --- a/src/pkg/dashboard/stage_tracker_blocker_js_test.go +++ b/src/pkg/dashboard/stage_tracker_blocker_js_test.go @@ -76,11 +76,14 @@ const nowMs = Date.parse('2026-10-20T21:10:00Z'); const pop = stageTrackerDecisionPopHtml(issue, opts, nowMs, 'Needs decision — tip'); assert.ok(pop.indexOf('has no workflows permission') >= 0 || pop.indexOf('has no `+"`workflows`"+` permission') >= 0, pop); assert.ok(pop.indexOf('.github/workflows/*') >= 0, pop); +// One primary action — the first the viewer may take, since "Let hive decide" cannot +// grant a permission — and "More ⋯" for the rest (the disabled delegate keeps its +// reason in the row menu). const buttons = pop.match(/]*data-ham-act="[^"]+"[^>]*>[^<]*<\/button>/g) || []; -const delBtn = buttons.find(b => b.indexOf('data-ham-act="decide:delegate"') >= 0); -assert.ok(delBtn && /aria-disabled="true"/.test(delBtn) && /title="[^"]*cannot grant a permission/.test(delBtn), delBtn); -assert.ok(buttons.some(b => b.indexOf('data-ham-act="blocker:recheck"') >= 0 && b.indexOf('>Re-check permissions<') >= 0), buttons.join('\n')); -assert.ok(buttons.some(b => b.indexOf('data-ham-act="open:app-settings"') >= 0), buttons.join('\n')); +assert.strictEqual(buttons.length, 1, buttons.join('\n')); +const first = opts.find(o => o.enabled); +assert.ok(buttons[0].indexOf('data-ham-act="' + first.id + '"') >= 0 && buttons[0].indexOf('ham-decision-lead') >= 0 && !/aria-disabled/.test(buttons[0]), buttons[0]); +assert.ok(pop.indexOf('data-ham-more="1"') >= 0, pop); // No slugs reach the operator. for (const bad of ['capability:workflows-permission', 'requires_human']) assert.ok(pop.indexOf(bad) < 0, bad + ' in ' + pop); `) diff --git a/src/pkg/dashboard/stage_tracker_decision.go b/src/pkg/dashboard/stage_tracker_decision.go index 376961a5dc..24b22bde89 100644 --- a/src/pkg/dashboard/stage_tracker_decision.go +++ b/src/pkg/dashboard/stage_tracker_decision.go @@ -6,6 +6,7 @@ import ( "strconv" "strings" "time" + "unicode" "github.com/hivecommons/hive/pkg/delegatedecision" "github.com/hivecommons/hive/pkg/review" @@ -46,6 +47,10 @@ type StageTrackerDecision struct { // ("contributor-lane:changes-requested", "sentinel-alert", …). Blocker string `json:"blocker,omitempty"` BlockerReason string `json:"blocker_reason,omitempty"` + // Detail is the technical background the popover folds behind one + // collapsed "Details" (how to trust the author, the rails, DCO): never + // in the first read (hivecommons/hive#15394). + Detail string `json:"detail,omitempty"` // Options are the actions that can advance the item, first the one the // owner asked to lead ("Let hive decide"), under the row context menu's // action ids. A disabled option says why; the SPA further greys out @@ -238,8 +243,8 @@ func decisionForParked(it StageTrackerItem, held bool) *StageTrackerDecision { d.Blocker += " " + decisionHeldBlocker(it.Hold) } retry := decisionOption(decisionActionRetry, "Re-evaluate now", true, "") - retry.Consequence = "re-reads GitHub and re-derives the stage" - d.Options = []StageTrackerDecisionOption{retry, decisionDelegateOption(held, "the hive says in plain words what it can and cannot do here"), decisionHoldOption(held)} + retry.Consequence = "Re-reads GitHub and recomputes the stage" + d.Options = []StageTrackerDecisionOption{retry, decisionDelegateOption(held, "Hive explains what it can do here"), decisionHoldOption(held)} if !slices.Contains(it.Modifiers, modNeedsHuman) { d.Options = append(d.Options, decisionOption(decisionActionNeedsHuman, "Mark needs-human", true, "")) } @@ -258,63 +263,124 @@ func decisionForParked(it StageTrackerItem, held bool) *StageTrackerDecision { func decisionForHumanMerge(it StageTrackerItem, held bool) *StageTrackerDecision { base, approver := stagelabels.HumanApprovedReason(it.Reason) base = strings.TrimSpace(base) - _, word, _ := stageTrackerHumanMergeReason(it.Reason) + _, _, tip := stageTrackerHumanMergeReason(it.Reason) d := &StageTrackerDecision{Since: it.StageSince, AskedBy: decisionAskedByLane, BlockerReason: base} - if word == "" { - word = "policy" - } ref := "#" + strconv.Itoa(it.Number) + // First read: one sentence of state, one of why (hivecommons/hive#15394). why := stageTrackerUntrustedAuthorWhy(base, it.Author) - if why == "" { - why = decisionPlainReason(base) - if strings.TrimSpace(base) == "" { - why = "the hive's merge rules leave this one to a person" - } + fix := stageTrackerUntrustedAuthorFix(base, it.Author) + switch { + case why != "": + why = "Hive won't merge it alone — " + why + "." + case tip != "": + why = sentence(tip) + default: + why = "Hive's merge rules leave this one to a person." + } + d.Question = "Ready to merge. " + why + details := []string{"Hive never merges this on its own; a maintainer merges here or on GitHub."} + if fix != "" { + details = append(details, fix) } - d.Question = "This PR is ready to merge, but the hive will not merge it by itself (" + word + "): " + why + ". Merge it now, let the hive merge it, or send it back?" - d.Blocker = "The hive never merges this unattended. A maintainer merges: here, or on GitHub." if approver != "" { - d.Blocker = "Approved by @" + approver + "; the hive still never merges this unattended. A maintainer merges: here, or on GitHub." + details = append(details, "Approved by @"+approver+".") } admitter := stagelabels.AdmissionLogin(it.AdmittedBy) if admitter != "" { // A person already took the trust call for this head (#15136): // the lane merges it as-is; nothing is adopted or re-authored. - d.Question = "@" + admitter + " approved this head as the owner decision; the hive's merge sweep merges " + ref + " as-is once CI is green and the head has soaked, and will not adopt or re-author it. Merge it now instead, or send it back?" - d.Blocker = "Admitted by @" + admitter + " (" + it.AdmittedBy + "). The hive merges this head on its next pass; a new push drops the admission and asks again." + d.Question = "@" + admitter + " approved it. Hive merges it on its next pass." + details = []string{"Admitted by @" + admitter + " (" + it.AdmittedBy + "). Hive merges this exact version once CI is green; a new push asks again."} } - dco := decisionDCOBlocker(it) - if dco != "" { - d.Blocker += " " + dco + if dco := decisionDCOBlocker(it); dco != "" { + details = append(details, dco) } if held { - d.Blocker += " " + decisionHeldBlocker(it.Hold) + details = append(details, decisionHeldBlocker(it.Hold)) } + d.Detail = stageTrackerSayOnce(d.Question, details...) mergeNow := decisionMergeNowOption(it, held) queue := decisionOption(decisionActionQueueMerge, "Approve — let hive merge", !held, "Release the hold first") - queue.Consequence = "records your approval as the trust override for this head; the hive's merge sweep merges " + ref + " as-is on its next pass once CI is green and the head has soaked, and does not adopt it" + queue.Consequence = "Hive merges " + ref + " on its next pass" if admitter != "" && !held { - queue.Enabled, queue.ReasonIfDisabled = false, "@"+admitter+" already approved this head; the hive merges it on its next pass" + queue.Enabled, queue.ReasonIfDisabled = false, "@"+admitter+" already approved it; hive merges it next pass" } - if dco != "" { + if it.DCOUnsigned > 0 { mergeNow.Consequence += "; " + decisionDCOConsequence(it) queue.Consequence += "; " + decisionDCOConsequence(it) } - direction := decisionOption(decisionActionDirection, "Give direction", it.AuthorKind != authorKindHuman, "The hive did not open this PR, so it cannot carry a direction to its author; leave a changes-requested review on GitHub") - direction.Consequence = "asks the author agent for a new head instead of merging" + direction := decisionOption(decisionActionDirection, "Give direction", it.AuthorKind != authorKindHuman, "Hive did not open this PR, so it cannot carry a direction to its author; leave a review on GitHub") + direction.Consequence = "Asks the author's agent for changes instead" closeSup := decisionOption(decisionActionCloseSuperseded, "Close as superseded", true, "") - closeSup.Consequence = "closes " + ref + " unmerged, naming the PR that replaces it" + closeSup.Consequence = "Closes " + ref + ", naming the PR that replaces it" closeWontfix := decisionOption(decisionActionCloseWontfix, "Close as won't fix", true, "") - closeWontfix.Consequence = "closes " + ref + " unmerged" - delegate := decisionDelegateOption(held, "the hive answers at once why it will not merge this itself and lists these options; it never merges it") + closeWontfix.Consequence = "Closes " + ref + " without merging" + delegate := decisionDelegateOption(held, "Hive explains and recommends; merges nothing") d.Options = []StageTrackerDecisionOption{mergeNow, queue} - if dco != "" { + if it.DCOUnsigned > 0 { d.Options = append(d.Options, decisionReauthorOption(it, ref, held)) } d.Options = append(d.Options, delegate, direction, closeSup, closeWontfix, decisionHoldOption(held)) return d } +// stageTrackerSayOnce joins parts into one text, dropping any sentence +// that already appeared in lead or earlier in the parts, so a hover never +// says the same thing twice (hivecommons/hive#15394). +func stageTrackerSayOnce(lead string, parts ...string) string { + seen := map[string]bool{} + for _, sent := range stageTrackerSentences(lead) { + seen[sent] = true + } + var out []string + for _, part := range parts { + var keep []string + for _, sent := range stageTrackerSentences(part) { + if seen[sent] { + continue + } + seen[sent] = true + keep = append(keep, sentence(sent)) + } + if len(keep) > 0 { + out = append(out, strings.Join(keep, " ")) + } + } + return strings.Join(out, " ") +} + +// stageTrackerSentences splits text on sentence ends and normalises each +// sentence (trimmed, trailing punctuation dropped, lower-cased first rune) +// for say-it-once comparison. +func stageTrackerSentences(text string) []string { + var out []string + for _, raw := range strings.FieldsFunc(text, func(r rune) bool { return r == '.' || r == '?' || r == '!' }) { + raw = strings.TrimSpace(raw) + if raw == "" { + continue + } + r := []rune(raw) + r[0] = unicode.ToLower(r[0]) + out = append(out, string(r)) + } + return out +} + +// sentence capitalises a clause and ends it with a full stop. +func sentence(s string) string { + s = strings.TrimSpace(s) + if s == "" { + return "" + } + r := []rune(s) + r[0] = unicode.ToUpper(r[0]) + s = string(r) + if !strings.HasSuffix(s, ".") && !strings.HasSuffix(s, "?") && !strings.HasSuffix(s, "!") { + s += "." + } + return s +} + // decisionDCOBlocker says, before anyone presses Approve, that the head // cannot merge as-is where DCO is required: the stage record's commit check // found commits without a Signed-off-by (hivecommons/hive#15136). "" when @@ -323,13 +389,13 @@ func decisionDCOBlocker(it StageTrackerItem) string { if it.DCOUnsigned <= 0 { return "" } - return fmt.Sprintf("Merging as-is may not be possible: %d of %s no Signed-off-by, so a required DCO check refuses the merge. Re-author as hive PR is the separate choice for that; an Approve never re-authors by itself.", + return fmt.Sprintf("%d of %s no Signed-off-by, so a required DCO check refuses the merge. Re-author as hive PR is the separate choice for that; an Approve never re-authors by itself.", it.DCOUnsigned, pluralCommitsHave(it.DCOTotal)) } // decisionDCOConsequence is the short DCO caveat under the merge options. func decisionDCOConsequence(it StageTrackerItem) string { - return fmt.Sprintf("%d of %s no Signed-off-by, so GitHub refuses the merge where DCO is required", it.DCOUnsigned, pluralCommitsHave(it.DCOTotal)) + return fmt.Sprintf("%d of %s no Signed-off-by (DCO)", it.DCOUnsigned, pluralCommitsHave(it.DCOTotal)) } // pluralCommitsHave renders "3 commits have" / "1 commit has" for the DCO @@ -356,9 +422,9 @@ func decisionReauthorOption(it StageTrackerItem, ref string, held bool) StageTra if it.Author != "" { who = "@" + it.Author } - o.ReasonIfDisabled = "The hive does not re-author a person's PR; ask " + who + " to sign off (git commit -s --amend, then push), or merge on GitHub if DCO is not required there" + o.ReasonIfDisabled = "Hive does not re-author a person's PR; ask " + who + " to sign off and push" } - o.Consequence = "the hive re-homes " + ref + "'s commits on a hive-owned, signed-off branch and opens a superseding PR; " + ref + " is closed when that one merges; nothing is merged as-is" + o.Consequence = "Hive reopens " + ref + " as a signed-off hive PR; nothing is merged as-is" return o } @@ -378,7 +444,7 @@ func decisionMergeNowOption(it StageTrackerItem, held bool) StageTrackerDecision return opt } opt := decisionOption(decisionActionMergeNow, "Approve & merge as maintainer", !held, "Release the hold first") - opt.Consequence = "merges " + ref + " into " + into + " now via hive's identity, attributed to you" + opt.Consequence = "Merges " + ref + " into " + into + " now, credited to you" return opt } @@ -417,8 +483,8 @@ func decisionForUnauthorized(it StageTrackerItem, held bool) *StageTrackerDecisi d.Blocker += " " + decisionHeldBlocker(it.Hold) } retry := decisionOption(decisionActionRetry, "Re-evaluate now", true, "") - retry.Consequence = "re-reads GitHub; the hive resumes and clears the label once the step is done" - d.Options = []StageTrackerDecisionOption{retry, decisionDelegateOption(held, "the hive says in plain words which step it may not take and what would let it"), decisionHoldOption(held)} + retry.Consequence = "Re-reads GitHub; hive resumes once the step is done" + d.Options = []StageTrackerDecisionOption{retry, decisionDelegateOption(held, "Hive explains which step it may not take"), decisionHoldOption(held)} if !slices.Contains(it.Modifiers, modNeedsHuman) { d.Options = append(d.Options, decisionOption(decisionActionNeedsHuman, "Mark needs-human", true, "")) } @@ -446,10 +512,10 @@ func decisionForWaitingOnAuthor(it StageTrackerItem, held bool) *StageTrackerDec d.Blocker += " " + decisionHeldBlocker(it.Hold) } closeSup := decisionOption(decisionActionCloseSuperseded, "Close as superseded", true, "") - closeSup.Consequence = "closes " + ref + " unmerged, naming the PR that replaces it" + closeSup.Consequence = "Closes " + ref + ", naming the PR that replaces it" closeWontfix := decisionOption(decisionActionCloseWontfix, "Close as won't fix", true, "") - closeWontfix.Consequence = "closes " + ref + " unmerged" - d.Options = []StageTrackerDecisionOption{decisionDelegateOption(held, "the hive weighs waiting against closing and says so in plain words; it never rewrites the PR"), closeSup, closeWontfix, decisionHoldOption(held)} + closeWontfix.Consequence = "Closes " + ref + " without merging" + d.Options = []StageTrackerDecisionOption{decisionDelegateOption(held, "Hive weighs waiting against closing; never rewrites the PR"), closeSup, closeWontfix, decisionHoldOption(held)} return d } @@ -795,7 +861,7 @@ func decisionForTriage(it StageTrackerItem, held bool) *StageTrackerDecision { } d.Options = []StageTrackerDecisionOption{ decisionOption(decisionActionAcceptTriage, "Accept triage", true, ""), - decisionDelegateOption(held, "the hive triages it as the owner's delegate: accepts it, or says in plain words why not"), + decisionDelegateOption(held, "Hive triages it for you, or explains why not"), decisionHoldOption(held), } if !slices.Contains(it.Modifiers, modNeedsHuman) { @@ -820,15 +886,15 @@ func decisionForNeedsHuman(it StageTrackerItem, held bool) *StageTrackerDecision // operator, on an issue it records /hive approve and un-parks it. resolve := decisionOption(decisionActionApprove, "Resolve — lift needs-human", !held, "Release the hold first") if it.Kind == "pr" { - resolve.Consequence = "lifts needs-human and posts /lgtm + /approve as you; the merge gate takes it from there" + resolve.Consequence = "Lifts needs-human and approves as you; hive merges" } else { - resolve.Consequence = "lifts needs-human and records /hive approve as you; the hive carries on" + resolve.Consequence = "Lifts needs-human and approves as you; hive carries on" } d.Options = []StageTrackerDecisionOption{resolve} // A needs-human PR still waiting on its contributor's clanker offers // the takeover actions too (hivecommons/hive#15038). d.Options = append(d.Options, takeoverDecisionOptions(it.Takeover, held)...) - d.Options = append(d.Options, decisionDelegateOption(held, "the hive reviews it as the owner's delegate and either lifts needs-human or says in plain words why it kept it"), decisionHoldOption(held)) + d.Options = append(d.Options, decisionDelegateOption(held, "Hive reviews it and lifts needs-human, or explains why not"), decisionHoldOption(held)) return d } diff --git a/src/pkg/dashboard/stage_tracker_decision_popover_test.go b/src/pkg/dashboard/stage_tracker_decision_popover_test.go index ba5583fb68..5c55b3bc88 100644 --- a/src/pkg/dashboard/stage_tracker_decision_popover_test.go +++ b/src/pkg/dashboard/stage_tracker_decision_popover_test.go @@ -21,6 +21,7 @@ func stageTrackerDecisionPopPreamble(t *testing.T, html string) string { jsFunc(t, html, "agentNowAgo"), jsFunc(t, html, "stageTrackerDecisionTriggerHtml"), jsFunc(t, html, "stageTrackerDecisionOptions"), + jsFunc(t, html, "stageTrackerSayOnce"), jsFunc(t, html, "stageTrackerDecisionPopHtml"), jsFunc(t, html, "stageTrackerDecisionRun"), }, "\n") @@ -90,23 +91,38 @@ assert.ok(trig.indexOf(' title=') < 0, trig); assert.ok(trig.indexOf('data-ham-tip="Merge gate — tip"') >= 0, trig); assert.ok(trig.indexOf('Needs human decision') >= 0, trig); -// Popover: dialog role, question → blocker → actions → who/when → stage line, in that order. +// Popover (hivecommons/hive#15394): dialog role, question → one primary action +// + "More ⋯" → who/when → a collapsed Details holding the blocker and the stage line. const nowMs = Date.parse('2026-10-27T12:30:00Z'); const pop = stageTrackerDecisionPopHtml(pr, stageTrackerDecisionOptions(pr, ctx), nowMs, 'Merge gate — tip'); assert.ok(pop.indexOf('role="dialog"') >= 0 && pop.indexOf('aria-label="Decision needed on o/r#7"') >= 0, pop); assert.ok(pop.indexOf('o/r#7 · Raise retries') >= 0, pop); const at = s => { const i = pop.indexOf(s); assert.ok(i >= 0, 'missing ' + s + ' in ' + pop); return i; }; -const iQ = at('Should the retry budget go to 5?'), iB = at('needs a new commit'), iA = at('ham-decision-acts'), iM = at('Asked by a reviewer · 2 hours ago'), iS = at('Merge gate — tip'); -assert.ok(iQ < iB && iB < iA && iA < iM && iM < iS, [iQ, iB, iA, iM, iS].join(',')); -// Buttons: delegate first and marked lead; disabled approve greyed with its reason; one verb each. -const buttons = pop.match(/]*data-ham-act="[^"]+"[^>]*>[^<]*<\/button>/g); +const iQ = at('Should the retry budget go to 5?'), iA = at('ham-decision-acts'), iM = at('Asked by a reviewer · 2 hours ago'), iD = at('
Details'), iB = at('needs a new commit'), iS = at('Merge gate — tip'); +assert.ok(iQ < iA && iA < iM && iM < iD && iD < iB && iB < iS, [iQ, iA, iM, iD, iB, iS].join(',')); +// Buttons: exactly one action — the first the viewer may take, marked lead — plus "More ⋯" for the row menu. +const buttons = pop.match(/]*>[^<]*<\/button>/g); +assert.strictEqual(buttons.length, 2, buttons.join('\n')); assert.ok(/data-ham-act="decide:delegate"/.test(buttons[0]) && buttons[0].indexOf('ham-decision-lead') >= 0, buttons[0]); assert.ok(buttons[0].indexOf('>Let hive decide<') >= 0, buttons[0]); -assert.ok(/aria-disabled="true"/.test(buttons[1]) && /title="A reviewer requested changes/.test(buttons[1]), buttons[1]); -assert.ok(buttons.some(b => b.indexOf('ham-menu-danger') >= 0 && b.indexOf('Close as superseded') >= 0), buttons.join('\n')); -assert.ok(buttons.every(b => b.indexOf('…') < 0 && b.indexOf('/lgtm') < 0), buttons.join('\n')); -// Plain words only: no reason slugs, stage codes or verdict enums reach the operator. -for (const bad of ['contributor-lane', 'requires_human', ' 085', 'sentinel']) assert.ok(pop.indexOf(bad) < 0, bad + ' in ' + pop); +assert.ok(/data-ham-more="1"/.test(buttons[1]) && buttons[1].indexOf('ham-decision-more') >= 0 && buttons[1].indexOf('>More ⋯<') >= 0, buttons[1]); +assert.ok(pop.indexOf('ham-decision-consequences') < 0 && pop.indexOf('/lgtm') < 0, pop); +// Nothing the viewer may take: the lead option shows greyed with its reason. +const held = Object.assign({}, pr, { modifiers: ['needs-decision', 'hold'], decision_needed: Object.assign({}, decision, { options: decision.options.slice(0, 1) }) }); +const heldPop = stageTrackerDecisionPopHtml(held, stageTrackerDecisionOptions(held, ctx), nowMs, ''); +assert.ok(/aria-disabled="true"[^>]*title="A reviewer requested changes/.test(heldPop), heldPop); +assert.ok(heldPop.indexOf('data-ham-more') < 0, heldPop); +// Say it once: a sentence the question already said does not come back in Details. +const echo = Object.assign({}, pr, { decision_needed: Object.assign({}, decision, { question: 'Ready to merge. Hive won\'t merge it alone — @x isn\'t a trusted author yet.', blocker: '', detail: 'To trust @x: give them the trusted tier under 👥 Contributors.' }) }); +const echoPop = stageTrackerDecisionPopHtml(echo, stageTrackerDecisionOptions(echo, ctx), nowMs, 'Ready for human merge — Hive won\'t merge it alone — @x isn\'t a trusted author yet · Next move: human — a maintainer merges it'); +assert.strictEqual((echoPop.match(/isn't a trusted author yet|isn't a trusted author yet/g) || []).length, 1, echoPop); +assert.ok(echoPop.indexOf('To trust @x') >= 0 && echoPop.indexOf('a maintainer merges it') >= 0, echoPop); +// The visible first read (everything outside Details) is at most 40 words. +const visible = echoPop.replace(//, '').replace(/<[^>]+>/g, ' ').replace(/&[a-z#0-9]+;/g, "'").trim().split(/\s+/).filter(Boolean); +assert.ok(visible.length <= 40, visible.length + ' words: ' + visible.join(' ')); +// Plain words only: no reason slugs, stage codes, verdict enums, internal nouns or config keys reach the operator. +for (const bad of ['contributor-lane', 'requires_human', ' 085', 'sentinel', 'sweep', 'soak', 'audit marker', 'trust override']) assert.ok(pop.indexOf(bad) < 0 && echoPop.indexOf(bad) < 0, bad + ' in ' + pop); +assert.ok(!/\b[a-z_]+\.[a-z_]+\.[a-z_]+\b/.test(echoPop.replace(/https?:\/\/\S+/g, '')), echoPop); // Escaped: a question with markup is text, not HTML. const hostile = Object.assign({}, pr, { decision_needed: Object.assign({}, decision, { question: '' }) }); assert.ok(stageTrackerDecisionPopHtml(hostile, [], nowMs, '').indexOf(' 12 { + t.Errorf("%s consequence is %d words: %q", o.Action, n, o.Consequence) } } dir := decisionOptionByAction(t, d, decisionActionDirection) @@ -321,8 +333,8 @@ func TestStageTrackerDecisionForHumanMerge(t *testing.T) { agent := it agent.Author, agent.AuthorKind, agent.DCOUnsigned, agent.DCOTotal = "hive[bot]", "hive", 2, 3 d := stageTrackerDecisionNeeded(agent, nil, "") - if !strings.Contains(d.Blocker, "2 of 3 commits have no Signed-off-by") || !strings.Contains(d.Blocker, "Re-author as hive PR is the separate choice") { - t.Fatalf("blocker lacks the DCO warning: %q", d.Blocker) + if !strings.Contains(d.Detail, "2 of 3 commits have no Signed-off-by") || !strings.Contains(d.Detail, "Re-author as hive PR is the separate choice") { + t.Fatalf("details lack the DCO warning: %q", d.Detail) } if got := []string{d.Options[0].Action, d.Options[1].Action, d.Options[2].Action}; got[2] != decisionActionReauthor || got[0] != decisionActionMergeNow || got[1] != decisionActionQueueMerge { t.Fatalf("options = %v, want merge-now, queue-merge, re-author", got) @@ -351,8 +363,8 @@ func TestStageTrackerDecisionForHumanMerge(t *testing.T) { admitted := it admitted.AdmittedBy = stagelabels.OperatorApprovalAdmission("octo") d := stageTrackerDecisionNeeded(admitted, nil, "") - if !strings.Contains(d.Blocker, "Admitted by @octo (operator-approval:octo)") { - t.Fatalf("blocker = %q", d.Blocker) + if !strings.Contains(d.Detail, "Admitted by @octo (operator-approval:octo)") || !strings.HasPrefix(d.Question, "@octo approved it.") { + t.Fatalf("question = %q detail = %q", d.Question, d.Detail) } if o := decisionOptionByAction(t, d, decisionActionQueueMerge); o.Enabled || !strings.Contains(o.ReasonIfDisabled, "@octo already approved") { t.Fatalf("queue-merge after admission = %+v", o) @@ -451,3 +463,56 @@ func TestStageTrackerNeedsHumanStatesCarryAnAction(t *testing.T) { }) } } + +// TestStageTrackerHumanMergeSaysItOnce (hivecommons/hive#15394): the 090 +// hover is built from the question, the folded details, the gate word's +// tip and the next-move line. No sentence may appear twice across them, +// the next-move line must not echo the reason text, and none of the +// operator-visible strings may carry a config key or internal jargon. +func TestStageTrackerHumanMergeSaysItOnce(t *testing.T) { + since := time.Date(2026, 10, 28, 15, 0, 0, 0, time.UTC) + for _, reason := range []string{ + stageengineprstage.ContributorLaneReasonAuthorAssociation, "untrusted-author-role", "author-permission-missing", "fork-non-member", + stageengineprstage.ContributorLaneReasonClaimTier, stageengineprstage.ContributorLaneReasonClaimUnverified, stageengineprstage.ContributorLaneReasonNoClaim, + "contributor-lane:workflow-files", "contributor-lane:tests-removed", "repo-auto-merge-disabled", "something-brand-new", + } { + it := StageTrackerItem{Repo: "hivecommons/hive", Number: 15315, Kind: "pr", Author: "odttlnt", AuthorKind: authorKindHuman, BaseRef: "v5", + Stage: stagelabels.ReadyForHumanMerge.Number(), StageSince: &since, Reason: reason} + base, _ := stagelabels.HumanApprovedReason(reason) + if why := stageTrackerUntrustedAuthorWhy(base, it.Author); why != "" { + it.HumanMergeReasonText = "Hive won't merge it alone — " + why + } + it.HumanMergeReason, _, _ = stageTrackerHumanMergeReason(reason) + d := stageTrackerDecisionNeeded(it, nil, "") + actor := stageTrackerStageActor(it, nil, since) + if n := len(strings.Fields(d.Question)); n > 25 { + t.Errorf("%s: question is %d words: %q", reason, n, d.Question) + } + seen := map[string]string{} + for _, part := range []struct{ name, text string }{{"question", d.Question}, {"blocker", d.Blocker}, {"detail", d.Detail}, {"next-move", actor.Why}} { + for _, sent := range stageTrackerSentences(part.text) { + if prev, dup := seen[sent]; dup { + t.Errorf("%s: %q appears in both %s and %s", reason, sent, prev, part.name) + } + seen[sent] = part.name + } + } + if it.HumanMergeReasonText != "" && strings.Contains(actor.Why, it.HumanMergeReasonText) { + t.Errorf("%s: next-move echoes the reason text: %q", reason, actor.Why) + } + all := strings.Join([]string{d.Question, d.Blocker, d.Detail, actor.Why, it.HumanMergeReasonText}, " ") + if m := configKeyRE.FindString(all); m != "" { + t.Errorf("%s: config key %q in hover text: %q", reason, m, all) + } + for _, word := range []string{"sweep", "soak", "sentinel", "audit marker", "trust override", " lane", "requires_human", " 085", " 090"} { + if strings.Contains(strings.ToLower(all), word) { + t.Errorf("%s: jargon %q in hover text: %q", reason, word, all) + } + } + } + if got := stageTrackerSayOnce("Ready to merge. Hive won't merge it alone — @x isn't trusted.", "hive won't merge it alone — @x isn't trusted. To trust @x: do this.", "To trust @x: do this. Rails apply."); got != "To trust @x: do this. Rails apply." { + t.Errorf("stageTrackerSayOnce = %q", got) + } +} + +var configKeyRE = regexp.MustCompile(`\b[a-z_]+\.[a-z_]+\.[a-z_]+\b`) diff --git a/src/pkg/dashboard/stage_tracker_row_actions_test.go b/src/pkg/dashboard/stage_tracker_row_actions_test.go index 28f51b9357..7f99138b5c 100644 --- a/src/pkg/dashboard/stage_tracker_row_actions_test.go +++ b/src/pkg/dashboard/stage_tracker_row_actions_test.go @@ -1330,7 +1330,9 @@ const pop = stageTrackerDecisionOptions(dec.item, merger); assert.deepStrictEqual(ids(pop).slice(0, 3), ['decide:merge-now', 'decide:queue-merge', 'decide:delegate'], 'popover order: ' + ids(pop)); assert.ok(pop[0].enabled && pop[1].enabled && pop[2].enabled); const html = stageTrackerDecisionPopHtml(dec.item, pop, Date.now(), ''); -for (const id of ['decide:merge-now', 'decide:queue-merge', 'decide:delegate']) assert.ok(html.includes('data-ham-act="' + id + '"'), id + ' rendered in the popover'); +// The popover shows the one recommended action (merge now) and hands the rest to the row menu. +assert.ok(html.includes('data-ham-act="decide:merge-now"') && html.includes('>Merge it<') && html.includes('data-ham-more="1"'), html); +assert.ok(!html.includes('data-ham-act="decide:queue-merge"') && !html.includes('data-ham-act="decide:delegate"'), html); // A 085 popover still leads with Let hive decide. const pr85 = { repo: 'o/r', kind: 'pr', number: 4, url: 'u', stage: 85, modifiers: ['needs-decision'], @@ -1392,7 +1394,7 @@ assert.strictEqual(stageTrackerDCOCaveat([]), ''); assert.ok(dialogs[0].cfg.message.includes('lack a Signed-off-by'), dialogs[0].cfg.message); await stageTrackerActionPayload([pr317], 'decide:queue-merge'); assert.strictEqual(dialogs[1].cfg.title, 'Approve — let hive merge'); - assert.ok(dialogs[1].cfg.message.includes('trust override for this head'), dialogs[1].cfg.message); + assert.ok(dialogs[1].cfg.message.includes("stands in for the author's trust on this version"), dialogs[1].cfg.message); assert.ok(dialogs[1].cfg.message.includes('will not adopt or re-author it'), dialogs[1].cfg.message); assert.ok(dialogs[1].cfg.message.includes('lack a Signed-off-by'), dialogs[1].cfg.message); // Re-author has its own confirm, danger-styled, with the don't-ask box. diff --git a/src/pkg/dashboard/stage_tracker_takeover_ui_test.go b/src/pkg/dashboard/stage_tracker_takeover_ui_test.go index 2aac46f568..1022314f5d 100644 --- a/src/pkg/dashboard/stage_tracker_takeover_ui_test.go +++ b/src/pkg/dashboard/stage_tracker_takeover_ui_test.go @@ -243,7 +243,9 @@ func TestStageTrackerTakeoverConfirmsAndPopover(t *testing.T) { opts = stageTrackerDecisionOptions(askedIssue, ctx); assert.strictEqual(opts.find(o => o.id === 'decide:adopt-now').enabled, true, JSON.stringify(opts)); const pop = stageTrackerDecisionPopHtml(asked, stageTrackerDecisionOptions(asked, ctx), Date.now(), ''); - assert.ok(pop.indexOf('data-ham-act="decide:adopt-now"') >= 0 && pop.indexOf('data-ham-act="decide:reroute"') >= 0, pop); + // One primary action (Let hive decide) and "More ⋯" for adopt / reroute via the row menu. + assert.ok(pop.indexOf('data-ham-act="decide:delegate"') >= 0 && pop.indexOf('data-ham-more="1"') >= 0, pop); + assert.ok(pop.indexOf('data-ham-act="decide:adopt-now"') < 0 && pop.indexOf('data-ham-act="decide:reroute"') < 0, pop); console.log('takeover confirms ok'); })().catch(e => { console.error(e); process.exit(1); }); `) diff --git a/src/pkg/dashboard/stage_tracker_test.go b/src/pkg/dashboard/stage_tracker_test.go index ac0ecd8692..f2356002e4 100644 --- a/src/pkg/dashboard/stage_tracker_test.go +++ b/src/pkg/dashboard/stage_tracker_test.go @@ -170,21 +170,21 @@ func TestStageTrackerManualMergeApproved(t *testing.T) { }{ { name: "workflow path approved", stage: stagelabels.ReadyForHumanMerge, reason: "contributor-lane:workflow-path:human-approved@clubanderson", - wantCaption: "Awaiting human merge (workflow path) — approved by @clubanderson; the hive never merges this itself: click Merge (or /lgtm + /approve for tide)", + wantCaption: "Ready to merge (workflow path) — approved by @clubanderson — a person merges it", wantApprover: "clubanderson", wantManual: true, wantActor: "maintainer", }, { name: "tests removed, approver unknown", stage: stagelabels.ReadyForHumanMerge, reason: "contributor-lane:tests-removed", - wantCaption: "Awaiting human merge (tests removed); the hive never merges this itself: click Merge (or /lgtm + /approve for tide)", + wantCaption: "Ready to merge (tests removed) — a person merges it", wantManual: true, wantActor: "maintainer", }, { name: "trust-blocked 090 unchanged", stage: stagelabels.ReadyForHumanMerge, reason: "untrusted-author-role", - wantCaption: "Ready for a maintainer's /lgtm /approve; the hive cannot merge it itself — author's role is not trusted for unattended merge", wantActor: "maintainer", + wantCaption: "Ready to merge — a maintainer merges it — author's role is not trusted for unattended merge", wantActor: "maintainer", }, { name: "requires_human approved at 090", stage: stagelabels.ReadyForHumanMerge, reason: "reviewer-verdict:requires_human:human-approved@octocat", - wantCaption: "Ready for a maintainer's /lgtm /approve; the hive cannot merge it itself — review verdict requires human — approved by @octocat", + wantCaption: "Ready to merge — a maintainer merges it — review verdict requires human — approved by @octocat", wantApprover: "octocat", wantActor: "maintainer", }, { @@ -219,14 +219,14 @@ func TestStageTrackerManualMergeApproved(t *testing.T) { s.statusMu.Unlock() resp := s.buildStageTracker(s.status, store, now) it := trackerItem(t, resp, "pr", 120) - if it.Stage != 90 || it.HumanApprover != "clubanderson" || !it.ManualMerge || !strings.HasPrefix(it.Caption, "Awaiting human merge (workflow path) — approved by @clubanderson") { + if it.Stage != 90 || it.HumanApprover != "clubanderson" || !it.ManualMerge || !strings.HasPrefix(it.Caption, "Ready to merge (workflow path) — approved by @clubanderson") { t.Fatalf("row = stage %d approver %q manual %v caption %q", it.Stage, it.HumanApprover, it.ManualMerge, it.Caption) } raw, err := json.Marshal(it) if err != nil { t.Fatal(err) } - if !strings.Contains(string(raw), `"human_approver":"clubanderson","manual_merge":true,"human_merge_reason":"workflow-files","human_merge_reason_text":"Changes .github/workflows/**`) { + if !strings.Contains(string(raw), `"human_approver":"clubanderson","manual_merge":true,"human_merge_reason":"workflow-files","human_merge_reason_text":"It changes GitHub workflow files`) { t.Fatalf("payload lacks the manual-merge / human-merge-reason fields: %s", raw) } if clean := trackerItem(t, resp, "pr", 101); clean.HumanApprover != "" || clean.ManualMerge || clean.HumanMergeReason != "" || clean.HumanMergeReasonText != "" { @@ -244,14 +244,14 @@ 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`)"}, + {"contributor-lane:workflow-path:human-approved@clubanderson", "workflow-files", "workflow files", "It changes GitHub workflow files"}, + {"contributor-lane:tests-removed", "tests-removed", "tests removed", "It removes tests"}, + {"human-merge-path:human-approved@octocat", "manual-merge-policy", "manual-merge policy", "It touches files this repo reserves"}, + {"untrusted-author-role", "untrusted-author", "untrusted author", "Hive won't merge it alone"}, + {"contributor-lane:claim-tier-untrusted", "untrusted-author", "untrusted author", "Hive won't merge it alone"}, + {"repo-auto-merge-disabled", "auto-merge-off", "auto-merge off", "Auto-merge is off for this repo"}, + {"reviewer-verdict:requires_human:human-approved@octocat", "reviewer-deferred", "reviewer deferred", "A reviewer asked for a person to merge"}, + {"something-brand-new", "policy", "policy", "Hive's merge rules leave this one to a person (`something-brand-new`)"}, {"", "", "", ""}, } for _, tt := range tests { @@ -279,7 +279,7 @@ func TestStageTrackerHumanMergeReason(t *testing.T) { 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 { + if pr401.HumanMergeReason != "workflow-files" || !strings.HasPrefix(pr401.HumanMergeReasonText, "It changes GitHub workflow files") || 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) diff --git a/src/pkg/dashboard/stage_tracker_ui_test.go b/src/pkg/dashboard/stage_tracker_ui_test.go index 8111ceb41a..f08e6849f9 100644 --- a/src/pkg/dashboard/stage_tracker_ui_test.go +++ b/src/pkg/dashboard/stage_tracker_ui_test.go @@ -268,7 +268,7 @@ assert.deepStrictEqual(segStates(row), [D, D, 'active', T, T, T, 'todo cap'], 'a assert.ok(row.includes('aria-current="step"') && subs(row).length === 0); assert.ok(row.includes('Fix <login>'), 'title escaped'); assert.strictEqual(prCol(row).length, 0, 'issue without a PR has an empty PR column'); -assert.ok(tooltip(row).includes('(author/human'), 'author kind stays in the tooltip'); +assert.ok(tooltip(row).includes('(person'), 'author kind stays in the tooltip, in plain words'); assert.ok(row.includes('30m'), row); // The age and the chip belong to the strip they describe, not to a title line // that may wrap: the since text closes the strip row (an empty spacer keeps @@ -826,12 +826,12 @@ assert.ok(!/
  • ]*title="Claimed"/.test(st row = stageTrackerRowHtml(g[3], stages, ctx); expectTitles(row.split('
    ]*title="First PR · Back with the contributor[^"]*@bo \(author\/clanker\)[^"]*"/.test(subs(row)[1]), 'sub-row PR link: PR title, then the PR tooltip: ' + subs(row)[1]); +assert.ok(/]*title="First PR · Back with the contributor[^"]*@bo \(agent\)[^"]*"/.test(subs(row)[1]), 'sub-row PR link: PR title, then the PR tooltip: ' + subs(row)[1]); // Standalone PR: the PR link (its title, then the row tooltip) and the active // chevron; the placeholder issue slot carries none. row = stageTrackerRowHtml(g[6], stages, ctx); expectTitles(row, ['a.ham-pr-ref', 'li.ham-seg'], 'standalone PR'); -assert.ok(/]*title="Standalone PR · Not yet admitted to auto merge[^"]*@cy \(author\/human\)/.test(row), 'PR link: title, then the row tooltip: ' + row); +assert.ok(/]*title="Standalone PR · Not yet admitted to auto merge[^"]*@cy \(person\)/.test(row), 'PR link: title, then the row tooltip: ' + row); assert.ok(row.includes('aria-label="human · @cy"') && !row.includes(''), 'author icon label is aria-only: ' + row); // Since cells are untouched: plain text, no title. assert.ok(/<span class="ham-since( ham-stalled)?">[^<]*<\/span>/.test(row) && !/ham-since[^>]*title=/.test(golden), 'since cells unchanged'); diff --git a/src/pkg/dashboard/static-src/css/tracker.css b/src/pkg/dashboard/static-src/css/tracker.css index 5502a79944..0b40e80e0f 100644 --- a/src/pkg/dashboard/static-src/css/tracker.css +++ b/src/pkg/dashboard/static-src/css/tracker.css @@ -509,7 +509,7 @@ .ham-decision-q { font-weight: var(--fw-semibold); color: var(--text); } .ham-decision-blocker { font-size: var(--fs-xs); color: var(--text-muted); } .ham-capability-gap { color: var(--amber); } - .ham-decision-meta, .ham-decision-stage { font-size: var(--fs-xs); color: var(--text-faint); } + .ham-decision-meta { font-size: var(--fs-xs); color: var(--text-faint); } .ham-decision-acts { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin: var(--sp-3) 0 var(--sp-2); } .ham-decision-act { padding: var(--sp-1) var(--sp-3); border: var(--line-width) solid var(--line-subtle); border-radius: var(--r-pill); background: transparent; color: var(--text); font: inherit; font-size: var(--fs-xs); cursor: pointer; white-space: nowrap; } .ham-decision-act:hover, .ham-decision-act:focus-visible { background: var(--panel-strong); outline: none; border-color: var(--line-strong); } @@ -517,9 +517,12 @@ .ham-decision-act.ham-menu-danger { color: var(--red); } .ham-decision-act[aria-disabled="true"] { color: var(--text-faint); border-style: dashed; cursor: default; opacity: 0.6; } .ham-decision-act[aria-disabled="true"]:hover { background: transparent; border-color: var(--line-subtle); } - .ham-decision-consequences { margin: 0 0 var(--sp-1); padding-left: var(--sp-4); font-size: var(--fs-xs); color: var(--text-muted); } - .ham-decision-consequences li { margin: 0; overflow-wrap: anywhere; } - .ham-decision-consequences b { font-weight: var(--fw-semibold); color: var(--text); } + .ham-decision-act.ham-decision-more { color: var(--text-muted); } + /* The technical background folds behind one collapsed Details. */ + .ham-decision-details { margin: var(--sp-2) 0 0; font-size: var(--fs-xs); color: var(--text-muted); } + .ham-decision-details > summary { cursor: pointer; color: var(--text-faint); } + .ham-decision-details > summary:focus-visible { outline: var(--line-width) solid var(--accent); outline-offset: var(--sp-1); border-radius: var(--r-sm); } + .ham-decision-details[open] > summary { color: var(--text-muted); } .ham-selbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); margin: 0 0 var(--sp-2); padding: var(--sp-2) var(--sp-3); border: var(--line-width) solid color-mix(in srgb, var(--accent) 45%, var(--line-subtle)); border-radius: var(--r-sm); background: color-mix(in srgb, var(--accent) 8%, var(--panel)); font-size: var(--fs-xs); } .ham-selbar[hidden] { display: none; } .ham-selbar .ham-sel-count { font-weight: var(--fw-semibold); color: var(--text); margin-right: var(--sp-2); } diff --git a/src/pkg/dashboard/static-src/js/tracker-actions.js b/src/pkg/dashboard/static-src/js/tracker-actions.js index d5d1ad8e78..5fc39cc83f 100644 --- a/src/pkg/dashboard/static-src/js/tracker-actions.js +++ b/src/pkg/dashboard/static-src/js/tracker-actions.js @@ -29,7 +29,7 @@ const it = rows[0]; const total = Number(it.dco_total) || 0; const of = total > 0 ? ' of ' + total + ' commit' + (total === 1 ? '' : 's') : ' commit' + (Number(it.dco_unsigned) === 1 ? '' : 's'); - return ' Before you do: ' + Number(it.dco_unsigned) + of + ' on ' + (rows.length > 1 ? 'the first of these' : 'this head') + ' lack a Signed-off-by, so GitHub refuses the merge where DCO is required. "Re-author as hive PR" is the separate choice for that; approving never re-authors by itself.'; + return ' Before you do: ' + Number(it.dco_unsigned) + of + ' on ' + (rows.length > 1 ? 'the first of these' : 'this head') + ' lack a Signed-off-by (DCO). "Re-author as hive PR" is the separate choice for that; approving does not re-author.'; } const STAGE_TRACKER_ACTION_LABELS = { 'decide:delegate': 'Let hive decide', 'decide:delegate-all': 'Let hive decide — all PRs', 'decide:delegate:rerun': 'Re-run decision', 'decide:approve': 'Approve', 'decide:direction': 'Give direction', @@ -696,26 +696,49 @@ if (lead > 0 && STAGE_TRACKER_MERGE_ACTIONS.indexOf(out[0].id) < 0) out.unshift(out.splice(lead, 1)[0]); return out; } - // Pure: the popover markup. + // Pure: drop any sentence already said earlier in the text, so a hover + // never repeats itself (hivecommons/hive#15394). + function stageTrackerSayOnce(parts) { + const seen = new Set(); + const out = []; + for (const part of parts) { + const keep = []; + for (const raw of String(part || '').split(/(?<=[.?!])\s+|\s+—\s+(?=[A-Z@])|\s+·\s+/)) { + const key = raw.trim().replace(/[.?!]+$/, '').toLowerCase(); + if (!key || seen.has(key)) continue; + seen.add(key); + keep.push(raw.trim()); + } + if (keep.length) out.push(keep.join(' · ')); + } + return out; + } + // Pure: the popover markup — one sentence of state, one primary action, + // "More ⋯" for the rest, who asked and when, and everything technical + // behind one collapsed Details (hivecommons/hive#15394). function stageTrackerDecisionPopHtml(item, options, nowMs, tip) { const d = item.decision_needed || {}; const ref = stageTrackerRefOf(item); const sinceMs = Date.parse(d.since || item.stage_since || ''); const meta = ['Asked by ' + (d.asked_by || 'the hive'), sinceMs ? agentNowAgo(nowMs - sinceMs) : ''].filter(Boolean).join(' · '); - const buttons = options.map(o => `<button type="button" class="ham-decision-act${o.danger ? ' ham-menu-danger' : ''}${o.id === 'decide:delegate' || (o.id === options[0].id && STAGE_TRACKER_MERGE_ACTIONS.indexOf(o.id) >= 0) ? ' ham-decision-lead' : ''}" data-ham-act="${esc(o.id)}"${o.enabled ? (o.consequence ? ` title="${esc(o.consequence)}"` : '') : ` aria-disabled="true" title="${esc(o.why)}"`}>${esc(o.label)}</button>`).join(''); - // Each option's consequence in plain words, so the choice is made - // knowing what happens next (hivecommons/hive#15078). - const consequences = options.filter(o => o.consequence).map(o => `<li><b>${esc(o.label)}</b> — ${esc(o.consequence)}</li>`).join(''); - // Order (owner): WHAT it is waiting on → WHAT you can do → WHO asked, when. + // The one recommended action: the first the viewer may take, else the + // lead option greyed with its reason. Short verbs here; the ⋯ menu + // keeps the full labels. + const shortLabel = { 'decide:merge-now': 'Merge it', 'decide:queue-merge': 'Let hive merge it', 'decide:direction': 'Send back' }; + const primary = options.length ? (options.find(o => o.enabled) || options[0]) : null; + const lead = primary ? `<button type="button" class="ham-decision-act ham-decision-lead${primary.danger ? ' ham-menu-danger' : ''}" data-ham-act="${esc(primary.id)}"${primary.enabled ? (primary.consequence ? ` title="${esc(primary.consequence)}"` : '') : ` aria-disabled="true" title="${esc(primary.why)}"`}>${esc(shortLabel[primary.id] || primary.label)}</button>` : ''; + const more = options.length > 1 ? `<button type="button" class="ham-decision-act ham-decision-more" data-ham-more="1" title="All actions for this row">More ⋯</button>` : ''; + const question = d.question || ''; + const said = typeof stageTrackerSayOnce === 'function' ? stageTrackerSayOnce([question, d.blocker, d.detail, tip]) : [question, d.blocker, d.detail, tip].filter(Boolean); + const details = question ? said.slice(1) : said; + const fold = details.length ? `<details class="ham-decision-details"><summary>Details</summary>${details.map(x => `<p class="ham-decision-blocker">${esc(x)}</p>`).join('')}</details>` : ''; return `<div class="ham-decision-pop" role="dialog" aria-label="${esc('Decision needed on ' + ref)}" tabindex="-1"> <div class="ham-decision-head">${esc(ref)}${item.title ? ' · ' + esc(item.title) : ''}</div> - <p class="ham-decision-q">${esc(d.question || '')}</p> + <p class="ham-decision-q">${esc(question)}</p> ${typeof stageTrackerPresenceTip === 'function' && stageTrackerPresenceTip(item, nowMs) ? `<p class="ham-decision-presence">${stageTrackerPresenceDotHtml(item, nowMs)}${esc(stageTrackerPresenceTip(item, nowMs))}</p>` : ''} - ${d.blocker ? `<p class="ham-decision-blocker">${esc(d.blocker)}</p>` : ''} - ${buttons ? `<div class="ham-decision-acts">${buttons}</div>` : ''} - ${consequences ? `<ul class="ham-decision-consequences">${consequences}</ul>` : ''} + ${lead || more ? `<div class="ham-decision-acts">${lead}${more}</div>` : ''} <p class="ham-decision-meta">${esc(meta)}</p> - ${tip ? `<p class="ham-decision-stage">${esc(tip)}</p>` : ''} + ${fold} </div>`; } // Run a popover action down the row context menu's path. @@ -773,7 +796,7 @@ p.onKey = e => { if (e.key === 'Escape') { e.preventDefault(); e.stopPropagation(); stageTrackerCloseDecisionPop(true); return; } if (e.key === 'Tab' && el.contains(e.target)) { - const acts = Array.from(el.querySelectorAll('.ham-decision-act')); + const acts = Array.from(el.querySelectorAll('.ham-decision-act, .ham-decision-details > summary')); const last = acts[acts.length - 1], first = acts[0]; if ((!e.shiftKey && e.target === last) || (e.shiftKey && (e.target === first || e.target === el))) stageTrackerCloseDecisionPop(true); } @@ -782,6 +805,15 @@ el.addEventListener('pointerleave', () => stageTrackerDecisionPopLeave()); el.addEventListener('focusin', () => { p.pinned = true; clearTimeout(p.timer); }); el.addEventListener('click', e => { + const moreBtn = e.target.closest('[data-ham-more]'); + if (moreBtn) { + // "More ⋯" hands over to the row's own menu, anchored on the trigger. + e.preventDefault(); e.stopPropagation(); + const anchor = stageTrackerDecisionTrigger(key) || trigger; + stageTrackerCloseDecisionPop(false); + stageTrackerOpenMenu([p.item], { anchor, restore: anchor }); + return; + } const b = e.target.closest('[data-ham-act]'); if (!b || b.getAttribute('aria-disabled') === 'true') return; e.preventDefault(); e.stopPropagation(); @@ -1325,10 +1357,10 @@ if (items.some(stageTrackerNeedsRebase)) { return (await stageTrackerAsk(id, 'confirm', { title: STAGE_TRACKER_REBASE_MERGE_LABEL, message: preface + refs + ' is behind ' + base + ' (needs a rebase), so GitHub would refuse a plain merge. Record your approval as ' + who + ' and have the hive rebase it onto ' + base + ', wait for CI, then merge it with your approval on record? You get a toast when it lands or if the rebase conflicts.' + stageTrackerDCOCaveat(items), confirmLabel: 'Approve & rebase-merge', danger: true })) ? {} : null; } - return (await stageTrackerAsk(id, 'confirm', { title: 'Approve & merge as maintainer', message: preface + 'Merge ' + refs + ' into ' + base + ' now via hive\'s identity, attributed to ' + who + '? The merge gate parked it for a human because its author is not a trusted merger on this repo; this is you taking that call. The head you see is the head that merges — a push in between makes GitHub refuse.' + stageTrackerDCOCaveat(items), confirmLabel: 'Approve & merge', danger: true })) ? {} : null; + return (await stageTrackerAsk(id, 'confirm', { title: 'Approve & merge as maintainer', message: preface + 'Merge ' + refs + ' into ' + base + ' now, credited to ' + who + '? Hive left this merge to a person; this is you taking that call. The version you see is the one that merges.' + stageTrackerDCOCaveat(items), confirmLabel: 'Approve & merge', danger: true })) ? {} : null; } case 'decide:queue-merge': - return (await stageTrackerAsk(id, 'confirm', { title: 'Approve — let hive merge', message: preface + 'Record your approval on ' + refs + ' as the owner decision, as ' + who + '? This is the trust override for this head: hive\'s merge sweep merges it as-is on the next tick once CI is green, respecting soak, and will not adopt or re-author it. The dashboard merges nothing itself.' + stageTrackerDCOCaveat(items), confirmLabel: 'Approve' })) ? {} : null; + return (await stageTrackerAsk(id, 'confirm', { title: 'Approve — let hive merge', message: preface + 'Approve ' + refs + ' as ' + who + '? Your approval stands in for the author\'s trust on this version: hive merges it as-is on its next pass once CI is green, and will not adopt or re-author it.' + stageTrackerDCOCaveat(items), confirmLabel: 'Approve' })) ? {} : null; case 'decide:re-author': { const caveat = stageTrackerDCOCaveat(items); return (await stageTrackerAsk(id, 'confirm', { title: 'Re-author as hive PR', message: preface + 'Have the hive re-author ' + refs + ' as ' + who + '?' + (caveat || ' Its head cannot merge as-is.') + ' The hive re-homes the commits on a hive-owned, signed-off branch and opens a superseding PR; this one is closed when that merges. Nothing is merged as-is, and the author\'s commits stay attributed.', confirmLabel: 'Re-author', danger: true })) ? {} : null; diff --git a/src/pkg/dashboard/static-src/js/tracker-row.js b/src/pkg/dashboard/static-src/js/tracker-row.js index 13332357a7..94b2d48698 100644 --- a/src/pkg/dashboard/static-src/js/tracker-row.js +++ b/src/pkg/dashboard/static-src/js/tracker-row.js @@ -283,7 +283,8 @@ 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 : ''); + // The reason is the whole story; the stage description would only repeat it (hivecommons/hive#15394). + 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(); if (actorTip && !sg.cap) tip += actorTip; // The sentinel's reason leads the lane tooltip so the security // implication is read before the stage mechanics. @@ -402,6 +403,8 @@ // Row tooltip: headline, reason, repo, author, flags, since, recent hops. function stageTrackerTooltip(item, nowMs) { const ak = item.author_kind || ''; + // Plain words for author_kind in hover text (hivecommons/hive#15394). + const akPlain = { human: 'person', clanker: 'agent', hive: 'hive', bot: 'bot' }; const mods = Array.isArray(item.modifiers) ? item.modifiers : []; const sinceMs = Date.parse(item.stage_since || ''); const trail = stageTrackerTrailText(item); @@ -409,7 +412,7 @@ const lines = openHeld ? [stageTrackerHeadline(item) + (item.caption || item.reason ? ' · ' + (item.caption || item.reason) : '') + (item.repo ? ' · ' + item.repo : '')] : [stageTrackerHeadline(item), item.caption || item.reason || '', item.repo || '']; - if (item.author || ak) lines.push('Author: ' + (item.author ? '@' + item.author : '') + (ak ? ' (author/' + ak + (item.author_kind_source === 'inferred' ? ', inferred' : '') + ')' : '') + (item.tier ? ' · ' + item.tier : '')); + if (item.author || ak) lines.push('Author: ' + (item.author ? '@' + item.author : '') + (ak ? ' (' + (akPlain[ak] || ak) + (item.author_kind_source === 'inferred' ? ', inferred' : '') + ')' : '') + (item.tier ? ' · ' + item.tier : '')); if (item.origin) lines.push('Origin: origin/' + item.origin); if (item.kind === 'issue' && Array.isArray(item.linked_prs) && item.linked_prs.length) lines.push('Covering PR: ' + item.linked_prs.map(lp => Number(lp.number) || 0).sort((x, y) => x - y).map(n => '#' + n).join(', ')); else if (item.kind === 'issue' && item.linked_pr) lines.push('Covering PR: #' + item.linked_pr); @@ -438,7 +441,8 @@ if (mods.indexOf('hold') >= 0 && typeof stageTrackerHoldPill === 'function' && stageTrackerHoldPill(item)) lines.push(stageTrackerHoldPill(item)); if (sinceMs) lines.push('Since ' + agentNowClockTime(sinceMs, nowMs) + ' · ' + agentNowAgo(nowMs - sinceMs)); if (trail) lines.push('Trail: ' + trail); - return lines.filter(Boolean).join('\n'); + // Say it once: a line the caption already said is not repeated (hivecommons/hive#15394). + return lines.filter((l, i) => l && lines.indexOf(l) === i).join('\n'); } // The sentinel chip: drawn in the chip area (beside needs rebase / diff --git a/src/pkg/dashboard/static/index.html b/src/pkg/dashboard/static/index.html index 9037adea45..71c6219b02 100644 --- a/src/pkg/dashboard/static/index.html +++ b/src/pkg/dashboard/static/index.html @@ -1832,7 +1832,7 @@ .ham-decision-q { font-weight: var(--fw-semibold); color: var(--text); } .ham-decision-blocker { font-size: var(--fs-xs); color: var(--text-muted); } .ham-capability-gap { color: var(--amber); } - .ham-decision-meta, .ham-decision-stage { font-size: var(--fs-xs); color: var(--text-faint); } + .ham-decision-meta { font-size: var(--fs-xs); color: var(--text-faint); } .ham-decision-acts { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin: var(--sp-3) 0 var(--sp-2); } .ham-decision-act { padding: var(--sp-1) var(--sp-3); border: var(--line-width) solid var(--line-subtle); border-radius: var(--r-pill); background: transparent; color: var(--text); font: inherit; font-size: var(--fs-xs); cursor: pointer; white-space: nowrap; } .ham-decision-act:hover, .ham-decision-act:focus-visible { background: var(--panel-strong); outline: none; border-color: var(--line-strong); } @@ -1840,9 +1840,12 @@ .ham-decision-act.ham-menu-danger { color: var(--red); } .ham-decision-act[aria-disabled="true"] { color: var(--text-faint); border-style: dashed; cursor: default; opacity: 0.6; } .ham-decision-act[aria-disabled="true"]:hover { background: transparent; border-color: var(--line-subtle); } - .ham-decision-consequences { margin: 0 0 var(--sp-1); padding-left: var(--sp-4); font-size: var(--fs-xs); color: var(--text-muted); } - .ham-decision-consequences li { margin: 0; overflow-wrap: anywhere; } - .ham-decision-consequences b { font-weight: var(--fw-semibold); color: var(--text); } + .ham-decision-act.ham-decision-more { color: var(--text-muted); } + /* The technical background folds behind one collapsed Details. */ + .ham-decision-details { margin: var(--sp-2) 0 0; font-size: var(--fs-xs); color: var(--text-muted); } + .ham-decision-details > summary { cursor: pointer; color: var(--text-faint); } + .ham-decision-details > summary:focus-visible { outline: var(--line-width) solid var(--accent); outline-offset: var(--sp-1); border-radius: var(--r-sm); } + .ham-decision-details[open] > summary { color: var(--text-muted); } .ham-selbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); margin: 0 0 var(--sp-2); padding: var(--sp-2) var(--sp-3); border: var(--line-width) solid color-mix(in srgb, var(--accent) 45%, var(--line-subtle)); border-radius: var(--r-sm); background: color-mix(in srgb, var(--accent) 8%, var(--panel)); font-size: var(--fs-xs); } .ham-selbar[hidden] { display: none; } .ham-selbar .ham-sel-count { font-weight: var(--fw-semibold); color: var(--text); margin-right: var(--sp-2); } @@ -15479,7 +15482,8 @@ <h3 class="faq-group-title">Where to get help</h3> 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 : ''); + // The reason is the whole story; the stage description would only repeat it (hivecommons/hive#15394). + 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(); if (actorTip && !sg.cap) tip += actorTip; // The sentinel's reason leads the lane tooltip so the security // implication is read before the stage mechanics. @@ -15598,6 +15602,8 @@ <h3 class="faq-group-title">Where to get help</h3> // Row tooltip: headline, reason, repo, author, flags, since, recent hops. function stageTrackerTooltip(item, nowMs) { const ak = item.author_kind || ''; + // Plain words for author_kind in hover text (hivecommons/hive#15394). + const akPlain = { human: 'person', clanker: 'agent', hive: 'hive', bot: 'bot' }; const mods = Array.isArray(item.modifiers) ? item.modifiers : []; const sinceMs = Date.parse(item.stage_since || ''); const trail = stageTrackerTrailText(item); @@ -15605,7 +15611,7 @@ <h3 class="faq-group-title">Where to get help</h3> const lines = openHeld ? [stageTrackerHeadline(item) + (item.caption || item.reason ? ' · ' + (item.caption || item.reason) : '') + (item.repo ? ' · ' + item.repo : '')] : [stageTrackerHeadline(item), item.caption || item.reason || '', item.repo || '']; - if (item.author || ak) lines.push('Author: ' + (item.author ? '@' + item.author : '') + (ak ? ' (author/' + ak + (item.author_kind_source === 'inferred' ? ', inferred' : '') + ')' : '') + (item.tier ? ' · ' + item.tier : '')); + if (item.author || ak) lines.push('Author: ' + (item.author ? '@' + item.author : '') + (ak ? ' (' + (akPlain[ak] || ak) + (item.author_kind_source === 'inferred' ? ', inferred' : '') + ')' : '') + (item.tier ? ' · ' + item.tier : '')); if (item.origin) lines.push('Origin: origin/' + item.origin); if (item.kind === 'issue' && Array.isArray(item.linked_prs) && item.linked_prs.length) lines.push('Covering PR: ' + item.linked_prs.map(lp => Number(lp.number) || 0).sort((x, y) => x - y).map(n => '#' + n).join(', ')); else if (item.kind === 'issue' && item.linked_pr) lines.push('Covering PR: #' + item.linked_pr); @@ -15634,7 +15640,8 @@ <h3 class="faq-group-title">Where to get help</h3> if (mods.indexOf('hold') >= 0 && typeof stageTrackerHoldPill === 'function' && stageTrackerHoldPill(item)) lines.push(stageTrackerHoldPill(item)); if (sinceMs) lines.push('Since ' + agentNowClockTime(sinceMs, nowMs) + ' · ' + agentNowAgo(nowMs - sinceMs)); if (trail) lines.push('Trail: ' + trail); - return lines.filter(Boolean).join('\n'); + // Say it once: a line the caption already said is not repeated (hivecommons/hive#15394). + return lines.filter((l, i) => l && lines.indexOf(l) === i).join('\n'); } // The sentinel chip: drawn in the chip area (beside needs rebase / @@ -17830,7 +17837,7 @@ <h2 class="config-title" id="activity-monitor-labels-title">All labels</h2> const it = rows[0]; const total = Number(it.dco_total) || 0; const of = total > 0 ? ' of ' + total + ' commit' + (total === 1 ? '' : 's') : ' commit' + (Number(it.dco_unsigned) === 1 ? '' : 's'); - return ' Before you do: ' + Number(it.dco_unsigned) + of + ' on ' + (rows.length > 1 ? 'the first of these' : 'this head') + ' lack a Signed-off-by, so GitHub refuses the merge where DCO is required. "Re-author as hive PR" is the separate choice for that; approving never re-authors by itself.'; + return ' Before you do: ' + Number(it.dco_unsigned) + of + ' on ' + (rows.length > 1 ? 'the first of these' : 'this head') + ' lack a Signed-off-by (DCO). "Re-author as hive PR" is the separate choice for that; approving does not re-author.'; } const STAGE_TRACKER_ACTION_LABELS = { 'decide:delegate': 'Let hive decide', 'decide:delegate-all': 'Let hive decide — all PRs', 'decide:delegate:rerun': 'Re-run decision', 'decide:approve': 'Approve', 'decide:direction': 'Give direction', @@ -18497,26 +18504,49 @@ <h2 class="config-title" id="activity-monitor-labels-title">All labels</h2> if (lead > 0 && STAGE_TRACKER_MERGE_ACTIONS.indexOf(out[0].id) < 0) out.unshift(out.splice(lead, 1)[0]); return out; } - // Pure: the popover markup. + // Pure: drop any sentence already said earlier in the text, so a hover + // never repeats itself (hivecommons/hive#15394). + function stageTrackerSayOnce(parts) { + const seen = new Set(); + const out = []; + for (const part of parts) { + const keep = []; + for (const raw of String(part || '').split(/(?<=[.?!])\s+|\s+—\s+(?=[A-Z@])|\s+·\s+/)) { + const key = raw.trim().replace(/[.?!]+$/, '').toLowerCase(); + if (!key || seen.has(key)) continue; + seen.add(key); + keep.push(raw.trim()); + } + if (keep.length) out.push(keep.join(' · ')); + } + return out; + } + // Pure: the popover markup — one sentence of state, one primary action, + // "More ⋯" for the rest, who asked and when, and everything technical + // behind one collapsed Details (hivecommons/hive#15394). function stageTrackerDecisionPopHtml(item, options, nowMs, tip) { const d = item.decision_needed || {}; const ref = stageTrackerRefOf(item); const sinceMs = Date.parse(d.since || item.stage_since || ''); const meta = ['Asked by ' + (d.asked_by || 'the hive'), sinceMs ? agentNowAgo(nowMs - sinceMs) : ''].filter(Boolean).join(' · '); - const buttons = options.map(o => `<button type="button" class="ham-decision-act${o.danger ? ' ham-menu-danger' : ''}${o.id === 'decide:delegate' || (o.id === options[0].id && STAGE_TRACKER_MERGE_ACTIONS.indexOf(o.id) >= 0) ? ' ham-decision-lead' : ''}" data-ham-act="${esc(o.id)}"${o.enabled ? (o.consequence ? ` title="${esc(o.consequence)}"` : '') : ` aria-disabled="true" title="${esc(o.why)}"`}>${esc(o.label)}</button>`).join(''); - // Each option's consequence in plain words, so the choice is made - // knowing what happens next (hivecommons/hive#15078). - const consequences = options.filter(o => o.consequence).map(o => `<li><b>${esc(o.label)}</b> — ${esc(o.consequence)}</li>`).join(''); - // Order (owner): WHAT it is waiting on → WHAT you can do → WHO asked, when. + // The one recommended action: the first the viewer may take, else the + // lead option greyed with its reason. Short verbs here; the ⋯ menu + // keeps the full labels. + const shortLabel = { 'decide:merge-now': 'Merge it', 'decide:queue-merge': 'Let hive merge it', 'decide:direction': 'Send back' }; + const primary = options.length ? (options.find(o => o.enabled) || options[0]) : null; + const lead = primary ? `<button type="button" class="ham-decision-act ham-decision-lead${primary.danger ? ' ham-menu-danger' : ''}" data-ham-act="${esc(primary.id)}"${primary.enabled ? (primary.consequence ? ` title="${esc(primary.consequence)}"` : '') : ` aria-disabled="true" title="${esc(primary.why)}"`}>${esc(shortLabel[primary.id] || primary.label)}</button>` : ''; + const more = options.length > 1 ? `<button type="button" class="ham-decision-act ham-decision-more" data-ham-more="1" title="All actions for this row">More ⋯</button>` : ''; + const question = d.question || ''; + const said = typeof stageTrackerSayOnce === 'function' ? stageTrackerSayOnce([question, d.blocker, d.detail, tip]) : [question, d.blocker, d.detail, tip].filter(Boolean); + const details = question ? said.slice(1) : said; + const fold = details.length ? `<details class="ham-decision-details"><summary>Details</summary>${details.map(x => `<p class="ham-decision-blocker">${esc(x)}</p>`).join('')}</details>` : ''; return `<div class="ham-decision-pop" role="dialog" aria-label="${esc('Decision needed on ' + ref)}" tabindex="-1"> <div class="ham-decision-head">${esc(ref)}${item.title ? ' · ' + esc(item.title) : ''}</div> - <p class="ham-decision-q">${esc(d.question || '')}</p> + <p class="ham-decision-q">${esc(question)}</p> ${typeof stageTrackerPresenceTip === 'function' && stageTrackerPresenceTip(item, nowMs) ? `<p class="ham-decision-presence">${stageTrackerPresenceDotHtml(item, nowMs)}${esc(stageTrackerPresenceTip(item, nowMs))}</p>` : ''} - ${d.blocker ? `<p class="ham-decision-blocker">${esc(d.blocker)}</p>` : ''} - ${buttons ? `<div class="ham-decision-acts">${buttons}</div>` : ''} - ${consequences ? `<ul class="ham-decision-consequences">${consequences}</ul>` : ''} + ${lead || more ? `<div class="ham-decision-acts">${lead}${more}</div>` : ''} <p class="ham-decision-meta">${esc(meta)}</p> - ${tip ? `<p class="ham-decision-stage">${esc(tip)}</p>` : ''} + ${fold} </div>`; } // Run a popover action down the row context menu's path. @@ -18574,7 +18604,7 @@ <h2 class="config-title" id="activity-monitor-labels-title">All labels</h2> p.onKey = e => { if (e.key === 'Escape') { e.preventDefault(); e.stopPropagation(); stageTrackerCloseDecisionPop(true); return; } if (e.key === 'Tab' && el.contains(e.target)) { - const acts = Array.from(el.querySelectorAll('.ham-decision-act')); + const acts = Array.from(el.querySelectorAll('.ham-decision-act, .ham-decision-details > summary')); const last = acts[acts.length - 1], first = acts[0]; if ((!e.shiftKey && e.target === last) || (e.shiftKey && (e.target === first || e.target === el))) stageTrackerCloseDecisionPop(true); } @@ -18583,6 +18613,15 @@ <h2 class="config-title" id="activity-monitor-labels-title">All labels</h2> el.addEventListener('pointerleave', () => stageTrackerDecisionPopLeave()); el.addEventListener('focusin', () => { p.pinned = true; clearTimeout(p.timer); }); el.addEventListener('click', e => { + const moreBtn = e.target.closest('[data-ham-more]'); + if (moreBtn) { + // "More ⋯" hands over to the row's own menu, anchored on the trigger. + e.preventDefault(); e.stopPropagation(); + const anchor = stageTrackerDecisionTrigger(key) || trigger; + stageTrackerCloseDecisionPop(false); + stageTrackerOpenMenu([p.item], { anchor, restore: anchor }); + return; + } const b = e.target.closest('[data-ham-act]'); if (!b || b.getAttribute('aria-disabled') === 'true') return; e.preventDefault(); e.stopPropagation(); @@ -19126,10 +19165,10 @@ <h2 class="config-title" id="activity-monitor-labels-title">All labels</h2> if (items.some(stageTrackerNeedsRebase)) { return (await stageTrackerAsk(id, 'confirm', { title: STAGE_TRACKER_REBASE_MERGE_LABEL, message: preface + refs + ' is behind ' + base + ' (needs a rebase), so GitHub would refuse a plain merge. Record your approval as ' + who + ' and have the hive rebase it onto ' + base + ', wait for CI, then merge it with your approval on record? You get a toast when it lands or if the rebase conflicts.' + stageTrackerDCOCaveat(items), confirmLabel: 'Approve & rebase-merge', danger: true })) ? {} : null; } - return (await stageTrackerAsk(id, 'confirm', { title: 'Approve & merge as maintainer', message: preface + 'Merge ' + refs + ' into ' + base + ' now via hive\'s identity, attributed to ' + who + '? The merge gate parked it for a human because its author is not a trusted merger on this repo; this is you taking that call. The head you see is the head that merges — a push in between makes GitHub refuse.' + stageTrackerDCOCaveat(items), confirmLabel: 'Approve & merge', danger: true })) ? {} : null; + return (await stageTrackerAsk(id, 'confirm', { title: 'Approve & merge as maintainer', message: preface + 'Merge ' + refs + ' into ' + base + ' now, credited to ' + who + '? Hive left this merge to a person; this is you taking that call. The version you see is the one that merges.' + stageTrackerDCOCaveat(items), confirmLabel: 'Approve & merge', danger: true })) ? {} : null; } case 'decide:queue-merge': - return (await stageTrackerAsk(id, 'confirm', { title: 'Approve — let hive merge', message: preface + 'Record your approval on ' + refs + ' as the owner decision, as ' + who + '? This is the trust override for this head: hive\'s merge sweep merges it as-is on the next tick once CI is green, respecting soak, and will not adopt or re-author it. The dashboard merges nothing itself.' + stageTrackerDCOCaveat(items), confirmLabel: 'Approve' })) ? {} : null; + return (await stageTrackerAsk(id, 'confirm', { title: 'Approve — let hive merge', message: preface + 'Approve ' + refs + ' as ' + who + '? Your approval stands in for the author\'s trust on this version: hive merges it as-is on its next pass once CI is green, and will not adopt or re-author it.' + stageTrackerDCOCaveat(items), confirmLabel: 'Approve' })) ? {} : null; case 'decide:re-author': { const caveat = stageTrackerDCOCaveat(items); return (await stageTrackerAsk(id, 'confirm', { title: 'Re-author as hive PR', message: preface + 'Have the hive re-author ' + refs + ' as ' + who + '?' + (caveat || ' Its head cannot merge as-is.') + ' The hive re-homes the commits on a hive-owned, signed-off branch and opens a superseding PR; this one is closed when that merges. Nothing is merged as-is, and the author\'s commits stay attributed.', confirmLabel: 'Re-author', danger: true })) ? {} : null;