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/fixed-19263-answered-signoff-wording.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- The activity tracker's Review track no longer reads "no sign-off pending" once a sign-off ask is answered, which looked like a missing DCO `Signed-off-by`. It reads "signed off" only when a GitHub Approve review answered it, "approved by `<login>`" for a dashboard approval, "answered by policy" when the owner-delegate policy answered it, and "decision answered" otherwise. `human_gate` gains `answered_via` (`review`, `dashboard`, `policy`) and `answered_by` now credits the dashboard approver (#19263).
7 changes: 5 additions & 2 deletions src/docs/api-reference/dashboard-misc.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,17 @@ check is not running in any useful sense, and when every pending check is stuck
the caption reads `CI stuck · …` and `active` is false.

Every open issue and PR row (and each `linked_prs[]` entry that mirrors a listed
PR) also carries `human_gate`: `{reasons, actions, answered?, answered_by?, waiting_on?}`.
PR) also carries `human_gate`: `{reasons, actions, answered?, answered_by?, answered_via?, waiting_on?}`.
`reasons` are the things a person is owed right now (`review`, `decision`,
`sentinel`, `hold`; empty when nothing is); `actions` are the gate verbs that
would act on the row (`decide:approve`, `gate:request-changes`, `decide:delegate`,
`gate:decide`, `gate:confirm-sentinel`, `release`) — a verb absent from the list
has nothing to act on and is never drawn. `answered` is true when the reviewer
asked for a person's sign-off on this head and the hive no longer parks the PR
on it, with `answered_by` the approver when the lane recorded one. `waiting_on`
on it, with `answered_by` the person who answered when one is known and
`answered_via` how: `review` (a GitHub Approve review on the head), `dashboard`
(a dashboard approval by `answered_by`) or `policy` (the owner-delegate policy;
no `answered_by`). Both are omitted when the row does not say. `waiting_on`
is `{kind, text, checks?}` on a PR with no reasons: what it actually waits on
(`conflict`, `author`, `fixing`, `checks-failing`, `checks-stuck`,
`checks-missing`, `ci-running`, `review-pending`, `merge-queue`). CI is classified against the resolved
Expand Down
2 changes: 1 addition & 1 deletion src/docs/dashboard-sections/activity-monitor.md
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ Every verb runs `runRowAction` — the row menu's own path: the in-app confirm o
| Sign-off question answered — a person approved the head, the PR left 085 | no gate pill; a passive **Approved by @login · waiting on …** pill (*No decision pending · waiting on …* when the lane recorded no approver) | none |
| Triage needed, or a human author's turn (`needs_human` with no park) | no gate pill; the row's lead (**Accept triage**, **Adopt**) | the lead only |

