diff --git a/changelog.d/fixed-16481-tracking-parent-word.md b/changelog.d/fixed-16481-tracking-parent-word.md new file mode 100644 index 0000000000..6da612447c --- /dev/null +++ b/changelog.d/fixed-16481-tracking-parent-word.md @@ -0,0 +1 @@ +- The activity monitor no longer shows a decomposed parent issue that is waiting on open child issues as a stuck *Actionable* row "waiting for the scanner to pick it up": the lit step reads `Tracking · 3/4` (or `Tracking · N open children`), the caption and actor name the open children, and the item carries `open_children` ([#16481](https://github.com/hivecommons/hive/issues/16481)). diff --git a/src/docs/dashboard-sections.md b/src/docs/dashboard-sections.md index e8a9246a4b..aebdf8bdaa 100644 --- a/src/docs/dashboard-sections.md +++ b/src/docs/dashboard-sections.md @@ -33,6 +33,7 @@ These words have a special meaning in Hive. Each entry explains them again the f - **Autonomy level:** how much Hive may do on its own, from L1 (watch only) to L6 (works and merges on its own). Hive calls this the ACMM level. - **Tracked:** an issue or pull request that Hive has put on its work list after its filters ran. - **Actionable:** a tracked item that Hive could work on now, because nothing is waiting on a person. +- **Tracking:** an actionable issue that was split into child issues and still has some open. The activity monitor lights its Actionable step as `Tracking · 3/4` (children done / total) instead of *Actionable*, and its caption names the open children: the scanner leaves such a parent to its children, so the time on the step is not scanner delay ([#16481](https://github.com/hivecommons/hive/issues/16481)). - **Held:** an item someone parked on purpose by adding a hold label, such as `hold` or `on-hold`. Hive leaves it alone. - **Outside:** an open item that Hive's filters kept off its work list, for example because of a label. - **Band:** a group the dashboard puts an issue or pull request in, named after what it needs next. Bands are for display only. diff --git a/src/pkg/dashboard/stage_tracker.go b/src/pkg/dashboard/stage_tracker.go index e3151ae0ef..3bac8363f4 100644 --- a/src/pkg/dashboard/stage_tracker.go +++ b/src/pkg/dashboard/stage_tracker.go @@ -296,6 +296,12 @@ type StageTrackerItem struct { ClaimReference bool `json:"claim_reference,omitempty"` IsTracker bool `json:"is_tracker,omitempty"` Children *github.IssueChildren `json:"children,omitempty"` + // OpenChildren is how many sub-issues of a decomposed parent are still + // open (the stage engine's "waiting on N open child issue(s)" suffix on + // a 010 reason). Non-zero means the parent is tracking its children, + // not waiting on the scanner, and the row reads "Tracking", not + // "Actionable" (hivecommons/hive#16481). + OpenChildren int `json:"open_children,omitempty"` // Labels are the item's GitHub labels as the snapshot saw them, so the // dashboard can offer a label filter without a second endpoint. Labels []string `json:"labels,omitempty"` diff --git a/src/pkg/dashboard/stage_tracker_actor.go b/src/pkg/dashboard/stage_tracker_actor.go index 70c021f41b..04ad7962ce 100644 --- a/src/pkg/dashboard/stage_tracker_actor.go +++ b/src/pkg/dashboard/stage_tracker_actor.go @@ -177,6 +177,9 @@ func stageTrackerStageActorOf(it StageTrackerItem, workers map[string]stageTrack } return set(StageActorNone, "", "not in any stage yet — the stage engine has not classified it") case stagelabels.Actionable: + if it.OpenChildren > 0 { + return set(StageActorNone, "", stageTrackerTrackingWhy(it.OpenChildren)) + } return set(StageActorHive, "", "waiting for the scanner to pick it up") case stagelabels.TriageNeeded: return set(StageActorHuman, "", "no maintainer has triaged it yet") diff --git a/src/pkg/dashboard/stage_tracker_build.go b/src/pkg/dashboard/stage_tracker_build.go index a354c6fb80..b4f3852409 100644 --- a/src/pkg/dashboard/stage_tracker_build.go +++ b/src/pkg/dashboard/stage_tracker_build.go @@ -181,6 +181,7 @@ func (s *Server) buildStageTracker(status *StatusPayload, store *stagelabels.Sto } stageTrackerApplyMergeTrain(it) it.Caption, it.Actor = stageTrackerCaption(stage, it.Reason, it.Author, it.Kind, it.Mirrored, rec, hasRec, it.LinkedPR, it.Head) + stageTrackerApplyTracking(it, stage) if c := stageTrackerSoakCaption(rec, now); c != "" { it.Caption = c } diff --git a/src/pkg/dashboard/stage_tracker_caption.go b/src/pkg/dashboard/stage_tracker_caption.go index ca75bc7196..acb7557205 100644 --- a/src/pkg/dashboard/stage_tracker_caption.go +++ b/src/pkg/dashboard/stage_tracker_caption.go @@ -1060,3 +1060,35 @@ func stageTrackerStaleDecisionRecord(rec stagelabels.Record, labels []string) bo } return true } + +// stageTrackerTrackingActor is the actor word of a decomposed parent at 010: +// nobody on the parent is due to move; its children carry the work. +const stageTrackerTrackingActor = "its children" + +// stageTrackerTrackingWhy is the stage_actor.why of a decomposed parent at +// 010 waiting on n open children. +func stageTrackerTrackingWhy(n int) string { + return "waiting on " + strconv.Itoa(n) + " open child issue(s) — the scanner does not claim a decomposed parent; its children carry the work" +} + +// stageTrackerApplyTracking rewrites a 010 issue row whose reason carries +// the stage engine's "waiting on N open child issue(s)" suffix: the parent +// is tracking its children, not waiting on the scanner, so the caption and +// actor say so and OpenChildren lets the client draw "Tracking · 3/4" +// instead of "Actionable" (hivecommons/hive#16481). +func stageTrackerApplyTracking(it *StageTrackerItem, stage stagelabels.Stage) { + if it == nil || it.Kind != "issue" || stage != stagelabels.Actionable { + return + } + n := stageengine.ReasonOpenChildren(it.Reason) + if n <= 0 { + return + } + it.OpenChildren = n + head := "Tracking" + if c := it.Children; c != nil && c.Total > 0 { + head += " — " + strconv.Itoa(c.Completed) + " of " + strconv.Itoa(c.Total) + " children done" + } + it.Caption = head + "; waiting on " + strconv.Itoa(n) + " open child issue(s). The scanner leaves a decomposed parent to its children" + it.Actor = stageTrackerTrackingActor +} diff --git a/src/pkg/dashboard/stage_tracker_tracking_test.go b/src/pkg/dashboard/stage_tracker_tracking_test.go new file mode 100644 index 0000000000..9a7ab2f305 --- /dev/null +++ b/src/pkg/dashboard/stage_tracker_tracking_test.go @@ -0,0 +1,97 @@ +package dashboard + +import ( + "strings" + "testing" + "time" + + "github.com/hivecommons/hive/pkg/github" + "github.com/hivecommons/hive/pkg/stageengine" + "github.com/hivecommons/hive/pkg/stagelabels" +) + +// hivecommons/hive#16481: a decomposed parent at 010 whose reason carries +// the engine's "waiting on N open child issue(s)" suffix is tracking its +// children, not waiting on the scanner; the row must say so. + +func TestReasonOpenChildren(t *testing.T) { + cases := map[string]int{ + "actionable; waiting on 1 open child issue(s)": 1, + "open PR addresses part of it (references it without a closing keyword; PR at 050-review-pending); waiting on 2 open child issue(s)": 2, + "actionable": 0, + "": 0, + "actionable; waiting on x open child issue(s)": 0, + } + for reason, want := range cases { + if got := stageengine.ReasonOpenChildren(reason); got != want { + t.Errorf("ReasonOpenChildren(%q) = %d, want %d", reason, got, want) + } + } +} + +func TestStageTrackerTrackingParentIsNotWaitingOnScanner(t *testing.T) { + now := time.Date(2026, 11, 3, 23, 0, 0, 0, time.UTC) + stage := stagelabels.Actionable + it := StageTrackerItem{Kind: "issue", Number: 16242, Stage: stage.Number(), IsTracker: true, + Children: &github.IssueChildren{Total: 4, Completed: 3}, + Reason: "actionable; waiting on 1 open child issue(s)"} + it.Caption, it.Actor = stageTrackerCaption(stage, it.Reason, "hanthor", it.Kind, false, stagelabels.Record{}, false, 0, "") + stageTrackerApplyTracking(&it, stage) + if it.OpenChildren != 1 { + t.Fatalf("OpenChildren = %d, want 1", it.OpenChildren) + } + if !strings.HasPrefix(it.Caption, "Tracking — 3 of 4 children done; waiting on 1 open child issue(s)") || strings.Contains(it.Caption, "scanner to pick it up") { + t.Fatalf("caption still blames the scanner: %q", it.Caption) + } + if it.Actor != stageTrackerTrackingActor { + t.Fatalf("actor = %q, want %q", it.Actor, stageTrackerTrackingActor) + } + it.StageActor = stageTrackerStageActor(it, nil, now) + if it.StageActor.Kind != StageActorNone || !strings.Contains(it.StageActor.Why, "1 open child issue(s)") || strings.Contains(it.StageActor.Why, "pick it up") { + t.Fatalf("stage actor still waits on the scanner: %+v", it.StageActor) + } + + // No children known: the caption still counts the open ones. + only := StageTrackerItem{Kind: "issue", Stage: stage.Number(), Reason: "actionable; waiting on 2 open child issue(s)"} + stageTrackerApplyTracking(&only, stage) + if only.OpenChildren != 2 || !strings.HasPrefix(only.Caption, "Tracking; waiting on 2 open child issue(s)") { + t.Fatalf("count-only parent: %+v", only) + } + + // A plain 010 issue, a PR, and a 040 parent are untouched. + for _, keep := range []struct { + it StageTrackerItem + stage stagelabels.Stage + }{ + {StageTrackerItem{Kind: "issue", Stage: stage.Number(), Reason: "actionable", Caption: "c", Actor: "scanner"}, stage}, + {StageTrackerItem{Kind: "pr", Stage: stage.Number(), Reason: "actionable; waiting on 1 open child issue(s)", Caption: "c", Actor: "scanner"}, stage}, + {StageTrackerItem{Kind: "issue", Stage: 40, Reason: "open PR covers it; waiting on 1 open child issue(s)", Caption: "c", Actor: "its PR"}, stagelabels.CoveredByPR}, + } { + before := keep.it + stageTrackerApplyTracking(&keep.it, keep.stage) + if keep.it.OpenChildren != 0 || keep.it.Caption != before.Caption || keep.it.Actor != before.Actor { + t.Fatalf("row rewritten that should not be: before %+v after %+v", before, keep.it) + } + } + plain := StageTrackerItem{Kind: "issue", Stage: stage.Number(), Reason: "actionable"} + if a := stageTrackerStageActor(plain, nil, now); a.Kind != StageActorHive || !strings.Contains(a.Why, "scanner") { + t.Fatalf("plain 010 issue lost its scanner actor: %+v", a) + } +} + +func TestStageTrackerTrackingWordJS(t *testing.T) { + html := indexHTML(t) + if !strings.Contains(html, `stageTrackerTrackingWord(item)`) { + t.Fatal("tracker-row.js does not consult stageTrackerTrackingWord for the lit 010 chevron") + } + runStageTrackerRowActionsScript(t, `const assert = require('assert'); +`+jsConstLine(t, html, "STAGE_TRACKER_TRACKING_WORD")+"\n"+ + jsFunc(t, html, "stageTrackerTrackingWord")+` +assert.strictEqual(stageTrackerTrackingWord({ kind: 'issue', stage: 10, open_children: 1, children: { total: 4, completed: 3 } }), 'Tracking · 3/4'); +assert.strictEqual(stageTrackerTrackingWord({ kind: 'issue', stage: 10, open_children: 1 }), 'Tracking · 1 open child'); +assert.strictEqual(stageTrackerTrackingWord({ kind: 'issue', stage: 10, open_children: 2 }), 'Tracking · 2 open children'); +assert.strictEqual(stageTrackerTrackingWord({ kind: 'issue', stage: 10, is_tracker: true, children: { total: 6, completed: 0 } }), ''); +assert.strictEqual(stageTrackerTrackingWord({ kind: 'pr', stage: 10, open_children: 1 }), ''); +assert.strictEqual(stageTrackerTrackingWord(null), ''); +`) +} diff --git a/src/pkg/dashboard/static-src/js/tracker-row.js b/src/pkg/dashboard/static-src/js/tracker-row.js index 44dbbe90f8..b47b42ebe0 100644 --- a/src/pkg/dashboard/static-src/js/tracker-row.js +++ b/src/pkg/dashboard/static-src/js/tracker-row.js @@ -50,6 +50,7 @@ const tipStage = (state === 'active' && curStage.label) ? curStage : st; let word = state === 'active' && STAGE_TRACKER_ACTIVE_WORD[cur] ? STAGE_TRACKER_ACTIVE_WORD[cur] : (st.short || st.label || String(n)); if (state === 'active' && n === 50) word = 'CI + Review'; + if (state === 'active' && n === 10 && cur === 10 && typeof stageTrackerTrackingWord === 'function') { const tw = stageTrackerTrackingWord(item); if (tw) word = tw; } if (state === 'active' && n === 30 && cur === 70 && !codeWorking) word = 'PR in progress'; // A merge-train member's word is its place in the train (#15117). if (state === 'active' && !detour && n > 0 && typeof stageTrackerTrainWord === 'function') { const tw = stageTrackerTrainWord(item, trains); if (tw) word = tw; } diff --git a/src/pkg/dashboard/static-src/js/tracker-words-core.js b/src/pkg/dashboard/static-src/js/tracker-words-core.js index c353c06c12..aa6e6a4372 100644 --- a/src/pkg/dashboard/static-src/js/tracker-words-core.js +++ b/src/pkg/dashboard/static-src/js/tracker-words-core.js @@ -54,6 +54,18 @@ const short = String((b && b.short) || '').trim(); return short ? STAGE_TRACKER_BLOCKED_WORD + ' · ' + short : ''; } + // A decomposed parent at 010 (server `open_children` > 0, hive#16481) + // reads "Tracking · 3/4" (children known) or "Tracking · 1 open child", + // never "Actionable": the scanner leaves it to its children, so the + // row is not a stuck unclaimed issue. + const STAGE_TRACKER_TRACKING_WORD = 'Tracking'; + function stageTrackerTrackingWord(item) { + const open = Number(item && item.open_children) || 0; + if (!(open > 0) || !item || item.kind !== 'issue') return ''; + const c = item.children; + if (c && Number(c.total) > 0) return STAGE_TRACKER_TRACKING_WORD + ' · ' + (Number(c.completed) || 0) + '/' + Number(c.total); + return STAGE_TRACKER_TRACKING_WORD + ' · ' + open + ' open child' + (open === 1 ? '' : 'ren'); + } // Issue-slot placeholders for a closing reference whose title the server // could not resolve (the issue is closed and unreadable, or of unknown state). const STAGE_TRACKER_CLOSED_ISSUE_TITLE = '(closed issue)'; diff --git a/src/pkg/dashboard/static/index.html b/src/pkg/dashboard/static/index.html index 7fd8fb7b73..e4bf198cac 100644 --- a/src/pkg/dashboard/static/index.html +++ b/src/pkg/dashboard/static/index.html @@ -15438,6 +15438,18 @@