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-stage-tracker-blocked-by.md
Original file line number Diff line number Diff line change
@@ -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).
53 changes: 51 additions & 2 deletions src/pkg/dashboard/stage_tracker.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
package dashboard

import (
Expand Down Expand Up @@ -325,7 +325,13 @@
// 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"`
Expand Down Expand Up @@ -674,6 +680,10 @@
}
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 {
Expand Down Expand Up @@ -718,14 +728,52 @@
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)
}
}
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 <sha7>" when the item's head is known.
const noVerdictClause = "no review verdict yet"
Expand Down Expand Up @@ -1317,6 +1365,7 @@
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)
}
Expand Down
96 changes: 96 additions & 0 deletions src/pkg/dashboard/stage_tracker_blocked_by_test.go
Original file line number Diff line number Diff line change
@@ -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
}
5 changes: 4 additions & 1 deletion src/pkg/dashboard/static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14282,14 +14282,17 @@ <h3 class="faq-group-title">Where to get help</h3>
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 <RFC3339>") 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;
if (!isNaN(recheckMs)) text += ' · re-check at ' + agentNowClockTime(recheckMs, Date.now());
// 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 + `<span class="ham-badge ham-badge-mod ${esc(cls)}"${tip ? ` title="${esc(tip)}"` : ''}>${esc(text)}${mods.length > 1 ? ' +' + (mods.length - 1) : ''}</span>`;
}
Expand Down
Loading