From c3ca6e3548f12db320ec4dc84bee9adf4954b78c Mon Sep 17 00:00:00 2001 From: mendezr Date: Thu, 29 Oct 2026 15:18:49 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix:=20show=20adopted=20PR=20pro?= =?UTF-8?q?venance=20in=20the=20stage=20tracker?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Carry adoption lineage from the stage store (or an App adoption branch) onto the live PR and linked rows, and identify the original in chips, captions and decision previews without GitHub requests. Hive-Run: hivecommons/hive#15396 Hive-Plan: tracker-adoption-lineage Hive-Spec: hivecommons/hive#15396#fix Co-authored-by: clubanderson <407614+clubanderson@users.noreply.github.com> Signed-off-by: mendezr --- changelog.d/fixed-tracker-adoption-lineage.md | 1 + src/pkg/dashboard/stage_tracker.go | 19 +++ src/pkg/dashboard/stage_tracker_lineage.go | 69 ++++++++ .../dashboard/stage_tracker_lineage_test.go | 153 ++++++++++++++++++ src/pkg/dashboard/static/index.html | 41 +++-- 5 files changed, 273 insertions(+), 10 deletions(-) create mode 100644 changelog.d/fixed-tracker-adoption-lineage.md create mode 100644 src/pkg/dashboard/stage_tracker_lineage.go create mode 100644 src/pkg/dashboard/stage_tracker_lineage_test.go diff --git a/changelog.d/fixed-tracker-adoption-lineage.md b/changelog.d/fixed-tracker-adoption-lineage.md new file mode 100644 index 0000000000..ce32e648f1 --- /dev/null +++ b/changelog.d/fixed-tracker-adoption-lineage.md @@ -0,0 +1 @@ +- Stage tracker rows and decision previews now identify the original contributor PR when Hive takes it over, including when the issue already links directly to the adopted copy ([#15396](https://github.com/hivecommons/hive/issues/15396)). diff --git a/src/pkg/dashboard/stage_tracker.go b/src/pkg/dashboard/stage_tracker.go index 174fdabbe8..1e34faccb3 100644 --- a/src/pkg/dashboard/stage_tracker.go +++ b/src/pkg/dashboard/stage_tracker.go @@ -460,6 +460,7 @@ type StageTrackerItem struct { // 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"` + Lineage *StageTrackerLineage `json:"lineage,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" @@ -647,6 +648,7 @@ type StageTrackerLinkedPR struct { Takeover *StageTrackerTakeover `json:"takeover,omitempty"` // Supersedes mirrors the nested PR's own row field. Supersedes *StageTrackerSupersedes `json:"supersedes,omitempty"` + Lineage *StageTrackerLineage `json:"lineage,omitempty"` } // StageTrackerSupersedes is the closed original a live PR replaced @@ -2082,6 +2084,8 @@ func (s *Server) buildStageTracker(status *StatusPayload, store *stagelabels.Sto prState := s.stageTrackerPRStateResolver(status, resp.RecentlyMerged) prOpen := func(repo string, number int) bool { return prState(repo, number) == blockedOnPRStateOpen } supersedes := stageTrackerSupersedesIndex(store, status.GitHubBaseURL) + lineage := stageTrackerLineageIndex(store, status.GitHubBaseURL) + lineageAuthors := map[string]github.PullRequest{} 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 @@ -2155,6 +2159,7 @@ func (s *Server) buildStageTracker(status *StatusPayload, store *stagelabels.Sto } addPR := func(repoName string, pr github.PullRequest, verdict *github.MergeVerdict, bucket, bucketReason string) { pr.Repo = nonEmpty(pr.Repo, repoName) + lineageAuthors[stagelabels.Key(repoName, pr.Number)] = pr rec, ok := lookup(repoName, pr.Number) if ok && rec.Superseded() { // hivecommons/hive#14471: the hive's adoption of this PR merged @@ -2166,6 +2171,7 @@ func (s *Server) buildStageTracker(status *StatusPayload, store *stagelabels.Sto Labels: append([]string(nil), pr.Labels...), CreatedAt: timePtr(pr.CreatedAt), UpdatedAt: timePtr(pr.UpdatedAt), Bucket: bucket, BucketReason: bucketReason, URL: overviewItemURL(pr.URL, pr.Repo, pr.Number, "pr", status.GitHubBaseURL)} + it.Lineage = stageTrackerPRLineage(lineage, repoName, pr, status.GitHubBaseURL) it.BaseRef = pr.BaseRef it.AuthorKind, it.AuthorKindSource = stageTrackerAuthorKind(pr.Labels, pr.Author, pr.AppAuthored, pr.HiveAttributed) if it.AuthorKindSource == authorKindSrcLabel { @@ -2227,6 +2233,9 @@ func (s *Server) buildStageTracker(status *StatusPayload, store *stagelabels.Sto it.Caption = joinClause(it.Caption, clause) } } + if it.Lineage != nil { + it.Caption += fmt.Sprintf(" (adopted from #%d)", it.Lineage.FromNumber) + } it.DecisionNeeded = stageTrackerDecisionNeededWith(it, agg, sentinelLabel, now, bctx) it.StageActor = stageTrackerStageActor(it, workers, now) add(it) @@ -2256,6 +2265,15 @@ func (s *Server) buildStageTracker(status *StatusPayload, store *stagelabels.Sto } } } + for i := range resp.Items { + it := &resp.Items[i] + if l := it.Lineage; l != nil { + if original, ok := lineageAuthors[stagelabels.Key(it.Repo, l.FromNumber)]; ok { + l.FromAuthor = nonEmpty(original.Author, l.FromAuthor) + l.FromAuthorKind, _ = stageTrackerAuthorKind(original.Labels, original.Author, original.AppAuthored, original.HiveAttributed) + } + } + } resp.OpenIssues, resp.OpenPRs = stageTrackerOpenCounts(resp.Items) stageTrackerMergeTrainPostPass(resp.Items) s.applyOperatorActions(resp.Items, now) @@ -3005,6 +3023,7 @@ func stageTrackerResolveLinkedPRs(items []StageTrackerItem, open func(repo strin lp.Rework = pr.Rework lp.Takeover = pr.Takeover lp.Supersedes = pr.Supersedes + lp.Lineage = pr.Lineage 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_lineage.go b/src/pkg/dashboard/stage_tracker_lineage.go new file mode 100644 index 0000000000..516a0dbf15 --- /dev/null +++ b/src/pkg/dashboard/stage_tracker_lineage.go @@ -0,0 +1,69 @@ +package dashboard + +import ( + "strconv" + "strings" + "time" + + "github.com/hivecommons/hive/pkg/github" + "github.com/hivecommons/hive/pkg/stagelabels" +) + +// StageTrackerLineage describes the provenance of the live copy, independently +// of whether the original is still linked, closed, or its copy has merged. +type StageTrackerLineage struct { + Kind string `json:"kind"` + FromNumber int `json:"from_number"` + FromURL string `json:"from_url"` + FromAuthor string `json:"from_author,omitempty"` + FromAuthorKind string `json:"from_author_kind,omitempty"` + ToNumber int `json:"to_number"` + ToURL string `json:"to_url"` + At *time.Time `json:"at,omitempty"` + Reason string `json:"reason,omitempty"` +} + +func stageTrackerLineageIndex(store *stagelabels.Store, baseURL string) map[string]StageTrackerLineage { + out := map[string]StageTrackerLineage{} + if store == nil { + return out + } + for _, key := range store.Keys() { + rec, ok := store.Get(key) + if !ok || rec.AdoptedBy <= 0 { + continue + } + repo, text, found := strings.Cut(key, "#") + number, err := strconv.Atoi(text) + if !found || err != nil || repo == "" || number <= 0 || number == rec.AdoptedBy { + continue + } + by := stagelabels.Key(repo, rec.AdoptedBy) + if prev, exists := out[by]; exists && prev.FromNumber <= number { + continue + } + l := StageTrackerLineage{Kind: "adopted", FromNumber: number, FromURL: overviewItemURL("", repo, number, "pr", baseURL), FromAuthor: rec.Author, ToNumber: rec.AdoptedBy, ToURL: overviewItemURL("", repo, rec.AdoptedBy, "pr", baseURL), Reason: rec.AdoptReason} + if !rec.AdoptedAt.IsZero() { + at := rec.AdoptedAt + l.At = &at + } + out[by] = l + } + return out +} + +// No network lookup: an App-owned adoption branch is enough to retain the +// original reference when the stage record has expired. Unknown facts stay empty. +func stageTrackerPRLineage(index map[string]StageTrackerLineage, repo string, pr github.PullRequest, baseURL string) *StageTrackerLineage { + if l, ok := index[stagelabels.Key(repo, pr.Number)]; ok { + return &l + } + if !pr.AppAuthored || !strings.HasPrefix(pr.HeadRef, "hive/adopt-") { + return nil + } + number, err := strconv.Atoi(strings.TrimPrefix(pr.HeadRef, "hive/adopt-")) + if err != nil || number <= 0 || number == pr.Number { + return nil + } + return &StageTrackerLineage{Kind: "adopted", FromNumber: number, FromURL: overviewItemURL("", repo, number, "pr", baseURL), ToNumber: pr.Number, ToURL: overviewItemURL(pr.URL, repo, pr.Number, "pr", baseURL)} +} diff --git a/src/pkg/dashboard/stage_tracker_lineage_test.go b/src/pkg/dashboard/stage_tracker_lineage_test.go new file mode 100644 index 0000000000..952e7a1d37 --- /dev/null +++ b/src/pkg/dashboard/stage_tracker_lineage_test.go @@ -0,0 +1,153 @@ +package dashboard + +import ( + "encoding/json" + "strings" + "testing" + "time" + + "github.com/hivecommons/hive/pkg/config" + "github.com/hivecommons/hive/pkg/github" + "github.com/hivecommons/hive/pkg/stagelabels" +) + +func TestStageTrackerLiveAdoptionLineage(t *testing.T) { + now := time.Date(2026, 10, 29, 10, 56, 0, 0, time.UTC) + for _, closeFirst := range []bool{false, true} { + t.Run(map[bool]string{false: "original-open", true: "close-first"}[closeFirst], func(t *testing.T) { + s := newTestServer() + store := stagelabels.NewStore("", func() time.Time { return now }) + s.stageStore = store + s.deps = &Dependencies{Config: &config.Config{}} + key := stagelabels.Key("hivecommons/hive", 15226) + store.Observe(key, stagelabels.AdoptedByHive, "contributor-lane:adopted") + store.NoteAuthor(key, "thatguywob") + store.MarkAdopted(key, "oldhead", 15308, now.Add(-6*time.Hour)) + store.NoteAdoptReason(key, "contributor-offline") + if closeFirst { + store.MarkSupersededClosedFirst(key, 15308, false, now.Add(-6*time.Hour)) + } + status := minimalPayload() + status.Repos = []FrontendRepo{{Name: "hive", Full: "hivecommons/hive", + ActionableIssues: []any{github.Issue{Number: 15198, Title: "Fix this", Labels: []string{"stage/040-covered-by-pr"}, LinkedPRs: []github.IssueLinkedPR{{Number: 15308, State: "open", Closing: true}}}}, + OpenPrs: []any{FrontendPR{PullRequest: github.PullRequest{Number: 15308, Author: "hivecommons-hive[bot]", AppAuthored: true, Title: "Adopted fix", Labels: []string{"stage/070-fixing"}, LinkedIssues: []github.PRLinkedIssue{{Number: 15198, State: "open"}}}}}, + }} + if !closeFirst { + status.Repos[0].OpenPrs = append(status.Repos[0].OpenPrs, FrontendPR{PullRequest: github.PullRequest{Number: 15226, Author: "thatguywob", Labels: []string{"author/clanker", "stage/074-adopted-by-hive"}}}) + } + s.UpdateStatus(status) + resp := s.buildStageTracker(status, store, now) + pr := trackerItem(t, resp, "pr", 15308) + issue := trackerItem(t, resp, "issue", 15198) + l := pr.Lineage + if l == nil || l.Kind != "adopted" || l.FromNumber != 15226 || l.FromAuthor != "thatguywob" || l.FromURL != "https://github.com/hivecommons/hive/pull/15226" || l.ToNumber != 15308 || l.ToURL != "https://github.com/hivecommons/hive/pull/15308" || l.At == nil || !l.At.Equal(now.Add(-6*time.Hour)) || l.Reason != "contributor-offline" { + t.Fatalf("lineage = %+v", l) + } + if !closeFirst && l.FromAuthorKind != "clanker" { + t.Fatalf("cached original kind = %q", l.FromAuthorKind) + } + if len(issue.LinkedPRs) != 1 || issue.LinkedPRs[0].Lineage != l { + t.Fatalf("linked lineage = %+v", issue.LinkedPRs) + } + if !strings.Contains(pr.Caption, "(adopted from #15226)") || !strings.Contains(issue.Caption, "(adopted from #15226)") { + t.Fatalf("captions: %q / %q", pr.Caption, issue.Caption) + } + raw, err := json.Marshal(resp) + if err != nil { + t.Fatal(err) + } + if strings.Count(string(raw), `"lineage":{"kind":"adopted"`) != 2 { + t.Fatalf("missing top-level or linked lineage: %s", raw) + } + }) + } +} + +func TestStageTrackerLineageRecordWinsAndIsRepoScoped(t *testing.T) { + now := time.Date(2026, 10, 29, 4, 56, 0, 0, time.UTC) + store := stagelabels.NewStore("", func() time.Time { return now }) + key := stagelabels.Key("acme/repo", 7) + store.Observe(key, stagelabels.AdoptedByHive, "adopted") + store.MarkAdopted(key, "head", 9, now) + index := stageTrackerLineageIndex(store, "") + pr := github.PullRequest{Number: 9, AppAuthored: true, HeadRef: "hive/adopt-8"} + if l := stageTrackerPRLineage(index, "acme/repo", pr, ""); l == nil || l.FromNumber != 7 || l.At == nil { + t.Fatalf("record did not win: %+v", l) + } + pr.HeadRef = "ordinary" + if l := stageTrackerPRLineage(index, "another/repo", pr, ""); l != nil { + t.Fatalf("cross-repo lineage: %+v", l) + } +} + +func TestStageTrackerLineageBranchFallback(t *testing.T) { + for _, tc := range []struct { + branch string + app bool + want bool + }{ + {"hive/adopt-15226", true, true}, {"hive/adopt-15226", false, false}, + {"hive/adopt-0", true, false}, {"hive/adopt-abc", true, false}, + {"hive/adopt-15226-extra", true, false}, {"hive/adopt-15308", true, false}, + {"ordinary", true, false}, + } { + pr := github.PullRequest{Number: 15308, AppAuthored: tc.app, HeadRef: tc.branch} + l := stageTrackerPRLineage(nil, "acme/repo", pr, "https://git.example") + if (l != nil) != tc.want { + t.Fatalf("%+v: %+v", tc, l) + } + if l != nil && (l.FromURL != "https://git.example/acme/repo/pull/15226" || l.FromAuthor != "" || l.At != nil || l.Reason != "") { + t.Fatalf("fallback fabricated facts: %+v", l) + } + } + if len(stageTrackerLineageIndex(nil, "")) != 0 { + t.Fatal("nil store") + } +} + +func TestStageTrackerLineageJS(t *testing.T) { + html := indexHTML(t) + script := strings.Join([]string{ + "const assert = require('assert');", + jsFunc(t, html, "esc"), jsFunc(t, html, "stageTrackerAgoText"), + jsFunc(t, html, "stageTrackerLineageClause"), jsFunc(t, html, "stageTrackerLineageChipHtml"), + jsFunc(t, html, "stageTrackerSupersedesTip"), jsFunc(t, html, "stageTrackerSupersedesChipHtml"), + jsFunc(t, html, "stageTrackerLinkedPRItem"), jsFunc(t, html, "stageTrackerLinkedPROpen"), + jsFunc(t, html, "stageTrackerFetchDelegatePlan"), + "function stageTrackerActionRequest() { return {url:'/plan', body:{}}; }", + "function stageTrackerRefOf(it) { return '#' + it.number; }", + "const STAGE_TRACKER_TERMINAL = 100;", + ` +const now = Date.parse('2026-10-29T10:56:00Z'); +const l = {kind:'adopted', from_number:15226, from_url:'https://github.com/hivecommons/hive/pull/15226', from_author:'thatguywob', at:'2026-10-29T04:56:00Z', reason:'contributor-offline'}; +const pr = {kind:'pr', number:15308, stage:70, lineage:l}; +assert.strictEqual(stageTrackerLineageClause(pr), '(adopted from #15226)'); +assert.strictEqual(stageTrackerLineageClause({}), ''); +assert.strictEqual(stageTrackerLineageChipHtml({}, now), ''); +const chip = stageTrackerLineageChipHtml(pr, now); +assert.ok(chip.includes("adopted from @thatguywob's #15226 · 6h ago"), chip); +assert.ok(chip.includes('href="' + l.from_url + '"'), chip); +assert.ok(chip.includes('Original commits kept.'), chip); +assert.ok(chip.includes('after CI went red'), chip); +assert.strictEqual(stageTrackerSupersedesChipHtml(Object.assign({supersedes:{number:15226}}, pr), now), ''); +const sub = stageTrackerLinkedPRItem({repo:'hivecommons/hive', number:15198, linked_prs:[pr]}, pr); +assert.strictEqual(sub.lineage, l); +assert.strictEqual(stageTrackerLinkedPRItem({number:1}, {number:2}).lineage, null); +const unknown = stageTrackerLineageChipHtml({lineage:{kind:'adopted', from_number:7}}, now); +assert.ok(!unknown.includes('undefined') && !unknown.includes('after CI went red'), unknown); +const hostile = stageTrackerLineageChipHtml({lineage:Object.assign({}, l, {from_author:'', from_url:'https://example.org/"x'})}, now); +assert.ok(!hostile.includes('') && hostile.includes('<img>'), hostile); +global.fetch = async () => ({ok:true, json:async () => ({ref:'server-ref', number:15308})}); +(async () => { + const plan = await stageTrackerFetchDelegatePlan(pr); + assert.strictEqual(plan.ref, 'server-ref (adopted from #15226)'); +})().catch(e => { console.error(e); process.exit(1); }); +`, + }, "\n") + runStageTrackerRowActionsScript(t, script) + for _, want := range []string{"stageTrackerLineageChipHtml(pr, nowMs)", "stageTrackerLineageChipHtml(item, nowMs)", "stageTrackerLineageChipHtml(lp, nowMs)", "(lineage ? ' ' + lineage : '')"} { + if !strings.Contains(html, want) { + t.Errorf("lineage not wired: %s", want) + } + } +} diff --git a/src/pkg/dashboard/static/index.html b/src/pkg/dashboard/static/index.html index 9037adea45..f19382c144 100644 --- a/src/pkg/dashboard/static/index.html +++ b/src/pkg/dashboard/static/index.html @@ -15639,10 +15639,29 @@

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. + // Provenance belongs to the live copy, even when the issue never links + // the original. Unknown author/time/reason facts are left out. + function stageTrackerLineageClause(item) { + const l = item && item.lineage; + if (!l || !(Number(l.from_number) > 0)) return ''; + const verb = l.kind === 'rebased-by-hive' ? 'rebased by hive from' : l.kind === 'superseded' ? 'supersedes' : 'adopted from'; + return '(' + verb + ' #' + Number(l.from_number) + ')'; + } + function stageTrackerLineageChipHtml(item, nowMs) { + if (!stageTrackerLineageClause(item)) return ''; + const l = item.lineage; + const who = l.from_author ? '@' + l.from_author : ''; + const verb = l.kind === 'rebased-by-hive' ? 'rebased by hive from ' : l.kind === 'superseded' ? 'supersedes ' : 'adopted from '; + const ago = stageTrackerAgoText(Date.parse(l.at || ''), nowMs); + const text = verb + (who ? who + "'s " : '') + '#' + Number(l.from_number) + (ago ? ' · ' + ago : ''); + const reason = l.reason || ''; + const offline = reason === 'contributor-offline' || reason === 'contributor-unavailable'; + const tip = offline ? 'Hive took this PR over after CI went red and ' + (who ? who + "'s agent" : "the contributor's agent") + " didn't respond. Original commits kept." + : 'Hive took this PR over. Original commits kept.' + (reason ? ' Reason: ' + reason + '.' : ''); + const icon = l.from_author_kind ? stageTrackerIcon(l.from_author_kind, 'ham-author-ico', l.from_author_kind) : ''; + return `${icon}${esc(text)}`; + } + // Legacy supersession trace for replacements without adoption lineage. function stageTrackerSupersedesTip(item, nowMs) { const sp = item && item.supersedes; if (!sp || !(Number(sp.number) > 0)) return ''; @@ -15652,7 +15671,7 @@

