Skip to content
Closed
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-14765-stage-dependency-blockers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- The stage tracker now marks issues waiting on open GitHub dependencies as blocked, names their predecessors, and shows โ€œActionable ยท blockedโ€ instead of implying they are waiting for a worker ([#14765](https://github.com/hivecommons/hive/issues/14765)).
13 changes: 11 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 @@ -267,6 +267,9 @@
// stage/085 on a PR carried as a park signal), needs-rebase, blocked,
// draft.
Modifiers []string `json:"modifiers"`
// BlockedBy lists the canonical work keys of unresolved dependencies.
// Resolved predecessors are omitted; labels alone do not populate it.
BlockedBy []string `json:"blocked_by,omitempty"`
// RegressedFrom / RegressedTo / RegressedAt / RegressedReason narrate
// the unresolved regression behind the `regressed` modifier: the
// high-water stage the item fell from, the stage that fall landed on
Expand Down Expand Up @@ -749,14 +752,20 @@
if it == nil || len(blockers) == 0 || it.Stage > trackerNumberPossiblyExists {
return
}
it.BlockedOn = append([]string(nil), blockers...)
it.BlockedOn = slices.Compact(append([]string(nil), blockers...))
it.BlockedBy = append([]string(nil), it.BlockedOn...)
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))
waiting := "waiting on " + stageTrackerBlockerList(it.Repo, it.BlockedOn)
if it.Stage == trackerNumberActionable {
it.Caption = "Triaged, but blocked; " + waiting
} else {
it.Caption = joinClause(it.Caption, waiting)
}
it.Actor = "its blockers"
}

Expand Down
2 changes: 1 addition & 1 deletion src/pkg/dashboard/stage_tracker_blocked_by_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func TestStageTrackerBlockedByDependencyIsSurfaced(t *testing.T) {
}

