diff --git a/changelog.d/fixed-tracker-closed-superseded-rows.md b/changelog.d/fixed-tracker-closed-superseded-rows.md new file mode 100644 index 0000000000..8454201a11 --- /dev/null +++ b/changelog.d/fixed-tracker-closed-superseded-rows.md @@ -0,0 +1 @@ +- Activity Monitor: a PR the hive closed when it opened its replacement (close-first supersession) no longer renders under its issue as a bare sub-row with an empty ladder; the live replacement PR carries a small "supersedes #N" chip (hover: when it was closed, link) as the only trace, and the issue's ladder follows the live PR alone. diff --git a/src/pkg/dashboard/delegated_pr_context.go b/src/pkg/dashboard/delegated_pr_context.go index 74895d8177..6459c1c4c0 100644 --- a/src/pkg/dashboard/delegated_pr_context.go +++ b/src/pkg/dashboard/delegated_pr_context.go @@ -40,7 +40,9 @@ func delegatedCompetingNumbers(items []StageTrackerItem, repo string, pr *gh.Pul if !found { items = append(items, live) } - stageTrackerResolveLinkedPRs(items) + // The items are a tracker response already filtered to open PRs; a + // link the response kept is kept here too. + stageTrackerResolveLinkedPRs(items, func(string, int) bool { return true }) seen := map[int]bool{} for _, issue := range items { if issue.Repo != repo || issue.Kind != "issue" { diff --git a/src/pkg/dashboard/delegated_pr_context_test.go b/src/pkg/dashboard/delegated_pr_context_test.go index a6f470db3d..17b567aebb 100644 --- a/src/pkg/dashboard/delegated_pr_context_test.go +++ b/src/pkg/dashboard/delegated_pr_context_test.go @@ -128,7 +128,12 @@ func TestGatherDelegatedRealPRContext(t *testing.T) { s := newFullServer(t) s.deps.GHClient = github.NewClient("token", "org", nil, slog.Default(), server.URL) s.deps.GHClient.SetAppBotLogin("hive[bot]") - s.status = &StatusPayload{Repos: []FrontendRepo{{Full: "org/repo", ActionableIssues: []any{github.Issue{Number: 7, LinkedPRs: []github.IssueLinkedPR{{Number: 8, State: "open"}, {Number: 9, State: "open"}}}}}}} + // Both PRs are open items of the snapshot: a linked PR the + // snapshot does not list is not drawn or counted (closed-first + // supersession left closed originals as bare sub-rows). + s.status = &StatusPayload{Repos: []FrontendRepo{{Full: "org/repo", + ActionableIssues: []any{github.Issue{Number: 7, LinkedPRs: []github.IssueLinkedPR{{Number: 8, State: "open"}, {Number: 9, State: "open"}}}}, + OpenPrs: []any{FrontendPR{PullRequest: github.PullRequest{Number: 8, Author: "hive[bot]"}}, FrontendPR{PullRequest: github.PullRequest{Number: 9, Author: "alice"}}}}}} in, err := s.gatherDelegatedInput(context.Background(), "org/repo", 8, "pr", delegatedDecisionRequest{}) if err != nil { t.Fatal(err) diff --git a/src/pkg/dashboard/stage_tracker.go b/src/pkg/dashboard/stage_tracker.go index 9f679586f4..4933aa729e 100644 --- a/src/pkg/dashboard/stage_tracker.go +++ b/src/pkg/dashboard/stage_tracker.go @@ -441,6 +441,11 @@ type StageTrackerItem struct { // "copy-failed" — a close-first copy failed and the original was // reopened for a person (hivecommons/hive#15135). AdoptedByState string `json:"adopted_by_state,omitempty"` + // Supersedes names the closed original this PR replaced (the hive's + // close-first supersession, hivecommons/hive#15135). The original is + // closed, unmerged, and never a tracker row; this is the only trace of + // it the tracker draws — a small chip on the live PR. + Supersedes *StageTrackerSupersedes `json:"supersedes,omitempty"` // Adoption is, on a nudged PR at stage/072, whether adoption is due, // what holds it, and the author's live presence, with the plain-words // line the row shows instead of a bare "Returned to contributor" @@ -597,6 +602,19 @@ type StageTrackerLinkedPR struct { Presence *StageTrackerPresence `json:"presence,omitempty"` // Takeover mirrors the nested PR's own row field (hivecommons/hive#15038). Takeover *StageTrackerTakeover `json:"takeover,omitempty"` + // Supersedes mirrors the nested PR's own row field. + Supersedes *StageTrackerSupersedes `json:"supersedes,omitempty"` +} + +// StageTrackerSupersedes is the closed original a live PR replaced +// (StageTrackerItem.Supersedes). ClosedAt is when the hive recorded the +// supersession; Open is true when the original could not be closed (a +// fork PR the App may not close) and was left open with the note. +type StageTrackerSupersedes struct { + Number int `json:"number"` + URL string `json:"url,omitempty"` + ClosedAt *time.Time `json:"closed_at,omitempty"` + Open bool `json:"open,omitempty"` } // StageTrackerHold is the row's hold provenance (stagelabels.HoldProvenance @@ -1953,6 +1971,8 @@ func (s *Server) buildStageTracker(status *StatusPayload, store *stagelabels.Sto resp.Items = append(resp.Items, it) } prState := s.stageTrackerPRStateResolver(status, resp.RecentlyMerged) + prOpen := func(repo string, number int) bool { return prState(repo, number) == blockedOnPRStateOpen } + supersedes := stageTrackerSupersedesIndex(store, status.GitHubBaseURL) issueFilter := s.issueFilterConfig() addIssue := func(repoName string, issue github.Issue, bucket, bucketReason string, progress *github.IssueChildren) { // A closed issue has no stage; a stage label it closed wearing is @@ -2009,7 +2029,11 @@ func (s *Server) buildStageTracker(status *StatusPayload, store *stagelabels.Sto it.ClaimantKind = s.stageTrackerClaimantKind(repoName, issue.Number) } for _, lp := range issue.LinkedPRs { - if lp.Number > 0 && !lp.Merged && !strings.EqualFold(lp.State, "closed") { + // The claims index may still say "open" for a PR the hive closed + // since (close-first supersession, hivecommons/hive#15135); the + // snapshot and caches are asked before a closed PR becomes a + // sub-row. + if lp.Number > 0 && !lp.Merged && !strings.EqualFold(lp.State, "closed") && !stageTrackerLinkedPRFinished(prState(nonEmpty(lp.Repo, repoName), lp.Number)) { it.LinkedPRs = append(it.LinkedPRs, StageTrackerLinkedPR{Number: lp.Number, URL: lp.URL}) } } @@ -2054,6 +2078,9 @@ func (s *Server) buildStageTracker(status *StatusPayload, store *stagelabels.Sto it.DeferredModifiers = append([]string{modSentinel}, it.DeferredModifiers...) } it.LinkedIssues = stageTrackerPRLinkedIssues(pr, repoName, status.GitHubBaseURL) + if sup, ok := supersedes[stagelabels.Key(repoName, pr.Number)]; ok { + it.Supersedes = &sup + } info, found := superseded[github.ReviewQueueKey(qualifyRepo(repoName), pr.Number)] if !found { info, found = superseded[github.ReviewQueueKey(repoName, pr.Number)] @@ -2114,7 +2141,7 @@ func (s *Server) buildStageTracker(status *StatusPayload, store *stagelabels.Sto stageTrackerMergeTrainPostPass(resp.Items) s.applyOperatorActions(resp.Items, now) resp.NeedsHuman, resp.OnHold = stageTrackerHumanCounts(resp.Items) - stageTrackerResolveLinkedPRs(resp.Items) + stageTrackerResolveLinkedPRs(resp.Items, prOpen) stageTrackerMarkClosedBy(resp.Items, s.mergedLedger().ClosedBy) stageTrackerResolveActors(resp.Items) sort.SliceStable(resp.Items, stageTrackerLess(resp.Items)) @@ -2789,7 +2816,14 @@ func stageTrackerPruneSoftLinks(pr *StageTrackerItem, prs, issues map[string]*St // side is read too: a PR whose closing references name an open issue in // the response is nested under that issue even when the issue's own claim // evidence has not caught up with it, so the pair draws as one row. -func stageTrackerResolveLinkedPRs(items []StageTrackerItem) { +// +// A linked PR with no PR row in the response is not an open PR of this +// snapshot — closed (the hive's close-first supersession, hivecommons/ +// hive#15135, or the claims index lagging a close) or finished — and is +// dropped rather than drawn as a bare sub-row with an empty ladder. open, +// when non-nil, may vouch for one the snapshot lacks (a cross-repository +// PR another repo's open set lists); it is then kept as the bare link. +func stageTrackerResolveLinkedPRs(items []StageTrackerItem, open func(repo string, number int) bool) { prs := map[string]*StageTrackerItem{} issues := map[string]*StageTrackerItem{} for i := range items { @@ -2836,13 +2870,18 @@ func stageTrackerResolveLinkedPRs(items []StageTrackerItem) { return } seen[lp.Number] = true - if pr := prs[it.Repo+"#"+strconv.Itoa(lp.Number)]; pr != nil { + pr := prs[it.Repo+"#"+strconv.Itoa(lp.Number)] + if pr == nil && (open == nil || !open(it.Repo, lp.Number)) { + return + } + if 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.SentinelAlert, lp.SentinelReason, lp.Head = pr.SentinelAlert, pr.SentinelReason, pr.Head lp.Adoption = pr.Adoption lp.Presence = pr.Presence lp.Takeover = pr.Takeover + lp.Supersedes = pr.Supersedes lp.HumanApprover, lp.ManualMerge = pr.HumanApprover, pr.ManualMerge lp.HumanMergeReason, lp.HumanMergeReasonText = pr.HumanMergeReason, pr.HumanMergeReasonText lp.AdmittedBy, lp.DCOUnsigned, lp.DCOTotal = pr.AdmittedBy, pr.DCOUnsigned, pr.DCOTotal diff --git a/src/pkg/dashboard/stage_tracker_adoption.go b/src/pkg/dashboard/stage_tracker_adoption.go index a6198caf5c..a4e8292ff1 100644 --- a/src/pkg/dashboard/stage_tracker_adoption.go +++ b/src/pkg/dashboard/stage_tracker_adoption.go @@ -3,6 +3,7 @@ package dashboard import ( "context" "fmt" + "strconv" "strings" "time" @@ -214,3 +215,45 @@ func stageTrackerAdoptionCaption(caption string, a *StageTrackerAdoption) string } return head + " — " + a.Text } + +// stageTrackerSupersedesIndex maps each superseding PR's store key to the +// closed original it replaced (hivecommons/hive#15135). The original's +// record carries SupersededBy; the tracker never renders that record as a +// row (addPR drops it, and a closed PR has no open item), so the live +// PR's chip is the one trace the tracker keeps. When several originals +// name the same superseder the lowest-numbered one is kept. +func stageTrackerSupersedesIndex(store *stagelabels.Store, baseURL string) map[string]StageTrackerSupersedes { + out := map[string]StageTrackerSupersedes{} + if store == nil { + return out + } + for _, key := range store.Keys() { + rec, ok := store.Get(key) + if !ok || !rec.Superseded() { + continue + } + repo, numText, found := strings.Cut(key, "#") + number, err := strconv.Atoi(numText) + if !found || err != nil || number <= 0 || repo == "" { + continue + } + by := stagelabels.Key(repo, rec.SupersededBy) + if prev, dup := out[by]; dup && prev.Number <= number { + continue + } + sup := StageTrackerSupersedes{Number: number, URL: overviewItemURL("", repo, number, "pr", baseURL), Open: rec.SupersededOpen} + if !rec.SupersededAt.IsZero() { + t := rec.SupersededAt + sup.ClosedAt = &t + } + out[by] = sup + } + return out +} + +// stageTrackerLinkedPRFinished reports whether a PR state the caches +// resolved (stageTrackerPRStateResolver) means the PR is no longer open +// work: closed unmerged or merged. Unknown ("") is not finished. +func stageTrackerLinkedPRFinished(state string) bool { + return state == blockedOnPRStateClosed || state == blockedOnPRStateMerged +} diff --git a/src/pkg/dashboard/stage_tracker_adoption_close_first_test.go b/src/pkg/dashboard/stage_tracker_adoption_close_first_test.go index ec2fec8cad..a878671247 100644 --- a/src/pkg/dashboard/stage_tracker_adoption_close_first_test.go +++ b/src/pkg/dashboard/stage_tracker_adoption_close_first_test.go @@ -6,6 +6,8 @@ import ( "testing" "time" + "github.com/hivecommons/hive/pkg/config" + "github.com/hivecommons/hive/pkg/github" "github.com/hivecommons/hive/pkg/stagelabels" ) @@ -60,3 +62,159 @@ func TestStageTrackerCloseFirstCopyFailedSaysWhy(t *testing.T) { t.Fatalf("after re-adopt adopted_by=%d state=%q", it.AdoptedBy, it.AdoptedByState) } } + +// A closed original (#15184, closed first when its copy #15247 opened) +// must not ride under its issue as a bare sub-row with an empty ladder: +// the claims index still names it "open" for a while, and the status +// enumeration's bucket reason still names it. The live copy keeps the +// trace as `supersedes` metadata only (hivecommons/hive#15135 follow-up). +func TestStageTrackerClosedSupersededPRNotASubRow(t *testing.T) { + now := time.Date(2026, 10, 29, 2, 30, 0, 0, time.UTC) + s := newTestServer() + store := stagelabels.NewStore("", func() time.Time { return now }) + s.stageStore = store + s.deps = &Dependencies{Config: &config.Config{}} + orig := stagelabels.Key("hivecommons/hive", 15184) + store.Observe(orig, stagelabels.AdoptedByHive, "contributor-lane:adopted") + store.MarkAdopted(orig, "bc3a6ea", 15247, now.Add(-30*time.Minute)) + store.MarkSupersededClosedFirst(orig, 15247, false, now.Add(-16*time.Minute)) + store.Observe(stagelabels.Key("hivecommons/hive", 15247), stagelabels.Fixing, "reviewer-verdict:changes_requested") + + status := minimalPayload() + status.HiveID = "hive" + status.Repos = []FrontendRepo{{ + Name: "hive", Full: "hivecommons/hive", + ActionableIssues: []any{github.Issue{Number: 15183, Title: "api-reference.md decision row is stale", Author: "pat", Labels: []string{"stage/040-covered-by-pr"}, + // The claims index lags the close: it still reports #15184 open. + LinkedPRs: []github.IssueLinkedPR{{Number: 15184, State: "open", URL: "https://github.com/hivecommons/hive/pull/15184", Closing: true}}}}, + // Only the copy is an open PR of the snapshot; the closed original is not. + OpenPrs: []any{FrontendPR{PullRequest: github.PullRequest{Number: 15247, Title: "📖 docs: refresh operator decision API reference", Author: "hivecommons-hive[bot]", AppAuthored: true, HeadSHA: "8464bac", Labels: []string{"stage/070-fixing"}, + LinkedIssues: []github.PRLinkedIssue{{Number: 15183, State: "open"}}}}}, + }} + s.UpdateStatus(status) + + resp := s.buildStageTracker(status, store, now) + for _, it := range resp.Items { + if it.Kind == "pr" && it.Number == 15184 { + t.Fatalf("closed original rendered as a row: %+v", it) + } + } + issue := trackerItem(t, resp, "issue", 15183) + if len(issue.LinkedPRs) != 1 || issue.LinkedPRs[0].Number != 15247 { + t.Fatalf("issue 15183 linked_prs = %+v (want only the live copy #15247)", issue.LinkedPRs) + } + lp := issue.LinkedPRs[0] + if lp.Stage != 70 || lp.Title == "" { + t.Fatalf("live sub-row not resolved from its PR row: %+v", lp) + } + if lp.Supersedes == nil || lp.Supersedes.Number != 15184 || lp.Supersedes.URL != "https://github.com/hivecommons/hive/pull/15184" || lp.Supersedes.Open || lp.Supersedes.ClosedAt == nil || !lp.Supersedes.ClosedAt.Equal(now.Add(-16*time.Minute)) { + t.Fatalf("sub-row supersedes = %+v", lp.Supersedes) + } + pr := trackerItem(t, resp, "pr", 15247) + if pr.Supersedes == nil || pr.Supersedes.Number != 15184 || pr.NestedUnder != 15183 { + t.Fatalf("pr 15247 supersedes=%+v nested_under=%d", pr.Supersedes, pr.NestedUnder) + } + raw, err := json.Marshal(resp) + if err != nil { + t.Fatal(err) + } + if !strings.Contains(string(raw), `"supersedes":{"number":15184,"url":"https://github.com/hivecommons/hive/pull/15184","closed_at":`) { + t.Fatalf("payload lacks the supersedes chip metadata: %s", raw) + } + if strings.Contains(string(raw), `{"number":15184,"url":"https://github.com/hivecommons/hive/pull/15184"}`) { + t.Fatalf("payload still carries the closed original as a bare linked PR: %s", raw) + } +} + +// The resolver drops a linked PR that has no PR row in the response (not +// open in the snapshot) unless the caller vouches for it as open elsewhere +// (a cross-repository PR listed by another repo's open set). +func TestStageTrackerResolveLinkedPRsDropsUnlistedPRs(t *testing.T) { + items := func() []StageTrackerItem { + return []StageTrackerItem{ + {Repo: "acme/console", Number: 9, Kind: "issue", LinkedPR: 77, LinkedPRs: []StageTrackerLinkedPR{{Number: 10}, {Number: 11, URL: "u11"}}}, + {Repo: "acme/console", Number: 10, Kind: "pr", Title: "Live PR", Stage: 70, Supersedes: &StageTrackerSupersedes{Number: 11}}, + } + } + got := items() + stageTrackerResolveLinkedPRs(got, nil) + if len(got[0].LinkedPRs) != 1 || got[0].LinkedPRs[0].Number != 10 || got[0].LinkedPRs[0].Supersedes == nil || got[0].LinkedPRs[0].Supersedes.Number != 11 { + t.Fatalf("unlisted links kept: %+v", got[0].LinkedPRs) + } + got = items() + stageTrackerResolveLinkedPRs(got, func(repo string, number int) bool { return number == 11 }) + if len(got[0].LinkedPRs) != 2 || got[0].LinkedPRs[1].Number != 11 || got[0].LinkedPRs[1].URL != "u11" || got[0].LinkedPRs[1].Title != "" { + t.Fatalf("vouched-for bare link not kept as is: %+v", got[0].LinkedPRs) + } +} + +func TestStageTrackerSupersedesIndex(t *testing.T) { + now := time.Date(2026, 10, 29, 2, 0, 0, 0, time.UTC) + store := stagelabels.NewStore("", func() time.Time { return now }) + for _, n := range []int{15184, 15170} { + key := stagelabels.Key("hivecommons/hive", n) + store.Observe(key, stagelabels.AdoptedByHive, "contributor-lane:adopted") + store.MarkAdopted(key, "bc3a6ea", 15247, now) + store.MarkSupersededClosedFirst(key, 15247, n == 15170, now) + } + // A plain adoption whose copy has not merged is not a supersession yet. + plain := stagelabels.Key("hivecommons/hive", 15300) + store.Observe(plain, stagelabels.AdoptedByHive, "contributor-lane:adopted") + store.MarkAdopted(plain, "bc3a6ea", 15301, now) + + idx := stageTrackerSupersedesIndex(store, "") + if len(idx) != 1 { + t.Fatalf("index = %+v", idx) + } + sup, ok := idx[stagelabels.Key("hivecommons/hive", 15247)] + if !ok || sup.Number != 15170 || !sup.Open || sup.URL != "https://github.com/hivecommons/hive/pull/15170" || sup.ClosedAt == nil || !sup.ClosedAt.Equal(now) { + t.Fatalf("supersedes = %+v", sup) + } + if got := stageTrackerSupersedesIndex(nil, ""); len(got) != 0 { + t.Fatalf("nil store = %+v", got) + } + if stageTrackerLinkedPRFinished("") || stageTrackerLinkedPRFinished(blockedOnPRStateOpen) || !stageTrackerLinkedPRFinished(blockedOnPRStateClosed) || !stageTrackerLinkedPRFinished(blockedOnPRStateMerged) { + t.Fatal("stageTrackerLinkedPRFinished") + } +} + +// The SPA draws the trace as one muted chip on the live PR's row (and its +// sub-row), linking to the closed original; nothing without `supersedes`. +func TestStageTrackerSupersedesChipJS(t *testing.T) { + html := indexHTML(t) + for _, want := range []string{ + ".ham-badge-supersedes {", + "supersedes: lp.supersedes || null", + "stageTrackerSupersedesChipHtml(item, Date.now())", + } { + if !strings.Contains(html, want) { + t.Errorf("index.html lacks %q", want) + } + } + script := strings.Join([]string{ + "const assert = require('assert');", + jsFunc(t, html, "esc"), + jsFunc(t, html, "stageTrackerAgoText"), + jsFunc(t, html, "stageTrackerSupersedesTip"), + jsFunc(t, html, "stageTrackerSupersedesChipHtml"), + jsFunc(t, html, "stageTrackerLinkedPRItem"), + jsFunc(t, html, "stageTrackerLinkedPROpen"), + "const STAGE_TRACKER_TERMINAL = 100;", + ` +const nowMs = Date.parse('2026-10-29T02:30:00Z'); +const live = { kind: 'pr', repo: 'hivecommons/hive', number: 15247, stage: 70, supersedes: { number: 15184, url: 'https://github.com/hivecommons/hive/pull/15184', closed_at: '2026-10-29T02:14:00Z' } }; +const chip = stageTrackerSupersedesChipHtml(live, nowMs); +assert.ok(chip.includes('>supersedes #15184<'), chip); +assert.ok(chip.includes('href="https://github.com/hivecommons/hive/pull/15184"'), chip); +assert.ok(chip.includes('closed 16m ago'), chip); +assert.ok(chip.includes('ham-badge-supersedes'), chip); +assert.strictEqual(stageTrackerSupersedesChipHtml({ kind: 'pr', number: 1 }, nowMs), ''); +assert.ok(stageTrackerSupersedesTip({ supersedes: { number: 7, open: true } }, nowMs).includes('left open')); +const issue = { kind: 'issue', repo: 'hivecommons/hive', number: 15183, linked_prs: [Object.assign({ title: 'docs' }, live)] }; +const sub = stageTrackerLinkedPRItem(issue, issue.linked_prs[0]); +assert.strictEqual(sub.supersedes.number, 15184); +assert.strictEqual(stageTrackerLinkedPRItem(issue, { number: 2 }).supersedes, null); +`, + }, "\n") + runStageTrackerRowActionsScript(t, script) +} diff --git a/src/pkg/dashboard/stage_tracker_test.go b/src/pkg/dashboard/stage_tracker_test.go index 488d0139b3..c1819a48d7 100644 --- a/src/pkg/dashboard/stage_tracker_test.go +++ b/src/pkg/dashboard/stage_tracker_test.go @@ -658,7 +658,7 @@ func TestStageTrackerIssueFeedPRsAreNotIssues(t *testing.T) { {Repo: "acme/console", Number: 9, Kind: "issue", LinkedPR: 9, LinkedPRs: []StageTrackerLinkedPR{{Number: 9}, {Number: 10}}}, {Repo: "acme/console", Number: 10, Kind: "pr", Title: "Real PR"}, } - stageTrackerResolveLinkedPRs(items) + stageTrackerResolveLinkedPRs(items, nil) if len(items[0].LinkedPRs) != 1 || items[0].LinkedPRs[0].Number != 10 || items[0].LinkedPRs[0].Title != "Real PR" { t.Fatalf("self-link not dropped: %+v", items[0].LinkedPRs) } diff --git a/src/pkg/dashboard/static/index.html b/src/pkg/dashboard/static/index.html index 5769af7e25..aa5bb32840 100644 --- a/src/pkg/dashboard/static/index.html +++ b/src/pkg/dashboard/static/index.html @@ -1553,6 +1553,9 @@ .ham-seg.active.ham-sentinel { background: var(--status-error); color: var(--surface-0); } /* 072 adoption chip (maintainer-policy, hive PR 14524): "waiting on @author (maintainer, offline 26h) — adopt?" */ .ham-badge-adoption { color: var(--status-warn); border-color: color-mix(in srgb, var(--status-warn) 55%, transparent); font-weight: var(--fw-medium); } + /* "supersedes N": the closed original a live PR replaced (hive PR 15135 follow-up). Muted — a trace, not a call to act. */ + .ham-badge-supersedes { color: var(--text-faint); border-color: var(--line-subtle); text-decoration: none; } + .ham-badge-supersedes:hover { color: var(--text-muted); } /* Waiting-on pill without an adoption clock (071, 072 before the nudge, a human's PR): muted, hive PR 15051. */ .ham-badge-waiting { color: var(--text-faint); border-color: var(--line-subtle); } /* Presence indicator on a waiting-on pill (hive PR 15051): who the row @@ -15362,6 +15365,26 @@

