diff --git a/changelog.d/fixed-stage-tracker-blocked-by.md b/changelog.d/fixed-stage-tracker-blocked-by.md new file mode 100644 index 0000000000..144ca9d017 --- /dev/null +++ b/changelog.d/fixed-stage-tracker-blocked-by.md @@ -0,0 +1 @@ +- The stage tracker now surfaces an Actionable issue the scheduler withholds for an open GitHub "blocked by" dependency: the row wears the `blocked` modifier, the chip and tooltip name the blocker(s), the payload carries `blocked_on`, and the caption reads "waiting on #N" instead of plain "waiting for the scanner" — sequenced RFC sub-issues no longer look like intake starvation (hivecommons/hive#14765). diff --git a/src/pkg/dashboard/stage_tracker.go b/src/pkg/dashboard/stage_tracker.go index 281077acf6..9f4dd9fb03 100644 --- a/src/pkg/dashboard/stage_tracker.go +++ b/src/pkg/dashboard/stage_tracker.go @@ -325,7 +325,13 @@ type StageTrackerItem struct { // issue at 020 or later (015 is not a gate; the reconciler removes the // label on its next pass, hivecommons/hive#14586). Rendered as a muted // operator tooltip, never as the stage word. - StaleLabels []string `json:"stale_labels,omitempty"` + StaleLabels []string `json:"stale_labels,omitempty"` + // BlockedOn lists the open GitHub "blocked by" dependencies ("repo#N") + // of an issue the scheduler withholds from every kick until they close + // (scheduler.partitionBlockedIssues). Without it a sequenced sub-issue + // read as plain Actionable nobody was picking up (hivecommons/hive#14765); + // the row wears the `blocked` modifier and the caption names the wait. + BlockedOn []string `json:"blocked_on,omitempty"` NudgeCount int `json:"nudge_count,omitempty"` LastNudgeAt *time.Time `json:"last_nudge_at,omitempty"` AdoptedBy int `json:"adopted_by,omitempty"` @@ -674,6 +680,10 @@ func (s *Server) stageTrackerSentinel(verifier *github.ReviewEvidenceVerifier, r } return alert, findings, reason } + +// stageTrackerModifierOrder is the modifier precedence the payload carries. +var stageTrackerModifierOrder = []string{modStalled, modRegressed, modHold, modUnauthorized, modNeedsHuman, modNeedsDecision, modNeedsTriage, modPossibleDupe, modNeedsRebase, modBlocked, modDraft} + func stageTrackerModifiers(labels []string, hiveID string, rec stagelabels.Record, hasRec bool, overrides map[string]time.Duration, now time.Time, draft bool) []string { set := map[string]bool{} for _, l := range labels { @@ -718,7 +728,7 @@ func stageTrackerModifiers(labels []string, hiveID string, rec stagelabels.Recor set[modDraft] = true } out := make([]string, 0, len(set)) - for _, m := range []string{modStalled, modRegressed, modHold, modUnauthorized, modNeedsHuman, modNeedsDecision, modNeedsTriage, modPossibleDupe, modNeedsRebase, modBlocked, modDraft} { + for _, m := range stageTrackerModifierOrder { if set[m] { out = append(out, m) } @@ -726,6 +736,44 @@ func stageTrackerModifiers(labels []string, hiveID string, rec stagelabels.Recor return out } +// stageTrackerBlockedBy marks an open issue the scheduler is deliberately +// holding back for unresolved GitHub "blocked by" dependencies +// (hivecommons/hive#14765). The kick list already withholds such issues +// ("Blocked by open dependencies … do NOT start these"), but the tracker +// showed them as plain Actionable with reason `actionable`, so sequenced +// sub-issues of an RFC read as intake starvation. The row gets the same +// `blocked` modifier the `blocked` label yields, the blocker keys, and a +// caption clause naming what it waits on. Only the pre-claim stages +// qualify: once a claim or PR exists the sequencing no longer gates it. +func stageTrackerBlockedBy(it *StageTrackerItem, blockers []string) { + if it == nil || len(blockers) == 0 || it.Stage > trackerNumberPossiblyExists { + return + } + it.BlockedOn = append([]string(nil), blockers...) + if !slices.Contains(it.Modifiers, modBlocked) { + it.Modifiers = append(it.Modifiers, modBlocked) + slices.SortFunc(it.Modifiers, func(a, b string) int { + return slices.Index(stageTrackerModifierOrder, a) - slices.Index(stageTrackerModifierOrder, b) + }) + } + it.Caption = joinClause(it.Caption, "waiting on "+stageTrackerBlockerList(it.Repo, blockers)) + it.Actor = "its blockers" +} + +// stageTrackerBlockerList renders blocker keys ("repo#N") for a caption, +// shortening a same-repo blocker to "#N". +func stageTrackerBlockerList(repo string, blockers []string) string { + parts := make([]string, 0, len(blockers)) + for _, b := range blockers { + b = strings.TrimSpace(b) + if r, n, ok := strings.Cut(b, "#"); ok && (r == "" || strings.EqualFold(r, repo) || strings.HasSuffix(strings.ToLower(repo), "/"+strings.ToLower(r))) { + b = "#" + n + } + parts = append(parts, b) + } + return strings.Join(parts, ", ") +} + // noVerdictClause is the bare no-verdict clause; stageTrackerCaption swaps // in "awaiting review of head " when the item's head is known. const noVerdictClause = "no review verdict yet" @@ -1317,6 +1365,7 @@ func (s *Server) buildStageTracker(status *StatusPayload, store *stagelabels.Sto stage, rec, ok = stagelabels.None, stagelabels.Record{}, false } finish(&it, issue.Labels, stage, rec, ok, false) + stageTrackerBlockedBy(&it, issue.OpenBlockers()) if it.Stage == trackerNumberClaimed { it.ClaimantKind = s.stageTrackerClaimantKind(repoName, issue.Number) } diff --git a/src/pkg/dashboard/stage_tracker_blocked_by_test.go b/src/pkg/dashboard/stage_tracker_blocked_by_test.go new file mode 100644 index 0000000000..51618fb677 --- /dev/null +++ b/src/pkg/dashboard/stage_tracker_blocked_by_test.go @@ -0,0 +1,96 @@ +package dashboard + +import ( + "strings" + "testing" + "time" + + "github.com/hivecommons/hive/pkg/github" +) + +// An Actionable issue the scheduler withholds for an open GitHub "blocked +// by" dependency must say so: `blocked` modifier, the blocker keys, and a +// caption naming the wait (hivecommons/hive#14765). Once the dependency +// resolves, or the issue is past the gate (claimed, covered by a PR), the +// row is untouched. +func TestStageTrackerBlockedByDependencyIsSurfaced(t *testing.T) { + now := time.Date(2026, 10, 23, 9, 0, 0, 0, time.UTC) + s := newTestServer() + + status := minimalPayload() + status.Repos = []FrontendRepo{{ + Name: "hive", Full: "hivecommons/hive", + ActionableIssues: []any{ + github.Issue{Number: 14635, Title: "search: index", Author: "pat", AuthorIsHuman: true, + Labels: []string{"stage/010-actionable"}, + DependsOn: []github.IssueDependency{{Key: "hive#14633"}, {Key: "hivecommons/crux#19"}, {Key: "hive#14600", Resolved: true}}}, + github.Issue{Number: 14636, Title: "search: ready", Author: "pat", AuthorIsHuman: true, + Labels: []string{"stage/010-actionable"}, + DependsOn: []github.IssueDependency{{Key: "hive#14600", Resolved: true}}}, + github.Issue{Number: 14637, Title: "search: claimed", Author: "pat", AuthorIsHuman: true, + Labels: []string{"stage/020-claimed"}, + DependsOn: []github.IssueDependency{{Key: "hive#14633"}}}, + github.Issue{Number: 14638, Title: "search: labelled and linked", Author: "pat", AuthorIsHuman: true, + Labels: []string{"stage/010-actionable", "blocked"}, + DependsOn: []github.IssueDependency{{Key: "hive#14633"}}}, + }, + }} + s.UpdateStatus(status) + resp := s.buildStageTracker(s.status, s.stageStore, now) + + blocked := trackerItem(t, resp, "issue", 14635) + if blocked.Stage != 10 || !hasMod(blocked, modBlocked) { + t.Errorf("#14635 = stage %d mods %v, want 010 + blocked", blocked.Stage, blocked.Modifiers) + } + if got, want := strings.Join(blocked.BlockedOn, ","), "hive#14633,hivecommons/crux#19"; got != want { + t.Errorf("#14635 blocked_on = %q, want %q (resolved blocker dropped, sorted)", got, want) + } + if !strings.HasSuffix(blocked.Caption, "waiting on #14633, hivecommons/crux#19") { + t.Errorf("#14635 caption = %q, want it to end naming the blockers", blocked.Caption) + } + if blocked.Actor != "its blockers" { + t.Errorf("#14635 actor = %q, want its blockers", blocked.Actor) + } + + ready := trackerItem(t, resp, "issue", 14636) + if hasMod(ready, modBlocked) || ready.BlockedOn != nil || strings.Contains(ready.Caption, "waiting on") { + t.Errorf("#14636 with only resolved deps = mods %v blocked_on %v caption %q, want plain Actionable", ready.Modifiers, ready.BlockedOn, ready.Caption) + } + + claimed := trackerItem(t, resp, "issue", 14637) + if claimed.Stage != 20 || hasMod(claimed, modBlocked) || claimed.BlockedOn != nil { + t.Errorf("#14637 past the gate = stage %d mods %v blocked_on %v, want 020 untouched", claimed.Stage, claimed.Modifiers, claimed.BlockedOn) + } + + labelled := trackerItem(t, resp, "issue", 14638) + if n := countMod(labelled, modBlocked); n != 1 { + t.Errorf("#14638 with label and dependency carries blocked ×%d, want once: %v", n, labelled.Modifiers) + } +} + +func TestStageTrackerBlockerList(t *testing.T) { + cases := []struct { + repo string + in []string + want string + }{ + {"hive", []string{"hive#1"}, "#1"}, + {"hivecommons/hive", []string{"hive#1", "hivecommons/hive#2"}, "#1, #2"}, + {"hive", []string{"hivecommons/crux#19", "#3"}, "hivecommons/crux#19, #3"}, + } + for _, c := range cases { + if got := stageTrackerBlockerList(c.repo, c.in); got != c.want { + t.Errorf("stageTrackerBlockerList(%q, %v) = %q, want %q", c.repo, c.in, got, c.want) + } + } +} + +func countMod(it StageTrackerItem, m string) int { + n := 0 + for _, x := range it.Modifiers { + if x == m { + n++ + } + } + return n +} diff --git a/src/pkg/dashboard/static/index.html b/src/pkg/dashboard/static/index.html index dee1a4c419..f7a33420f2 100644 --- a/src/pkg/dashboard/static/index.html +++ b/src/pkg/dashboard/static/index.html @@ -14282,6 +14282,8 @@

Where to get help

const handled = stageTrackerRegressionHandled(item); if (handled && mods.length > 1) mods.push(mods.shift()); let text = handled && mods[0] === 'regressed' ? STAGE_TRACKER_HANDLED_TEXT : (STAGE_TRACKER_MOD_TEXT[mods[0]] || mods[0].replace(/-/g, ' ')); + // A row the scheduler withholds for open GitHub "blocked by" dependencies names them (hivecommons/hive#14765). + if (mods[0] === 'blocked' && Array.isArray(item.blocked_on) && item.blocked_on.length) text = stageTrackerBlockedTip(item); // A blocked row with a hive:recheck-after deadline ("blocked until ") names when the sweep re-checks it. const recheck = mods[0] === 'blocked' ? /^blocked until (\S+)/i.exec(String(item.bucket_reason || '')) : null; const recheckMs = recheck ? Date.parse(recheck[1]) : NaN; @@ -14289,7 +14291,8 @@

Where to get help

// The regressed pill (lead or folded into "+1") explains itself on hover. const regressed = stageTrackerRegressionText(item, Date.now()); // An unauthorized pill names the missing App permission and the human step. - const tip = (mods.indexOf('unauthorized') >= 0 && String(item.unauthorized || '').trim()) || regressed; + const tip = (mods.indexOf('unauthorized') >= 0 && String(item.unauthorized || '').trim()) || regressed + || (mods.indexOf('blocked') >= 0 && Array.isArray(item.blocked_on) && item.blocked_on.length ? 'Withheld from the scanner until ' + item.blocked_on.join(', ') + (item.blocked_on.length > 1 ? ' close' : ' closes') : ''); const cls = 'ham-mod-' + mods[0] + (handled && mods[0] === 'regressed' ? ' ham-mod-handled' : ''); return sentinel + `${esc(text)}${mods.length > 1 ? ' +' + (mods.length - 1) : ''}`; }