diff --git a/changelog.d/fixed-15071-activity-monitor.md b/changelog.d/fixed-15071-activity-monitor.md new file mode 100644 index 0000000000..a19892d2da --- /dev/null +++ b/changelog.d/fixed-15071-activity-monitor.md @@ -0,0 +1 @@ +- The Activity Monitor names server-derived stage actors, shows idle bot PRs as waiting or conflicting, draws shared covering PRs only once, and keeps the merged-today counter above the merge gate. diff --git a/src/docs/dashboard-sections.md b/src/docs/dashboard-sections.md index 85b8788e5f..b95c902783 100644 --- a/src/docs/dashboard-sections.md +++ b/src/docs/dashboard-sections.md @@ -702,7 +702,7 @@ Fed by `GET /api/stage-tracker`. Every issue and pull request follows the same p **Confirmations and "Don't ask again".** Each confirm dialog a row action raises — Approve (including a sentinel-flagged head: *⚠ Sentinel flagged security-relevant changes at 40a959b …*), Let hive decide, Close as superseded / won't-fix, Mark needs-human and the rest — carries a **Don't ask again for this action** box. Ticking it and confirming stores `hive.tracker.confirm.=skip` in this browser's `localStorage` (one key per action id, e.g. `hive.tracker.confirm.decide:delegate`); later clicks on that action run at once. Nothing the dialog would have said is lost: the result toast carries the same ⚠ sentinel line (it is per head, so skipping the confirm never skips the warning) and the one-line item summary. Actions that need your text (*Give direction…*, *Send back…*, the superseder picker) always ask. The ⚙ settings dialog's **Confirmations** section lists which actions are skipped and has one **Reset confirmations** button that turns them all back on. -**Merged today.** The toolbar's right end shows a small hex glyph with **Merged today: N** — pull requests the hive saw merge since your local midnight (seeded after a reload from the tracker payload's `merged_24h` list, the audit log's `pr_merged` entries over the last 24 hours, and grown live by the same merge detector that plays the zap); hovering lists the last five with their times. When a PR on the list merges its row does **not** simply vanish on the next refresh: it stays pinned for about 2.5 s, its ✓ cell glows amber, the event line reads *Hive: merged #14947 · by hive*, a flat brand-amber hex token lifts out of the ✓ cell and arcs (≈0.5 s) to the counter, which ticks up with a soft scale-pop — the merge zap, when sound is on, plays as the token lands — and then the row takes its normal exit. Several merges in one refresh stagger 200 ms apart with at most three tokens in flight (the rest tick the count without flying); a merged PR that is filtered out or on another page still counts. Under reduced motion nothing flies: the count ticks and the row glows. A PR drawn inline on its issue's row (the usual case — one covering PR, no sub-row) celebrates on that issue row: every row stamps the PR keys it draws (`data-ham-prs`) and the SPA remembers each PR's host row from the last payload, so the flight has somewhere to start from even when the merge also closes the issue. The ⚙ dialog's **Merges** section has **Celebrate merges** (default on, `hive.tracker.celebrate`); off, the row leaves as before and the zap plays at once. **Test celebration** beside it plays one flight from the first row of the list to the counter (pop and zap, the count unchanged) so the effect can be checked without waiting for a merge; under reduced motion it says so and only pops. The row effect is reusable in the SPA as `celebrateRow(rowEl, {kind: 'merged' | 'closed-by-merge'})`. +**Merged today.** Directly above the Merge gate / ✓ column header, right-aligned and independent of filter-bar wrapping, a small hex glyph appears with **Merged today: N** — pull requests the hive saw merge since your local midnight (seeded after a reload from the tracker payload's `merged_24h` list, the audit log's `pr_merged` entries over the last 24 hours, and grown live by the same merge detector that plays the zap); hovering lists the last five with their times. When a PR on the list merges its row does **not** simply vanish on the next refresh: it stays pinned for about 2.5 s, its ✓ cell glows amber, the event line reads *Hive: merged #14947 · by hive*, a flat brand-amber hex token lifts out of the ✓ cell and arcs (≈0.5 s) to the counter, which ticks up with a soft scale-pop — the merge zap, when sound is on, plays as the token lands — and then the row takes its normal exit. Several merges in one refresh stagger 200 ms apart with at most three tokens in flight (the rest tick the count without flying); a merged PR that is filtered out or on another page still counts. Under reduced motion nothing flies: the count ticks and the row glows. A PR drawn inline on its issue's row (the usual case — one covering PR, no sub-row) celebrates on that issue row: every row stamps the PR keys it draws (`data-ham-prs`) and the SPA remembers each PR's host row from the last payload, so the flight has somewhere to start from even when the merge also closes the issue. The ⚙ dialog's **Merges** section has **Celebrate merges** (default on, `hive.tracker.celebrate`); off, the row leaves as before and the zap plays at once. **Test celebration** beside it plays one flight from the first row of the list to the counter (pop and zap, the count unchanged) so the effect can be checked without waiting for a merge; under reduced motion it says so and only pops. The row effect is reusable in the SPA as `celebrateRow(rowEl, {kind: 'merged' | 'closed-by-merge'})`. **Multi-select.** The checkbox in a row's left gutter selects the row — and the checkbox in a nested PR sub-row's gutter selects that PR on its own, so one or more PRs under an issue can be picked without the issue or each other; **Shift+click** selects the range from the last clicked row (sub-rows are in the range order right after their issue), **Cmd/Ctrl+click** toggles, **Cmd/Ctrl+Shift+click** adds a range to what is selected; with a row focused, **Space** toggles it (Shift+Space extends). Cmd/Ctrl- or Shift-clicking the row itself, away from its links, selects it too. A selection bar appears above the list with the count, **Clear**, and the same actions for the whole selection — *Decide…* (opens the group as a menu, *Let hive decide* first — each selected row gets its own delegated-decision job, see below), **Let hive decide (N selected)** (one click for the whole selection: one delegated-decision job per selected item, each nested PR sub-row by its own number, with one summary toast — "3 sent · 2 decided · 1 no-op", plus "· 1 failed" when any failed — and the per-action confirm / *Don't ask again* of *Let hive decide*), *Hold*, *Release hold*, *Re-evaluate now*, *Mark needs-human…*, *Copy links* — each enabled only when it is valid for every selected row and otherwise greyed with the first reason ("Not applicable to acme/console#12", "Sign in with write access…"). Right-clicking a selected row acts on the whole selection. Bulk actions run one request per row, in list order, under a progress toast ("Hold 2/5 — acme/console#12…"); the result toast lists each failure by row and the successes stand, after which the list and the status snapshot refresh (a hive-wide rescan is sent once per batch). Selection is keyed on the row's item (repository, kind, number), not its node, so the live re-render keeps it; a row that leaves the list — merged, closed, filtered or paged out — leaves the selection. @@ -812,3 +812,5 @@ This section exists on the v6 line only. On v5 the same facts are in the Diagnos **When it appears.** On v6 only, when the hive reports platform data. **Settings that change it.** Your code hosting settings and optional service settings change it. The code hosting service is `project.forge`; a self-managed GitLab or a Gitea/Forgejo instance also shows its URL. See [Forges](integrations/forges.md). + +The stage pill's actor comes from the server's `stage_actor` (`kind`, `login`, `since`, `why`): hive → ⬡, contributor clanker → robot, human → the same person glyph as Needs human decision, bot → robot. `none` has no actor icon and explains “no one is working on this right now — ” on hover. A bot PR in the fixing lane with no worker says **Conflicting · bot PR** (or **Waiting · bot PR**) with the bot author's icon, rather than claiming someone is fixing it. A current-round hive worker is explicit evidence of active work; a stage label alone is not. Each covering PR has one server-selected `drawn_under` issue (the lowest listed issue number); other linked issues point to that row instead of drawing its live strip again. diff --git a/src/pkg/dashboard/stage_tracker.go b/src/pkg/dashboard/stage_tracker.go index 0f5d2473ad..099a70ecbf 100644 --- a/src/pkg/dashboard/stage_tracker.go +++ b/src/pkg/dashboard/stage_tracker.go @@ -233,8 +233,20 @@ type StageTrackerHop struct { Regressed bool `json:"regressed,omitempty"` } +// StageTrackerActor names current work or the next responsible actor. +type StageTrackerActor struct { + Kind string `json:"kind"` + Login string `json:"login"` + Since *time.Time `json:"since"` + Why string `json:"why"` +} + // StageTrackerItem is one open issue or PR on the tracker. type StageTrackerItem struct { + StageActor StageTrackerActor `json:"stage_actor"` + StageState string `json:"stage_state,omitempty"` + // DrawnUnder is the single issue row that draws this PR (0 = standalone). + DrawnUnder int `json:"drawn_under,omitempty"` Superseded *github.ReviewQueueSuperseded `json:"superseded,omitempty"` Repo string `json:"repo"` Number int `json:"number"` @@ -260,7 +272,7 @@ type StageTrackerItem struct { // both empty for an actionable or held item. Bucket string `json:"bucket,omitempty"` BucketReason string `json:"bucket_reason,omitempty"` - // AuthorKind is human / clanker / hive ("" = unknown) and + // AuthorKind is human / clanker / hive / bot ("" = unknown) and // AuthorKindSource says whether it came from an author/ label // ("label") or was inferred from the PR's hive markers ("inferred"). AuthorKind string `json:"author_kind,omitempty"` @@ -458,16 +470,19 @@ type StageTrackerLinkedIssue struct { // StageTrackerLinkedPR is one covering PR nested under an issue row. type StageTrackerLinkedPR struct { - BaseRef string `json:"base_ref,omitempty"` - Number int `json:"number"` - Title string `json:"title,omitempty"` - URL string `json:"url,omitempty"` - Author string `json:"author,omitempty"` - AuthorKind string `json:"author_kind,omitempty"` - Stage int `json:"stage,omitempty"` - StageSince *time.Time `json:"stage_since,omitempty"` - Caption string `json:"caption,omitempty"` - Modifiers []string `json:"modifiers,omitempty"` + StageActor StageTrackerActor `json:"stage_actor"` + StageState string `json:"stage_state,omitempty"` + DrawnUnder int `json:"drawn_under,omitempty"` + BaseRef string `json:"base_ref,omitempty"` + Number int `json:"number"` + Title string `json:"title,omitempty"` + URL string `json:"url,omitempty"` + Author string `json:"author,omitempty"` + AuthorKind string `json:"author_kind,omitempty"` + Stage int `json:"stage,omitempty"` + StageSince *time.Time `json:"stage_since,omitempty"` + Caption string `json:"caption,omitempty"` + Modifiers []string `json:"modifiers,omitempty"` // DeferredModifiers mirrors the nested PR's own row field: the // merge-gate pills it is not yet drawing. DeferredModifiers []string `json:"deferred_modifiers,omitempty"` @@ -698,7 +713,7 @@ func stageTrackerAuthorKind(labels []string, author string, appAuthored, hiveAtt } } if strings.HasSuffix(strings.ToLower(strings.TrimSpace(author)), botLoginSuffix) { - return "", "" + return "bot", authorKindSrcInfer } if strings.TrimSpace(author) == "" { return "", "" @@ -1777,6 +1792,9 @@ func (s *Server) buildStageTracker(status *StatusPayload, store *stagelabels.Sto resp.OpenIssues, resp.OpenPRs = stageTrackerOpenCounts(resp.Items) s.applyOperatorActions(resp.Items, now) resp.NeedsHuman, resp.OnHold = stageTrackerHumanCounts(resp.Items) + for i := range resp.Items { + stageTrackerSetActor(&resp.Items[i], status.Agents) + } stageTrackerResolveLinkedPRs(resp.Items) sort.SliceStable(resp.Items, stageTrackerLess(resp.Items)) return resp @@ -2500,6 +2518,7 @@ func stageTrackerResolveLinkedPRs(items []StageTrackerItem) { if pr := prs[it.Repo+"#"+strconv.Itoa(lp.Number)]; pr != nil { lp.Title, lp.Author, lp.AuthorKind, lp.Stage = pr.Title, pr.Author, pr.AuthorKind, pr.Stage lp.StageSince, lp.Caption = pr.StageSince, pr.Caption + lp.StageActor, lp.StageState = pr.StageActor, pr.StageState lp.SentinelAlert, lp.SentinelReason, lp.Head = pr.SentinelAlert, pr.SentinelReason, pr.Head lp.Adoption = pr.Adoption lp.HumanApprover, lp.ManualMerge = pr.HumanApprover, pr.ManualMerge @@ -2541,9 +2560,19 @@ func stageTrackerResolveLinkedPRs(items []StageTrackerItem) { } for i := range items { if items[i].Kind == "pr" { + items[i].DrawnUnder = items[i].NestedUnder items[i].ClosedIssue = stageTrackerClosedIssueAnchor(items[i]) } } + // Publish the final owner only after every issue has been considered. + for i := range items { + for j := range items[i].LinkedPRs { + lp := &items[i].LinkedPRs[j] + if pr := prs[items[i].Repo+"#"+strconv.Itoa(lp.Number)]; pr != nil { + lp.DrawnUnder = pr.DrawnUnder + } + } + } } // stageTrackerClosedIssueAnchor returns the closed issue a standalone PR diff --git a/src/pkg/dashboard/stage_tracker_actor.go b/src/pkg/dashboard/stage_tracker_actor.go new file mode 100644 index 0000000000..a850c2d5b5 --- /dev/null +++ b/src/pkg/dashboard/stage_tracker_actor.go @@ -0,0 +1,65 @@ +package dashboard + +import ( + "slices" + "strings" + "time" +) + +// stageTrackerSetActor distinguishes a lane classification from live work. +// Human gates and author returns name the next responsible actor; execution +// stages name an agent only when its current round actually touches the item. +func stageTrackerSetActor(it *StageTrackerItem, agents []FrontendAgent) { + a := StageTrackerActor{Kind: "none", Why: "waiting for the next pipeline evaluation"} + switch it.Stage { + case 15, 17, 45, 85, 90: + a.Kind, a.Why = "human", "waiting for a human decision" + case 20: + if it.ClaimantKind != "" { + a.Kind, a.Why = it.ClaimantKind, "live claim holder" + } + case 30, 40, 70, 71, 72: + a.Login = it.Author + switch it.AuthorKind { + case "human", "clanker": + a.Kind, a.Why = it.AuthorKind, "waiting for the PR author" + case "bot": + a.Why = "bot PR; waiting for the bot's next run" + default: + a.Why = "no active agent is working on this PR" + } + } + a.Since = it.StageSince + // A live worker takes precedence over inferred responsibility, except at + // explicit human gates where a decision is still required. + if a.Kind != "human" { + for _, agent := range agents { + la := agent.LastAction + if agent.Busy != "working" || la == nil || !la.Current || la.Number != it.Number { + continue + } + repo := strings.ToLower(la.Repo) + target := strings.ToLower(it.Repo) + if repo == "" || (repo != target && !strings.HasSuffix(target, "/"+repo)) { + continue + } + a.Kind, a.Login, a.Why = "hive", agent.Name, "agent is working on this item in its current round" + if at, err := time.Parse(time.RFC3339, la.At); err == nil { + a.Since = &at + } + break + } + } + it.StageActor = a + if it.Stage == 70 && a.Kind == "none" { + it.StageState = "Waiting for fixes" + if it.AuthorKind == "bot" { + it.StageState = "Waiting · bot PR" + if strings.Contains(strings.ToLower(it.Reason), "conflict") || slices.Contains(it.Modifiers, "needs-rebase") { + it.StageState = "Conflicting · bot PR" + } + } + it.Caption = it.StageState + " — " + a.Why + it.Actor = "" + } +} diff --git a/src/pkg/dashboard/stage_tracker_actor_test.go b/src/pkg/dashboard/stage_tracker_actor_test.go new file mode 100644 index 0000000000..e19b44c033 --- /dev/null +++ b/src/pkg/dashboard/stage_tracker_actor_test.go @@ -0,0 +1,57 @@ +package dashboard + +import ( + "testing" + "time" +) + +func TestStageTrackerActorEvidence(t *testing.T) { + for _, tc := range []struct { + name string + item StageTrackerItem + agents []FrontendAgent + kind, login, state string + }{ + {name: "conflicting nightly bot", item: StageTrackerItem{Kind: "pr", Stage: 70, Author: "github-actions[bot]", AuthorKind: "bot", Modifiers: []string{"needs-rebase"}}, kind: "none", login: "github-actions[bot]", state: "Conflicting · bot PR"}, + {name: "idle hive fixing classification", item: StageTrackerItem{Kind: "pr", Stage: 70, AuthorKind: "hive"}, kind: "none", state: "Waiting for fixes"}, + {name: "human return", item: StageTrackerItem{Kind: "pr", Stage: 71, AuthorKind: "human", Author: "sam"}, kind: "human", login: "sam"}, + {name: "contributor return", item: StageTrackerItem{Kind: "pr", Stage: 72, AuthorKind: "clanker", Author: "relay"}, kind: "clanker", login: "relay"}, + {name: "decision gate", item: StageTrackerItem{Kind: "pr", Stage: 85}, kind: "human"}, + {name: "unknown", item: StageTrackerItem{Kind: "pr", Stage: 30}, kind: "none"}, + {name: "current worker", item: StageTrackerItem{Repo: "hivecommons/hive", Number: 14921, Kind: "pr", Stage: 70}, agents: []FrontendAgent{{Name: "fixer", Busy: "working", LastAction: &FrontendAgentLastAction{Repo: "hive", Number: 14921, Current: true, At: "2026-10-28T12:00:00Z"}}}, kind: "hive", login: "fixer"}, + {name: "stale round", item: StageTrackerItem{Repo: "hivecommons/hive", Number: 14921, Kind: "pr", Stage: 70}, agents: []FrontendAgent{{Name: "fixer", Busy: "working", LastAction: &FrontendAgentLastAction{Repo: "hive", Number: 14921}}}, kind: "none", state: "Waiting for fixes"}, + {name: "other repository", item: StageTrackerItem{Repo: "hivecommons/docs", Number: 14921, Kind: "pr", Stage: 70}, agents: []FrontendAgent{{Name: "fixer", Busy: "working", LastAction: &FrontendAgentLastAction{Repo: "hive", Number: 14921, Current: true}}}, kind: "none", state: "Waiting for fixes"}, + } { + t.Run(tc.name, func(t *testing.T) { + stageTrackerSetActor(&tc.item, tc.agents) + a := tc.item.StageActor + if a.Kind != tc.kind || a.Login != tc.login || a.Why == "" || tc.item.StageState != tc.state { + t.Fatalf("actor=%+v state=%q", a, tc.item.StageState) + } + if tc.name == "current worker" && (a.Since == nil || !a.Since.Equal(time.Date(2026, 10, 28, 12, 0, 0, 0, time.UTC))) { + t.Fatalf("worker since=%v", a.Since) + } + }) + } +} + +func TestStageTrackerSharedPRDrawingOwner(t *testing.T) { + // #14921 closes #14906 (already closed), #14910 and #14911. Input + // order must not change its drawing owner, and other repos are isolated. + items := []StageTrackerItem{ + {Repo: "hivecommons/hive", Number: 14911, Kind: "issue"}, + {Repo: "hivecommons/hive", Number: 14921, Kind: "pr", Stage: 70, StageActor: StageTrackerActor{Kind: "hive", Login: "fixer"}, LinkedIssues: []StageTrackerLinkedIssue{{Number: 14906, State: "closed"}, {Number: 14910, State: "open"}, {Number: 14911, State: "open"}}}, + {Repo: "hivecommons/hive", Number: 14910, Kind: "issue"}, + {Repo: "hivecommons/docs", Number: 14921, Kind: "pr"}, + } + stageTrackerResolveLinkedPRs(items) + if items[1].DrawnUnder != 14910 || items[3].DrawnUnder != 0 { + t.Fatalf("owners: %+v", items) + } + for _, i := range []int{0, 2} { + lp := items[i].LinkedPRs + if len(lp) != 1 || lp[0].DrawnUnder != 14910 || lp[0].StageActor.Login != "fixer" { + t.Fatalf("issue %d: %+v", items[i].Number, lp) + } + } +} diff --git a/src/pkg/dashboard/stage_tracker_header.test.js b/src/pkg/dashboard/stage_tracker_header.test.js new file mode 100644 index 0000000000..b815cadf7b --- /dev/null +++ b/src/pkg/dashboard/stage_tracker_header.test.js @@ -0,0 +1,42 @@ +// Run by the dashboard's node fixture job in CI. +const test = require('node:test'); +const assert = require('node:assert/strict'); +const fs = require('node:fs'); +const path = require('node:path'); +const html = fs.readFileSync(path.join(__dirname, 'static', 'index.html'), 'utf8'); + +test('merged counter belongs to the persistent gate header and the flight resolves it', () => { + const headerStart = html.indexOf('
'); + assert.ok(headerStart >= 0 && panelStart > headerStart); + const header = html.slice(headerStart, panelStart); + assert.match(header, /id="activity-monitor-merged"/); + assert.match(header, /class="ham-strip ham-counter-align"/); + assert.match(header, /class="ham-since"/); // same gate/since geometry as column labels + const toolbar = html.slice(html.indexOf('
({ left: 800, top: 20, width: 120, height: 24 }) }; + const ids = Object.fromEntries([...header.matchAll(/id="([^"]+)"/g)].map(m => [m[1], target])); + let resolved, token; + const document = { + getElementById(id) { resolved = id; return ids[id]; }, + createElement() { return token = { style: { values: {}, setProperty(k, v) { this.values[k] = v; } }, remove() {} }; }, + body: { appendChild() {} }, + }; + const celebrate = new Function('document', ` + const STAGE_TRACKER_CELEBRATE_PIN_MS = 2500, STAGE_TRACKER_CELEBRATE_MAX_FLIGHTS = 3, STAGE_TRACKER_CELEBRATE_FLY_MS = 500, STAGE_TRACKER_TOKEN_SVG = ''; + let _stageTrackerFlights = 0; + const setTimeout = () => {}, stageTrackerAfter = () => {}, stageTrackerReducedMotion = () => false; + ${src[0]} + return celebrateRow; + `)(document); + const row = { classList: { add() {} }, dataset: {}, querySelector: () => ({ getBoundingClientRect: () => ({ left: 800, top: 200, width: 24, height: 24 }) }) }; + assert.equal(celebrate(row, { preview: true }).flew, true); + assert.equal(resolved, 'activity-monitor-merged'); + assert.equal(token.style.values['--cue-dy'], '-180px', 'token flies upward to the gate header'); +}); diff --git a/src/pkg/dashboard/stage_tracker_motion_bucket.test.js b/src/pkg/dashboard/stage_tracker_motion_bucket.test.js index 534426ba36..8a0943baeb 100644 --- a/src/pkg/dashboard/stage_tracker_motion_bucket.test.js +++ b/src/pkg/dashboard/stage_tracker_motion_bucket.test.js @@ -69,13 +69,13 @@ test('open, open · hold and claimed never move', () => { test('a PR in progress pulses only when an agent is working it', () => { for (const stage of [30, 40]) { - assert.strictEqual(motion({ stage, kind: 'pr', author_kind: 'hive' }), 'active', stage + ' hive author'); - assert.strictEqual(motion({ stage, kind: 'pr', author_kind: 'clanker' }), 'active', stage + ' clanker author'); + assert.strictEqual(motion({ stage, kind: 'pr', author_kind: 'hive', stage_actor: { kind: 'hive' } }), 'active', stage + ' hive author'); + assert.strictEqual(motion({ stage, kind: 'pr', author_kind: 'clanker', stage_actor: { kind: 'clanker' } }), 'active', stage + ' clanker author'); assert.strictEqual(motion({ stage, kind: 'pr', author_kind: 'human' }), 'static', stage + ' human author'); assert.strictEqual(motion({ stage, kind: 'pr' }), 'static', stage + ' unknown author'); } - // An issue at 030 (kick running, no PR yet) reads the linked PR's author kind. - assert.strictEqual(motion({ stage: 30, kind: 'issue', linked_prs: [{ author_kind: 'hive' }] }), 'active'); + // A mirrored issue carries the server-derived stage actor too. + assert.strictEqual(motion({ stage: 30, kind: 'issue', stage_actor: { kind: 'hive' }, linked_prs: [{ author_kind: 'hive' }] }), 'active'); assert.strictEqual(motion({ stage: 30, kind: 'issue', linked_prs: [] }), 'static'); }); diff --git a/src/pkg/dashboard/stage_tracker_repo_grouping_test.go b/src/pkg/dashboard/stage_tracker_repo_grouping_test.go index 5d29e7bfb2..387e4db7ee 100644 --- a/src/pkg/dashboard/stage_tracker_repo_grouping_test.go +++ b/src/pkg/dashboard/stage_tracker_repo_grouping_test.go @@ -215,7 +215,7 @@ const stages = [ { number: 90, label: 'Ready for human merge', short: 'Ready for human merge', branch_from: 80 }, { number: 100, label: 'Merge queue', short: 'Merge queue' }, { number: 110, label: 'Merged', short: 'Merged' }, ]; -const P = (repo, n, stage, extra) => Object.assign({ kind: 'pr', repo, number: n, stage, title: 'PR ' + n, url: 'https://x/' + n, author: 'ann', author_kind: 'human', stage_since: '2026-01-01T11:00:00Z', created_at: '2026-01-01T10:00:00Z', modifiers: [] }, extra || {}); +const P = (repo, n, stage, extra) => Object.assign({ kind: 'pr', repo, number: n, stage, stage_actor: { kind: stage === 85 || stage === 90 ? 'human' : 'hive' }, title: 'PR ' + n, url: 'https://x/' + n, author: 'ann', author_kind: 'human', stage_since: '2026-01-01T11:00:00Z', created_at: '2026-01-01T10:00:00Z', modifiers: [] }, extra || {}); const I = (repo, n, stage, extra) => Object.assign({ kind: 'issue', repo, number: n, stage, title: 'Issue ' + n, url: 'https://x/' + n, stage_since: '2026-01-01T11:00:00Z', created_at: '2026-01-01T10:00:00Z', modifiers: [] }, extra || {}); ` } diff --git a/src/pkg/dashboard/stage_tracker_test.go b/src/pkg/dashboard/stage_tracker_test.go index 110afb7448..64cebe6423 100644 --- a/src/pkg/dashboard/stage_tracker_test.go +++ b/src/pkg/dashboard/stage_tracker_test.go @@ -87,25 +87,25 @@ func TestStageTrackerNeedsAuthorAndReturnedWords(t *testing.T) { func TestHumanizeStageReason(t *testing.T) { cases := map[string]string{ - "actionable": "", - "live agent claim": "", - "mirrors PR #12332": "mirrors PR #12332", - "label:needs-rebase": "needs a rebase", - "held": "held by a hold label", - "contributor-lane:no-verdict": "no review verdict yet", - "required-check-pending:build-and-test": "check build-and-test still running", - "required-check-failing:DCO": "check DCO failing", - "reviewer-verdict:changes_requested": "review swarm requested changes", - "pending: head pushed 59s ago (< min_head_age)": "head pushed 59s ago; waiting for the minimum head age", - "contributor-lane:soaking:12m": "soaking", - "excluded-label:do-not-merge": "label do-not-merge excludes it", - "some-new-token": "some new token", - "base-branch-red:docker (hive),docker (hub)": "waiting for the base branch's CI to recover (docker (hive), docker (hub)) — not this PR's fault", - "shared-ci-incident:13208": "deferred to shared-CI incident #13208 — not this PR's fault", - "fork-guard:Canary": "check Canary refuses fork PRs — a maintainer must push this branch to the repository", - "contributor-lane:workflow-path": "workflow path", - "contributor-lane:tests-removed": "tests removed", - "human-merge-path": "human-merge path", + "actionable": "", + "live agent claim": "", + "mirrors PR #12332": "mirrors PR #12332", + "label:needs-rebase": "needs a rebase", + "held": "held by a hold label", + "contributor-lane:no-verdict": "no review verdict yet", + "required-check-pending:build-and-test": "check build-and-test still running", + "required-check-failing:DCO": "check DCO failing", + "reviewer-verdict:changes_requested": "review swarm requested changes", + "pending: head pushed 59s ago (< min_head_age)": "head pushed 59s ago; waiting for the minimum head age", + "contributor-lane:soaking:12m": "soaking", + "excluded-label:do-not-merge": "label do-not-merge excludes it", + "some-new-token": "some new token", + "base-branch-red:docker (hive),docker (hub)": "waiting for the base branch's CI to recover (docker (hive), docker (hub)) — not this PR's fault", + "shared-ci-incident:13208": "deferred to shared-CI incident #13208 — not this PR's fault", + "fork-guard:Canary": "check Canary refuses fork PRs — a maintainer must push this branch to the repository", + "contributor-lane:workflow-path": "workflow path", + "contributor-lane:tests-removed": "tests removed", + "human-merge-path": "human-merge path", "contributor-lane:workflow-path:human-approved@clubanderson": "workflow path — approved by @clubanderson", "reviewer-verdict:requires_human:human-approved@octocat": "review verdict requires human — approved by @octocat", } @@ -536,7 +536,7 @@ func TestStageTrackerAuthorKindFallback(t *testing.T) { {nil, "hive-app[bot]", true, false, authorKindHive, authorKindSrcInfer}, {nil, "zoe", false, true, authorKindClanker, authorKindSrcInfer}, {[]string{"agent/scanner"}, "someone", false, false, authorKindHive, authorKindSrcInfer}, - {nil, "dependabot[bot]", false, false, "", ""}, + {nil, "dependabot[bot]", false, false, "bot", authorKindSrcInfer}, {nil, "pat", false, false, authorKindHuman, authorKindSrcInfer}, {nil, "", false, false, "", ""}, } diff --git a/src/pkg/dashboard/stage_tracker_ui_test.go b/src/pkg/dashboard/stage_tracker_ui_test.go index 1566b01be4..5f70274c7d 100644 --- a/src/pkg/dashboard/stage_tracker_ui_test.go +++ b/src/pkg/dashboard/stage_tracker_ui_test.go @@ -283,16 +283,16 @@ assert.ok(tooltip(row).startsWith('Open No stage recorded yet') && tooltip(row). // 015 triage-needed: the Actionable column lights (not a detour) with the // word "Triage needed" and a human (maintainer) next move; the headline and // chevron tooltip name the stage; the server already dropped the chip. -row = stageTrackerRowHtml({ repo: 'acme/console', number: 13262, kind: 'issue', title: 'Review backlog (security)', stage: 15, author: 'hive-bot', author_kind: 'hive', caption: 'Actionable, but no maintainer has looked at it yet; waiting for triage' }, stages, ctx); +row = stageTrackerRowHtml({ repo: 'acme/console', number: 13262, kind: 'issue', title: 'Review backlog (security)', stage: 15, stage_actor: { kind: 'human' }, author: 'hive-bot', author_kind: 'hive', caption: 'Actionable, but no maintainer has looked at it yet; waiting for triage' }, stages, ctx); assert.deepStrictEqual(segStates(row), [D, 'active', T, T, T, T, 'todo cap'], '015 lights the Actionable column: ' + row); assert.ok(/aria-current="step">]*>[\s\S]*?<\/svg>Triage needed<\/span>3d'), 'only blocked rows row = stageTrackerRowHtml({ repo: 'acme/console', number: 27, kind: 'pr', title: 'Held and blocked', stage: 0, stage_since: new Date(now - 3 * 86400000).toISOString(), modifiers: ['blocked', 'hold'] }, stages, ctx); assert.strictEqual(openWord(row), 'Open · hold', 'hold is a human instruction: it wins over blocked and still carries no age'); assert.deepStrictEqual(segStates(row), ['active ham-open-hold', T, T, T, T, T, 'todo cap']); -row = stageTrackerRowHtml({ repo: 'acme/console', number: 28, kind: 'pr', title: 'Blocked later', stage: 50, modifiers: ['blocked'] }, stages, ctx); +row = stageTrackerRowHtml({ repo: 'acme/console', number: 28, kind: 'pr', title: 'Blocked later', stage: 50, stage_actor: { kind: 'hive' }, modifiers: ['blocked'] }, stages, ctx); assert.ok(!row.includes('ham-open-blocked') && !row.includes('Open · blocked'), 'blocked past Open is a chip, not an Open word'); // A draft PR with no stage (hivecommons/hive#14572): the far-right pill // reads "draft" with the explanatory tooltip, the Open word reads "Draft", @@ -383,7 +383,7 @@ row = stageTrackerRowHtml({ repo: 'acme/console', number: 31, kind: 'pr', title: assert.strictEqual(openWord(row), 'Open · hold', 'hold wins the Open word over draft'); assert.deepStrictEqual(segStates(row), ['active ham-open-hold', T, T, T, T, T, 'todo cap']); assert.ok(row.includes('ham-mod-hold" title="' + STAGE_TRACKER_DRAFT_TIP + '">hold +1'), 'hold leads, draft folded: ' + row); -row = stageTrackerRowHtml({ repo: 'acme/console', number: 32, kind: 'pr', title: 'Still drafting', stage: 50, modifiers: ['draft'] }, stages, ctx); +row = stageTrackerRowHtml({ repo: 'acme/console', number: 32, kind: 'pr', title: 'Still drafting', stage: 50, stage_actor: { kind: 'hive' }, modifiers: ['draft'] }, stages, ctx); assert.ok(!row.includes('ham-open-draft') && !row.includes('>Draft'), 'draft past Open is a chip, not an Open word: ' + row); assert.ok(row.includes('ham-mod-draft"'), row); assert.strictEqual(stageTrackerHeadline({ stage: 0, modifiers: ['draft'] }), 'Open · draft'); @@ -395,14 +395,14 @@ assert.strictEqual(stageTrackerCurrentStageHtml({ stage: 0, stage_since: new Dat // Issue with exactly one covering PR (only its number known, legacy linked_pr): // a single entry whose strip is driven by the PR; with no PR stage it lights // PR in progress. -row = stageTrackerRowHtml({ repo: 'acme/console', number: 8, kind: 'issue', url: 'https://github.com/acme/console/issues/8', stage: 100, mirrored: true, linked_pr: 102, caption: 'Covered by PR #102' }, stages, ctx); +row = stageTrackerRowHtml({ repo: 'acme/console', number: 8, kind: 'issue', url: 'https://github.com/acme/console/issues/8', stage: 100, stage_actor: { kind: 'hive' }, mirrored: true, linked_pr: 102, caption: 'Covered by PR #102' }, stages, ctx); assert.deepStrictEqual(segStates(row), [D, D, D, 'active', T, T, 'todo cap'], 'one covering PR: single entry'); assert.ok(tooltip(row).includes('Covering PR: #102'), tooltip(row)); assert.deepStrictEqual(prCol(row).length, 1, 'the covering PR sits in the PR column of the title line'); assert.strictEqual(subs(row).length, 0, 'no sub-rows for a single covering PR'); const prCell = (html) => (html.slice(0, html.indexOf('aria-label="Pipeline progress"')).match(/
  • ([\s\S]*?)<\/li>/) || [])[1] || ''; assert.ok(prCell(row).startsWith(STAGE_TRACKER_LINKED_GLYPH + 'Ready for auto mergestalled') && row.includes('2h'), 'chips + since come from the covering PR: ' + row); @@ -428,23 +428,23 @@ assert.ok(tooltip(row).includes('Admitted, merging') && tooltip(row).includes('C assert.ok(prCol(row)[0].includes('ham-author-human') && prCol(row)[0].includes('Fix it'), prCol(row)[0]); assert.strictEqual(subs(row).length, 0); // Two covering PRs, one of unknown stage: that sub-row is a blank lead-in with nothing lit. -row = stageTrackerRowHtml({ repo: 'acme/console', number: 8, kind: 'issue', stage: 40, linked_prs: [{ number: 102, stage: 100 }, { number: 104 }] }, stages, ctx); +row = stageTrackerRowHtml({ repo: 'acme/console', number: 8, kind: 'issue', stage: 40, linked_prs: [{ number: 102, stage: 100, stage_actor: { kind: 'hive' } }, { number: 104 }] }, stages, ctx); assert.ok(subs(row)[1].includes('#104') && segStates(subs(row)[1]).every(st => st.startsWith('blank') || st === 'todo' || st === 'todo cap'), 'unknown PR stage: blank lead-in, nothing lit'); assert.ok(tooltip(row).includes('acme/console'), 'repo lives in the tooltip'); // Full PR row for 100: Merge gate lit as Ready for auto merge with the hive actor icon. -row = stageTrackerRowHtml({ repo: 'acme/console', number: 102, kind: 'pr', stage: 100, author: 'hive-bot', author_kind: 'hive' }, stages, ctx); +row = stageTrackerRowHtml({ repo: 'acme/console', number: 102, kind: 'pr', stage: 100, stage_actor: { kind: 'hive' }, author: 'hive-bot', author_kind: 'hive' }, stages, ctx); assert.deepStrictEqual(segStates(row), [D, D, D, D, D, 'active', 'todo cap']); assert.ok(strip(row).includes('title="Merge queue — admitted, merging · Next move: hive"'), 'chevron tooltip carries 100: ' + row); assert.ok(text(row).includes('#102 Ready for auto merge'), text(row)); // Full PR row for 095: Merge gate lit as Soaking (not a detour), hive actor, // chevron tooltip names the real stage and the time left; headline carries it too. -row = stageTrackerRowHtml({ repo: 'acme/console', number: 13020, kind: 'pr', stage: 95, author: 'hive-bot', author_kind: 'hive', soak_remaining_seconds: 17 * 60 + 1 }, stages, ctx); +row = stageTrackerRowHtml({ repo: 'acme/console', number: 13020, kind: 'pr', stage: 95, stage_actor: { kind: 'hive' }, author: 'hive-bot', author_kind: 'hive', soak_remaining_seconds: 17 * 60 + 1 }, stages, ctx); assert.deepStrictEqual(segStates(row), [D, D, D, D, D, 'active', 'todo cap'], '095 lights the Merge gate column, no detour'); assert.ok(strip(row).includes('title="Pre-merge soak — admitted, soaking — 18m left · Next move: hive"'), 'chevron tooltip carries 095 + time left: ' + row); assert.ok(tooltip(row).startsWith('Pre-merge soak — 18m left'), 'headline: ' + tooltip(row)); -assert.strictEqual(stageTrackerHeadline({ stage: 95 }), 'Pre-merge soak', 'no remaining known → plain headline'); -assert.strictEqual(stageTrackerHeadline({ stage: 95, soak_remaining_seconds: 5400 }), 'Pre-merge soak — 1h30m left'); -assert.strictEqual(stageTrackerHeadline({ stage: 95, kind: 'issue', soak_remaining_seconds: 60 }), 'Pre-merge soak — 1m left (its PR)'); +assert.strictEqual(stageTrackerHeadline({ stage: 95, stage_actor: { kind: 'hive' } }), 'Pre-merge soak', 'no remaining known → plain headline'); +assert.strictEqual(stageTrackerHeadline({ stage: 95, stage_actor: { kind: 'hive' }, soak_remaining_seconds: 5400 }), 'Pre-merge soak — 1h30m left'); +assert.strictEqual(stageTrackerHeadline({ stage: 95, stage_actor: { kind: 'hive' }, kind: 'issue', soak_remaining_seconds: 60 }), 'Pre-merge soak — 1m left (its PR)'); assert.strictEqual(stageTrackerAnchor(95, stages, 'pr'), STAGE_TRACKER_MERGE_COLUMN, '095 anchors on the merge gate column'); // PR returned to contributor: detour badge rides Review; chip cap = author kind + first modifier (+N). @@ -468,9 +468,9 @@ assert.ok(row.includes('ham-mod-needs-human">needs human +1'), row); assert.ok(tooltip(row).includes('Flags: needs-rebase, needs-human') && tooltip(row).includes('Trail: CI / Review → Reviewed → Returned to contributor'), tooltip(row)); // PR reviewed (060): Review done, Merge gate lit, no detour. -row = stageTrackerRowHtml({ repo: 'acme/console', number: 107, kind: 'pr', stage: 60 }, stages, ctx); +row = stageTrackerRowHtml({ repo: 'acme/console', number: 107, kind: 'pr', stage: 60, stage_actor: { kind: 'hive' } }, stages, ctx); assert.deepStrictEqual(segStates(row), [D, D, D, D, D, 'active', 'todo cap']); -row = stageTrackerRowHtml({ repo: 'acme/console', number: 109, kind: 'pr', stage: 80, caption: 'soak 20m left' }, stages, ctx); +row = stageTrackerRowHtml({ repo: 'acme/console', number: 109, kind: 'pr', stage: 80, stage_actor: { kind: 'hive' }, caption: 'soak 20m left' }, stages, ctx); assert.ok(row.includes('Ready for auto merge') && strip(row).includes('title="Awaiting merge admission — not yet admitted — soak 20m left · Next move: hive"'), 'chevron tooltip carries 080: ' + row); // PR regressed from the queue back to review-pending: Review lit, "Sent back" in the tooltip. @@ -480,16 +480,16 @@ assert.ok(tooltip(row).startsWith('Sent back')); assert.ok(row.includes('ham-mod-regressed'), 'regressed outranks needs-rebase for the single chip'); // Stalled PR awaiting admission: since text turns red. -row = stageTrackerRowHtml({ repo: 'acme/console', number: 104, kind: 'pr', stage: 80, stage_since: new Date(now - 3*3600000).toISOString(), modifiers: ['stalled'] }, stages, ctx); +row = stageTrackerRowHtml({ repo: 'acme/console', number: 104, kind: 'pr', stage: 80, stage_actor: { kind: 'hive' }, stage_since: new Date(now - 3*3600000).toISOString(), modifiers: ['stalled'] }, stages, ctx); assert.deepStrictEqual(segStates(row), [D, D, D, D, D, 'active', 'todo cap']); assert.ok(row.includes('3h'), row); // Human-merge detour off Merge gate. -row = stageTrackerRowHtml({ repo: 'acme/console', number: 105, kind: 'pr', stage: 90 }, stages, ctx); +row = stageTrackerRowHtml({ repo: 'acme/console', number: 105, kind: 'pr', stage: 90, stage_actor: { kind: 'human' } }, stages, ctx); assert.deepStrictEqual(segStates(row), [D, D, D, D, D, 'active detoured', 'todo cap']); assert.ok(row.includes('Ready for human merge')); // 085 has its own word; needs-decision as a modifier elsewhere reads "needs human decision". -row = stageTrackerRowHtml({ repo: 'acme/console', number: 106, kind: 'pr', stage: 85, modifiers: ['blocked'], caption: 'DCO failing — fix, waive or close' }, stages, ctx); +row = stageTrackerRowHtml({ repo: 'acme/console', number: 106, kind: 'pr', stage: 85, stage_actor: { kind: 'human' }, modifiers: ['blocked'], caption: 'DCO failing — fix, waive or close' }, stages, ctx); assert.deepStrictEqual(segStates(row), [D, D, D, D, D, 'active detoured', 'todo cap']); assert.ok(row.includes('Needs human decision') && !row.includes('ham-mod-needs-decision'), row); assert.ok(tooltip(row).includes('Needs a human decision'), row); @@ -510,39 +510,39 @@ for (const parked of [45, 85]) { assert.ok(row.includes('Needs human decision') && tooltip(row).includes('Needs a human decision') && !tooltip(row).includes('(its PR)'), row); } // 045 needs attention like the other parking stages. -assert.ok(stageTrackerNeedsAttention({ kind: 'issue', stage: 45 }) && stageTrackerNeedsAttention({ kind: 'pr', stage: 85 }) && !stageTrackerNeedsAttention({ kind: 'issue', stage: 10 })); +assert.ok(stageTrackerNeedsAttention({ kind: 'issue', stage: 45, stage_actor: { kind: 'human' } }) && stageTrackerNeedsAttention({ kind: 'pr', stage: 85, stage_actor: { kind: 'human' } }) && !stageTrackerNeedsAttention({ kind: 'issue', stage: 10 })); // A regression the hive is working through is not a call on a person: out of "Needs attention", no "Sent back" headline. assert.ok(!stageTrackerNeedsAttention({ kind: 'issue', stage: 10, modifiers: ['regressed'], regressed_from: 40 }), 'regressed at Actionable is hive-handled'); assert.ok(!stageTrackerNeedsAttention({ kind: 'issue', stage: 30, modifiers: ['regressed', 'draft'], regressed_from: 40 }), 'draft is not a human gate'); -assert.ok(stageTrackerNeedsAttention({ kind: 'issue', stage: 85, modifiers: ['regressed'], regressed_from: 100 }), 'regressed while parked on a person'); +assert.ok(stageTrackerNeedsAttention({ kind: 'issue', stage: 85, stage_actor: { kind: 'human' }, modifiers: ['regressed'], regressed_from: 100 }), 'regressed while parked on a person'); assert.ok(stageTrackerNeedsAttention({ kind: 'pr', stage: 70, modifiers: ['regressed', 'needs-rebase'], regressed_from: 100 }), 'regressed with a human-call modifier'); assert.notStrictEqual(stageTrackerHeadline({ kind: 'issue', stage: 10, modifiers: ['regressed'], regressed_from: 40 }), 'Sent back'); assert.strictEqual(stageTrackerHeadline({ kind: 'pr', stage: 70, modifiers: ['regressed', 'needs-rebase'], regressed_from: 100 }), 'Sent back'); // ...but an issue whose single covering PR sits on 085 still rides the PR's // merge gate, with the "(its PR)" suffix. -row = stageTrackerRowHtml({ repo: 'acme/console', number: 356, kind: 'issue', stage: 40, linked_prs: [{ number: 109, author_kind: 'hive', stage: 85 }] }, stages, ctx); +row = stageTrackerRowHtml({ repo: 'acme/console', number: 356, kind: 'issue', stage: 40, linked_prs: [{ number: 109, author_kind: 'hive', stage: 85, stage_actor: { kind: 'human' } }] }, stages, ctx); assert.deepStrictEqual(segStates(row), [D, D, D, D, D, 'active detoured', 'todo cap'], row); assert.ok(tooltip(row).includes('Needs a human decision (its PR)'), row); // A PR parked at 085 lights the 080 column as a detour; its chevron hover // names the parking stage, not the column it rides on — the owner read // "Awaiting merge admission … Next move: human" on hivecommons/hive#14821 // and #14822 while the engine still said 085. -row = stageTrackerRowHtml({ repo: 'acme/console', number: 14821, kind: 'pr', stage: 85, caption: 'decision requested' }, stages, ctx); +row = stageTrackerRowHtml({ repo: 'acme/console', number: 14821, kind: 'pr', stage: 85, stage_actor: { kind: 'human' }, caption: 'decision requested' }, stages, ctx); const chevronTip = (r) => (/
  • ]*title="([^"]*)" aria-current="step"/.exec(r) || [])[1] || ''; assert.ok(chevronTip(row).startsWith('Needs human decision') && !chevronTip(row).includes('Awaiting merge admission') && !chevronTip(row).includes('not yet admitted') && chevronTip(row).includes('Next move: human'), 'detour chevron names its own stage: ' + chevronTip(row)); -row = stageTrackerRowHtml({ repo: 'acme/console', number: 14830, kind: 'pr', stage: 80, caption: 'CI green' }, stages, ctx); +row = stageTrackerRowHtml({ repo: 'acme/console', number: 14830, kind: 'pr', stage: 80, stage_actor: { kind: 'hive' }, caption: 'CI green' }, stages, ctx); assert.ok(chevronTip(row).startsWith('Awaiting merge admission — not yet admitted') && chevronTip(row).includes('Next move: hive'), '080 keeps its own hover: ' + chevronTip(row)); -row = stageTrackerRowHtml({ repo: 'acme/console', number: 107, kind: 'pr', stage: 50, modifiers: ['needs-decision'] }, stages, ctx); +row = stageTrackerRowHtml({ repo: 'acme/console', number: 107, kind: 'pr', stage: 50, stage_actor: { kind: 'hive' }, modifiers: ['needs-decision'] }, stages, ctx); assert.ok(row.includes('ham-mod-needs-decision">needs human decision') && tooltip(row).includes('Flags: needs human decision'), row); // Whose move it is, as an ink-coloured icon after the word: Review = hive, // PR in progress = the PR author, Claimed = the claimant; Open/Actionable carry none. assert.ok(row.includes('CI / ReviewReturned to contributorNeeds authorPR in progressPR in progressClaimedClaimed'), 'no claimant known, no icon: ' + row); row = stageTrackerRowHtml({ repo: 'acme/console', number: 9, kind: 'issue', stage: 10 }, stages, ctx); assert.ok(!row.includes('ham-actor-ico') && !tooltip(row).includes('Next move'), row); -row = stageTrackerRowHtml({ repo: 'acme/console', number: 105, kind: 'pr', stage: 90 }, stages, ctx); +row = stageTrackerRowHtml({ repo: 'acme/console', number: 105, kind: 'pr', stage: 90, stage_actor: { kind: 'human' } }, stages, ctx); assert.ok(row.includes('aria-label="Next move: human"') && row.includes('Ready for human merge]*>tracker 1/3'), 'tracker p assert.ok(row.includes('v6'), 'covering PR base: ' + row); // 040 shares the PR in progress column with 030; the chevron tooltip names the real stage. -row = stageTrackerRowHtml({ repo: 'acme/console', number: 9, kind: 'issue', title: 'Ordering drifts', stage: 40, linked_prs: [{ number: 103, title: 'Backport', author_kind: 'clanker', stage: 30 }, { number: 102, title: 'Fix it', url: 'u', author_kind: 'human', stage: 70, stage_since: new Date(now - 3600000).toISOString(), modifiers: ['needs-rebase'], caption: 'Rebasing onto main' }] }, stages, ctx); +row = stageTrackerRowHtml({ repo: 'acme/console', number: 9, kind: 'issue', title: 'Ordering drifts', stage: 40, linked_prs: [{ number: 103, title: 'Backport', author_kind: 'clanker', stage: 30, stage_actor: { kind: 'clanker' } }, { number: 102, title: 'Fix it', url: 'u', author_kind: 'human', stage: 70, stage_actor: { kind: 'human' }, stage_since: new Date(now - 3600000).toISOString(), modifiers: ['needs-rebase'], caption: 'Rebasing onto main' }] }, stages, ctx); assert.deepStrictEqual(segStates(row), [D, D, D, B, B, B, 'blank cap']); assert.ok(!strip(row).includes('aria-current'), 'issue strip has no lit chevron once PRs cover it'); assert.ok(row.includes('Ordering drifts'), 'issue keeps its own title on the left'); @@ -660,19 +660,19 @@ assert.strictEqual(subs(row).length, 0, 'no PR yet'); // A merged covering PR: single entry with the green cap lit; nested when there are two. row = stageTrackerRowHtml({ repo: 'acme/console', number: 11, kind: 'issue', stage: 40, linked_prs: [{ number: 120, title: 'Done', author_kind: 'hive', stage: 110 }] }, stages, ctx); assert.deepStrictEqual(segStates(row), [D, D, D, D, D, D, 'active cap merged']); -row = stageTrackerRowHtml({ repo: 'acme/console', number: 11, kind: 'issue', stage: 40, linked_prs: [{ number: 121, title: 'Follow-up', author_kind: 'hive', stage: 50 }, { number: 120, title: 'Done', author_kind: 'hive', stage: 110 }] }, stages, ctx); +row = stageTrackerRowHtml({ repo: 'acme/console', number: 11, kind: 'issue', stage: 40, linked_prs: [{ number: 121, title: 'Follow-up', author_kind: 'hive', stage: 50, stage_actor: { kind: 'hive' } }, { number: 120, title: 'Done', author_kind: 'hive', stage: 110 }] }, stages, ctx); assert.deepStrictEqual(segStates(subs(row)[0]), [B, B, B, D, D, D, 'active cap merged'], 'furthest along first'); // Title line: lead cell (Open..Claimed) and PR cell (PR in progress..Merge gate) each truncate with an ellipsis; the full title is on the element itself. row = stageTrackerRowHtml({ repo: 'acme/console', number: 12, kind: 'issue', title: 'A very long issue title that must not wrap', stage: 10 }, stages, ctx); // No PR to list: the lead cell widens over the empty PR column so a long title has room before it truncates. assert.ok(/
  • <\/span><\/li>/.test(row), row); // Sort key: a covered issue counts as far along as its furthest PR. -assert.strictEqual(stageTrackerSortKey({ kind: 'issue', stage: 40, linked_prs: [{ number: 1, stage: 30 }, { number: 2, stage: 90 }] }, stages).anchor, 80); +assert.strictEqual(stageTrackerSortKey({ kind: 'issue', stage: 40, linked_prs: [{ number: 1, stage: 30 }, { number: 2, stage: 90, stage_actor: { kind: 'human' } }] }, stages).anchor, 80); // An issue parked on 045 (or a pre-045 085) with no PR sorts at Actionable, not past the merge gate. -assert.strictEqual(stageTrackerSortKey({ kind: 'issue', stage: 45 }, stages).anchor, 10); -assert.strictEqual(stageTrackerSortKey({ kind: 'issue', stage: 15 }, stages).anchor, 10, '015 sorts with Actionable'); -assert.strictEqual(stageTrackerSortKey({ kind: 'issue', stage: 85 }, stages).anchor, 10); -assert.strictEqual(stageTrackerSortKey({ kind: 'pr', stage: 85 }, stages).anchor, 80); +assert.strictEqual(stageTrackerSortKey({ kind: 'issue', stage: 45, stage_actor: { kind: 'human' } }, stages).anchor, 10); +assert.strictEqual(stageTrackerSortKey({ kind: 'issue', stage: 15, stage_actor: { kind: 'human' } }, stages).anchor, 10, '015 sorts with Actionable'); +assert.strictEqual(stageTrackerSortKey({ kind: 'issue', stage: 85, stage_actor: { kind: 'human' } }, stages).anchor, 10); +assert.strictEqual(stageTrackerSortKey({ kind: 'pr', stage: 85, stage_actor: { kind: 'human' } }, stages).anchor, 80); assert.strictEqual(stageTrackerSortKey({ kind: 'issue', stage: 40, linked_prs: [{ number: 1 }] }, stages).anchor, 30, 'unknown PR stage falls back to the issue'); assert.strictEqual(stageTrackerSortKey({ kind: 'pr', stage: 72 }, stages).anchor, 50); @@ -690,7 +690,7 @@ assert.deepStrictEqual(segStates(row), ['active', T, T, T, T, T, 'todo cap']); // chevron now leads with its stage icon, so the regex skips that svg. const prWords = {}; for (const [st, word, actor] of [[50, 'CI / Review', 'hive'], [60, 'Ready for auto merge', 'hive'], [70, 'Fixing', 'author'], [71, 'Needs author', 'author'], [72, 'Returned to contributor', 'author'], [74, 'Adopted by hive', 'hive'], [80, 'Ready for auto merge', 'hive'], [85, 'Needs human decision', 'human'], [90, 'Ready for human merge', 'human'], [100, 'Ready for auto merge', 'hive']]) { - const r = stageTrackerRowHtml({ repo: 'acme/console', number: 500 + st, kind: 'pr', stage: st, author_kind: 'clanker' }, stages, ctx); + const r = stageTrackerRowHtml({ repo: 'acme/console', number: 500 + st, kind: 'pr', stage: st, stage_actor: { kind: actor === 'author' ? 'clanker' : actor }, author_kind: 'clanker' }, stages, ctx); const m = /aria-current="step">]*>[\s\S]*?<\/svg>([^<]*)<\/span>]*aria-label="Next move: ([a-z]+)"[^>]*>/.exec(r); assert.ok(m, 'stage ' + st + ' has no active word + actor: ' + r); assert.deepStrictEqual([m[1], m[2]], [word, actor === 'author' ? 'clanker' : actor], 'stage ' + st); @@ -699,15 +699,15 @@ for (const [st, word, actor] of [[50, 'CI / Review', 'hive'], [60, 'Ready for au // The responsive caption names the column, the detour word when there is one, // and the next mover for the strip's active segment; it stays empty when no // active segment is in range. -assert.strictEqual(stageTrackerCurrentStageHtml({ repo: 'acme/console', number: 570, kind: 'pr', stage: 70, author_kind: 'clanker' }, stages), '

    CI / Review · Fixing · Next move: clanker

    '); -assert.strictEqual(stageTrackerCurrentStageHtml({ repo: 'acme/console', number: 560, kind: 'pr', stage: 60 }, stages), '

    Ready for auto merge · Next move: hive

    ', 'no detour → column word only'); -assert.strictEqual(stageTrackerCurrentStageHtml({ repo: 'acme/console', number: 570, kind: 'pr', stage: 70, author_kind: 'clanker' }, stages, { from: 500 }), '', 'no caption when the active segment is out of range'); +assert.strictEqual(stageTrackerCurrentStageHtml({ repo: 'acme/console', number: 570, kind: 'pr', stage: 70, stage_actor: { kind: 'clanker' }, author_kind: 'clanker' }, stages), '

    CI / Review · Fixing · Next move: clanker

    '); +assert.strictEqual(stageTrackerCurrentStageHtml({ repo: 'acme/console', number: 560, kind: 'pr', stage: 60, stage_actor: { kind: 'hive' } }, stages), '

    Ready for auto merge · Next move: hive

    ', 'no detour → column word only'); +assert.strictEqual(stageTrackerCurrentStageHtml({ repo: 'acme/console', number: 570, kind: 'pr', stage: 70, stage_actor: { kind: 'clanker' }, author_kind: 'clanker' }, stages, { from: 500 }), '', 'no caption when the active segment is out of range'); assert.strictEqual(STAGE_TRACKER_ACTOR[70], 'author', '070 fixing is the author\'s move'); // Filters. const items = [ - { kind: 'pr', repo: 'a/b', stage: 50 }, { kind: 'issue', repo: 'a/c', number: 1, stage: 10 }, - { kind: 'pr', repo: 'a/b', stage: 72 }, { kind: 'pr', repo: 'a/c', number: 9, stage: 80, modifiers: ['stalled'], nested_under: 1 }, - { kind: 'pr', repo: 'a/c', number: 10, stage: 80, nested_under: 2 }, + { kind: 'pr', repo: 'a/b', stage: 50, stage_actor: { kind: 'hive' } }, { kind: 'issue', repo: 'a/c', number: 1, stage: 10 }, + { kind: 'pr', repo: 'a/b', stage: 72 }, { kind: 'pr', repo: 'a/c', number: 9, stage: 80, stage_actor: { kind: 'hive' }, modifiers: ['stalled'], nested_under: 1 }, + { kind: 'pr', repo: 'a/c', number: 10, stage: 80, stage_actor: { kind: 'hive' }, nested_under: 2 }, ]; // All / Issues nest a PR under its listed issue; Pull requests flattens; a PR whose issue is not listed stands alone. assert.deepStrictEqual(stageTrackerVisible(items, { kind: 'all', repo: '' }).map(it => it.number), [undefined, 1, undefined, 10]); @@ -722,12 +722,12 @@ assert.strictEqual(items.filter(stageTrackerNeedsAttention).length, 2); // be its own parent issue, and must never appear under the Issues filter. const g = [ { kind: 'issue', repo: 'g/r', number: 1, title: 'Lone issue', stage: 20, author: 'ann', author_kind: 'human' }, - { kind: 'issue', repo: 'g/r', number: 2, title: 'Issue with one PR', stage: 40, linked_prs: [{ number: 21, title: 'The one PR', author: 'hive-bot', author_kind: 'hive', stage: 50 }] }, - { kind: 'pr', repo: 'g/r', number: 21, title: 'The one PR', stage: 50, author: 'hive-bot', author_kind: 'hive', nested_under: 2 }, - { kind: 'issue', repo: 'g/r', number: 3, title: 'Issue with two PRs', stage: 40, linked_prs: [{ number: 31, title: 'First PR', author: 'bo', author_kind: 'clanker', stage: 72 }, { number: 32, title: 'Second PR', author: 'cy', author_kind: 'human', stage: 90 }] }, - { kind: 'pr', repo: 'g/r', number: 31, title: 'First PR', stage: 72, author: 'bo', author_kind: 'clanker', nested_under: 3 }, - { kind: 'pr', repo: 'g/r', number: 32, title: 'Second PR', stage: 90, author: 'cy', author_kind: 'human', nested_under: 3 }, - { kind: 'pr', repo: 'g/r', number: 40, title: 'Standalone PR', stage: 80, author: 'cy', author_kind: 'human', modifiers: ['needs-rebase'] }, + { kind: 'issue', repo: 'g/r', number: 2, title: 'Issue with one PR', stage: 40, linked_prs: [{ number: 21, title: 'The one PR', author: 'hive-bot', author_kind: 'hive', stage: 50, stage_actor: { kind: 'hive' } }] }, + { kind: 'pr', repo: 'g/r', number: 21, title: 'The one PR', stage: 50, stage_actor: { kind: 'hive' }, author: 'hive-bot', author_kind: 'hive', nested_under: 2 }, + { kind: 'issue', repo: 'g/r', number: 3, title: 'Issue with two PRs', stage: 40, linked_prs: [{ number: 31, title: 'First PR', author: 'bo', author_kind: 'clanker', stage: 72, stage_actor: { kind: 'clanker' } }, { number: 32, title: 'Second PR', author: 'cy', author_kind: 'human', stage: 90, stage_actor: { kind: 'human' } }] }, + { kind: 'pr', repo: 'g/r', number: 31, title: 'First PR', stage: 72, stage_actor: { kind: 'clanker' }, author: 'bo', author_kind: 'clanker', nested_under: 3 }, + { kind: 'pr', repo: 'g/r', number: 32, title: 'Second PR', stage: 90, stage_actor: { kind: 'human' }, author: 'cy', author_kind: 'human', nested_under: 3 }, + { kind: 'pr', repo: 'g/r', number: 40, title: 'Standalone PR', stage: 80, stage_actor: { kind: 'hive' }, author: 'cy', author_kind: 'human', modifiers: ['needs-rebase'] }, ]; const golden = stageTrackerVisible(g, { kind: 'all', repo: '' }).map(it => stageTrackerRowHtml(it, stages, ctx)).join('\n'); for (const it of g) assert.strictEqual(titles(golden, it.title), 1, 'exactly one visible title for #' + it.number + ' (' + it.title + ')'); @@ -790,6 +790,24 @@ assert.ok(/[^<]*<\/span>/.test(row) && !/ // Merged: the lit cap is the only chevron with hover text. row = stageTrackerRowHtml({ repo: 'acme/console', number: 106, kind: 'pr', stage: 110 }, stages, ctx); assert.ok(/
  • /.test(row) && titled(strip(row)).length === 1, row); + +// Server-derived actors override author identity, including misleading logins. +assert.strictEqual(stageTrackerActorKind({ stage: 70, author: 'hive-bot', author_kind: 'hive' }), '', 'no payload actor means unknown'); +const botPR = { number: 500, title: 'Nightly resync', author: 'github-actions[bot]', author_kind: 'bot', stage: 70, stage_state: 'Conflicting · bot PR', stage_actor: { kind: 'none', login: 'github-actions[bot]', since: null, why: "bot PR; waiting for the bot's next run" } }; +for (const botItem of [Object.assign({ repo: 'hivecommons/docs', kind: 'pr' }, botPR), { repo: 'hivecommons/docs', number: 496, kind: 'issue', linked_prs: [botPR] }]) { + const botRow = stageTrackerRowHtml(botItem, stages, ctx); + assert.ok(botRow.includes('Conflicting · bot PR') && botRow.includes('PR author: bot'), botRow); + assert.ok(!botRow.includes('ham-actor-ico') && !botRow.includes('>Fixing<'), botRow); + assert.ok(botRow.includes('no one is working on this right now — bot PR;'), botRow); +} +const sharedPR = { number: 14921, title: 'Shared fix', stage: 70, drawn_under: 14910, stage_actor: { kind: 'hive' } }; +const owners = [14911, 14910].map(number => ({ repo: 'hivecommons/hive', number, kind: 'issue', stage: 40, linked_prs: [sharedPR] })); +const ownerRows = owners.map(i => stageTrackerRowHtml(i, stages, ctx)); +assert.strictEqual(titles(ownerRows.join(''), 'Shared fix'), 1, 'one drawn PR across two issues'); +assert.ok(ownerRows[0].includes('shown under issue #14910') && !ownerRows[0].includes('aria-current="step"'), ownerRows[0]); +assert.strictEqual(stageTrackerNestedOpenPRs(owners[0]).length, 0, 'secondary issue has no PR row actions'); +assert.strictEqual(stageTrackerNestedOpenPRs(owners[1]).length, 1); + ` // Over stdin: the lifted fixture exceeds Linux's per-argument limit. cmd := exec.Command(node, "-") @@ -878,9 +896,9 @@ const items = [ // #2: clanker issue claimed 5h ago (past the 4h dwell), stage/020 + author/clanker. { kind: 'issue', repo: 'a/b', number: 2, title: 'Refactor scanner', stage: 20, stage_since: ago(5 * H), created_at: ago(3 * D), author_kind: 'clanker', labels: ['stage/020-claimed', 'author/clanker', 'bug'], modifiers: [] }, // #3: hive PR in review for 30 min, needs-rebase. - { kind: 'pr', repo: 'a/b', number: 3, title: 'Fix login crash', stage: 50, stage_since: ago(30 * 60000), created_at: ago(H), author_kind: 'hive', labels: ['stage/050-review', 'author/hive', 'needs-rebase'], modifiers: ['needs-rebase'] }, + { kind: 'pr', repo: 'a/b', number: 3, title: 'Fix login crash', stage: 50, stage_actor: { kind: 'hive' }, stage_since: ago(30 * 60000), created_at: ago(H), author_kind: 'hive', labels: ['stage/050-review', 'author/hive', 'needs-rebase'], modifiers: ['needs-rebase'] }, // #4: human PR at the merge gate for 9 days in another repo. - { kind: 'pr', repo: 'a/c', number: 4, title: 'Docs sweep', stage: 80, stage_since: ago(9 * D), created_at: ago(10 * D), author_kind: 'human', labels: ['stage/080-merge-gate', 'author/human', 'role/docs'], modifiers: [] }, + { kind: 'pr', repo: 'a/c', number: 4, title: 'Docs sweep', stage: 80, stage_actor: { kind: 'hive' }, stage_since: ago(9 * D), created_at: ago(10 * D), author_kind: 'human', labels: ['stage/080-merge-gate', 'author/human', 'role/docs'], modifiers: [] }, // #5: clanker issue actionable for 2 days, under its dwell; stalled modifier. { kind: 'issue', repo: 'a/c', number: 5, title: 'Add paging', stage: 10, stage_since: ago(2 * D), created_at: ago(2 * D), author_kind: 'clanker', labels: ['stage/010-actionable', 'author/clanker', 'role/docs'], modifiers: ['stalled'] }, ]; @@ -924,8 +942,8 @@ assert.deepStrictEqual(nums(stageTrackerVisible(items, F({ attention: true, auth // (label chips, the Pull requests tab, …) drops the issue the PR must still // render as its own row — an item never disappears because its issue did. const nestedItems = items.concat([ - { kind: 'issue', repo: 'a/b', number: 6, title: 'Covered', stage: 20, stage_since: ago(H), created_at: ago(D), author_kind: 'human', labels: ['stage/020-claimed', 'bug'], modifiers: [], linked_prs: [{ number: 7, stage: 50 }] }, - { kind: 'pr', repo: 'a/b', number: 7, title: 'Covers 6', stage: 50, stage_since: ago(H), created_at: ago(H), author_kind: 'hive', labels: ['stage/050-review', 'author/hive'], modifiers: [], nested_under: 6 }, + { kind: 'issue', repo: 'a/b', number: 6, title: 'Covered', stage: 20, stage_since: ago(H), created_at: ago(D), author_kind: 'human', labels: ['stage/020-claimed', 'bug'], modifiers: [], linked_prs: [{ number: 7, stage: 50, stage_actor: { kind: 'hive' } }] }, + { kind: 'pr', repo: 'a/b', number: 7, title: 'Covers 6', stage: 50, stage_actor: { kind: 'hive' }, stage_since: ago(H), created_at: ago(H), author_kind: 'hive', labels: ['stage/050-review', 'author/hive'], modifiers: [], nested_under: 6 }, ]); assert.deepStrictEqual(nums(stageTrackerVisible(nestedItems, F(), ctx)).sort(), [1, 2, 3, 4, 5, 6], 'issue listed → the PR rides its row, not its own'); assert.deepStrictEqual(nums(stageTrackerVisible(nestedItems, F({ labels: ['author/hive'] }), ctx)), [3, 7], 'issue filtered out → the PR is its own row'); @@ -1010,17 +1028,17 @@ assert.deepStrictEqual([dlg.total, dlg.selected, dlg.query], [40, 1, 'zz-1']); // Needs human (hivecommons/hive#15008): stage/modifier predicate shared with the count — labels alone never qualify. const parked = items.concat([ - { kind: 'issue', repo: 'a/b', number: 20, stage: 45, modifiers: [], labels: ['stage/045-needs-decision'] }, + { kind: 'issue', repo: 'a/b', number: 20, stage: 45, stage_actor: { kind: 'human' }, modifiers: [], labels: ['stage/045-needs-decision'] }, { kind: 'issue', repo: 'a/b', number: 21, stage: 20, modifiers: ['needs-human'], labels: ['needs-human/agent-ready'] }, - { kind: 'pr', repo: 'a/b', number: 22, stage: 71, author_kind: 'human', modifiers: [], labels: ['stage/071-needs-author', 'author/human'] }, - { kind: 'pr', repo: 'a/b', number: 23, stage: 71, author_kind: 'clanker', modifiers: [], labels: ['stage/071-needs-author'] }, + { kind: 'pr', repo: 'a/b', number: 22, stage: 71, stage_actor: { kind: 'human' }, author_kind: 'human', modifiers: [], labels: ['stage/071-needs-author', 'author/human'] }, + { kind: 'pr', repo: 'a/b', number: 23, stage: 71, stage_actor: { kind: 'clanker' }, author_kind: 'clanker', modifiers: [], labels: ['stage/071-needs-author'] }, { kind: 'issue', repo: 'a/b', number: 24, stage: 40, modifiers: [], labels: ['needs-signal'] }, - { kind: 'issue', repo: 'a/b', number: 25, stage: 45, modifiers: ['hold'], labels: ['stage/045-needs-decision', 'hold'] }, - { kind: 'pr', repo: 'a/b', number: 26, stage: 80, modifiers: ['hold'], labels: ['hold'] }, - { kind: 'pr', repo: 'a/b', number: 27, stage: 60, modifiers: ['stalled', 'blocked-on-pr'], labels: [] }, - { kind: 'issue', repo: 'a/b', number: 28, stage: 15, modifiers: [], labels: [] }, - { kind: 'pr', repo: 'a/b', number: 29, stage: 90, modifiers: [], labels: [] }, - { kind: 'pr', repo: 'a/b', number: 30, stage: 50, modifiers: ['unauthorized'], labels: [] }, + { kind: 'issue', repo: 'a/b', number: 25, stage: 45, stage_actor: { kind: 'human' }, modifiers: ['hold'], labels: ['stage/045-needs-decision', 'hold'] }, + { kind: 'pr', repo: 'a/b', number: 26, stage: 80, stage_actor: { kind: 'hive' }, modifiers: ['hold'], labels: ['hold'] }, + { kind: 'pr', repo: 'a/b', number: 27, stage: 60, stage_actor: { kind: 'hive' }, modifiers: ['stalled', 'blocked-on-pr'], labels: [] }, + { kind: 'issue', repo: 'a/b', number: 28, stage: 15, stage_actor: { kind: 'human' }, modifiers: [], labels: [] }, + { kind: 'pr', repo: 'a/b', number: 29, stage: 90, stage_actor: { kind: 'human' }, modifiers: [], labels: [] }, + { kind: 'pr', repo: 'a/b', number: 30, stage: 50, stage_actor: { kind: 'hive' }, modifiers: ['unauthorized'], labels: [] }, ]); assert.strictEqual(stageTrackerItemNeedsHuman(parked.find(x => x.number === 24)), false, '040 "PR in progress" needs no human (#14976)'); assert.strictEqual(stageTrackerItemNeedsHuman(parked.find(x => x.number === 23)), false, '071 with a clanker author is the bot\'s turn'); @@ -1036,6 +1054,7 @@ assert.strictEqual(stageTrackerFilterActive(F({ onHold: true })), true); assert.strictEqual(stageTrackerNormalizeFilter({ needsHuman: 'yes' }).needsHuman, true); assert.strictEqual(stageTrackerNormalizeFilter({ onHold: 1 }).onHold, true); assert.strictEqual(stageTrackerLabelDialogData(stageTrackerLabelFacets(parked, F({ needsHuman: true, onHold: true }))).selected, 2); + ` cmd := exec.Command(node, "-e", script) if out, err := cmd.CombinedOutput(); err != nil { diff --git a/src/pkg/dashboard/static/index.html b/src/pkg/dashboard/static/index.html index 483ad40908..c00e2cef5b 100644 --- a/src/pkg/dashboard/static/index.html +++ b/src/pkg/dashboard/static/index.html @@ -1386,6 +1386,8 @@ .ham-pager .ham-chip:disabled { opacity: 0.4; cursor: default; } .ham-cols { padding: 0 var(--sp-2) var(--sp-2); border-bottom: var(--line-width) solid var(--line-subtle); margin-bottom: var(--sp-2); } .ham-cols .ham-strip { height: auto; } + .ham-counter-header { border-bottom: 0; margin-bottom: 0; } + .ham-counter-align { justify-content: flex-end; } .ham-cols .ham-seg { background: transparent; clip-path: none; color: var(--text-faint); font-size: var(--fs-xs); justify-content: center; } .ham-cols .ham-since { color: var(--text-faint); font-family: inherit; } .ham-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--sp-2); padding: var(--sp-5) var(--sp-2); } @@ -7213,11 +7215,11 @@

    Hive activity moni - Merged today: 0

  • +
    Merged today: 0
    Loading the tracker…
    @@ -14103,6 +14105,7 @@

    Where to get help

    var _stageTrackerLabelQuery = ''; function stageTrackerHeadline(item) { + if (item.stage_state) return item.stage_state; if (item.superseded && item.superseded.closer_pr) return 'Superseded by #' + item.superseded.closer_pr + ' — decide'; const n = Number(item.stage) || 0; const mods = Array.isArray(item.modifiers) ? item.modifiers : []; @@ -14325,6 +14328,7 @@

    Where to get help

    110: '', issue: '', human: '', + bot: '', clanker: '', hive: '', pr: '', @@ -14340,21 +14344,15 @@

    Where to get help

    // "[author icon] #N title" for the PR in progress column of the title line. // tip, when given, replaces the default "title / Author" hover text. function stageTrackerPRRef(number, url, authorKind, author, title, tip) { - const ak = authorKind || 'hive'; + const ak = authorKind || ''; const who = ak + (author ? ' · @' + author : ''); return `
    ${stageTrackerIcon(ak, 'ham-author-ico ham-author-' + esc(ak), who)}#${Number(number) || 0}${title ? `${esc(title)}` : ''}`; } // Author kind of whoever must move on the item's current stage ('' = none). function stageTrackerActorKind(item) { - const role = STAGE_TRACKER_ACTOR[Number(item.stage) || 0] || ''; - if (role === 'claimant') return item.claimant_kind || ''; - if (role === 'author') { - if (item.kind === 'pr') return item.author_kind || ''; - const lp = Array.isArray(item.linked_prs) ? item.linked_prs[0] : null; - return (lp && lp.author_kind) || ''; - } - return role; + const actor = item && item.stage_actor; + return actor && actor.kind !== 'none' ? actor.kind : ''; } // An Open item is tinted stale once it has sat unlabelled this long. @@ -14401,7 +14399,7 @@

    Where to get help

    const from = range && range.from != null ? range.from : -Infinity; const to = range && range.to != null ? range.to : Infinity; const actorKind = stageTrackerActorKind(item); - const actorIco = actorKind ? stageTrackerIcon(actorKind, 'ham-ico ham-actor-ico', 'Next move: ' + actorKind) : ''; + const actorIco = actorKind ? stageTrackerIcon(actorKind, 'ham-ico ham-actor-ico', 'Next move: ' + actorKind) : (item.stage_state && (item.stage_author_kind || item.author_kind) === 'bot' ? stageTrackerIcon('bot', 'ham-ico ham-author-ico', 'PR author: bot') : ''); // Static chevrons carry no data-motion: the CSS only animates the two // moving buckets. The hive-acting pulse needs an agent actually on // the item (tracker-cues: working); a hive stage with nobody on it is @@ -14429,7 +14427,9 @@

    Where to get help

    else if (curStage === 100) tip = sg.label + ' — admitted, merging'; // Why a person merges a 090 PR leads its tooltip (hivecommons/hive#14658). else if (curStage === STAGE_TRACKER_READY_FOR_HUMAN_MERGE && item.human_merge_reason_text) tip = ((sg.detour && sg.detour.text) || sg.label) + ' — ' + String(item.human_merge_reason_text).trim() + (sg.description ? ' — ' + sg.description : ''); + if (item.stage_state && !sg.cap) tip = item.stage_state; if (actorKind && !sg.cap) tip += ' · Next move: ' + actorKind; + else if (!sg.cap && item.stage_actor) tip += ' · no one is working on this right now — ' + item.stage_actor.why; // The sentinel's reason leads the lane tooltip so the security // implication is read before the stage mechanics. if (sentinel) tip = stageTrackerSentinelTip(item) + ' — ' + tip; @@ -14442,6 +14442,7 @@

    Where to get help

    // becomes a button and the chevron drops its native title so the // popover (which repeats the stage line) is its one hover text. const decision = active && !sg.cap && typeof stageTrackerDecisionOf === 'function' ? stageTrackerDecisionOf(item) : null; + if (active && item.stage_state) { sg.short = item.stage_state; if (sg.detour) sg.detour.text = item.stage_state; } const word = sg.detour ? `${esc(sg.detour.text)}` : `${esc(sg.short)}`; if (sg.cap) inner = stageTrackerIcon(sg.number, 'ham-ico'); else if (active) inner = stageTrackerIcon(sg.number, 'ham-ico ham-active-ico') + (decision ? stageTrackerDecisionTriggerHtml(decision, word, tip) : word) + actorIco; @@ -14460,7 +14461,7 @@

    Where to get help

    if (!active) return ''; const actor = active.cap ? '' : stageTrackerActorKind(item); const regressed = stageTrackerRegressionText(item, Date.now()); - const text = active.short + (active.detour && active.detour.text !== active.short ? ' · ' + active.detour.text : '') + (actor ? ' · Next move: ' + actor : '') + (regressed ? ' · ' + regressed : ''); + const text = (item.stage_state || active.short + (active.detour && active.detour.text !== active.short ? ' · ' + active.detour.text : '')) + (actor ? ' · Next move: ' + actor : '') + (regressed ? ' · ' + regressed : ''); return `

    ${esc(text)}

    `; } @@ -14851,7 +14852,7 @@

    Where to get help

    // PRs under it (the superseded-by prompt pre-fills the one sibling). function stageTrackerLinkedPRItem(issue, lp) { const open = Array.isArray(issue.linked_prs) ? issue.linked_prs.filter(x => x && x.number !== lp.number && stageTrackerLinkedPROpen(x)) : []; - return { repo: issue.repo, number: lp.number, kind: 'pr', title: lp.title || '', url: lp.url || '', author: lp.author || '', author_kind: lp.author_kind || '', + return { repo: issue.repo, number: lp.number, kind: 'pr', title: lp.title || '', url: lp.url || '', author: lp.author || '', author_kind: lp.author_kind || '', stage_actor: lp.stage_actor, stage_state: lp.stage_state || '', stage: lp.stage || 0, stage_since: lp.stage_since || '', stage_slug: lp.stage_slug || '', modifiers: lp.modifiers || [], deferred_modifiers: lp.deferred_modifiers || [], caption: lp.caption || '', reason: lp.reason || '', human_approver: lp.human_approver || '', manual_merge: !!lp.manual_merge, human_merge_reason: lp.human_merge_reason || '', human_merge_reason_text: lp.human_merge_reason_text || '', sentinel_alert: !!lp.sentinel_alert, sentinel_reason: lp.sentinel_reason || '', head: lp.head || '', decision_needed: lp.decision_needed || null, adoption: lp.adoption || null, superseded: !!lp.superseded, parent: Number(issue.number) || 0, siblings: open.map(x => Number(x.number) || 0), @@ -14864,7 +14865,7 @@

    Where to get help

    // Pure: an issue's open nested PRs as row items. function stageTrackerNestedOpenPRs(issue) { if (!issue || issue.kind === 'pr') return []; - return (Array.isArray(issue.linked_prs) ? issue.linked_prs : []).filter(stageTrackerLinkedPROpen).map(lp => stageTrackerLinkedPRItem(issue, lp)); + return (Array.isArray(issue.linked_prs) ? issue.linked_prs : []).filter(lp => stageTrackerLinkedPROpen(lp) && (!lp.drawn_under || Number(lp.drawn_under) === Number(issue.number))).map(lp => stageTrackerLinkedPRItem(issue, lp)); } function stageTrackerSubRowHtml(lp, issue, stages, nowMs, ctx) { const pr = stageTrackerLinkedPRItem(issue, lp); @@ -15041,13 +15042,18 @@

    Where to get help

    const title = item.title || ''; let prRefs = [], shown = item, range = null, subs = ''; if (isIssue) { - const linked = stageTrackerLinkedSorted(item, stages); + const allLinked = stageTrackerLinkedSorted(item, stages); + const linked = allLinked.filter(lp => !lp.drawn_under || Number(lp.drawn_under) === Number(item.number)); + const elsewhere = allLinked.filter(lp => lp.drawn_under && Number(lp.drawn_under) !== Number(item.number)); + const references = elsewhere.map(lp => `#${Number(lp.number)} · shown under issue #${Number(lp.drawn_under)}`); + if (!linked.length && elsewhere.length) { range = { to: 20 }; shown = Object.assign({}, item, { stage: 40 }); } + prRefs = references; if (linked.length === 1) { // One covering PR: a single entry whose strip the PR's stage drives. const lp = linked[0]; - const who = (lp.author_kind || 'hive') + (lp.author ? ' · @' + lp.author : ''); + const who = (lp.author_kind || 'unknown') + (lp.author ? ' · @' + lp.author : ''); prRefs = [STAGE_TRACKER_LINKED_GLYPH + stageTrackerPRRef(lp.number, lp.url, lp.author_kind || '', lp.author, lp.title, (lp.title ? lp.title + '\n' : '') + 'Author: ' + who + ' · ' + stageTrackerLinkedTip(item, lp.number, ctx)) + (lp.base_ref ? ` ${esc(lp.base_ref)}` : '')]; - shown = Object.assign({}, item, { via_pr: true, stage: lp.stage || 40, stage_since: lp.stage_since || item.stage_since, modifiers: lp.modifiers || item.modifiers, deferred_modifiers: lp.deferred_modifiers || item.deferred_modifiers || [], caption: lp.caption || item.caption, reason: lp.reason || item.reason, + shown = Object.assign({}, item, { via_pr: true, stage_actor: lp.stage_actor, stage_state: lp.stage_state || '', stage_author_kind: lp.author_kind || '', stage: lp.stage || 40, stage_since: lp.stage_since || item.stage_since, modifiers: lp.modifiers || item.modifiers, deferred_modifiers: lp.deferred_modifiers || item.deferred_modifiers || [], caption: lp.caption || item.caption, reason: lp.reason || item.reason, human_approver: lp.human_approver || '', manual_merge: !!lp.manual_merge, human_merge_reason: lp.human_merge_reason || '', human_merge_reason_text: lp.human_merge_reason_text || '', sentinel_alert: !!lp.sentinel_alert, sentinel_reason: lp.sentinel_reason || '', head: lp.head || '', decision_needed: lp.decision_needed || null, adoption: lp.adoption || null }); } else if (linked.length) { // Several covering PRs: the issue strip ends at Claimed, all passed @@ -15056,6 +15062,7 @@

    Where to get help

    if (stageTrackerAnchor(item.stage, stages, item.kind) <= 20) shown = Object.assign({}, item, { stage: 40 }); subs = linked.map(lp => stageTrackerSubRowHtml(lp, item, stages, nowMs, ctx)).join(''); } + if (linked.length) prRefs = prRefs.concat(references); } // Invariant (owner): the issue slot on the left never holds a PR. A // PR whose issue is listed is nested under it; a PR seen on its own @@ -15086,7 +15093,7 @@

    Where to get help

    const ci = item.closed_issue; const notPlanned = String(ci.state_reason || '').toLowerCase() === 'not_planned'; const ciTip = (ci.title || STAGE_TRACKER_CLOSED_ISSUE_TITLE) + ' · closed' + (notPlanned ? ' (not planned)' : '') + ' · PR still open'; - const ak = item.author_kind || 'hive'; + const ak = item.author_kind || ''; leadHtml = ``; } const prs = typeof stageTrackerRowPRKeys === 'function' ? stageTrackerRowPRKeys(item) : ''; - return `
    + return `
    ${stageTrackerRowToolsHtml(item)}
    ${stageTrackerHeadColsHtml(prRefs, leadHtml, stageTrackerActedBadgeHtml(item, nowMs) + stageTrackerChipsHtml(shown))} @@ -17789,7 +17796,7 @@

    All labels

    merge count." A merged PR's row does not vanish on the next refresh: it is pinned for STAGE_TRACKER_CELEBRATE_PIN_MS, its ✓ cell glows, a small brand-amber hex token lifts out of that cell and arcs to the - toolbar's "Merged today" count, the count ticks +1 with a soft pop + gate header's "Merged today" count, the count ticks +1 with a soft pop (the zap plays on arrival when sound is on), then the row leaves by the usual exit. Several merges in one refresh stagger 200 ms apart and at most STAGE_TRACKER_CELEBRATE_MAX_FLIGHTS tokens fly at once; @@ -17894,7 +17901,7 @@

    All labels

    function stageTrackerRowPRKeys(item) { if (!item) return ''; if (item.kind === 'pr') return stageTrackerPRKey(item.repo, item.number); - return (Array.isArray(item.linked_prs) ? item.linked_prs : []).filter(lp => lp && Number(lp.number) > 0).map(lp => stageTrackerPRKey(lp.repo || item.repo, lp.number)).join(' '); + return (Array.isArray(item.linked_prs) ? item.linked_prs : []).filter(lp => lp && Number(lp.number) > 0 && (!lp.drawn_under || Number(lp.drawn_under) === Number(item.number))).map(lp => stageTrackerPRKey(lp.repo || item.repo, lp.number)).join(' '); } // PR key → the row key it was last drawn on (from the previous payload's // nested_under / linked_prs), for a merge whose row left the DOM @@ -17905,7 +17912,7 @@

    All labels

    for (const it of (d && Array.isArray(d.items) ? d.items : [])) { if (!it) continue; if (it.kind === 'pr') out[stageTrackerPRKey(it.repo, it.number)] = Number(it.nested_under) > 0 ? stageTrackerItemKey({ repo: it.repo, kind: 'issue', number: it.nested_under }) : stageTrackerItemKey(it); - for (const lp of (Array.isArray(it.linked_prs) ? it.linked_prs : [])) if (lp && Number(lp.number) > 0) out[stageTrackerPRKey(lp.repo || it.repo, lp.number)] = stageTrackerItemKey(it); + for (const lp of (Array.isArray(it.linked_prs) ? it.linked_prs : [])) if (lp && Number(lp.number) > 0 && (!lp.drawn_under || Number(lp.drawn_under) === Number(it.number))) out[stageTrackerPRKey(lp.repo || it.repo, lp.number)] = stageTrackerItemKey(it); } return out; } @@ -18434,7 +18441,7 @@

    All labels

    function stageTrackerCelebrateSectionHtml(on) { return `
    Merges
    -

    When a pull request merges its row stays for a moment, its ✓ cell glows and a small token rises into the toolbar's "Merged today" count, which ticks up. Under reduced motion the count ticks and the row glows, nothing flies. The count resets at midnight.

    +

    When a pull request merges its row stays for a moment, its ✓ cell glows and a small token rises into the gate header's "Merged today" count, which ticks up. Under reduced motion the count ticks and the row glows, nothing flies. The count resets at midnight.

    `; }