claimed := trackerItem(t, resp, "issue", 14637)
if claimed.Stage != 20 || hasMod(claimed, modBlocked) || claimed.BlockedOn != nil {
if claimed.Stage != 20 || hasMod(claimed, modBlocked) || claimed.BlockedOn != nil || claimed.BlockedBy != nil {
t.Errorf("#14637 past the gate = stage %d mods %v blocked_on %v, want 020 untouched", claimed.Stage, claimed.Modifiers, claimed.BlockedOn)
}

Expand Down
91 changes: 91 additions & 0 deletions src/pkg/dashboard/stage_tracker_blocked_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
package dashboard

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

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

func TestStageTrackerOpenDependencies(t *testing.T) {
now := time.Date(2026, 10, 28, 1, 0, 0, 0, time.UTC)
for _, tc := range []struct {
name string
labels []string
deps []github.IssueDependency
want []string
}{
{
name: "open blockers without label",
deps: []github.IssueDependency{
{Key: "acme/console#7"}, {Key: "acme/console#3", Resolved: true},
{Key: "acme/console#6"}, {Key: "acme/console#7"}, {},
{Key: "acme/console-api#8"},
},
want: []string{"acme/console#6", "acme/console#7", "acme/console-api#8"},
},
{
name: "open blocker and label", labels: []string{"blocked"},
deps: []github.IssueDependency{{Key: "acme/console#7"}}, want: []string{"acme/console#7"},
},
{name: "resolved blockers", deps: []github.IssueDependency{{Key: "acme/console#7", Resolved: true}, {}}},
{name: "no dependencies"},
{name: "label only", labels: []string{"blocked"}},
} {
t.Run(tc.name, func(t *testing.T) {
s := newTestServer()
store := stagelabels.NewStore("", func() time.Time { return now })
store.Observe(stagelabels.Key("acme/console", 21), stagelabels.Actionable, "actionable")
status := minimalPayload()
status.Repos = []FrontendRepo{{Name: "console", Full: "acme/console", ActionableIssues: []any{
github.Issue{Number: 21, Title: "Waiting work", Labels: tc.labels, DependsOn: tc.deps},
}}}
s.UpdateStatus(status)
resp := s.buildStageTracker(s.status, store, now)
it := trackerItem(t, resp, "issue", 21)
if it.Stage != trackerNumberActionable || it.Reason != "actionable" {
t.Fatalf("dependency display must preserve the stage and reason: %+v", it)
}
if !slices.Equal(it.BlockedBy, tc.want) {
t.Fatalf("blocked_by = %v, want %v", it.BlockedBy, tc.want)
}
wantBlocked := len(tc.want) > 0 || slices.Contains(tc.labels, "blocked")
count := 0
for _, mod := range it.Modifiers {
if mod == modBlocked {
count++
}
}
if (count == 1) != wantBlocked || count > 1 {
t.Fatalf("blocked modifier count = %d, want blocked=%v", count, wantBlocked)
}
if len(tc.want) > 0 {
if !strings.Contains(it.Caption, "waiting on #") || strings.Contains(it.Caption, "waiting for the scanner") || it.Actor != "its blockers" {
t.Fatalf("blocked work must explain the wait: %+v", it)
}
for _, key := range tc.want {
ref := key
if number, ok := strings.CutPrefix(key, "acme/console#"); ok {
ref = "#" + number
}
if !strings.Contains(it.Caption, ref) {
t.Errorf("caption %q omits %s", it.Caption, ref)
}
}
} else if it.Actor != "scanner" || !strings.Contains(it.Caption, "waiting for the scanner") {
t.Fatalf("no unresolved dependencies should preserve the normal caption: %+v", it)
}
body, err := json.Marshal(it)
if err != nil {
t.Fatal(err)
}
if strings.Contains(string(body), `"blocked_by"`) != (len(tc.want) > 0) {
t.Fatalf("blocked_by must be present only for unresolved dependencies: %s", body)
}
})
}
}
12 changes: 12 additions & 0 deletions src/pkg/dashboard/stage_tracker_ui_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,18 @@ assert.deepStrictEqual(segStates(row), ['active ham-open-blocked ham-open-stale'
assert.ok(strip(row).includes(' โ€” blocked on acme/api#7 โ€” '), 'a known blocker is named: ' + strip(row));
assert.strictEqual(stageTrackerBlockedTip({ blocked_on: ['acme/api#7', 'acme/api#8'] }), 'blocked on acme/api#7, acme/api#8');
assert.strictEqual(stageTrackerBlockedTip({}), 'carries the blocked label');
// GitHub dependency blockers keep stage 010 but must not look starved for a worker.
const dependencyBlocked = { repo: 'acme/console', number: 14635, kind: 'issue', title: 'Sequenced work', stage: 10, modifiers: ['blocked'], blocked_by: ['acme/console#7', 'acme/api#8'], caption: 'Triaged, but blocked; waiting on #7, acme/api#8' };
row = stageTrackerRowHtml(dependencyBlocked, stages, ctx);
assert.strictEqual(stageTrackerHeadline(dependencyBlocked), 'Actionable ยท blocked');
assert.ok(strip(row).includes('<span class="ham-seg-t">Actionable ยท blocked</span>'), row);
assert.deepStrictEqual(segStates(row), [D, 'active ham-open-blocked', T, T, T, T, 'todo cap'], 'only the active Actionable step shows the block');
assert.ok(strip(row).includes('blocked on acme/console#7, acme/api#8'), row);
assert.ok(tooltip(row).includes('waiting on #7, acme/api#8'), row);
assert.ok(row.includes('>blocked</span>'), 'the existing modifier pill must render');
assert.strictEqual(stageTrackerCurrentStageHtml(dependencyBlocked, stages, null, now), '<p class="ham-current-stage">Actionable ยท blocked</p>');
assert.strictEqual(stageTrackerHeadline({ stage: 10, modifiers: [] }), 'Waiting for a worker');
assert.strictEqual(stageTrackerSegments({ stage: 10, modifiers: [] }, stages, now).find(s => s.state === 'active').short, 'Actionable');
row = stageTrackerRowHtml({ repo: 'acme/console', number: 29, kind: 'issue', title: 'Blocked no since', stage: 0, created_at: new Date(now - 3 * 86400000).toISOString(), modifiers: ['blocked'] }, stages, ctx);
assert.strictEqual(openWord(row), 'Open ยท blocked ยท since 3d', 'created_at fallback in the chevron');
assert.ok(row.includes('<span class="ham-since">3d</span>'), 'created_at fallback in the since column: ' + row);
Expand Down
14 changes: 7 additions & 7 deletions src/pkg/dashboard/static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13930,7 +13930,7 @@ <h3 class="faq-group-title">Where to get help</h3>
const viaPR = item.kind === 'issue' && n >= 50 && (n !== 85 || item.via_pr) ? ' (its PR)' : '';
switch (n) {
case 0: return 'Open';
case 10: return 'Waiting for a worker';
case 10: return mods.indexOf('blocked') >= 0 ? 'Actionable ยท blocked' : 'Waiting for a worker';
case 15: return 'Triage needed';
case 17: return 'Possibly exists ยท needs author';
case 20: return 'Claimed';
Expand Down Expand Up @@ -13970,10 +13970,10 @@ <h3 class="faq-group-title">Where to get help</h3>
});
}

// The Open ยท blocked chevron's reason: the blocker when the payload names
// one (`blocked_on`: "owner/repo#N" or a list of them), else the label.
// Blocked chevrons name unresolved dependencies, falling back to the
// older blocked_on field or the label when no dependency is known.
function stageTrackerBlockedTip(item) {
const on = item && item.blocked_on;
const on = item && (item.blocked_by || item.blocked_on);
const refs = (Array.isArray(on) ? on : (on ? [on] : [])).map(r => String(r || '').trim()).filter(Boolean);
return refs.length ? 'blocked on ' + refs.join(', ') : 'carries the blocked label';
}
Expand Down Expand Up @@ -14037,9 +14037,9 @@ <h3 class="faq-group-title">Where to get help</h3>
const mods = Array.isArray(item.modifiers) ? item.modifiers : [];
const openHold = n === 0 && state === 'active' && mods.indexOf('hold') >= 0;
// hold is a human instruction, so it wins over blocked when both are present.
const openBlocked = n === 0 && state === 'active' && !openHold && mods.indexOf('blocked') >= 0;
const stepBlocked = (n === 0 || (n === 10 && cur === 10)) && state === 'active' && !openHold && mods.indexOf('blocked') >= 0;
if (openHold) word = 'Open ยท hold';
else if (openBlocked) word = 'Open ยท blocked';
else if (stepBlocked) word = n === 10 ? 'Actionable ยท blocked' : 'Open ยท blocked';
// A plain or blocked Open step (no stage label, not held) says how
// long it has sat there, from the same instant the since column
// shows โ€” a stale blocked item is exactly what should stand out.
Expand All @@ -14048,7 +14048,7 @@ <h3 class="faq-group-title">Where to get help</h3>
const os = stageTrackerOpenSince(item);
if (os.ms) { word += ' ยท since ' + stageTrackerShortAgo(nowMs - os.ms); openSince = Object.assign({ stale: nowMs - os.ms > STAGE_TRACKER_OPEN_STALE_DAYS * 86400000 }, os); }
}
return { number: n, code: n ? String(n).padStart(3, '0') : '', short: word, label: tipStage.label || st.label || String(n), description: tipStage.description || st.description || '', state, terminal: false, detour: n === anchor ? detour : null, hold: openHold, blocked: openBlocked, openSince };
return { number: n, code: n ? String(n).padStart(3, '0') : '', short: word, label: tipStage.label || st.label || String(n), description: tipStage.description || st.description || '', state, terminal: false, detour: n === anchor ? detour : null, hold: openHold, blocked: stepBlocked, openSince };
});
segs.push({ number: STAGE_TRACKER_TERMINAL, code: '', short: 'Merged', label: 'Merged', description: 'Merged โ€” the pipeline is complete', state: terminal ? 'active' : 'todo', terminal, cap: true, detour: null });
return segs;
Expand Down
Loading