From e434e240768cdf617e5d094b2ea29b48f5d21999 Mon Sep 17 00:00:00 2001 From: thatguywob Date: Wed, 28 Oct 2026 01:07:53 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix:=20expose=20open=20dependenc?= =?UTF-8?q?y=20blockers=20in=20stage=20tracker?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Show unresolved dependency keys and waiting captions alongside the blocked modifier. Mark the active Actionable step as blocked so operators can distinguish sequencing from scanner starvation. Hive-Run: hivecommons/hive#14765 Hive-Plan: stage-tracker-dependency-visibility Hive-Spec: issue-14765#expected Co-authored-by: clubanderson <407614+clubanderson@users.noreply.github.com> Signed-off-by: thatguywob --- .../fixed-14765-stage-dependency-blockers.md | 1 + src/pkg/dashboard/stage_tracker.go | 13 ++- .../stage_tracker_blocked_by_test.go | 2 +- .../dashboard/stage_tracker_blocked_test.go | 91 +++++++++++++++++++ src/pkg/dashboard/stage_tracker_ui_test.go | 12 +++ src/pkg/dashboard/static/index.html | 14 +-- 6 files changed, 123 insertions(+), 10 deletions(-) create mode 100644 changelog.d/fixed-14765-stage-dependency-blockers.md create mode 100644 src/pkg/dashboard/stage_tracker_blocked_test.go diff --git a/changelog.d/fixed-14765-stage-dependency-blockers.md b/changelog.d/fixed-14765-stage-dependency-blockers.md new file mode 100644 index 0000000000..3ae7d59ffc --- /dev/null +++ b/changelog.d/fixed-14765-stage-dependency-blockers.md @@ -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)). diff --git a/src/pkg/dashboard/stage_tracker.go b/src/pkg/dashboard/stage_tracker.go index 00cb6088dc..e9aaf16671 100644 --- a/src/pkg/dashboard/stage_tracker.go +++ b/src/pkg/dashboard/stage_tracker.go @@ -267,6 +267,9 @@ type StageTrackerItem struct { // 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 @@ -749,14 +752,20 @@ func stageTrackerBlockedBy(it *StageTrackerItem, blockers []string) { 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" } diff --git a/src/pkg/dashboard/stage_tracker_blocked_by_test.go b/src/pkg/dashboard/stage_tracker_blocked_by_test.go index 51618fb677..cf7bc41477 100644 --- a/src/pkg/dashboard/stage_tracker_blocked_by_test.go +++ b/src/pkg/dashboard/stage_tracker_blocked_by_test.go @@ -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) } diff --git a/src/pkg/dashboard/stage_tracker_blocked_test.go b/src/pkg/dashboard/stage_tracker_blocked_test.go new file mode 100644 index 0000000000..32aff2ddd3 --- /dev/null +++ b/src/pkg/dashboard/stage_tracker_blocked_test.go @@ -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) + } + }) + } +} diff --git a/src/pkg/dashboard/stage_tracker_ui_test.go b/src/pkg/dashboard/stage_tracker_ui_test.go index 559d9a12f7..c086913f9c 100644 --- a/src/pkg/dashboard/stage_tracker_ui_test.go +++ b/src/pkg/dashboard/stage_tracker_ui_test.go @@ -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('Actionable · blocked'), 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'), 'the existing modifier pill must render'); +assert.strictEqual(stageTrackerCurrentStageHtml(dependencyBlocked, stages, null, now), '

Actionable · blocked

'); +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('3d'), 'created_at fallback in the since column: ' + row); diff --git a/src/pkg/dashboard/static/index.html b/src/pkg/dashboard/static/index.html index df56424e2d..55497d01e0 100644 --- a/src/pkg/dashboard/static/index.html +++ b/src/pkg/dashboard/static/index.html @@ -13930,7 +13930,7 @@

Where to get help

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'; @@ -13970,10 +13970,10 @@

Where to get help

}); } - // 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'; } @@ -14037,9 +14037,9 @@

Where to get help

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. @@ -14048,7 +14048,7 @@

Where to get help

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;