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-tracker-informational-sentinel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Keep informational trusted-author security notices separate from actual sentinel gates in Activity Monitor, quoting the real reviewer question without assigning exclusive decision authority to either the PR author or a person the reviewer mentions.
2 changes: 2 additions & 0 deletions src/docs/dashboard-sections/activity-monitor.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ The header reports the filtered row count and how many need attention; paginatio

### How you'll know something is waiting on you

A verified trusted-author security notice without the live blocking sentinel label is informational, not the reason a human must act. Its tooltip says **Informational security notice (not a merge gate)**. An independent reviewer decision retains its quoted question with reviewer provenance. A login mentioned in that question is not an assignment or exclusive authority; neither that suggestion nor the PR author's identity supplies a decision owner. A real blocking sentinel label still names its security gate, even when a reviewer question also exists.

The hive often parks work on a person: a decision asked at **045** / **085**, a PR at **090** ready for a human merge, an approval the hive's GitHub App cannot give (`needs-human`, `unauthorized`), or a contributor who has gone offline past their grace so the operator is the fallback. Those waits used to look like any other row ("PR in progress"); nothing added them up and nothing said so. Three surfaces now read one server block, `/api/stage-tracker` → `waiting_on_human` (`count`, `items[{repo, number, type, kind, since, who}]`), so a human wait is never silent:

- **Sidebar.** A second, orange badge on **Hive activity monitor** carries the waiting-on-you count (the grey badge stays the row count). Its tooltip lists the five longest waits with what each needs and how long it has waited. Hidden at zero.
Expand Down
4 changes: 4 additions & 0 deletions src/pkg/dashboard/stage_tracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,9 @@ type StageTrackerItem struct {
SentinelAlert bool `json:"sentinel_alert,omitempty"`
SentinelFindings int `json:"sentinel_findings,omitempty"`
SentinelReason string `json:"sentinel_reason,omitempty"`
// SentinelNotice marks verified informational findings without the live
// blocking label. The notice remains visible but is not a decision gate.
SentinelNotice bool `json:"sentinel_notice,omitempty"`
// HumanApprover is the trusted merger whose GitHub Approve review on
// the current head settled a requires_human verdict or a manual-merge
// lane rule (the `:human-approved@login` suffix on the stage reason).
Expand Down Expand Up @@ -695,6 +698,7 @@ type StageTrackerLinkedPR struct {
// so a sub-row under an issue names the alert too.
SentinelAlert bool `json:"sentinel_alert,omitempty"`
SentinelReason string `json:"sentinel_reason,omitempty"`
SentinelNotice bool `json:"sentinel_notice,omitempty"`
// HumanApprover / ManualMerge / HumanMergeReason(Text) mirror the
// nested PR's 090 fields so a sub-row's gate cell says why a person
// merges it, as the top-level row would (hivecommons/hive#14658).
Expand Down
5 changes: 5 additions & 0 deletions src/pkg/dashboard/stage_tracker_actor.go
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,11 @@ func stageTrackerClipReason(s string) string {
// stageTrackerDecisionWhy: the clause after "a human decision is owed" —
// the lane reason humanized ("workflow path"), else the asker's question.
func stageTrackerDecisionWhy(it StageTrackerItem) string {
if it.SentinelNotice && it.DecisionNeeded != nil && it.DecisionNeeded.AskedBy == decisionAskedByReviewer {
if question := strings.TrimSpace(it.DecisionNeeded.Question); question != "" {
return "reviewer question: " + question
}
}
if clause := humanizeStageReason(it.Reason); clause != "" {
return clause
}
Expand Down
3 changes: 3 additions & 0 deletions src/pkg/dashboard/stage_tracker_build.go
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,9 @@ func (s *Server) buildStageTracker(status *StatusPayload, store *stagelabels.Sto
// is offline says what that means for it.
it.Caption = stageTrackerOfflineAuthorCaption(it.Caption, it.Presence, it.Stage, adoptionClock, now)
it.SentinelAlert, it.SentinelFindings, it.SentinelReason = s.stageTrackerSentinel(evidenceVerifier, repoName, pr.Number, pr.HeadSHA, pr.Labels)
it.SentinelNotice = it.SentinelAlert && !slices.ContainsFunc(pr.Labels, func(label string) bool {
return strings.EqualFold(strings.TrimSpace(label), sentinelLabel)
})
// The sentinel chip is a merge-gate pill too (the trusted-author
// notice and the real alert alike): sentinel_alert stays truthful
// for the gate word and the Decide… preface, but before the gate
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 @@ -29,7 +29,7 @@ func decisionForPR(it StageTrackerItem, verdict *review.Aggregate, sentinelLabel
selfHold = it.Hold
}

sentinel := it.SentinelAlert || lower == "sentinel" || lower == stageengineprstage.ContributorLaneReasonSentinelBlocked
sentinel := !it.SentinelNotice && (it.SentinelAlert || lower == "sentinel" || lower == stageengineprstage.ContributorLaneReasonSentinelBlocked)
changes := decisionChangesRequested(base)
laneRule := decisionLaneRule(base)
adoptionLane, adoptionStalled := strings.CutPrefix(base, stagelabels.LaneReasonAdoptionStalledPrefix)
Expand Down
1 change: 1 addition & 0 deletions src/pkg/dashboard/stage_tracker_links.go
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ func stageTrackerResolveLinkedPRs(items []StageTrackerItem, open func(repo strin
lp.Title, lp.Author, lp.AuthorKind, lp.Stage = pr.Title, pr.Author, pr.AuthorKind, pr.Stage
lp.StageSince, lp.Caption = pr.StageSince, pr.Caption
lp.SentinelAlert, lp.SentinelReason, lp.Head = pr.SentinelAlert, pr.SentinelReason, pr.Head
lp.SentinelNotice = pr.SentinelNotice
lp.Claimant = pr.Claimant
lp.Adoption = pr.Adoption
lp.Presence = pr.Presence
Expand Down
11 changes: 10 additions & 1 deletion src/pkg/dashboard/stage_tracker_sentinel_lane_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,19 @@ func TestStageTrackerSentinelFlag(t *testing.T) {

resp := s.buildStageTracker(s.status, store, now)
labelled := trackerItem(t, resp, "pr", 109)
if labelled.SentinelNotice {
t.Fatal("a live blocking label must not become an informational notice")
}
if !labelled.SentinelAlert || labelled.SentinelFindings != 0 || labelled.SentinelReason != "" {
t.Fatalf("label-only PR 109 = alert %v findings %d reason %q", labelled.SentinelAlert, labelled.SentinelFindings, labelled.SentinelReason)
}
if labelled.Stage != trackerNumberNeedsDecision {
t.Fatalf("PR 109 stage = %d, want 085", labelled.Stage)
}
evid := trackerItem(t, resp, "pr", 110)
if !evid.SentinelNotice {
t.Fatal("verified trusted-author findings without a blocking label must be informational")
}
if !evid.SentinelAlert || evid.SentinelFindings != 2 || evid.SentinelReason != "touches OWNERS (+1 more)" || evid.Head != headEvidence {
t.Fatalf("evidence PR 110 = alert %v findings %d reason %q head %q", evid.SentinelAlert, evid.SentinelFindings, evid.SentinelReason, evid.Head)
}
Expand Down Expand Up @@ -167,6 +173,9 @@ func TestStageTrackerSentinelFlag(t *testing.T) {
if nested == nil || !nested.SentinelAlert || nested.Head != headClean {
t.Fatalf("issue 13 linked_prs must mirror PR 112's alert: %+v", issue.LinkedPRs)
}
if nested.SentinelNotice {
t.Fatal("the nested live label must retain its blocking meaning")
}

// Webhook: the label comes off → flag drops; goes on → flag returns.
// The head the re-read reports is kept so evidence follows the revision.
Expand Down Expand Up @@ -286,7 +295,7 @@ func TestStageTrackerSentinelLaneWiring(t *testing.T) {
`confirmLabel: 'Post /lgtm + /approve', danger: !!sentinel`,
`label: preface + 'What should the hive change on '`,
`if (item.sentinel_alert && deferred.indexOf(STAGE_TRACKER_SENTINEL_CHIP) < 0) lines.push(stageTrackerSentinelTip(item));`,
`sentinel_alert: !!lp.sentinel_alert, sentinel_reason: lp.sentinel_reason || '', head: lp.head || ''`,
`sentinel_alert: !!lp.sentinel_alert, sentinel_reason: lp.sentinel_reason || '', sentinel_notice: !!lp.sentinel_notice, head: lp.head || ''`,
} {
if !strings.Contains(html, want) {
t.Errorf("index.html missing sentinel lane wiring %q", want)
Expand Down
74 changes: 74 additions & 0 deletions src/pkg/dashboard/stage_tracker_sentinel_notice_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
package dashboard

import (
"encoding/json"
"strings"
"testing"
"time"

"github.com/hivecommons/hive/pkg/review"
"github.com/hivecommons/hive/pkg/stageengine"
"github.com/hivecommons/hive/pkg/stagelabels"
)

func TestStageTrackerSentinelNoticePreservesActualReviewerDecision(t *testing.T) {
const question = "@hanthor: may the protected build-and-test context become a three-lane aggregate gated by required-context-scope success?"
it := StageTrackerItem{
Kind: "pr", Repo: "hivecommons/hive", Number: 16026,
Head: "32fe2056576fce6ddf93a51f1dd17431575679d7",
Stage: stagelabels.NeedsDecision.Number(), Reason: stageengine.StageReasonVerdictRequiresHuman,
Author: "clubanderson", AuthorKind: authorKindHuman,
SentinelAlert: true, SentinelNotice: true, SentinelReason: "workflow changes by a trusted author",
}
verdict := &review.Aggregate{HeadSHA: it.Head, DecisionQuestion: question}
d := stageTrackerDecisionNeeded(it, verdict, "sentinel-alert")
if d == nil || d.Question != question || d.AskedBy != decisionAskedByReviewer ||
strings.Contains(d.Blocker, "security check") || strings.Contains(d.Blocker, "sentinel-alert") {
t.Fatalf("informational notice displaced the actual reviewer question: %+v", d)
}
it.DecisionNeeded = d
actor := stageTrackerStageActor(it, nil, time.Now())
if actor.Kind != StageActorHuman || actor.Login != "" || !strings.Contains(actor.Why, "@hanthor") ||
!strings.Contains(actor.Why, "reviewer question:") || strings.Contains(actor.Why, "clubanderson") || strings.Contains(actor.HumanReason, "sentinel") {
t.Fatalf("author or notice became the decision owner/reason: %+v", actor)
}
it.StageActor = actor
payload, err := json.Marshal(it)
if err != nil {
t.Fatal(err)
}
html := indexHTML(t)
runStageTrackerRowActionsScript(t, stageTrackerRowsPreludeJS(t, html)+stageTrackerRowsFixtureJS+
jsFunc(t, html, "stageTrackerSentinelPreface")+
"\nconst notice = "+string(payload)+";\n"+`
assert.strictEqual(stageTrackerSentinelInLane(notice), false);
assert.strictEqual(stageTrackerSentinelAsSuffix({...notice, stage:71}), false);
assert.ok(stageTrackerSentinelTip(notice).includes('Informational security notice (not a merge gate)'));
assert.ok(!stageTrackerSentinelTip({...notice, sentinel_reason:''}).includes('must review before merge'));
const own = stageTrackerRowHtml(notice, stages, ctx);
assert.ok(!text(own).includes('Sentinel alert'), text(own));
assert.ok(!own.includes('aria-label="Sentinel alert'), own);
assert.ok(own.includes('ham-sentinel-notice'), own);
assert.strictEqual(stageTrackerSentinelPreface([notice]), '', 'informational notice is not an approval danger preface');
assert.ok(!text(own).includes('Needs @clubanderson'), text(own));
assert.ok(own.includes('@hanthor'), own);
const linked = stageTrackerLinkedPRItem({repo:notice.repo, number:500}, notice);
assert.strictEqual(linked.sentinel_notice, true, 'canonical linked adapter preserves notice semantics');
const inline = stageTrackerRowHtml({repo:notice.repo, kind:'issue', number:500, stage:40, linked_prs:[notice]}, stages, ctx);
assert.ok(!text(inline).includes('Sentinel alert'), text(inline));
assert.ok(!text(inline).includes('Needs @clubanderson'), text(inline));
const nested = stageTrackerRowHtml({repo:notice.repo, kind:'issue', number:500, stage:40,
linked_prs:[notice, {...notice, number:16099, sentinel_alert:false, sentinel_notice:false, stage:50}]}, stages, ctx);
assert.ok(!text(nested).includes('Sentinel alert'), text(nested));
assert.ok(!text(nested).includes('Needs @clubanderson'), text(nested));
const blocking = {...notice, sentinel_notice:false};
assert.strictEqual(stageTrackerSentinelInLane(blocking), true, 'actual blocking alert remains a sentinel gate');
assert.strictEqual(stageTrackerSentinelAsSuffix({...blocking, stage:71}), true);
assert.ok(!stageTrackerSentinelTip(blocking).includes('Informational'));
`)
it.SentinelNotice = false
blocking := stageTrackerDecisionNeeded(it, verdict, "sentinel-alert")
if blocking == nil || !strings.Contains(blocking.Blocker, "sentinel-alert") || blocking.Question != question {
t.Fatalf("genuine alert or coexisting reviewer question was suppressed: %+v", blocking)
}
}
1 change: 1 addition & 0 deletions src/pkg/dashboard/static-src/css/tracker.css
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@
reads "Sentinel alert · needs human". Danger-tinted from the
status token the sentinel pill on the repo card already uses. */
.ham-badge-sentinel { color: var(--status-error); border-color: color-mix(in srgb, var(--status-error) 55%, transparent); font-weight: var(--fw-medium); }
.ham-badge-sentinel.ham-sentinel-notice { color: var(--status-info); border-color: color-mix(in srgb, var(--status-info) 55%, transparent); }
.ham-seg.active.ham-sentinel { background: var(--status-error); color: var(--surface-0); }
/* 072 adoption chip (maintainer-policy, hive PR 14524): "waiting on @author (maintainer, offline 26h) — adopt?" */
.ham-badge-adoption { color: var(--status-warn); border-color: color-mix(in srgb, var(--status-warn) 55%, transparent); font-weight: var(--fw-medium); }
Expand Down
2 changes: 1 addition & 1 deletion src/pkg/dashboard/static-src/js/tracker-actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -1470,7 +1470,7 @@
// flagged PR, so the operator reads the security reason before
// choosing Approve; '' when nothing in items is flagged.
function stageTrackerSentinelPreface(items) {
return (items || []).filter(it => it && it.sentinel_alert).map(it => '⚠ ' + stageTrackerRefOf(it) + ' — ' + stageTrackerSentinelTip(it)).join('\n');
return (items || []).filter(it => it && it.sentinel_alert && !it.sentinel_notice).map(it => '⚠ ' + stageTrackerRefOf(it) + ' — ' + stageTrackerSentinelTip(it)).join('\n');
}
// Every confirm a row action raises can be opted out of per browser,
// per action id (the dialog's "Don't ask again for this action" box;
Expand Down
4 changes: 2 additions & 2 deletions src/pkg/dashboard/static-src/js/tracker-row-layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
return { repo: canonical ? canonical[1] : (lp.repo || issue.repo), number: lp.number, kind: 'pr', title: lp.title || '', url: lp.url || '', author: lp.author || '', author_kind: lp.author_kind || '',
state: lp.state || '', terminal_merge: !!lp.terminal_merge, merged_by: lp.merged_by || '',
stage: lp.stage || 0, stage_since: lp.stage_since || '', stage_slug: lp.stage_slug || '', modifiers: lp.modifiers || [], deferred_modifiers: lp.deferred_modifiers || [], caption: lp.caption || '', reason: lp.reason || '', preparation: lp.preparation || null, human_attention: lp.human_attention || null,
human_approver: lp.human_approver || '', manual_merge: !!lp.manual_merge, human_merge_reason: lp.human_merge_reason || '', human_merge_reason_text: lp.human_merge_reason_text || '', sentinel_alert: !!lp.sentinel_alert, sentinel_reason: lp.sentinel_reason || '', head: lp.head || '', base_ref: lp.base_ref || '', decision_needed: lp.decision_needed || null,
human_approver: lp.human_approver || '', manual_merge: !!lp.manual_merge, human_merge_reason: lp.human_merge_reason || '', human_merge_reason_text: lp.human_merge_reason_text || '', sentinel_alert: !!lp.sentinel_alert, sentinel_reason: lp.sentinel_reason || '', sentinel_notice: !!lp.sentinel_notice, head: lp.head || '', base_ref: lp.base_ref || '', decision_needed: lp.decision_needed || null,
adoption: lp.adoption || null, takeover: lp.takeover || null, superseded: !!lp.superseded, supersedes: lp.supersedes || null, parent: Number(issue.number) || 0, siblings: open.map(x => Number(x.number) || 0),
last_operator_action: lp.last_operator_action || null, operator_action_count: lp.operator_action_count || 0, hold: lp.hold || null, stage_actor: lp.stage_actor || null, claimant: lp.claimant || null, presence: lp.presence || null, rework: lp.rework || null, push: lp.push || null, merge_gate: lp.merge_gate || null, merge_train: lp.merge_train || null, left_train: lp.left_train || null, overlap: lp.overlap || null,
decided: lp.decided || null, adopted_by: Number(lp.adopted_by) || 0, adopted_by_state: lp.adopted_by_state || '', adopted_from: lp.adopted_from || null, lineage: lp.lineage || null, state: lp.state || '', superseded_by: Number(lp.superseded_by) || 0 };
Expand Down Expand Up @@ -490,7 +490,7 @@
prRefs = [STAGE_TRACKER_LINKED_GLYPH + stageTrackerPRPillsHtml(stageTrackerPRRef(lp.number, lp.url, lp.author_kind || '', lp.author, lp.title, (lp.title ? lp.title + '\n' : '') + 'Author: ' + who + ' · ' + stageTrackerLinkedTip(item, lp.number, ctx)), typeof stageTrackerLinkedChipsHtml === 'function' ? stageTrackerLinkedChipsHtml(lp, lineage) : (lineage || null), lp.base_ref)];
shown = Object.assign({}, item, { via_pr: true, stage: stageTrackerLeadStage(lp), stage_since: lp.stage_since || item.stage_since, modifiers: lp.modifiers || item.modifiers, deferred_modifiers: lp.deferred_modifiers || item.deferred_modifiers || [], caption: lp.caption || item.caption, reason: lp.reason || item.reason, preparation: lp.preparation || null,
terminal_merge: !!lp.terminal_merge, merged_by: lp.merged_by || '',
human_approver: lp.human_approver || '', manual_merge: !!lp.manual_merge, human_merge_reason: lp.human_merge_reason || '', human_merge_reason_text: lp.human_merge_reason_text || '', sentinel_alert: !!lp.sentinel_alert, sentinel_reason: lp.sentinel_reason || '', head: lp.head || '', decision_needed: lp.decision_needed || null, hold: lp.hold || null, adoption: lp.adoption || null, stage_actor: lp.stage_actor || item.stage_actor || null, claimant: lp.claimant || null, presence: lp.presence || null, rework: lp.rework || null, push: lp.push || null, merge_gate: lp.merge_gate || null, merge_train: lp.merge_train || null, left_train: lp.left_train || null, overlap: lp.overlap || null, decided: lp.decided || item.decided || null });
human_approver: lp.human_approver || '', manual_merge: !!lp.manual_merge, human_merge_reason: lp.human_merge_reason || '', human_merge_reason_text: lp.human_merge_reason_text || '', sentinel_alert: !!lp.sentinel_alert, sentinel_reason: lp.sentinel_reason || '', sentinel_notice: !!lp.sentinel_notice, head: lp.head || '', decision_needed: lp.decision_needed || null, hold: lp.hold || null, adoption: lp.adoption || null, stage_actor: lp.stage_actor || item.stage_actor || null, claimant: lp.claimant || null, presence: lp.presence || null, rework: lp.rework || null, push: lp.push || null, merge_gate: lp.merge_gate || null, merge_train: lp.merge_train || null, left_train: lp.left_train || null, overlap: lp.overlap || null, decided: lp.decided || item.decided || null });
} else if (linked.length) {
// Several covering PRs: the issue strip ends at Claimed, all passed
// and nothing lit; one sub-row per PR carries the live chevron.
Expand Down
3 changes: 2 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 @@ -287,7 +287,8 @@
}
function stageTrackerSentinelChipHtml(item) {
if (!item || !item.sentinel_alert || stageTrackerSentinelInLane(item) || stageTrackerSentinelAsSuffix(item) || stageTrackerDeferredMods(item).indexOf(STAGE_TRACKER_SENTINEL_CHIP) >= 0) return '';
return `<span class="ham-badge ham-badge-sentinel" title="${esc(stageTrackerSentinelTip(item))}" aria-label="${esc('Sentinel alert — ' + stageTrackerSentinelTip(item))}">${esc(STAGE_TRACKER_SENTINEL_CHIP)}</span>`;
const label = item.sentinel_notice ? 'Informational security notice' : 'Sentinel alert';
return `<span class="ham-badge ham-badge-sentinel${item.sentinel_notice ? ' ham-sentinel-notice' : ''}" title="${esc(stageTrackerSentinelTip(item))}" aria-label="${esc(label + ' — ' + stageTrackerSentinelTip(item))}">${esc(STAGE_TRACKER_SENTINEL_CHIP)}</span>`;
}

// Pure: the hold pill text from the row's `hold` provenance ('' when the
Expand Down
Loading
Loading