Where to get help

} function stageTrackerSupersedesChipHtml(item, nowMs) { const tip = stageTrackerSupersedesTip(item, nowMs); - if (!tip) return ''; + if (!tip || item.lineage) 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)}"`; @@ -16017,7 +16036,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, supersedes: lp.supersedes || null, 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, lineage: lp.lineage || 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, rework: lp.rework || null, merge_gate: lp.merge_gate || null, merge_train: lp.merge_train || null, decided: lp.decided || null, adopted_by: Number(lp.adopted_by) || 0, adopted_by_state: lp.adopted_by_state || '', adopted_from: lp.adopted_from || null, state: lp.state || '', superseded_by: Number(lp.superseded_by) || 0 }; } @@ -16034,7 +16053,7 @@

Where to get help

// hive's copy of an adopted PR (hivecommons/hive#15126). function stageTrackerAdoptedFromChipHtml(pr, nowMs) { const af = pr && pr.adopted_from; - if (!af || !af.number) return ''; + if (!af || !af.number || pr.lineage) return ''; let text = '↳ adopted from #' + af.number; if (af.decided_at) { const what = af.decided_action === 'let-hive-decide' ? 'you let hive decide' : 'you approved'; @@ -16047,6 +16066,7 @@

Where to get help

const pr = stageTrackerLinkedPRItem(issue, lp); const superseded = typeof stageTrackerLinkedSupersededText === 'function' ? stageTrackerLinkedSupersededText(lp, issue) : ''; let ref = stageTrackerPRRef(pr.number, pr.url, pr.author_kind, pr.author, pr.title, (pr.title ? pr.title + ' · ' : '') + (superseded || stageTrackerTooltip(pr, nowMs)) + ' · ' + stageTrackerLinkedTip(issue, pr.number, ctx)); + ref += typeof stageTrackerLineageChipHtml === 'function' ? stageTrackerLineageChipHtml(pr, nowMs) : ''; if (lp.base_ref) ref += ` ${esc(lp.base_ref)}`; const chip = ctx && ctx.repoChips ? stageTrackerRepoChipHtml(pr.repo, ctx) : ''; if (chip) ref = `${chip}${ref}`; @@ -16272,7 +16292,7 @@