Where to get help

// The sentinel chip: drawn in the chip area (beside needs rebase / // regressed) on every lane but the one whose word already says it. + // Pure: the "supersedes #N" chip on a live PR that replaced a closed + // original (`supersedes`: {number, url, closed_at, open} — the hive's + // close-first supersession, hivecommons/hive#15135). The closed PR is + // never a row; this chip is its only trace. '' without one. + function stageTrackerSupersedesTip(item, nowMs) { + const sp = item && item.supersedes; + if (!sp || !(Number(sp.number) > 0)) return ''; + const ago = stageTrackerAgoText(Date.parse(sp.closed_at || ''), nowMs); + if (sp.open) return 'Replaces #' + Number(sp.number) + ' (left open with the note' + (ago ? ', ' + ago : '') + ')'; + return 'Replaces #' + Number(sp.number) + ' (closed' + (ago ? ' ' + ago : '') + ')'; + } + function stageTrackerSupersedesChipHtml(item, nowMs) { + const tip = stageTrackerSupersedesTip(item, nowMs); + if (!tip) return ''; + const sp = item.supersedes; + const text = 'supersedes #' + Number(sp.number); + const attrs = `class="ham-badge ham-badge-supersedes" title="${esc(tip)}" aria-label="${esc(tip)}"`; + if (sp.url) return `${esc(text)}`; + return `${esc(text)}`; + } function stageTrackerSentinelChipHtml(item) { if (!item || !item.sentinel_alert || stageTrackerSentinelInLane(item) || stageTrackerDeferredMods(item).indexOf(STAGE_TRACKER_SENTINEL_CHIP) >= 0) return ''; return `${esc(STAGE_TRACKER_SENTINEL_CHIP)}`; @@ -15388,7 +15411,7 @@

