From e3bb05ab8f6e70a14302a0157856ccbe592c4fd3 Mon Sep 17 00:00:00 2001 From: Andrew Anderson Date: Wed, 28 Oct 2026 15:32:59 -0400 Subject: [PATCH 1/4] =?UTF-8?q?=F0=9F=90=9B=20Activity=20Monitor:=20server?= =?UTF-8?q?-derived=20stage=20actor=20icons,=20one=20row=20per=20PR,=20Mer?= =?UTF-8?q?ged-today=20counter=20above=20the=20gate?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Every lit stage pill now draws its actor icon from a server-derived stage_actor {kind, login, since, why} (hive / clanker / human / bot / none) instead of guessing from author_kind; a bot-authored or unowned red 070 PR reads "Conflicting · bot PR" / "Red · nobody on it" with the matching icon, and kind none shows no icon with a "no one is working on this right now - why" tooltip (hivecommons/docs#500). A PR that closes several open issues is drawn once: linked_prs entries carry drawn_under (the PR's nested_under) and the other issues show a "↳ #N · under #M" chip instead of a second identical strip (hivecommons/hive#14921 under #14910 and #14911). The "Merged today" counter is mounted into a slot in the column header directly above the Merge gate / ✓ columns (stageTrackerMergedCountMount), parked in its toolbar home while the board is empty; celebrateRow and the count draw resolve the chip through stageTrackerMergedChip() so the token targets the new location. Fixes #15071 Signed-off-by: Andrew Anderson --- ...fixed-tracker-actor-icon-dedupe-counter.md | 1 + src/docs/dashboard-sections.md | 6 +- src/pkg/dashboard/stage_tracker.go | 45 ++- src/pkg/dashboard/stage_tracker_actor.go | 363 ++++++++++++++++++ .../stage_tracker_actor_icon_test.go | 244 ++++++++++++ src/pkg/dashboard/stage_tracker_actor_test.go | 200 ++++++++++ .../stage_tracker_attention_order_test.go | 1 + src/pkg/dashboard/stage_tracker_cues_test.go | 5 + .../dashboard/stage_tracker_motion_test.go | 11 + .../stage_tracker_pills_gate_test.go | 1 + .../stage_tracker_repo_grouping_test.go | 5 + src/pkg/dashboard/stage_tracker_ui_test.go | 41 +- src/pkg/dashboard/static/index.html | 115 +++++- 13 files changed, 1012 insertions(+), 26 deletions(-) create mode 100644 changelog.d/fixed-tracker-actor-icon-dedupe-counter.md create mode 100644 src/pkg/dashboard/stage_tracker_actor.go create mode 100644 src/pkg/dashboard/stage_tracker_actor_icon_test.go create mode 100644 src/pkg/dashboard/stage_tracker_actor_test.go diff --git a/changelog.d/fixed-tracker-actor-icon-dedupe-counter.md b/changelog.d/fixed-tracker-actor-icon-dedupe-counter.md new file mode 100644 index 0000000000..9ab55897c2 --- /dev/null +++ b/changelog.d/fixed-tracker-actor-icon-dedupe-counter.md @@ -0,0 +1 @@ +- Hive Activity Monitor: every lit stage pill now draws its actor icon from a server-derived `stage_actor` (hive ⬡, contributor clanker, human, bot cog, or none with a "no one is working on this right now — why" tooltip) instead of guessing from the author; a bot-authored or unowned red PR reads "Conflicting · bot PR" / "Red · nobody on it" instead of an active "Fixing"; a PR closing several open issues is drawn once (`drawn_under`) with a "↳ #N · under #M" chip on the other issues; and the "Merged today" counter sits directly above the Merge gate / ✓ column header so the merge token's flight ends above the gate. diff --git a/src/docs/dashboard-sections.md b/src/docs/dashboard-sections.md index 6da0aa172f..d012b3d1de 100644 --- a/src/docs/dashboard-sections.md +++ b/src/docs/dashboard-sections.md @@ -706,7 +706,11 @@ 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'})`. +**Who is on it (actor icons).** The small icon after the lit pill's words names whose move the row is, and it comes from the payload — `stage_actor: {kind, login, since, why}`, derived server-side for every item and every nested PR — never from a guess on a login string. `kind` is one of **hive** (⬡ honeycomb: a hive lane or agent acts next; `login` is the agent when one is on it right now), **clanker** (robot head: a registered contributor agent must push), **human** (the person glyph the *Needs human decision* pill uses: the author, approver or a maintainer must act; `login` names them when known), **bot** (cog: a non-hive automation account such as `github-actions[bot]` or renovate authored the PR; the hive does not fix bot PRs, it waits for the bot's next run), or **none** (no icon: nobody is working on it — the pill's tooltip then reads *no one is working on this right now — *). `why` is a short sentence the tooltip appends after *Next move: @*. A `070` Fixing pill is only shown as **Fixing** when someone can fix it; a bot-authored or unowned red PR reads its state in plain words instead — **Conflicting · bot PR**, **Red · nobody on it** — with the matching icon, so a row such as hivecommons/docs#500 (a nightly resync PR that conflicts with its base) no longer looks like active hive work. Issues riding one covering PR take that PR's actor; nested PR sub-rows carry their own. + +**One row per PR.** A pull request that closes several open issues (`Closes #A` and `Closes #B`) is drawn once, under the issue the server names in each linked entry's `drawn_under` (its `nested_under`, the lowest-numbered open issue it closes). The other issues keep their own strip and show a compact **↳ #N · under #M** chip beside the title (tooltip: *PR #N covers this issue too; its row is drawn under #M*) instead of a second identical sub-row, so hivecommons/hive#14921 appears once under #14910 and #14911 points at it. Payloads without `drawn_under` draw as before. + +**Merged today.** The column header carries, directly above the **Merge gate** and ✓ columns (right-aligned over the gate, never in the filter chip bar, so it stays put however the toolbar wraps), 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) straight up the gate column to the counter above it — into the hive — 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'})`; the counter is one DOM node (`#activity-monitor-merged`) that the renderer mounts into the header slot after each refresh and parks in its toolbar home while the board is empty, so the token always targets wherever it currently sits. **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. diff --git a/src/pkg/dashboard/stage_tracker.go b/src/pkg/dashboard/stage_tracker.go index ad37d61f4f..0f3a90f24f 100644 --- a/src/pkg/dashboard/stage_tracker.go +++ b/src/pkg/dashboard/stage_tracker.go @@ -415,7 +415,12 @@ type StageTrackerItem struct { // ClaimantKind is the author kind of whoever holds the live claim on a // claimed issue (human / clanker / hive), from the worker-claim ledger. ClaimantKind string `json:"claimant_kind,omitempty"` - LinkedPR int `json:"linked_pr,omitempty"` + // StageActor is who holds the next move on this row — hive, clanker, + // human, a foreign bot, or nobody — with the plain-words why. The SPA + // draws the stage pill's actor icon from StageActor.Kind only + // (stage_tracker_actor.go). + StageActor *StageTrackerActor `json:"stage_actor,omitempty"` + LinkedPR int `json:"linked_pr,omitempty"` // LinkedPRs lists the open pull requests covering an issue (the one // named in the stage reason first) with everything the tracker needs // to draw each as a sub-row nested under the issue. @@ -516,6 +521,16 @@ type StageTrackerLinkedPR struct { OperatorActionCount int `json:"operator_action_count,omitempty"` // Hold mirrors the nested PR's own row field (hivecommons/hive#15020). Hold *StageTrackerHold `json:"hold,omitempty"` + // StageActor mirrors the nested PR's own row field so the sub-row's + // pill wears the same actor icon. + StageActor *StageTrackerActor `json:"stage_actor,omitempty"` + // DrawnUnder is the issue whose row draws this PR's full sub-row (the + // PR's NestedUnder). A PR that closes several open issues (`Closes + // #14910` and `Closes #14911` in one body) is listed by each of them, + // but its live strip is drawn once, under this issue; every other + // parent shows a compact "↳ #N · under #M" reference instead of a + // second identical row (hivecommons/hive#14921 drew twice). + DrawnUnder int `json:"drawn_under,omitempty"` } // StageTrackerHold is the row's hold provenance (stagelabels.HoldProvenance @@ -1632,6 +1647,7 @@ func (s *Server) buildStageTracker(status *StatusPayload, store *stagelabels.Sto } presence, maintainerPolicy := s.stageTrackerPresence(), s.stageTrackerMaintainerPolicy() sweep := s.stageTrackerSweepState() + workers := stageTrackerWorkersFromStatus(status) finish := func(it *StageTrackerItem, labels []string, stage stagelabels.Stage, rec stagelabels.Record, hasRec bool, draft bool) { // "Needs human decision" is read from the item's current labels, not // a store record that outlived them: once the park label is gone @@ -1712,6 +1728,11 @@ func (s *Server) buildStageTracker(status *StatusPayload, store *stagelabels.Sto if slices.Contains(it.Modifiers, modUnauthorized) || slices.Contains(it.DeferredModifiers, modUnauthorized) { it.UnauthorizedStep, it.Unauthorized = stageTrackerUnauthorized(it.Reason) } + // A foreign bot's PR the lane filed under 070: nobody in the hive + // is fixing it, and the caption must not claim so. + if stage == stagelabels.Fixing && it.Kind == "pr" && stageTrackerBotAuthor(it.Author, it.AuthorKind) { + it.Caption, it.Actor = stageTrackerBotFixingCaption(*it), StageActorBot + } it.History = stageTrackerHistory(rec) } seen := map[string]bool{} @@ -1787,6 +1808,7 @@ func (s *Server) buildStageTracker(status *StatusPayload, store *stagelabels.Sto } } it.DecisionNeeded = stageTrackerDecisionNeededAt(it, nil, sentinelLabel, now) + it.StageActor = stageTrackerStageActor(it, workers, now) add(it) } addPR := func(repoName string, pr github.PullRequest, verdict *github.MergeVerdict, bucket, bucketReason string) { @@ -1837,12 +1859,19 @@ func (s *Server) buildStageTracker(status *StatusPayload, store *stagelabels.Sto it.Caption += ": " + info.KeepReason } it.Actor = "maintainer" + if it.Stage == trackerNumberFixing && stageTrackerBotAuthor(it.Author, it.AuthorKind) { + // docs#500: a conflicting bot PR already replaced by a + // merged one is not a maintainer's decision to make; the + // bot's next run supersedes it (hivecommons/docs#500). + it.Caption, it.Actor = stageTrackerBotFixingCaption(it), StageActorBot + } } var agg *review.Aggregate if a, ok := verdictFor(repoName, pr.Number, pr.HeadSHA); ok { agg = &a } it.DecisionNeeded = stageTrackerDecisionNeededAt(it, agg, sentinelLabel, now) + it.StageActor = stageTrackerStageActor(it, workers, now) add(it) } for _, repo := range status.Repos { @@ -1874,6 +1903,7 @@ func (s *Server) buildStageTracker(status *StatusPayload, store *stagelabels.Sto s.applyOperatorActions(resp.Items, now) resp.NeedsHuman, resp.OnHold = stageTrackerHumanCounts(resp.Items) stageTrackerResolveLinkedPRs(resp.Items) + stageTrackerResolveActors(resp.Items) sort.SliceStable(resp.Items, stageTrackerLess(resp.Items)) return resp } @@ -2637,6 +2667,19 @@ func stageTrackerResolveLinkedPRs(items []StageTrackerItem) { } it.LinkedPRs = out } + // NestedUnder is final only once every issue has been read; name it on + // each listing so the SPA draws the PR's strip under one parent only. + for i := range items { + it := &items[i] + if it.Kind != "issue" { + continue + } + for j := range it.LinkedPRs { + if pr := prs[it.Repo+"#"+strconv.Itoa(it.LinkedPRs[j].Number)]; pr != nil { + it.LinkedPRs[j].DrawnUnder = pr.NestedUnder + } + } + } for i := range items { if items[i].Kind == "pr" { items[i].ClosedIssue = stageTrackerClosedIssueAnchor(items[i]) diff --git a/src/pkg/dashboard/stage_tracker_actor.go b/src/pkg/dashboard/stage_tracker_actor.go new file mode 100644 index 0000000000..190c555591 --- /dev/null +++ b/src/pkg/dashboard/stage_tracker_actor.go @@ -0,0 +1,363 @@ +package dashboard + +import ( + "fmt" + "slices" + "strconv" + "strings" + "time" + + "github.com/hivecommons/hive/pkg/stagelabels" +) + +// StageTrackerActor is who (or what) holds the next move on a tracker row, +// derived server-side so the SPA draws the actor icon from Kind alone and +// never guesses from a login string (hivecommons/hive: docs#500 drew +// "Fixing" with no icon because its github-actions[bot] author matched +// none of the heuristics). +// +// Kind is one of StageActorHive (a hive lane or agent: honeycomb), +// StageActorClanker (a registered contributor agent: robot), +// StageActorHuman (a person: the same glyph as "Needs human decision"), +// StageActorBot (a non-hive GitHub bot such as github-actions[bot] or +// dependabot: cog) or StageActorNone (nobody is working on it right now; +// the tooltip then leads with Why). Login names the account or agent when +// known; Since is when the move became theirs (the stage entry time); Why +// is the plain-words reason, always set. +type StageTrackerActor struct { + Kind string `json:"kind"` + Login string `json:"login,omitempty"` + Since *time.Time `json:"since,omitempty"` + Why string `json:"why"` +} + +const ( + StageActorHive = authorKindHive + StageActorClanker = authorKindClanker + StageActorHuman = authorKindHuman + StageActorBot = "bot" + StageActorNone = "none" +) + +// stageTrackerNobodyLead is the fixed opening of every StageActorNone +// tooltip (the SPA appends it before Why). +const stageTrackerNobodyLead = "no one is working on this right now" + +// stageTrackerWorker is one busy agent on a current item, from the status +// payload the tracker already has (FrontendAgent.LastAction with Current +// set and Busy "working"); the SPA's stageTrackerWorkers reads the same +// fields. +type stageTrackerWorker struct { + Agent string + Action string + At time.Time +} + +// stageTrackerWorkersFromStatus keys the busy agents by +// lower-case owner/repo#number. +func stageTrackerWorkersFromStatus(status *StatusPayload) map[string]stageTrackerWorker { + out := map[string]stageTrackerWorker{} + if status == nil { + return out + } + for _, a := range status.Agents { + la := a.LastAction + if la == nil || a.Busy != "working" || !la.Current || la.Repo == "" || la.Number <= 0 { + continue + } + w := stageTrackerWorker{Agent: nonEmpty(a.Name, "an agent"), Action: la.Action} + if t, err := time.Parse(time.RFC3339Nano, la.At); err == nil { + w.At = t + } + out[strings.ToLower(la.Repo)+"#"+strconv.Itoa(la.Number)] = w + } + return out +} + +// stageTrackerWorkerOn finds the agent on repo#number; a bare repo name in +// the audit ("hive") matches "hivecommons/hive" on its tail, as the SPA does. +func stageTrackerWorkerOn(workers map[string]stageTrackerWorker, repo string, number int) (stageTrackerWorker, bool) { + if len(workers) == 0 || number <= 0 { + return stageTrackerWorker{}, false + } + key := strings.ToLower(repo) + "#" + strconv.Itoa(number) + if w, ok := workers[key]; ok { + return w, true + } + suffix := "#" + strconv.Itoa(number) + lr := strings.ToLower(repo) + for k, w := range workers { + if !strings.HasSuffix(k, suffix) { + continue + } + wr := strings.TrimSuffix(k, suffix) + if strings.HasSuffix(lr, "/"+wr) || strings.HasSuffix(wr, "/"+lr) { + return w, true + } + } + return stageTrackerWorker{}, false +} + +// stageTrackerBotAuthor is true for a GitHub bot account the hive does not +// own: a "[bot]" login with no author kind resolved (the hive's own App +// PRs resolve to hive through AppAuthored / author/hive). +func stageTrackerBotAuthor(author, authorKind string) bool { + return authorKind == "" && strings.HasSuffix(strings.ToLower(strings.TrimSpace(author)), botLoginSuffix) +} + +// stageTrackerAuthorActorKind maps an item's author to an actor kind. +func stageTrackerAuthorActorKind(author, authorKind string) string { + switch authorKind { + case authorKindHive, authorKindClanker, authorKindHuman: + return authorKind + } + if stageTrackerBotAuthor(author, authorKind) { + return StageActorBot + } + return StageActorNone +} + +// stageTrackerBotWhy says why nobody in the hive fixes a bot's PR. +func stageTrackerBotWhy(author string) string { + return "bot-authored PR (@" + author + ") — the hive does not fix bot PRs; it waits for the bot's next run to replace it" +} + +// stageTrackerStageActor derives the row's actor from its finished fields. +// Issues at 030/040 and mirrored issues inherit their covering PR's actor +// in stageTrackerResolveActors once the PR rows are known; here they get +// the fallback for a PR not in the snapshot. +func stageTrackerStageActor(it StageTrackerItem, workers map[string]stageTrackerWorker, now time.Time) *StageTrackerActor { + a := &StageTrackerActor{Since: it.StageSince} + set := func(kind, login, why string) *StageTrackerActor { + a.Kind, a.Login, a.Why = kind, login, why + return a + } + mods := it.Modifiers + if slices.Contains(mods, modHold) { + return set(StageActorNone, "", "on hold — the owner paused it on purpose; nothing moves until the hold is lifted") + } + if it.Superseded != nil && it.Superseded.CloserPR > 0 && !stageTrackerBotAuthor(it.Author, it.AuthorKind) { + return set(StageActorHuman, "", "superseded by #"+strconv.Itoa(it.Superseded.CloserPR)+" — a maintainer decides whether to close it") + } + stage := stageByNumber(it.Stage) + if it.Kind == "issue" && it.Mirrored { + return set(StageActorNone, "", "covered by PR #"+strconv.Itoa(it.LinkedPR)+", which is not in this snapshot") + } + switch stage { + case stagelabels.None: + switch { + case slices.Contains(mods, modBlocked): + why := "blocked" + if it.BlockedOnPR != nil && it.BlockedOnPR.Number > 0 { + why += " on PR #" + strconv.Itoa(it.BlockedOnPR.Number) + } else if len(it.BlockedOn) > 0 { + why += " on " + strings.Join(it.BlockedOn, ", ") + } + return set(StageActorNone, "", why+" — nothing moves until the dependency closes") + case slices.Contains(mods, modDraft): + k := stageTrackerAuthorActorKind(it.Author, it.AuthorKind) + if k == StageActorNone { + return set(k, it.Author, "draft — the author has not marked it ready for review") + } + return set(k, it.Author, "draft — waits for the author to mark it ready for review") + } + return set(StageActorNone, "", "not in any stage yet — the stage engine has not classified it") + case stagelabels.Actionable: + return set(StageActorHive, "", "waiting for the scanner to pick it up") + case stagelabels.TriageNeeded: + return set(StageActorHuman, "", "no maintainer has triaged it yet") + case stagelabels.PossiblyExisting: + k := stageTrackerAuthorActorKind(it.Author, it.AuthorKind) + if k == StageActorNone || k == StageActorBot { + k = StageActorHuman + } + return set(k, it.Author, "prior art found — the author must confirm the gap or close it") + case stagelabels.Claimed: + switch it.ClaimantKind { + case authorKindHive, authorKindClanker, authorKindHuman: + return set(it.ClaimantKind, "", "holds the live claim; work is about to start") + } + return set(StageActorNone, "", "claimed, but no live claim is in the worker ledger") + case stagelabels.PRInProgress: + return set(StageActorHive, "", "an agent has a PR under way; not yet opened") + case stagelabels.CoveredByPR: + return set(StageActorNone, "", "covered by PR #"+strconv.Itoa(it.LinkedPR)+", which is not in this snapshot") + case stagelabels.ReviewPending: + return set(StageActorHive, "", "review swarm — waiting for a verdict on the current head") + case stagelabels.Reviewed: + return set(StageActorHive, "", "approved; a required check is still pending") + case stagelabels.Fixing, stagelabels.NeedsAuthor, stagelabels.ReturnedToContributor: + return stageTrackerAuthorStageActor(a, it, stage, workers, now) + case stagelabels.AdoptedByHive: + if w, ok := stageTrackerWorkerOn(workers, it.Repo, it.Number); ok { + return set(StageActorHive, w.Agent, stageTrackerWorkerWhy(w, now)) + } + return set(StageActorHive, "", "adopted — the hive carries it from here") + case stagelabels.AwaitingMergeAdmission: + return set(StageActorHive, "", "automerge lane — waiting to be admitted") + case stagelabels.NeedsDecision, stagelabels.IssueNeedsDecision: + if step, _ := stageTrackerUnauthorized(it.Reason); step != "" { + return set(StageActorHuman, "", "the hive is not permitted to "+step+"; a person must") + } + return set(StageActorHuman, "", "a human decision is owed") + case stagelabels.ReadyForHumanMerge: + why := "ready for a maintainer's merge; the hive never merges this itself" + if it.HumanMergeReasonText != "" { + why = strings.TrimSpace(it.HumanMergeReasonText) + } + return set(StageActorHuman, it.HumanApprover, why) + case stagelabels.PreMergeSoak: + return set(StageActorHive, "", "automerge lane — the pre-merge soak window is running") + case stagelabels.MergeQueue: + return set(StageActorHive, "", "in the merge queue — tide or the merge window takes it") + } + return set(StageActorNone, "", "no stage recorded yet") +} + +// stageTrackerAuthorStageActor: 070 / 071 / 072 park the PR on its +// author. A hive PR is the hive's (an agent on it is named; otherwise the +// hive re-kicks it), a clanker's is re-kicked by its contributor hive, a +// human must act, a foreign bot's PR is nobody's to fix (StageActorBot: +// icon of the bot, caption says it waits for the bot's next run), and an +// unknown author is StageActorNone. +func stageTrackerAuthorStageActor(a *StageTrackerActor, it StageTrackerItem, stage stagelabels.Stage, workers map[string]stageTrackerWorker, now time.Time) *StageTrackerActor { + kind := stageTrackerAuthorActorKind(it.Author, it.AuthorKind) + a.Kind, a.Login = kind, it.Author + switch kind { + case StageActorHive: + if w, ok := stageTrackerWorkerOn(workers, it.Repo, it.Number); ok { + a.Login, a.Why = w.Agent, stageTrackerWorkerWhy(w, now) + return a + } + if stage == stagelabels.Fixing { + a.Why = "hive PR — no agent is on it this moment; the hive re-kicks it on its next cycle" + } else { + a.Why = "hive PR — the hive re-kicks it on its next cycle" + } + case StageActorClanker: + if it.Adoption != nil && it.Adoption.Text != "" { + a.Why = it.Adoption.Text + } else { + a.Why = "contributor agent's PR — its hive re-kicks it; adopted by this hive if it goes quiet" + } + case StageActorHuman: + if stage == stagelabels.Fixing { + a.Why = "@" + it.Author + " must push a fix; the hive does not edit a person's PR" + } else { + a.Why = "@" + it.Author + " must act" + } + case StageActorBot: + a.Why = stageTrackerBotWhy(it.Author) + default: + a.Login = "" + a.Why = "author kind unknown — no author/ label and no hive marker on the PR" + } + return a +} + +func stageTrackerWorkerWhy(w stageTrackerWorker, now time.Time) string { + why := w.Agent + " is on it" + if word := stageTrackerWorkWord(w.Action); word != "" { + why = w.Agent + " " + word + } + if !w.At.IsZero() && now.After(w.At) { + why += " · " + stageTrackerShortAgoText(now.Sub(w.At)) + " ago" + } + return why +} + +// stageTrackerWorkWord mirrors the SPA's STAGE_TRACKER_WORK_WORDS. +func stageTrackerWorkWord(action string) string { + switch action { + case "agent_pr_created": + return "opened a pull request" + case "agent_issue_created": + return "opened an issue" + case "agent_comment_created": + return "commented" + case "agent_issue_claimed": + return "claimed it" + case "agent_label_applied": + return "changed labels" + case "agent_review_requested": + return "asked for review" + case "agent_issue_closed", "pr_closed": + return "closed it" + case "agent_pr_reviewed": + return "reviewed it" + case "pr_merged": + return "merged it" + } + return "" +} + +func stageTrackerShortAgoText(d time.Duration) string { + switch { + case d < time.Minute: + return fmt.Sprintf("%ds", int(d/time.Second)) + case d < time.Hour: + return fmt.Sprintf("%dm", int(d/time.Minute)) + case d < 48*time.Hour: + return fmt.Sprintf("%dh", int(d/time.Hour)) + } + return fmt.Sprintf("%dd", int(d/(24*time.Hour))) +} + +// stageTrackerBotFixingCaption is the honest caption for a foreign bot's +// PR the lane filed under 070-fixing: nobody is fixing it. Red or +// conflicting is named from the modifiers; a supersession names the PR +// that replaced it. +func stageTrackerBotFixingCaption(it StageTrackerItem) string { + lead := "Red or changes requested" + if slices.Contains(it.Modifiers, modNeedsRebase) { + lead = "Conflicting with the base branch" + } + c := lead + "; " + stageTrackerBotWhy(it.Author) + if it.Superseded != nil && it.Superseded.CloserPR > 0 { + c += " (superseded by #" + strconv.Itoa(it.Superseded.CloserPR) + ")" + } + return c +} + +// stageTrackerResolveActors runs after stageTrackerResolveLinkedPRs: an +// issue riding its covering PR (030 / 040 / mirrored) takes that PR's +// actor, and each nested sub-row carries its PR's actor so the SPA draws +// the same icon on both. +func stageTrackerResolveActors(items []StageTrackerItem) { + prs := map[string]*StageTrackerItem{} + for i := range items { + if items[i].Kind == "pr" { + prs[items[i].Repo+"#"+strconv.Itoa(items[i].Number)] = &items[i] + } + } + for i := range items { + it := &items[i] + if it.Kind != "issue" { + continue + } + for j := range it.LinkedPRs { + if pr := prs[it.Repo+"#"+strconv.Itoa(it.LinkedPRs[j].Number)]; pr != nil && pr.StageActor != nil { + cp := *pr.StageActor + it.LinkedPRs[j].StageActor = &cp + } + } + if it.StageActor == nil || slices.Contains(it.Modifiers, modHold) { + continue + } + rides := it.Mirrored || it.Stage == trackerNumberPRInProgress || it.Stage == trackerNumberCoveredByPR + if !rides || len(it.LinkedPRs) == 0 { + continue + } + lead := it.LinkedPRs[0] + for _, lp := range it.LinkedPRs { + if lp.DrawnUnder == 0 || lp.DrawnUnder == it.Number { + lead = lp + break + } + } + if lead.StageActor != nil { + cp := *lead.StageActor + it.StageActor = &cp + } + } +} diff --git a/src/pkg/dashboard/stage_tracker_actor_icon_test.go b/src/pkg/dashboard/stage_tracker_actor_icon_test.go new file mode 100644 index 0000000000..e515f4e7db --- /dev/null +++ b/src/pkg/dashboard/stage_tracker_actor_icon_test.go @@ -0,0 +1,244 @@ +package dashboard + +import ( + "strings" + "testing" +) + +// The actor icon on a lit stage pill comes from the server's stage_actor +// kind, never from a guess on the login: hive → honeycomb, clanker → robot, +// human → the same person glyph "Needs human decision" uses, bot → cog, +// none → no icon and a tooltip that says nobody is on it and why +// (hivecommons/docs#500 drew "Fixing" with no icon and nobody fixing). +func stageTrackerActorIconJS(t *testing.T, html string) string { + t.Helper() + return strings.Join([]string{ + jsFunc(t, html, "stageTrackerFixingWord"), + jsFunc(t, html, "stageTrackerLinkedElsewhere"), + jsFunc(t, html, "stageTrackerLinkedElsewhereHtml"), + }, "\n") +} + +func TestStageTrackerActorIconKindsJS(t *testing.T) { + html := indexHTML(t) + runStageTrackerRowActionsScript(t, stageTrackerRowsPreludeJS(t, html)+"\n"+stageTrackerActorIconJS(t, html)+stageTrackerRowsFixtureJS+` +const actorSvg = (html) => (/]*aria-label="([^"]*)"[^>]*>([\s\S]*?)<\/svg>/.exec(strip(html)) || []); +const detour = (html) => (/([^<]*)<\/span>/.exec(strip(html)) || [])[1]; +const litTitle = (html) => (/
  • ]*title="([^"]*)"/.exec(strip(html)) || [])[1] || ''; +const since = new Date(now - 10 * 3600000).toISOString(); +const pr = (n, extra) => Object.assign({ repo: 'hivecommons/docs', number: n, kind: 'pr', title: 'docs: resync', url: 'https://x/' + n, stage: 70, stage_since: since, caption: 'Fixing', author: 'alice', author_kind: 'human' }, extra || {}); + +// hive → honeycomb. +let row = stageTrackerRowHtml(pr(501, { author: 'hive-bot', author_kind: 'hive', stage_actor: { kind: 'hive', login: 'fixer', why: 'fixer commented · 3m ago' } }), stages, ctx); +assert.strictEqual(actorSvg(row)[1], 'Next move: hive', row); +assert.ok(actorSvg(row)[2].includes(STAGE_TRACKER_ICONS.hive), 'hive draws the honeycomb'); +assert.strictEqual(detour(row), 'Fixing', 'an agent on it: the pill stays Fixing'); +assert.ok(litTitle(row).includes('Next move: hive @fixer — fixer commented · 3m ago'), litTitle(row)); + +// clanker → robot head. +row = stageTrackerRowHtml(pr(502, { author_kind: 'clanker', stage_actor: { kind: 'clanker', login: 'acme-agent', why: '@acme-agent must push a fix' } }), stages, ctx); +assert.strictEqual(actorSvg(row)[1], 'Next move: clanker'); +assert.ok(actorSvg(row)[2].includes(STAGE_TRACKER_ICONS.clanker)); +assert.strictEqual(detour(row), 'Fixing'); + +// human → the person glyph "Needs human decision" uses. +row = stageTrackerRowHtml(pr(503, { stage_actor: { kind: 'human', login: 'alice', why: '@alice must push a fix' } }), stages, ctx); +assert.strictEqual(actorSvg(row)[1], 'Next move: human'); +assert.ok(actorSvg(row)[2].includes(STAGE_TRACKER_ICONS.human), 'human draws the person glyph'); +const decision = stageTrackerRowHtml(pr(509, { stage: 85, stage_actor: { kind: 'human' } }), stages, ctx); +assert.strictEqual(actorSvg(decision)[2], actorSvg(row)[2], 'same glyph as the Needs human decision pill'); + +// bot → cog, and the pill reads the state instead of an active Fixing (docs#500). +const botWhy = 'bot-authored PR (@github-actions[bot]) — the hive does not fix bot PRs; it waits for the bot\'s next run to replace it (superseded by #497)'; +row = stageTrackerRowHtml(pr(500, { author: 'github-actions[bot]', author_kind: '', modifiers: ['stalled', 'regressed', 'needs-rebase'], caption: 'Conflicting with the base branch; ' + botWhy, stage_actor: { kind: 'bot', login: 'github-actions[bot]', why: botWhy } }), stages, ctx); +assert.strictEqual(actorSvg(row)[1], 'Next move: bot', row); +assert.ok(actorSvg(row)[2].includes(STAGE_TRACKER_ICONS.bot), 'bot draws the cog'); +assert.ok(!actorSvg(row)[2].includes(STAGE_TRACKER_ICONS.clanker), 'a bot is not drawn as a clanker'); +assert.strictEqual(detour(row), 'Conflicting · bot PR', 'nobody is fixing: the pill says the state in plain words'); +assert.ok(litTitle(row).includes('Next move: bot @github-actions[bot] — bot-authored PR'), litTitle(row)); +assert.ok(text(row).includes('Conflicting · bot PR'), 'the compact caption carries the same words: ' + text(row)); + +// none → no icon; the tooltip says nobody is on it and why. +row = stageTrackerRowHtml(pr(504, { author_kind: '', stage_actor: { kind: 'none', why: 'the PR is red and no agent or author is on it' } }), stages, ctx); +assert.strictEqual(actorSvg(row).length, 0, 'no actor icon when nobody is working: ' + strip(row)); +assert.strictEqual(detour(row), 'Red · nobody on it'); +assert.ok(litTitle(row).includes('no one is working on this right now — the PR is red and no agent or author is on it'), litTitle(row)); +assert.ok(tooltip(row).includes('no one is working on this right now — the PR is red'), 'row tooltip too: ' + tooltip(row)); + +// No stage_actor (older server): the stage-table heuristic still applies and the word stays Fixing. +row = stageTrackerRowHtml(pr(505, { author_kind: 'clanker' }), stages, ctx); +assert.strictEqual(actorSvg(row)[1], 'Next move: clanker', 'legacy payloads keep the author-kind fallback'); +assert.strictEqual(detour(row), 'Fixing'); +assert.ok(litTitle(row).includes(' · Next move: clanker'), litTitle(row)); + +// The server word wins over the heuristic: a hive stage with none → no icon. +row = stageTrackerRowHtml(pr(506, { stage: 50, caption: 'CI running', stage_actor: { kind: 'none', why: 'CI is still running' } }), stages, ctx); +assert.strictEqual(actorSvg(row).length, 0, strip(row)); +assert.ok(strip(row).includes('CI / Review'), 'a path column keeps its name'); +assert.ok(litTitle(row).includes(STAGE_TRACKER_NOBODY_LEAD + ' — CI is still running')); + +// An issue riding its one covering PR takes the PR's actor. +const lp = { number: 500, title: 'docs: resync', url: 'https://x/500', author: 'github-actions[bot]', author_kind: '', stage: 70, stage_since: since, modifiers: ['needs-rebase'], stage_actor: { kind: 'bot', login: 'github-actions[bot]', why: botWhy } }; +row = stageTrackerRowHtml({ repo: 'hivecommons/docs', number: 496, kind: 'issue', title: 'Resync', url: 'https://x/496', stage: 40, stage_since: since, linked_prs: [lp] }, stages, ctx); +assert.strictEqual(actorSvg(row)[1], 'Next move: bot', 'single covering PR: the issue strip carries the PR actor: ' + row); +assert.strictEqual(detour(row), 'Conflicting · bot PR'); + +// Sub-rows carry their own actor: one with an agent, one with nobody. +row = stageTrackerRowHtml({ repo: 'hivecommons/docs', number: 497, kind: 'issue', title: 'Two', url: 'https://x/497', stage: 40, stage_since: since, linked_prs: [ + Object.assign({}, lp, { number: 510, stage_actor: { kind: 'hive', login: 'fixer', why: 'fixer is on it' } }), + Object.assign({}, lp, { number: 511, modifiers: [], stage_actor: { kind: 'none', why: 'no agent is on it' } }), +] }, stages, ctx); +const subRows = subs(row); +assert.strictEqual(subRows.length, 2); +assert.ok(subRows[0].includes('aria-label="Next move: hive"') && subRows[0].includes('Fixing'), subRows[0]); +assert.ok(!subRows[1].includes('ham-actor-ico') && subRows[1].includes('Red · nobody on it') && subRows[1].includes(STAGE_TRACKER_NOBODY_LEAD + ' — no agent is on it'), subRows[1]); +`) +} + +// A PR that closes two open issues is drawn once: under the issue the server +// names in drawn_under; the other issue shows a compact "under #M" chip in +// place of a second identical strip (hivecommons/hive#14921 under #14910 and +// #14911 drew twice). +func TestStageTrackerLinkedDrawnUnderJS(t *testing.T) { + html := indexHTML(t) + runStageTrackerRowActionsScript(t, stageTrackerRowsPreludeJS(t, html)+"\n"+stageTrackerActorIconJS(t, html)+stageTrackerRowsFixtureJS+` +const since = new Date(now - 3600000).toISOString(); +const lp = (n, under, extra) => Object.assign({ number: n, title: 'fix', url: 'https://x/' + n, author: 'hive-bot', author_kind: 'hive', stage: 70, stage_since: since, drawn_under: under, stage_actor: { kind: 'hive', login: 'fixer', why: 'fixer is on it' } }, extra || {}); +const issue = (n, prs) => ({ repo: 'hivecommons/hive', number: n, kind: 'issue', title: 'Issue ' + n, url: 'https://x/' + n, stage: 40, stage_since: since, caption: 'open PR #14921 covers it', linked_prs: prs }); +const elsewhere = (row) => Array.from(row.matchAll(/]*title="([^"]*)"[^>]*>([^<]*)<\/a>/g)).map(m => ({ title: m[1], text: m[2] })); + +// The owning issue draws the PR as its single covering PR, no chip. +let row = stageTrackerRowHtml(issue(14910, [lp(14921, 14910)]), stages, ctx); +assert.deepStrictEqual(prCol(row).length, 1, 'owner: the PR sits in the PR column: ' + row); +assert.ok(prCol(row)[0].includes('#14921')); +assert.strictEqual(strips(row).length, 1); +assert.ok(row.includes('Fixing') && row.includes('aria-label="Next move: hive"'), row); +assert.deepStrictEqual(elsewhere(row), [], 'owner carries no elsewhere chip'); + +// The other issue does not redraw the PR: its own strip (040 Covered by PR) and a chip pointing at the owner row. +row = stageTrackerRowHtml(issue(14911, [lp(14921, 14910)]), stages, ctx); +assert.strictEqual(prCol(row).length, 0, 'the PR column is empty, no second ↳ #14921 row: ' + row); +assert.strictEqual(subs(row).length, 0); +assert.strictEqual(strips(row).length, 1); +assert.ok(strip(row).includes('PR in progress') && strip(row).includes('title="Covered by PR'), 'the issue draws its own 040 stage (lit at the PR column): ' + strip(row)); +assert.deepStrictEqual(elsewhere(row), [{ title: 'PR #14921 covers this issue too; its row is drawn under #14910', text: '↳ #14921 · under #14910' }]); +assert.ok(!strip(row).includes('Fixing'), 'no second lit Fixing pill'); +assert.ok(tooltip(row).includes('Covering PR: #14921'), 'the row tooltip still names the covering PR'); + +// Several PRs: the ones drawn here are sorted and drawn, the rest become chips. +row = stageTrackerRowHtml(issue(14912, [lp(14921, 14910), lp(14930, 14912), lp(14931, 14912, { stage: 50 })]), stages, ctx); +assert.strictEqual(subs(row).length, 2, 'two PRs drawn here → two sub-rows: ' + row); +assert.ok(!row.includes('data-ham-sub-key="hivecommons/hive/pr#14921"'), 'the PR drawn elsewhere is not a sub-row'); +assert.deepStrictEqual(elsewhere(row).map(e => e.text), ['↳ #14921 · under #14910']); + +// Older payloads without drawn_under draw under every issue as before. +row = stageTrackerRowHtml(issue(14911, [lp(14921, 0)]), stages, ctx); +assert.strictEqual(prCol(row).length, 1); +assert.deepStrictEqual(elsewhere(row), []); +assert.deepStrictEqual(stageTrackerLinkedElsewhere(issue(14911, [lp(14921, 0)])), []); +assert.deepStrictEqual(stageTrackerLinkedSorted(issue(14911, [lp(14921, 14910)]), stages), [], 'drawn elsewhere → not in this row\'s list'); +`) +} + +// The "Merged today" counter lives in the column header, over the Merge +// gate and ✓ columns (not in the filter chip bar), so a merge token's flight +// from a row's ✓ cell is short and ends above the gate. It is one node for +// the life of the page: the renderer mounts it into the header slot after +// each reconcile and parks it in its toolbar home when the board is empty. +func TestStageTrackerMergedCounterPlacement(t *testing.T) { + html := indexHTML(t) + for _, want := range []string{ + `
  • `, + `.ham-cols-top .ham-seg.ham-merged-slot-seg { flex: 1 1 calc(4em + var(--sp-1)); justify-content: flex-end;`, + `stageTrackerMergedCountMount(el);`, + `stageTrackerMergedCountMount(null);`, + `@media (prefers-reduced-motion: reduce) { .cue-token { display: none; } .ham-merged-count.cue-tick { animation: none; }`, + `id="sts-celebrate-on" data-change-action="stageTrackerCelebrateChange"`, + } { + if !strings.Contains(html, want) { + t.Errorf("index.html missing merged-counter placement wiring %q", want) + } + } + for _, fn := range []string{"celebrateRow", "stageTrackerMergedCountDraw"} { + src := jsFunc(t, html, fn) + if strings.Contains(src, "getElementById('activity-monitor-merged')") || !strings.Contains(src, "stageTrackerMergedChip()") { + t.Errorf("%s must resolve the counter through stageTrackerMergedChip() so the token targets the mounted node", fn) + } + } + // The toolbar-home markup and the header slot CSS name no literal colour. + for _, line := range strings.Split(html, "\n") { + if strings.Contains(line, ".ham-merged-slot") || strings.Contains(line, ".ham-cols-top") || strings.Contains(line, ".ham-merged-home") { + if strings.Contains(line, "#") || strings.Contains(line, "rgb(") { + t.Errorf("merged-counter CSS must use tokens only: %s", strings.TrimSpace(line)) + } + } + } + lifted := strings.Join([]string{ + "function esc(s) { return String(s).replace(/&/g, '&').replace(/([\s\S]*?)<\/div>/.exec(header)[1]; +const names = header.slice(header.indexOf('') + 6); +assert.ok(header.indexOf('ham-cols-top') < header.indexOf('Merge gate'), 'the counter row sits above the column names'); +assert.ok(names.startsWith('`; } else if (item.closed_issue && Number(item.closed_issue.number) > 0) { @@ -16503,6 +16568,9 @@

    All labels

    _stageTrackerMoves = {}; stageTrackerSelectionSync(el, []); const emptyHtml = `
    ${d.items.length ? 'Nothing matches the current filters.' : 'Nothing open is being tracked right now.'}
    `; + // The counter goes back to its toolbar home before the header + // (and its slot) leaves with the rows. + stageTrackerMergedCountMount(null); if (el.querySelector('[data-ham-key]')) { stageTrackerReconcile(el, [], { effect, hidden: document.hidden }); // Departing rows collapse first; the empty line follows them out. @@ -16522,6 +16590,7 @@

    All labels

    : { key: stageTrackerItemKey(grouping ? e.item : e), html: stageTrackerRowHtml(grouping ? e.item : e, stages, ctx) })), nowMs); const rec = stageTrackerReconcile(el, rows, { effect, hidden: document.hidden }); if (rec.deferred) stageTrackerScheduleSettle(); + stageTrackerMergedCountMount(el); // Selection is keyed on the row, never baked into its HTML, so a kept // node stays selected across the refresh and a departed row leaves it. stageTrackerSelectionSync(el, rows.map(r => r.key)); @@ -18229,8 +18298,30 @@

    All labels

    _stageTrackerMergedToday = stageTrackerMergedTodayNext(_stageTrackerMergedToday, d, fresh, nowMs, _stageTrackerCelebratePending); stageTrackerMergedCountDraw(false); } + // The counter is one node for the life of the page. It lives in the + // header slot above the Merge gate while rows are drawn (so the token + // lands "in the hive" above the gate) and parks in its toolbar home + // when the board is empty; the reconcile keys rows on their source + // HTML, so the mounted chip never forces a header re-render. + // The node is cached on the function itself (not a module var) so a + // lifted copy of it (tests) is self-contained; a detached chip stays + // cached until a re-mount reattaches it. + function stageTrackerMergedChip() { + const have = stageTrackerMergedChip.node; + if (have && have.isConnected !== false) return have; + stageTrackerMergedChip.node = document.getElementById('activity-monitor-merged') || have || null; + return stageTrackerMergedChip.node; + } + function stageTrackerMergedCountMount(el) { + const chip = stageTrackerMergedChip(); + if (!chip) return null; + const slot = el && typeof el.querySelector === 'function' ? el.querySelector('.ham-cols .ham-merged-slot') : null; + const target = slot || document.getElementById('activity-monitor-merged-home'); + if (target && chip.parentNode !== target) target.appendChild(chip); + return target; + } function stageTrackerMergedCountDraw(tick) { - const chip = document.getElementById('activity-monitor-merged'); + const chip = stageTrackerMergedChip(); const txt = stageTrackerMergedTodayText(_stageTrackerMergedToday, Date.now()); _stageTrackerMergedTodayCount = txt.count; if (!chip) return; @@ -18351,7 +18442,7 @@

    All labels

    } if (kind !== 'merged') return { flew: false }; const reduced = stageTrackerReducedMotion(); - const chip = document.getElementById('activity-monitor-merged'); + const chip = stageTrackerMergedChip(); const cap = rowEl.querySelector('.ham-seg.cap'); if (reduced || !chip || !cap || _stageTrackerFlights >= STAGE_TRACKER_CELEBRATE_MAX_FLIGHTS || typeof cap.getBoundingClientRect !== 'function') { stageTrackerCelebrateTick(key, preview); From e5407f0bfd352feeb0150a4cab97b28cb1304e88 Mon Sep 17 00:00:00 2001 From: Andrew Anderson Date: Wed, 28 Oct 2026 15:42:03 -0400 Subject: [PATCH 2/4] =?UTF-8?q?=F0=9F=90=9B=20Activity=20Monitor:=20drop?= =?UTF-8?q?=20the=20unused=20Go=20copy=20of=20the=20nobody-lead=20text=20(?= =?UTF-8?q?the=20SPA=20owns=20it)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Andrew Anderson --- src/pkg/dashboard/stage_tracker_actor.go | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/pkg/dashboard/stage_tracker_actor.go b/src/pkg/dashboard/stage_tracker_actor.go index 190c555591..a29f7de73c 100644 --- a/src/pkg/dashboard/stage_tracker_actor.go +++ b/src/pkg/dashboard/stage_tracker_actor.go @@ -20,8 +20,8 @@ import ( // StageActorClanker (a registered contributor agent: robot), // StageActorHuman (a person: the same glyph as "Needs human decision"), // StageActorBot (a non-hive GitHub bot such as github-actions[bot] or -// dependabot: cog) or StageActorNone (nobody is working on it right now; -// the tooltip then leads with Why). Login names the account or agent when +// dependabot: cog) or StageActorNone (nobody is working on it right now — +// the SPA leads its tooltip with STAGE_TRACKER_NOBODY_LEAD, then Why). Login names the account or agent when // known; Since is when the move became theirs (the stage entry time); Why // is the plain-words reason, always set. type StageTrackerActor struct { @@ -39,10 +39,6 @@ const ( StageActorNone = "none" ) -// stageTrackerNobodyLead is the fixed opening of every StageActorNone -// tooltip (the SPA appends it before Why). -const stageTrackerNobodyLead = "no one is working on this right now" - // stageTrackerWorker is one busy agent on a current item, from the status // payload the tracker already has (FrontendAgent.LastAction with Current // set and Busy "working"); the SPA's stageTrackerWorkers reads the same From 9f4b5d80be7280f684e786143981a6797c38c268 Mon Sep 17 00:00:00 2001 From: Andrew Anderson Date: Wed, 28 Oct 2026 15:54:31 -0400 Subject: [PATCH 3/4] =?UTF-8?q?=F0=9F=90=9B=20Activity=20Monitor:=20lift?= =?UTF-8?q?=20stageTrackerStageActor=20in=20the=20motion-bucket=20node=20t?= =?UTF-8?q?est?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Andrew Anderson --- src/pkg/dashboard/stage_tracker_motion_bucket.test.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/pkg/dashboard/stage_tracker_motion_bucket.test.js b/src/pkg/dashboard/stage_tracker_motion_bucket.test.js index 534426ba36..e1d329f6e0 100644 --- a/src/pkg/dashboard/stage_tracker_motion_bucket.test.js +++ b/src/pkg/dashboard/stage_tracker_motion_bucket.test.js @@ -25,6 +25,8 @@ const src = [ pick(/const STAGE_TRACKER_MOTION_BY_STAGE = \{[\s\S]*?\n \};\n/, 'STAGE_TRACKER_MOTION_BY_STAGE'), pick(/const STAGE_TRACKER_MOTION_AUTHOR_STAGES = [^\n]*\n/, 'STAGE_TRACKER_MOTION_AUTHOR_STAGES'), pick(/const STAGE_TRACKER_MOTION_HUMAN_MODS = [^\n]*\n/, 'STAGE_TRACKER_MOTION_HUMAN_MODS'), + pick(/const STAGE_TRACKER_ACTOR_NONE = [^\n]*\n/, 'STAGE_TRACKER_ACTOR_NONE'), + pick(/function stageTrackerStageActor\(item\) \{[\s\S]*?\n \}\n/, 'stageTrackerStageActor'), pick(/function stageTrackerActorKind\(item\) \{[\s\S]*?\n \}\n/, 'stageTrackerActorKind'), pick(/function stageTrackerMotion\(item\) \{[\s\S]*?\n \}\n/, 'stageTrackerMotion'), ].join('\n'); From 29949f4d3f0c4a730aa5f31f8572c3e4bda96271 Mon Sep 17 00:00:00 2001 From: Andrew Anderson Date: Wed, 28 Oct 2026 17:35:29 -0400 Subject: [PATCH 4/4] =?UTF-8?q?=F0=9F=90=9B=20Activity=20Monitor:=20lift?= =?UTF-8?q?=20the=20stage-actor=20helpers=20in=20the=20000-new=20row=20tes?= =?UTF-8?q?t=20after=20rebase?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Andrew Anderson --- src/pkg/dashboard/stage_tracker_new_test.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/pkg/dashboard/stage_tracker_new_test.go b/src/pkg/dashboard/stage_tracker_new_test.go index af2f521f61..5350f8f4fe 100644 --- a/src/pkg/dashboard/stage_tracker_new_test.go +++ b/src/pkg/dashboard/stage_tracker_new_test.go @@ -248,7 +248,10 @@ func TestStageTrackerNewRowRendering(t *testing.T) { jsFunc(t, html, "stageTrackerShortAgo"), jsFunc(t, html, "stageTrackerNewState"), jsFunc(t, html, "stageTrackerNewLines"), + jsConstLine(t, html, "STAGE_TRACKER_ACTOR_NONE"), + jsFunc(t, html, "stageTrackerStageActor"), jsFunc(t, html, "stageTrackerActorKind"), + jsFunc(t, html, "stageTrackerActorTip"), jsFunc(t, html, "stageTrackerHeadline"), jsFunc(t, html, "stageTrackerSegments"), jsFunc(t, html, "stageTrackerStripItems"),