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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/changed-hive-permission-pill-wording.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Activity Monitor: the muted pill a PR wears while the hive's GitHub App is missing a permission now reads "hive bot lacks permission" instead of "unauthorized", and its tooltip, the row hover line, the Needs-attention chip title, the needs-human tip, the human-merge gate word and the decision popover say the same — nobody did anything illegitimate, the App installation lacks one permission (hivecommons/hive#16639). The `hive:unauthorized` label, comment marker and API fields are unchanged.
18 changes: 11 additions & 7 deletions src/pkg/dashboard/stage_tracker_caption.go
Original file line number Diff line number Diff line change
Expand Up @@ -457,12 +457,16 @@ func unauthorizedStepWords(step string) string {
return strings.ReplaceAll(strings.TrimSpace(step), "-", " ")
}

// Tooltip for the unauthorized pill, per step; the generic form serves a
// label whose stage reason does not (or no longer) names the step.
// Tooltip for the hive-bot-lacks-permission pill, per step; the generic
// form serves a label whose stage reason does not (or no longer) names the
// step. Operator wording says "hive bot lacks permission", never
// "unauthorized" (hivecommons/hive#16639): nobody did anything illegitimate,
// the App installation is missing one permission. The label name
// hive:unauthorized is a contract and stays.
const (
stageTrackerUnauthorizedApproveRuns = "The hive's GitHub App lacks `actions: write`, so it cannot approve the workflow runs GitHub is holding for this head. A maintainer must click Approve and run on the PR's checks banner (or the Actions tab); see the hive:unauthorized comment for the run ids. Hive resumes, and clears the label, once the required checks report."
stageTrackerUnauthorizedGeneric = "The hive's GitHub App lacks a permission for the next step, so only a person can take it; the hive:unauthorized comment on the PR names the permission and the step. Hive resumes, and clears the label, once the step is done."
stageTrackerUnauthorizedMergeWF = "The hive's GitHub App lacks `workflows: write`, so it cannot merge this owner-approved PR that edits .github/workflows files. A maintainer must click Merge on GitHub (the approval already stands), or grant the App Workflows: Read and write so the hive can merge such PRs itself."
stageTrackerUnauthorizedApproveRuns = "The hive bot's GitHub App is missing the 'actions: write' permission needed to approve the workflow runs GitHub is holding for this head, so a person has to take that step: click Approve and run on the PR's checks banner (or the Actions tab); the `hive:unauthorized` comment on the PR lists the run ids. Hive resumes and clears the label once the required checks report."
stageTrackerUnauthorizedGeneric = "The hive bot's GitHub App is missing a permission needed for the next step, so a person has to take that step. The `hive:unauthorized` comment on the PR names the permission and the action; hive resumes and clears the label once it's done."
stageTrackerUnauthorizedMergeWF = "The hive bot's GitHub App is missing the 'workflows: write' permission needed to merge this owner-approved PR that edits .github/workflows files, so a person has to take that step: click Merge on GitHub (the approval already stands), or grant the App Workflows: Read and write so the hive can merge such PRs itself."
)

// stageTrackerUnauthorized derives the gate word and the tooltip for an
Expand All @@ -480,7 +484,7 @@ func stageTrackerUnauthorized(reason string) (step, tip string) {
if rest == stageengineprstage.UnauthorizedStepMergeWorkflowPath {
return step, stageTrackerUnauthorizedMergeWF
}
return step, "The hive's GitHub App lacks the permission to " + step + ", so only a person can take that step; the hive:unauthorized comment on the PR names the permission and the action. Hive resumes, and clears the label, once the step is done."
return step, "The hive bot's GitHub App is missing the permission needed to " + step + ", so a person has to take that step. The `hive:unauthorized` comment on the PR names the permission and the action; hive resumes and clears the label once it's done."
}

