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-16481-tracking-parent-word.md
Original file line number Diff line number Diff line change
@@ -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)).
1 change: 1 addition & 0 deletions src/docs/dashboard-sections.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 6 additions & 0 deletions src/pkg/dashboard/stage_tracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down
3 changes: 3 additions & 0 deletions src/pkg/dashboard/stage_tracker_actor.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
1 change: 1 addition & 0 deletions src/pkg/dashboard/stage_tracker_build.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
32 changes: 32 additions & 0 deletions src/pkg/dashboard/stage_tracker_caption.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
97 changes: 97 additions & 0 deletions src/pkg/dashboard/stage_tracker_tracking_test.go
Original file line number Diff line number Diff line change
@@ -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), '');
`)
}
1 change: 1 addition & 0 deletions src/pkg/dashboard/static-src/js/tracker-row.js
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand Down
12 changes: 12 additions & 0 deletions src/pkg/dashboard/static-src/js/tracker-words-core.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)';
Expand Down
13 changes: 13 additions & 0 deletions src/pkg/dashboard/static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -15438,6 +15438,18 @@ <h3 class="faq-group-title">Where to get help</h3>
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)';
Expand Down Expand Up @@ -17457,6 +17469,7 @@ <h3 class="faq-group-title">Where to get help</h3>
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; }
Expand Down
22 changes: 22 additions & 0 deletions src/pkg/stageengine/derive_issue.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,28 @@ func ReasonIsPartialCover(reason string) bool {
return strings.HasPrefix(strings.TrimSpace(reason), "open PR addresses part of it")
}

const reasonOpenChildrenPrefix = "waiting on "

// ReasonOpenChildren reads the "; waiting on N open child issue(s)" suffix
// deriveIssue appends to a decomposed parent's reason and returns N, or 0
// when the reason carries no such suffix. Presentation layers use it to say
// the parent is tracking its children rather than waiting on the scanner.
func ReasonOpenChildren(reason string) int {
for _, part := range strings.Split(reason, ";") {
part = strings.TrimSpace(part)
if !strings.HasPrefix(part, reasonOpenChildrenPrefix) || !strings.HasSuffix(part, " open child issue(s)") {
continue
}
digits := strings.TrimSuffix(strings.TrimPrefix(part, reasonOpenChildrenPrefix), " open child issue(s)")
n, err := strconv.Atoi(digits)
if err != nil || n <= 0 {
return 0
}
return n
}
return 0
}

// deriveIssue maps issue Facts to a Decision. Pure: same Facts → same
// Decision. An issue never goes past 040-covered-by-pr: 050+ are PR stages
// (stagelabels.Table, PR: true) and mirroring them onto the issue is what
Expand Down
Loading