Where to get help

} function stageTrackerChipsHtml(item) { - const sentinel = stageTrackerSentinelChipHtml(item) + (typeof stageTrackerAdoptionChipHtml === 'function' ? stageTrackerAdoptionChipHtml(item) : '') + (typeof stageTrackerPresenceChipHtml === 'function' ? stageTrackerPresenceChipHtml(item) : '') + (typeof stageTrackerReroutePillHtml === 'function' ? stageTrackerReroutePillHtml(item) : ''); + const sentinel = stageTrackerSentinelChipHtml(item) + (typeof stageTrackerAdoptionChipHtml === 'function' ? stageTrackerAdoptionChipHtml(item) : '') + (typeof stageTrackerPresenceChipHtml === 'function' ? stageTrackerPresenceChipHtml(item) : '') + (typeof stageTrackerReroutePillHtml === 'function' ? stageTrackerReroutePillHtml(item) : '') + (typeof stageTrackerSupersedesChipHtml === 'function' ? stageTrackerSupersedesChipHtml(item, Date.now()) : ''); const mods = (Array.isArray(item.modifiers) ? item.modifiers.slice() : []) .sort((x, y) => STAGE_TRACKER_MOD_PRIORITY.indexOf(x) - STAGE_TRACKER_MOD_PRIORITY.indexOf(y)); if (!mods.length) return sentinel; @@ -15692,7 +15715,7 @@

Where to get help

return { repo: issue.repo, number: lp.number, kind: 'pr', title: lp.title || '', url: lp.url || '', author: lp.author || '', author_kind: lp.author_kind || '', 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 || '', base_ref: lp.base_ref || '', decision_needed: lp.decision_needed || null, - adoption: lp.adoption || null, takeover: lp.takeover || null, superseded: !!lp.superseded, parent: Number(issue.number) || 0, siblings: open.map(x => Number(x.number) || 0), + adoption: lp.adoption || null, takeover: lp.takeover || null, superseded: !!lp.superseded, supersedes: lp.supersedes || null, parent: Number(issue.number) || 0, siblings: open.map(x => Number(x.number) || 0), last_operator_action: lp.last_operator_action || null, operator_action_count: lp.operator_action_count || 0, hold: lp.hold || null, stage_actor: lp.stage_actor || null, presence: lp.presence || null, merge_gate: lp.merge_gate || null, merge_train: lp.merge_train || null }; } // Pure: whether a linked PR is still open (not merged / closed / superseded).