**Let hive decide**, **Approve** and **Approve as-is** are drawn only where the action has a decision to act on (a parked PR, an issue's one parked PR, an issue parked at 045, or an issue with several open PRs for *Let hive decide*); a hold or sentinel pill on a row that is not parked keeps only its own answer. The reviewer's `requires_human` verdict lights `review` only while the hive parks the PR on it; afterwards the Review track reads *signed off* (*no sign-off pending* when the lane recorded no approver), never *needs owner sign-off*.
**Let hive decide**, **Approve** and **Approve as-is** are drawn only where the action has a decision to act on (a parked PR, an issue's one parked PR, an issue parked at 045, or an issue with several open PRs for *Let hive decide*); a hold or sentinel pill on a row that is not parked keeps only its own answer. The reviewer's `requires_human` verdict lights `review` only while the hive parks the PR on it; afterwards the Review track reads *signed off* only when a GitHub Approve review on the head answered it, *approved by &lt;login&gt;* for a dashboard approval, *answered by policy* when the owner-delegate policy answered it, and *decision answered* when the row does not say how; never *needs owner sign-off*. `human_gate.answered_via` (`review`, `dashboard`, `policy`) carries which.

When no decision is pending the row names what it actually waits on (`human_gate.waiting_on`), the first that applies: a merge conflict with the base; the author's turn; required checks failing (named); required checks **stuck** (named); required checks not reported (named); CI running (*n/m*); the review re-run on the new head; the merge queue. A required check that has been queued or in progress longer than `HIVE_TRACKER_CHECK_STUCK_AFTER` (default two hours — well past the slowest pipeline) is **stuck**, not running: the CI track reads *CI 67/69 · 'PR Type', 'PR Issue' stuck* (*13 running · 2 stuck (…)* while other checks still move), its hover says nothing finishes a stuck check on its own, and when every pending check is stuck the track stops pulsing. A verb clicked from a stale view — the row re-rendered between the paint and the click — answers *nothing to act on — #N is waiting on required checks stuck: PR Type, PR Issue* and the tracker re-reads the server at once so the row drops the verb.

Expand Down
14 changes: 14 additions & 0 deletions src/pkg/dashboard/stage_tracker_activity.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -888,6 +888,20 @@ test('#16484: count grammar — CI passed/total and Review done/total across eve
assert.equal(review('changes_requested'), 'Review 3/5 · changes requested');
assert.equal(review('human_decision'), 'Review 3/5 · needs owner sign-off', 'reviews done; the sign-off is what is left, never "awaiting human"');
assert.equal(review('human_decision', {}, { decision_needed: { question: '@clubanderson should decide whether to accept this workflow change from a fork.' } }), 'Review 3/5 · needs owner sign-off', 'no viewer known: the owner');
// An answered sign-off ask: only a GitHub Approve review reads "signed
// off"; never "no sign-off pending", which read like a DCO failure.
const answeredConsts = ['STAGE_TRACKER_ANSWERED_VIA_REVIEW', 'STAGE_TRACKER_ANSWERED_VIA_DASHBOARD', 'STAGE_TRACKER_ANSWERED_VIA_POLICY'].map(name => constLine(strip, name)).join('\n');
const answeredWord = new Function(answeredConsts + '\n' + fn(strip, 'stageTrackerGateAnsweredWord') + ';return stageTrackerGateAnsweredWord;')();
const gate = (via, by) => ({ human_gate: { reasons: [], actions: [], answered: true, answered_by: by, answered_via: via } });
assert.equal(answeredWord(gate('review', 'octo')), 'signed off');
assert.equal(answeredWord({ human_approver: 'octo' }), 'signed off', 'an older payload: the recorded GitHub approver');
assert.equal(answeredWord(gate('dashboard', 'maintainer')), 'approved by maintainer');
assert.equal(answeredWord(gate('dashboard', '@maintainer')), 'approved by maintainer');
assert.equal(answeredWord(gate('dashboard', '')), 'decision answered', 'no login known: no name invented');
assert.equal(answeredWord(gate('policy', '')), 'answered by policy');
assert.equal(answeredWord(gate('', '')), 'decision answered');
assert.equal(answeredWord({}), 'decision answered');
for (const item of [{}, gate('', ''), gate('dashboard', ''), gate('policy', '')]) assert.ok(!/sign-off|signed off/.test(answeredWord(item)), 'no sign-off claimed without an Approve review: ' + JSON.stringify(item));
globalThis.window = { _hiveUser: 'ClubAnderson' };
try {
assert.equal(review('human_decision', {}, { decision_needed: { question: '@clubanderson should decide whether to accept this workflow change from a fork.' } }), 'Review 3/5 · needs your sign-off', 'the ask names the viewer');
Expand Down
53 changes: 49 additions & 4 deletions src/pkg/dashboard/stage_tracker_gate.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import (
"strconv"
"strings"
"time"

"github.com/hivecommons/hive/pkg/delegatedecision"
)

// The human gate's one source of truth (hivecommons/hive#18769).
Expand Down Expand Up @@ -52,6 +54,16 @@ const (
gateWaitMergeQueue = "merge-queue"
)

// How an answered sign-off ask was answered (human_gate.answered_via). The
// SPA's STAGE_TRACKER_ANSWERED_VIA_* mirror them: only a GitHub Approve
// review reads "signed off"; a dashboard approval names its login; the
// owner-delegate policy reads "answered by policy".
const (
gateAnsweredViaReview = "review"
gateAnsweredViaDashboard = "dashboard"
gateAnsweredViaPolicy = "policy"
)

// stageTrackerHumanGateDelegateAllMin mirrors the SPA's
// STAGE_TRACKER_DELEGATE_ALL_MIN: an issue row with this many open PRs
// delegates all of them.
Expand Down Expand Up @@ -94,9 +106,12 @@ type StageTrackerHumanGate struct {
Actions []string `json:"actions"`
// Answered is true when the reviewer asked for a person's sign-off on
// this head and the hive no longer parks the PR on it; AnsweredBy is
// the approver when the lane recorded one.
Answered bool `json:"answered,omitempty"`
AnsweredBy string `json:"answered_by,omitempty"`
// the person who answered when one is known. AnsweredVia is how: a
// GitHub Approve review (review), a dashboard approval (dashboard) or
// the owner-delegate policy (policy); empty when the row does not say.
Answered bool `json:"answered,omitempty"`
AnsweredBy string `json:"answered_by,omitempty"`
AnsweredVia string `json:"answered_via,omitempty"`
// WaitingOn names what the item actually waits on when no decision is
// pending.
WaitingOn *StageTrackerHumanGateWait `json:"waiting_on,omitempty"`
Expand Down Expand Up @@ -249,14 +264,44 @@ func stageTrackerHumanGateFor(it StageTrackerItem, now time.Time) *StageTrackerH
return g
}
if stageTrackerHumanGateOnHead(it.ReviewActivity, it.Head) && it.ReviewActivity.State == "human_decision" && !slices.Contains(reasons, gateReasonReview) {
g.Answered, g.AnsweredBy = true, strings.TrimPrefix(strings.TrimSpace(it.HumanApprover), "@")
g.Answered = true
g.AnsweredBy, g.AnsweredVia = stageTrackerHumanGateAnswerer(it)
}
if len(reasons) == 0 {
g.WaitingOn = stageTrackerHumanGateWaitingOn(it, now)
}
return g
}

// stageTrackerHumanGateAnswerer names who answered a sign-off ask on the
// row's head and how. The `:human-approved@login` suffix (a GitHub Approve
// review) wins; otherwise the newest applied operator action on this head:
// a dashboard approve / queue-merge / merge-now credits its actor, and an
// approving let-hive-decide is the owner-delegate policy
// (delegatedecision.PolicyName), which has no person to credit. Both are
// empty when nothing on the row says.
func stageTrackerHumanGateAnswerer(it StageTrackerItem) (by, via string) {
if approver := strings.TrimPrefix(strings.TrimSpace(it.HumanApprover), "@"); approver != "" {
return approver, gateAnsweredViaReview
}
a := it.LastOperatorAction
if a == nil || a.Outcome != operatorActionOutcomeApplied {
return "", ""
}
if head := strings.TrimSpace(a.HeadSHA); head != "" && it.Head != "" && !strings.EqualFold(head, it.Head) {
return "", ""
}
switch a.Action {
case operatorActionApprove, operatorActionQueueMerge, operatorActionMergeNow:
return strings.TrimPrefix(strings.TrimSpace(a.Actor), "@"), gateAnsweredViaDashboard
case operatorActionLetHiveDecide:
if a.Verdict == string(delegatedecision.VerdictApprove) {
return "", gateAnsweredViaPolicy
}
}
return "", ""
}

// stageTrackerHumanGateWaitingOn names what a PR nobody owes a decision on is
// waiting for, the first that applies: a conflict, its author, required
// checks (red, stuck, unreported, running), the review of this head, the
Expand Down
62 changes: 54 additions & 8 deletions src/pkg/dashboard/stage_tracker_gate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"testing"
"time"

"github.com/hivecommons/hive/pkg/delegatedecision"
"github.com/hivecommons/hive/pkg/github"
)

Expand All @@ -18,12 +19,13 @@ type gateStateCase struct {
Name string `json:"name"`
Item StageTrackerItem `json:"item"`
Want struct {
Reasons []string `json:"reasons"`
Actions []string `json:"actions"`
Answered bool `json:"answered"`
AnsweredBy string `json:"answered_by"`
Wait string `json:"wait"`
Inert bool `json:"inert"`
Reasons []string `json:"reasons"`
Actions []string `json:"actions"`
Answered bool `json:"answered"`
AnsweredBy string `json:"answered_by"`
AnsweredVia string `json:"answered_via"`
Wait string `json:"wait"`
Inert bool `json:"inert"`
} `json:"want"`
}

Expand Down Expand Up @@ -71,8 +73,8 @@ func TestStageTrackerHumanGateTable(t *testing.T) {
if !slices.Equal(g.Actions, tc.Want.Actions) {
t.Errorf("actions = %v, want %v", g.Actions, tc.Want.Actions)
}
if g.Answered != tc.Want.Answered || g.AnsweredBy != tc.Want.AnsweredBy {
t.Errorf("answered = %v by %q, want %v by %q", g.Answered, g.AnsweredBy, tc.Want.Answered, tc.Want.AnsweredBy)
if g.Answered != tc.Want.Answered || g.AnsweredBy != tc.Want.AnsweredBy || g.AnsweredVia != tc.Want.AnsweredVia {
t.Errorf("answered = %v by %q via %q, want %v by %q via %q", g.Answered, g.AnsweredBy, g.AnsweredVia, tc.Want.Answered, tc.Want.AnsweredBy, tc.Want.AnsweredVia)
}
wait := ""
if g.WaitingOn != nil {
Expand Down Expand Up @@ -230,3 +232,47 @@ func TestStageTrackerResolveHumanGates(t *testing.T) {
t.Error("an issue with one parked nested PR must accept Let hive decide")
}
}

// TestStageTrackerHumanGateAnsweredVia pins who answered a sign-off ask and
// how. Only a GitHub Approve review (the `:human-approved@login` suffix) is
// a sign-off; a dashboard approval credits the person who clicked it; the
// owner-delegate policy credits nobody; and with nothing recorded the gate
// still reads answered, without a name, so the row never claims a sign-off
// that did not happen.
func TestStageTrackerHumanGateAnsweredVia(t *testing.T) {
const head = "abc1234"
now := time.Date(2026, 11, 19, 12, 0, 0, 0, time.UTC)
answeredRow := func(approver string, action *StageTrackerOperatorAction) StageTrackerItem {
return StageTrackerItem{Repo: "acme/api", Number: 7, Kind: "pr", Stage: trackerNumberReviewed, Head: head, HumanApprover: approver,
ReviewActivity: &StageTrackerActivity{Head: head, State: "human_decision"}, LastOperatorAction: action}
}
applied := func(action, actor, sha, verdict string) *StageTrackerOperatorAction {
return &StageTrackerOperatorAction{Action: action, Actor: actor, HeadSHA: sha, Verdict: verdict, Outcome: operatorActionOutcomeApplied, At: now}
}
cases := []struct {
name string
item StageTrackerItem
by, via string
}{
{"github approve review", answeredRow("@octo", nil), "octo", gateAnsweredViaReview},
{"review wins over a dashboard action", answeredRow("octo", applied(operatorActionApprove, "someone", head, "")), "octo", gateAnsweredViaReview},
{"dashboard approve", answeredRow("", applied(operatorActionApprove, "maintainer", head, "")), "maintainer", gateAnsweredViaDashboard},
{"dashboard queue-merge", answeredRow("", applied(operatorActionQueueMerge, "maintainer", "", "")), "maintainer", gateAnsweredViaDashboard},
{"owner-delegate policy", answeredRow("", applied(operatorActionLetHiveDecide, "hive-1", head, string(delegatedecision.VerdictApprove))), "", gateAnsweredViaPolicy},
{"policy that did not approve", answeredRow("", applied(operatorActionLetHiveDecide, "hive-1", head, string(delegatedecision.VerdictDirection))), "", ""},
{"approval on an older head", answeredRow("", applied(operatorActionApprove, "maintainer", "0ld0ld0", "")), "", ""},
{"approval that failed", answeredRow("", &StageTrackerOperatorAction{Action: operatorActionApprove, Actor: "maintainer", Outcome: operatorActionOutcomeFailed}), "", ""},
{"nothing recorded", answeredRow("", nil), "", ""},
}
for _, tc := range cases {
t.Run(tc.name, func(t *testing.T) {
g := stageTrackerHumanGateFor(tc.item, now)
if g == nil || !g.Answered {
t.Fatalf("gate = %+v, want an answered sign-off ask", g)
}
if g.AnsweredBy != tc.by || g.AnsweredVia != tc.via {
t.Errorf("answered by %q via %q, want by %q via %q", g.AnsweredBy, g.AnsweredVia, tc.by, tc.via)
}
})
}
}
23 changes: 22 additions & 1 deletion src/pkg/dashboard/static-src/js/tracker-row-strip.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@
const q = item.decision_needed && item.decision_needed.question ? String(item.decision_needed.question).toLowerCase() : '';
const me = typeof window !== 'undefined' && window._hiveUser ? String(window._hiveUser).toLowerCase() : '';
const mine = !!me && new RegExp('@' + me.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') + '(?![\\w-])').test(q);
if (typeof stageTrackerGateAnswered === 'function' && stageTrackerGateAnswered(item)) return count + (String(item.human_approver || '').trim() ? ' · signed off' : ' · no sign-off pending');
if (typeof stageTrackerGateAnswered === 'function' && stageTrackerGateAnswered(item)) return count + ' · ' + stageTrackerGateAnsweredWord(item);
return count + (mine ? ' · needs your sign-off' : ' · needs owner sign-off');
}
case 'reviewing': return count + ' · ' + (actor ? actor + ' reviewing' : 'in progress');
Expand All @@ -136,6 +136,27 @@
}
}

// How an answered sign-off ask was answered (human_gate.answered_via,
// stage_tracker_gate.go gateAnsweredVia*).
const STAGE_TRACKER_ANSWERED_VIA_REVIEW = 'review';
const STAGE_TRACKER_ANSWERED_VIA_DASHBOARD = 'dashboard';
const STAGE_TRACKER_ANSWERED_VIA_POLICY = 'policy';
// Pure: the review word once the reviewer's sign-off ask on this head is
// answered. "signed off" only for a GitHub Approve review (the
// human_approver the lane recorded); a dashboard approval names who
// approved; the owner-delegate policy reads "answered by policy"; else
// "decision answered". Never "no sign-off pending", which read like a
// missing DCO Signed-off-by.
function stageTrackerGateAnsweredWord(item) {
const g = item && item.human_gate && typeof item.human_gate === 'object' ? item.human_gate : null;
const via = g && g.answered_via ? String(g.answered_via) : '';
const by = String((g && g.answered_by) || '').trim().replace(/^@/, '');
if (via === STAGE_TRACKER_ANSWERED_VIA_REVIEW || (!via && String((item && item.human_approver) || '').trim())) return 'signed off';
if (via === STAGE_TRACKER_ANSWERED_VIA_POLICY) return 'answered by policy';
if (via === STAGE_TRACKER_ANSWERED_VIA_DASHBOARD && by) return 'approved by ' + by;
return 'decision answered';
}

// Unreported checks whose workflow runs sit behind GitHub's
// approve-workflows gate (dependabot, forks): the CI blocker reads
// "workflow-approval-required:<n>" (stage_tracker_activity.go). A
Expand Down
Loading
Loading