// stageTrackerManualMergeReason reports whether a bare stage reason is a
Expand All @@ -506,7 +510,7 @@ var stageTrackerHumanMergeReasonWords = map[string][2]string{
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.HumanMergeReasonUnauthorized: {"hive bot lacks permission", "The hive bot's GitHub App is missing the permission to merge here; a person merges"},
stageengineprstage.HumanMergeReasonReviewerDeferred: {"reviewer deferred", "A reviewer asked for a person to merge this one"},
stageengineprstage.HumanMergeReasonBreakingChange: {"human merge", "Breaking change — owner merges; hive never merges a ⚠️-titled or needs-owner-merge PR"},
}
Expand Down
4 changes: 2 additions & 2 deletions src/pkg/dashboard/stage_tracker_decision_lanes.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ func decisionForUnauthorized(it StageTrackerItem, held bool) *StageTrackerDecisi
step := strings.TrimSpace(it.UnauthorizedStep)
if step == "" {
_, tip := stageTrackerUnauthorized(it.Reason)
d.Question = "The hive's GitHub App lacks a permission for the next step. " + tip
d.Question = "The hive bot lacks a permission for the next step. " + tip
} else {
d.Question = "The hive's GitHub App may not " + unauthorizedStepWords(step) + " here. Do that step on GitHub, then re-evaluate so the hive picks it up."
d.Question = "The hive bot's GitHub App is missing the permission to " + unauthorizedStepWords(step) + " here. Do that step on GitHub, then re-evaluate so the hive picks it up."
}
d.Blocker = strings.TrimSpace(it.Unauthorized)
if d.Blocker == "" {
Expand Down
2 changes: 1 addition & 1 deletion src/pkg/dashboard/stage_tracker_decision_pr.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func decisionForPR(it StageTrackerItem, verdict *review.Aggregate, sentinelLabel
switch {
case it.UnauthorizedStep != "":
d.AskedBy = decisionAskedByApp
d.Question = "The hive's GitHub App may not " + unauthorizedStepWords(it.UnauthorizedStep) + " here. A maintainer has to do that step on GitHub."
d.Question = "The hive bot's GitHub App is missing the permission to " + unauthorizedStepWords(it.UnauthorizedStep) + " here. A maintainer has to do that step on GitHub."
d.Blocker = strings.TrimSpace(it.Unauthorized)
delegateOK, delegateWhy = false, decisionWhyNoPermission
approveOK, approveWhy = false, decisionWhyApproveNoGrant
Expand Down
4 changes: 2 additions & 2 deletions src/pkg/dashboard/stage_tracker_pills_gate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ func TestStageTrackerDeferredPillsPayload(t *testing.T) {
if !strings.Contains(string(raw), `"modifiers":[],"deferred_modifiers":["sentinel","needs-human"]`) || !strings.Contains(string(raw), `"sentinel_alert":true`) {
t.Fatalf("payload: %s", raw)
}
if held := trackerItem(t, resp, "pr", 141); held.Stage != 72 || !hasMod(held, modUnauthorized) || len(held.DeferredModifiers) != 0 || held.UnauthorizedStep != "approve workflow runs" || !strings.Contains(held.Unauthorized, "`actions: write`") {
if held := trackerItem(t, resp, "pr", 141); held.Stage != 72 || !hasMod(held, modUnauthorized) || len(held.DeferredModifiers) != 0 || held.UnauthorizedStep != "approve workflow runs" || !strings.Contains(held.Unauthorized, "'actions: write'") {
t.Fatalf("PR 141 = stage %d mods %v deferred %v step %q", held.Stage, held.Modifiers, held.DeferredModifiers, held.UnauthorizedStep)
}
if refused := trackerItem(t, resp, "pr", 142); refused.Stage != 50 || hasMod(refused, modUnauthorized) || !slices.Equal(refused.DeferredModifiers, []string{modUnauthorized}) || refused.UnauthorizedStep != "merge" {
Expand Down Expand Up @@ -225,7 +225,7 @@ const gate80 = { kind: 'pr', stage: 80, modifiers: [], sentinel_alert: true, hea
assert.ok(stageTrackerChipsHtml(gate80).includes('ham-badge-sentinel'), 'sentinel chip at 080');
// Actionable-now pills show wherever the row stands.
assert.ok(stageTrackerChipsHtml({ kind: 'pr', stage: 50, modifiers: ['hold'], deferred_modifiers: ['needs-human'] }).includes('>hold<'));
assert.ok(stageTrackerChipsHtml({ kind: 'pr', stage: 72, modifiers: ['unauthorized'], unauthorized: 'needs actions: write' }).includes('>unauthorized<'));
assert.ok(stageTrackerChipsHtml({ kind: 'pr', stage: 72, modifiers: ['unauthorized'], unauthorized: 'needs actions: write' }).includes('>hive bot lacks permission<'));
assert.ok(stageTrackerNeedsAttention({ kind: 'pr', stage: 50, modifiers: ['hold'], deferred_modifiers: ['needs-human'] }));
// A payload without the field (older server) renders exactly as before.
assert.ok(stageTrackerChipsHtml({ kind: 'pr', stage: 50, modifiers: ['needs-human'], sentinel_alert: true }).includes('ham-badge-sentinel'));
Expand Down
18 changes: 9 additions & 9 deletions src/pkg/dashboard/stage_tracker_unauthorized_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ func TestStageTrackerUnauthorizedFromReason(t *testing.T) {
for _, tc := range []struct {
name, reason, wantStep, wantTip string
}{
{name: "approve workflow runs", reason: approve, wantStep: "approve workflow runs", wantTip: "`actions: write`"},
{name: "approve workflow runs", reason: approve, wantStep: "approve workflow runs", wantTip: "'actions: write'"},
{name: "human-approved suffix is stripped", reason: approve + ":human-approved@pat", wantStep: "approve workflow runs", wantTip: "Approve and run"},
{name: "another step", reason: prstage.StageReasonUnauthorizedPrefix + "update-branch", wantStep: "update branch", wantTip: "permission to update branch"},
{name: "label without a reason", reason: "contributor-lane:soaking(1h)", wantTip: "lacks a permission for the next step"},
{name: "empty", reason: "", wantTip: "lacks a permission for the next step"},
{name: "another step", reason: prstage.StageReasonUnauthorizedPrefix + "update-branch", wantStep: "update branch", wantTip: "permission needed to update branch"},
{name: "label without a reason", reason: "contributor-lane:soaking(1h)", wantTip: "missing a permission needed for the next step"},
{name: "empty", reason: "", wantTip: "missing a permission needed for the next step"},
} {
t.Run(tc.name, func(t *testing.T) {
step, tip := stageTrackerUnauthorized(tc.reason)
Expand Down Expand Up @@ -63,7 +63,7 @@ func TestStageTrackerUnauthorizedPayload(t *testing.T) {
s.statusMu.Unlock()
resp := s.buildStageTracker(s.status, store, now)
it := trackerItem(t, resp, "pr", 130)
if it.Stage != 85 || !hasMod(it, modUnauthorized) || it.UnauthorizedStep != "approve workflow runs" || !strings.Contains(it.Unauthorized, "`actions: write`") {
if it.Stage != 85 || !hasMod(it, modUnauthorized) || it.UnauthorizedStep != "approve workflow runs" || !strings.Contains(it.Unauthorized, "'actions: write'") {
t.Fatalf("row = stage %d mods %v step %q tip %q", it.Stage, it.Modifiers, it.UnauthorizedStep, it.Unauthorized)
}
if !strings.HasPrefix(it.Caption, "Waiting for a maintainer · approve workflow runs on GitHub") || !strings.Contains(it.Caption, "not permitted to approve workflow runs") || it.Actor != "maintainer" {
Expand All @@ -73,7 +73,7 @@ func TestStageTrackerUnauthorizedPayload(t *testing.T) {
if err != nil {
t.Fatal(err)
}
if !strings.Contains(string(raw), `"unauthorized_step":"approve workflow runs"`) || !strings.Contains(string(raw), `"unauthorized":"The hive's GitHub App lacks`) {
if !strings.Contains(string(raw), `"unauthorized_step":"approve workflow runs"`) || !strings.Contains(string(raw), `"unauthorized":"The hive bot's GitHub App is missing`) {
t.Fatalf("payload lacks the unauthorized fields: %s", raw)
}
if clean := trackerItem(t, resp, "pr", 101); clean.UnauthorizedStep != "" || clean.Unauthorized != "" || hasMod(clean, modUnauthorized) {
Expand Down Expand Up @@ -118,15 +118,15 @@ func TestStageTrackerUnauthorizedJS(t *testing.T) {
jsFunc(t, html, "stageTrackerChipsHtml"),
jsFunc(t, html, "stageTrackerNeedsAttention"),
}, "\n") + `
const tip = "The hive's GitHub App lacks \u0060actions: write\u0060, so it cannot approve the workflow runs.";
const tip = "The hive bot's GitHub App is missing the 'actions: write' permission needed to approve the workflow runs.";
const item = { kind: 'pr', stage: 85, modifiers: ['unauthorized'], unauthorized_step: 'approve workflow runs', unauthorized: tip };
const pill = stageTrackerChipsHtml(item);
assert.ok(pill.includes('ham-mod-unauthorized') && pill.includes('>unauthorized<'), pill);
assert.ok(pill.includes('ham-mod-unauthorized') && pill.includes('>hive bot lacks permission<'), pill);
assert.ok(pill.includes('title="' + esc(tip) + '"'), pill);
assert.ok(STAGE_TRACKER_HUMAN_MODS.includes('unauthorized') && STAGE_TRACKER_MOTION_HUMAN_MODS.includes('unauthorized'));
assert.ok(stageTrackerNeedsAttention(item));
// unauthorized outranks the needs-* chips but yields to hold, a human instruction.
assert.ok(stageTrackerChipsHtml({ stage: 85, modifiers: ['needs-decision', 'unauthorized'] }).includes('>unauthorized +1<'));
assert.ok(stageTrackerChipsHtml({ stage: 85, modifiers: ['needs-decision', 'unauthorized'] }).includes('>hive bot lacks permission +1<'));
assert.ok(stageTrackerChipsHtml({ stage: 10, modifiers: ['unauthorized', 'hold'] }).includes('>hold +1<'));
// The 085 chevron names the human step owed; without a step the generic word stays.
assert.strictEqual(stageTrackerUnauthorizedWord(item), 'Waiting for a maintainer · approve workflow runs on GitHub');
Expand Down
2 changes: 1 addition & 1 deletion src/pkg/dashboard/static-src/html/tracker.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ <h2 class="config-title" id="activity-monitor-settings-title">Hive activity moni
<input id="activity-monitor-q" class="ham-input" type="search" placeholder="Search # or title…" autocomplete="off" spellcheck="false" aria-label="Search by number or title" data-input-action="hamFilter" data-arg0="q" data-arg-types="s,w">
<label class="ham-repo-filter"><span>Since</span><select id="activity-monitor-age" class="ham-select" data-change-action="hamFilter" data-arg0="age" data-arg-types="s,v" title="Time on the current step (or open, when no step is known)"><option value="any">Any age</option><option value="1h">Over 1 hour</option><option value="1d">Over 1 day</option><option value="1w">Over 1 week</option><option value="stale">Past the stage dwell</option></select></label>
<label class="ham-repo-filter"><span>Author</span><select id="activity-monitor-author" class="ham-select" data-change-action="hamFilter" data-arg0="author" data-arg-types="s,v"><option value="any">Any author</option><option value="human">Human</option><option value="clanker">Clanker</option><option value="hive">Hive</option></select></label>
<button type="button" class="ham-chip" id="activity-monitor-attention" data-action="hamFilter" data-arg0="attention" data-arg1="toggle" aria-pressed="false" title="Stalled, held, unauthorized, needs-human, needs-decision, needs-rebase, blocked, on 045 / 071 / 072 / 085 / 090, or regressed while parked on a person. Merge-gate pills (sentinel, needs-human, needs-decision) count only once the PR reaches the merge gate">Needs attention</button>
<button type="button" class="ham-chip" id="activity-monitor-attention" data-action="hamFilter" data-arg0="attention" data-arg1="toggle" aria-pressed="false" title="Stalled, held, hive bot lacks permission, needs-human, needs-decision, needs-rebase, blocked, on 045 / 071 / 072 / 085 / 090, or regressed while parked on a person. Merge-gate pills (sentinel, needs-human, needs-decision) count only once the PR reaches the merge gate">Needs attention</button>
<button type="button" class="ham-chip ham-chip--waiting" id="activity-monitor-waiting" data-action="hamFilter" data-arg0="waitingOnYou" data-arg1="toggle" aria-pressed="false" title="Only items parked on you: a decision asked at 045 / 085, a PR ready for a human merge at 090, an approval the hive cannot give, or a contributor offline past their grace so you are the fallback. Same rows as the sidebar's orange badge and the topbar's Waiting on you pill">Waiting on you</button>
<label class="ham-repo-filter"><span>Decisions</span><select id="activity-monitor-acted" class="ham-select" data-change-action="hamFilter" data-arg0="acted" data-arg-types="s,v" aria-label="Filter by whether you acted on the row" title="Awaiting my decision: parked on a person, no action recorded yet. I acted: an action was recorded from this dashboard (history badge). Acted, still stuck: acted, but the item has not moved past that stage (amber history badge)"><option value="any">Any</option><option value="awaiting">Awaiting my decision</option><option value="acted">I acted</option><option value="stuck">Acted, still stuck</option></select></label>
<label class="ham-repo-filter"><span>Sort</span><select id="activity-monitor-sort" class="ham-select" data-change-action="hamFilter" data-arg0="sort" data-arg-types="s,v"><option value="furthest">Furthest along</option><option value="waiting">Longest waiting</option><option value="newest">Newest</option><option value="number">Number</option></select> <button type="button" class="ham-chip ham-dir" id="activity-monitor-dir" data-action="hamFilter" data-arg0="dir" data-arg1="toggle" aria-label="Reverse sort direction" title="Attention-first within each column; arrow flips age order">↓</button></label>
Expand Down
2 changes: 1 addition & 1 deletion src/pkg/dashboard/static-src/js/agent-now.js
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@
// "workflow-files" / "untrusted-author" / "branch-protection", falling
// back to "policy"); the tooltip carries the payload's one-sentence
// human_merge_reason_text (hivecommons/hive#14658).
const STAGE_TRACKER_HUMAN_MERGE_REASON_WORD = { 'workflow-files': 'workflow files', 'tests-removed': 'tests removed', 'manual-merge-policy': 'manual-merge policy', 'branch-protection': 'branch protection', 'merge-method': 'merge method', 'auto-merge-off': 'auto-merge off', 'untrusted-author': 'untrusted author', 'unauthorized': 'unauthorized', 'reviewer-deferred': 'reviewer deferred', 'breaking-change': 'human merge', 'policy': 'policy' };
const STAGE_TRACKER_HUMAN_MERGE_REASON_WORD = { 'workflow-files': 'workflow files', 'tests-removed': 'tests removed', 'manual-merge-policy': 'manual-merge policy', 'branch-protection': 'branch protection', 'merge-method': 'merge method', 'auto-merge-off': 'auto-merge off', 'untrusted-author': 'untrusted author', 'unauthorized': 'hive bot lacks permission', 'reviewer-deferred': 'reviewer deferred', 'breaking-change': 'human merge', 'policy': 'policy' };
// 090 under the breaking-change rule (human_merge_reason
// "breaking-change": a ⚠️ title or needs-owner-merge label,
// hivecommons/hive#15442): no approval lets the hive merge it, so the
Expand Down
4 changes: 2 additions & 2 deletions src/pkg/dashboard/static-src/js/tracker-row-strip.js
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,7 @@
if (item.sentinel_alert && deferred.indexOf(STAGE_TRACKER_SENTINEL_CHIP) < 0) lines.push(stageTrackerSentinelTip(item));
const regressed = stageTrackerRegressionText(item, nowMs);
if (regressed) lines.push(regressed.charAt(0).toUpperCase() + regressed.slice(1));
if (mods.indexOf('unauthorized') >= 0 && item.unauthorized) lines.push('Unauthorized: ' + item.unauthorized);
if (mods.indexOf('unauthorized') >= 0 && item.unauthorized) lines.push('Hive bot lacks permission: ' + item.unauthorized);
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);
Expand Down Expand Up @@ -778,7 +778,7 @@
// The regressed pill (lead or folded into "+1") explains itself on
// hover; failing that, a draft pill (lead or folded) does.
const regressed = stageTrackerRegressionText(item, Date.now());
// An unauthorized pill names the missing App permission and the human step;
// A hive-bot-lacks-permission pill names the missing App permission and the human step;
// the regressed pill explains itself; a blocked pill names what it waits on;
// failing all three, a draft pill does.
const anyBlockedPR = mods.indexOf('blocked') >= 0 ? stageTrackerBlockedOnPR(item) : null;
Expand Down
Loading
Loading