Where to get help

// 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 : ''); - 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)}` : '')]; + 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)) + (typeof stageTrackerLineageChipHtml === 'function' ? stageTrackerLineageChipHtml(lp, nowMs) : '') + (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, 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, hold: lp.hold || null, adoption: lp.adoption || null, stage_actor: lp.stage_actor || item.stage_actor || null, presence: lp.presence || null, rework: lp.rework || null, merge_gate: lp.merge_gate || null, merge_train: lp.merge_train || null, decided: lp.decided || item.decided || null }); } else if (linked.length) { @@ -16309,7 +16329,7 @@

Where to get help

`; } else { const li = stageTrackerPRIssueSlot(item); - prRefs = [stageTrackerPRRef(item.number, item.url, item.author_kind || '', item.author, title, (title ? title + ' · ' : '') + stageTrackerTooltip(shown, nowMs))]; + prRefs = [stageTrackerPRRef(item.number, item.url, item.author_kind || '', item.author, title, (title ? title + ' · ' : '') + stageTrackerTooltip(shown, nowMs)) + (typeof stageTrackerLineageChipHtml === 'function' ? stageTrackerLineageChipHtml(item, nowMs) : '')]; leadHtml = li.number ? `
${stageTrackerIcon('issue', 'ham-kind-ico')}${chip} @@ -19026,7 +19046,8 @@

All labels

const r = await fetch(req.url + '/plan', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(req.body) }); const data = await r.json().catch(() => ({})); if (!r.ok) return { ref: stageTrackerRefOf(item), number: item.number, error: data.error || ('HTTP ' + r.status) }; - return Object.assign({ ref: stageTrackerRefOf(item) }, data); + const lineage = typeof stageTrackerLineageClause === 'function' ? stageTrackerLineageClause(item) : ''; + return Object.assign({}, data, { ref: (data.ref || stageTrackerRefOf(item)) + (lineage ? ' ' + lineage : '') }); } catch (e) { return { ref: stageTrackerRefOf(item), number: item.number, error: String(e && e.message || e) }; } } // The three-button preview: resolves { chosen } for Let hive do that,