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-standing-meta-no-stage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Bot Dependency Dashboards and the Hive Advisory Report no longer get a stage label. A triage bot's `needs-human` on mergeraptor's Dependency Dashboards (projectbluefin/gutenprint-printer-app#45, ps-printer-app#50, hplip-printer-app#42) parked them at `stage/045-needs-decision`; the sweep and the out-of-cycle facts now derive no stage for standing meta issues, so the 045 comes off.
6 changes: 6 additions & 0 deletions src/docs/dashboard.md
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,12 @@ and exposes the editable rows.
| Draft PRs | Pull request is open but marked draft. | GitHub draft state. | Use GitHub's **Ready for review** action. |
| Hold-adjacent/other | Safety remainder for open items that did not match a named actionable, held, blocked, or outside classifier. | Fixed scanner fallback. | Check labels and scanner rules; add a dedicated classifier if the remainder is meaningful. |

A standing meta issue (bot Dependency Dashboard, Hive Advisory Report) derives
no stage label, in the sweep and out of cycle: a `needs-human` a triage bot puts
on a Dependency Dashboard used to park it at `stage/045-needs-decision`
(projectbluefin/gutenprint-printer-app#45). The stage writer takes such a 045
off; the bot's own labels stay.

The Issues and PRs panels link directly to `/api/overview/issues.csv` and
`/api/overview/prs.csv` by default, or to the matching `.json` endpoints when
JSON export is selected; non-empty legend rows add a `slice` query filter (the
Expand Down
10 changes: 10 additions & 0 deletions src/pkg/github/stage_facts_sink.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,16 @@ func (c *Client) enrichStageFacts(ctx context.Context, f stageengine.Facts) (sta
f.Issue.Bucket = stageengine.BucketFiltered
f.Issue.FilteredReason = issueFilterReason
}
// A standing meta issue derives no stage out of cycle either, or a
// webhook on a Renovate dashboard re-parks it between sweeps.
if f.Issue != nil {
switch standingMetaIssueKindFor(issue.GetTitle(), issue.GetUser().GetLogin(), labels) {
case standingMetaDependencyDashboard:
f.Issue.Bucket = stageengine.BucketDependencyDashboard
case standingMetaHiveAdvisory:
f.Issue.Bucket = stageengine.BucketHiveAdvisory
}
}
if f.Issue != nil {
resolveIssueLabelFacts(issueInputFrom(f), &f)
f.Issue.Stalled = issueHasLabel(f.Labels, stagelabels.StalledLabel)
Expand Down
9 changes: 8 additions & 1 deletion src/pkg/github/stage_facts_sink_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ type stageFactsServer struct {
state string
isPR bool
body string
// title / login, when set, are the issue's title and author.
title string
login string
added []string
removed []string
// prState / prMerged answer GET /pulls/N (the covering-PR re-read);
Expand Down Expand Up @@ -57,7 +60,11 @@ func newStageFactsServer(t *testing.T, labels ...string) *stageFactsServer {
}
_ = json.NewEncoder(w).Encode(body)
case r.Method == http.MethodGet && strings.Contains(r.URL.Path, "/issues/"):
body := map[string]any{"number": 7, "state": s.state, "labels": wireLabelsOf(s.labels), "user": map[string]any{"login": "dev"}, "body": s.body}
login := s.login
if login == "" {
login = "dev"
}
body := map[string]any{"number": 7, "state": s.state, "labels": wireLabelsOf(s.labels), "user": map[string]any{"login": login}, "body": s.body, "title": s.title}
if s.isPR {
body["pull_request"] = map[string]any{"url": "https://api.github.com/repos/o/r/pulls/7"}
}
Expand Down
46 changes: 46 additions & 0 deletions src/pkg/github/stage_standing_meta_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package github

import (
"context"
"strings"
"testing"

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

// projectbluefin/gutenprint-printer-app#45, ps-printer-app#50 and
// hplip-printer-app#42: mergeraptor's Dependency Dashboards wore stage/045
// because a triage bot added `needs-human`. A standing meta issue is not
// work and derives no stage: the sweep row and an out-of-cycle fact both
// take the 045 off and write nothing else.
func TestStandingMetaIssueDerivesNoStage(t *testing.T) {
for _, bucket := range []string{"dependency_dashboard", "hive_advisory"} {
in := IssueStageInput{Repo: "o/r", Number: 45, Labels: []string{"triage/accepted", "needs-human", stagelabels.IssueNeedsDecision.Label()}, Bucket: bucket}
if d := issueStageDecision(in, nil); d.Stage != stagelabels.None || !strings.Contains(d.Reason, "standing meta issue") {
t.Fatalf("%s: decision = %+v, want no stage", bucket, d)
}
}

srv := newStageFactsServer(t, "triage/accepted", "kind/cleanup", "needs-human", stagelabels.IssueNeedsDecision.Label())
srv.title, srv.login = "Dependency Dashboard", "mergeraptor[bot]"
c := testClient(t, srv.srv.URL)
if err := c.StageFacts().Parked(context.Background(), c.IssueStageRef("o/r", 7), "needs-human"); err != nil {
t.Fatal(err)
}
labels, added, removed := srv.snapshot()
if stagelabels.Current(labels) != stagelabels.None || len(added) != 0 || strings.Join(removed, ",") != stagelabels.IssueNeedsDecision.Label() {
t.Fatalf("labels=%v added=%v removed=%v, want 045 removed and nothing added", labels, added, removed)
}
if !issueHasLabel(labels, "needs-human") {
t.Fatalf("labels = %v: the bot's needs-human is not the hive's to remove", labels)
}

f, err := c.enrichStageFacts(context.Background(), stageengine.Facts{Ref: c.IssueStageRef("o/r", 7), Issue: &stageengine.IssueFacts{Bucket: stageengine.BucketActionable}})
if err != nil {
t.Fatal(err)
}
if f.Issue.Bucket != stageengine.BucketDependencyDashboard {
t.Fatalf("bucket = %q, want dependency_dashboard", f.Issue.Bucket)
}
}
21 changes: 15 additions & 6 deletions src/pkg/stageengine/derive_issue.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@ import (
// mapping is pinned byte-for-byte on both sides of the move.

const (
reasonIssueNotIssue = "stage facts: not an issue"
reasonIssueNoBucket = "stage facts: no enumeration bucket for the issue"
reasonIssueClosed = "closed"
reasonIssueLikelyDone = "merged PR awaiting confirmation"
reasonIssueActionable = "actionable"
reasonIssueOpenPR = "open PR covers it"
reasonIssueNotIssue = "stage facts: not an issue"
reasonIssueNoBucket = "stage facts: no enumeration bucket for the issue"
// reasonIssueStandingMeta prefixes the bucket of a standing meta issue.
reasonIssueStandingMeta = "standing meta issue, not work: "
reasonIssueClosed = "closed"
reasonIssueLikelyDone = "merged PR awaiting confirmation"
reasonIssueActionable = "actionable"
reasonIssueOpenPR = "open PR covers it"
// reasonIssueOpenPRPartial is 040 under a PR that references the issue
// without closing it (ClaimFact.Partial); ReasonIsPartialCover reads it.
reasonIssueOpenPRPartial = "open PR addresses part of it (references it without a closing keyword)"
Expand Down Expand Up @@ -137,6 +139,13 @@ func issueTriageClear(f Facts, stage stagelabels.Stage) []string {
// belongs to the PR, whose stage the reason names).
func issueStage(f Facts) (stage stagelabels.Stage, covered bool, reason string) {
is := f.Issue
// A standing meta issue is a control panel or a report, never work:
// projectbluefin/gutenprint-printer-app#45, ps-printer-app#50 and
// hplip-printer-app#42 (mergeraptor's Dependency Dashboards) wore
// stage/045 because a triage bot added `needs-human`.
if is.Bucket == BucketDependencyDashboard || is.Bucket == BucketHiveAdvisory {
return stagelabels.None, false, reasonIssueStandingMeta + string(is.Bucket)
}
if is.LikelyDone {
return stagelabels.None, false, reasonIssueLikelyDone
}
Expand Down
8 changes: 8 additions & 0 deletions src/pkg/stageengine/derive_issue_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@ func TestDeriveIssueTable(t *testing.T) {
reason string
}{
{"actionable", nil, stagelabels.Actionable, false, "actionable"},
{"dependency dashboard parked by a bot", func(f *Facts) {
f.Issue.Bucket = BucketDependencyDashboard
f.Park.NeedsHuman = true
}, stagelabels.None, false, "standing meta issue, not work: dependency_dashboard"},
{"hive advisory with a decision label", func(f *Facts) {
f.Issue.Bucket = BucketHiveAdvisory
f.Park.DecisionLabel = "stage/045-needs-decision"
}, stagelabels.None, false, "standing meta issue, not work: hive_advisory"},
{"reporter triage bucket", func(f *Facts) {
f.Issue.Bucket = BucketReporterTriage
f.Issue.TriageAwaiting = "reporter-trust gate: awaiting the triage label"
Expand Down
6 changes: 6 additions & 0 deletions src/pkg/stageengine/facts.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,12 @@ const (
// (#9665) holds out until a maintainer adds the triage label; it
// derives 015-triage-needed.
BucketReporterTriage IssueBucket = "reporter_triage"
// BucketDependencyDashboard and BucketHiveAdvisory are the standing meta
// issues (a bot's Dependency Dashboard, the hive's own advisory report):
// structurally not work, so they derive no stage at all — not even 045
// from a `needs-human` a triage bot put on them.
BucketDependencyDashboard IssueBucket = "dependency_dashboard"
BucketHiveAdvisory IssueBucket = "hive_advisory"
)

// IssueFacts is the issue-side evidence.
Expand Down
Loading