diff --git a/changelog.d/added-15806.md b/changelog.d/added-15806.md new file mode 100644 index 0000000000..f10a5f0b0e --- /dev/null +++ b/changelog.d/added-15806.md @@ -0,0 +1 @@ +- The activity monitor's stage tracker names, on the PR sub-row drawn under an issue, the other listed open issues that PR also closes ([#15806](https://github.com/hivecommons/hive/issues/15806)): a gray "also closes #15503" pill beside the PR link (comma-separated, three numbers then "+N", every number linking to its issue; the hover names each issue's title) — the reciprocal of the "↳ #N · under #M" chip the other issues already show. The issue's `linked_prs[]` entry drawn here (`drawn_under` == the issue) gains `also_closes` (number, title, url). diff --git a/src/docs/dashboard-sections/activity-monitor.md b/src/docs/dashboard-sections/activity-monitor.md index 398c45bfa3..728f4496e4 100644 --- a/src/docs/dashboard-sections/activity-monitor.md +++ b/src/docs/dashboard-sections/activity-monitor.md @@ -434,6 +434,8 @@ A pull request that closes several open issues (`Closes #A` and `Closes #B`) is Payloads without `drawn_under` draw as before. +The link reads both ways (hivecommons/hive#15806): the entry drawn under #A carries `also_closes` — the other listed open issues the PR closes (number, title, url) — and the PR's line wears a gray **also closes #B** pill beside the PR link, in the lineage-pill style (comma-separated for several, three numbers then **+N**, every number linking to its issue; tooltip: *this PR also resolves #B (title)*). The "↳ … under …" listing never carries it. + #### Merged (the chip, the ledger, the flight) A thin bar at the top of the tracker — it stays pinned under the card header while the list scrolls, with the stage column header strip pinned just below it — carries the dashboard's bee glyph (the version card's bee, in a 28 px hit area; the pill is no taller than the chips beside it) with **Merged** and the all-time count drawn as a **quiet odometer at rest, always** — one shallow inset track with a hairline border and faint dividers, a wheel per digit, tabular semibold digits at the chip's own type size, no thousands separator (#15543: the first drum's 18 px bevelled cells were "too big of font … the animation is perfect though" — the roll is unchanged) — every pull request the hive tracked that reached merged, *all time*, with *N today · N this week* beside it at the bar's usual size. The number is the server's, not the tab's: the hive keeps a **merged ledger** at `/data/merged-ledger.json` (entries for 90 days, an all-time total that only grows, atomic writes, seeded on first boot from the audit log's `pr_merged` history with the PR throughput counter as the floor, then backfilled by the first closed sweep, which on such a boot asks GitHub for every PR closed in the last 30 days — merges by people and other bots the audit log never saw — instead of its usual one day; so the ledger counts every merged PR in a configured repository, and its all-time number is expected to run above the hive-observed PR throughput counter it was seeded from) fed by the audit log's `pr_merged` lines — the hive's own merges on every path and the poller's observations of merges by people or other bots — and by webhook / closed-sweep snapshots of a PR GitHub reports merged, which carry the title and the merger's login within seconds. diff --git a/src/pkg/dashboard/stage_tracker.go b/src/pkg/dashboard/stage_tracker.go index 5ce05339a6..72704fbd2e 100644 --- a/src/pkg/dashboard/stage_tracker.go +++ b/src/pkg/dashboard/stage_tracker.go @@ -709,6 +709,12 @@ type StageTrackerLinkedPR struct { // 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"` + // AlsoCloses is set only on the listing drawn here (DrawnUnder == the + // parent issue): the other listed open issues this PR also closes + // (number, title, url), lowest number first, so the PR's sub-row can + // name them back — the reciprocal of the "↳ #N · under #M" chip + // (hivecommons/hive#15806). + AlsoCloses []StageTrackerLinkedIssue `json:"also_closes,omitempty"` // Presence mirrors the nested PR's own row field (hivecommons/hive#15051). Presence *StageTrackerPresence `json:"presence,omitempty"` // Rework mirrors the nested PR's own row field (hivecommons/hive#15280). diff --git a/src/pkg/dashboard/stage_tracker_also_closes_test.go b/src/pkg/dashboard/stage_tracker_also_closes_test.go new file mode 100644 index 0000000000..3956df380c --- /dev/null +++ b/src/pkg/dashboard/stage_tracker_also_closes_test.go @@ -0,0 +1,159 @@ +package dashboard + +import ( + "slices" + "testing" + "time" + + "github.com/hivecommons/hive/pkg/github" + "github.com/hivecommons/hive/pkg/stagelabels" +) + +// TestStageTrackerLinkedPRAlsoCloses reproduces hivecommons/hive#15806: PR +// #15759 closes the open, listed #15502 and #15503 (and a closed #15500). +// Its strip is drawn once, under #15502; that listing names #15503 back in +// also_closes (number, title, url) so the sub-row can say "also closes +// #15503", while the #15503 listing — the "↳ … under #15502" chip — carries +// none. A PR closing a single listed issue gets no also_closes at all, and +// a soft reference (`Refs #15504`, listed) is never an "also closes". +func TestStageTrackerLinkedPRAlsoCloses(t *testing.T) { + now := time.Date(2026, 10, 30, 12, 0, 0, 0, time.UTC) + s := newTestServer() + clock := now + store := stagelabels.NewStore("", func() time.Time { return clock }) + s.stageStore = store + clock = now.Add(-2 * time.Hour) + store.Observe(stagelabels.Key("acme/hive", 15759), stagelabels.ReviewPending, "ci green") + store.Observe(stagelabels.Key("acme/hive", 15502), stagelabels.CoveredByPR, "open PR #15759 covers it (PR at 050-review-pending)") + store.Observe(stagelabels.Key("acme/hive", 15503), stagelabels.CoveredByPR, "open PR #15759 covers it (PR at 050-review-pending)") + store.Observe(stagelabels.Key("acme/hive", 15760), stagelabels.ReviewPending, "ci green") + store.Observe(stagelabels.Key("acme/hive", 15510), stagelabels.CoveredByPR, "open PR #15760 covers it (PR at 050-review-pending)") + clock = now + + status := minimalPayload() + status.HiveID = "hv-test" + status.Repos = []FrontendRepo{{ + Name: "hive", Full: "acme/hive", + ActionableIssues: []any{ + github.Issue{Number: 15502, Title: "Review backlog (correctness): nil deref", URL: "https://github.com/acme/hive/issues/15502", Author: "hive-app[bot]", Labels: []string{"stage/040-covered-by-pr"}, + LinkedPRs: []github.IssueLinkedPR{{Number: 15759, State: "open"}}}, + github.Issue{Number: 15503, Title: "Review backlog (correctness): off-by-one", URL: "https://github.com/acme/hive/issues/15503", Author: "hive-app[bot]", Labels: []string{"stage/040-covered-by-pr"}, + LinkedPRs: []github.IssueLinkedPR{{Number: 15759, State: "open"}}}, + github.Issue{Number: 15504, Title: "Review backlog (correctness): referenced only", URL: "https://github.com/acme/hive/issues/15504", Author: "hive-app[bot]", Labels: []string{"stage/030-in-progress"}}, + github.Issue{Number: 15510, Title: "a lone issue", URL: "https://github.com/acme/hive/issues/15510", Author: "hive-app[bot]", Labels: []string{"stage/040-covered-by-pr"}, + LinkedPRs: []github.IssueLinkedPR{{Number: 15760, State: "open"}}}, + }, + OpenPrs: []any{ + FrontendPR{PullRequest: github.PullRequest{Number: 15759, Title: "fix the review backlog", Author: "hive-app[bot]", AppAuthored: true, Labels: []string{"stage/050-review-pending", "author/hive"}, + LinkedIssues: []github.PRLinkedIssue{{Number: 15500, State: "closed"}, {Number: 15503}, {Number: 15502}}, + ReferencedIssues: []github.PRLinkedIssue{{Number: 15504, Repo: "acme/hive", Via: github.PRLinkViaRefs}}}}, + FrontendPR{PullRequest: github.PullRequest{Number: 15760, Title: "fix the lone issue", Author: "hive-app[bot]", AppAuthored: true, Labels: []string{"stage/050-review-pending", "author/hive"}, + LinkedIssues: []github.PRLinkedIssue{{Number: 15510}}}}, + }, + }} + s.statusMu.Lock() + s.status = status + s.statusMu.Unlock() + resp := s.buildStageTracker(status, store, now) + + if pr := trackerItem(t, resp, "pr", 15759); pr.NestedUnder != 15502 { + t.Fatalf("nested_under = %d, want 15502", pr.NestedUnder) + } + owner := trackerItem(t, resp, "issue", 15502) + if len(owner.LinkedPRs) != 1 || owner.LinkedPRs[0].DrawnUnder != 15502 { + t.Fatalf("issue 15502 linked_prs = %+v, want one listing of #15759 drawn here", owner.LinkedPRs) + } + got := owner.LinkedPRs[0].AlsoCloses + if len(got) != 1 || got[0].Number != 15503 || got[0].Title != "Review backlog (correctness): off-by-one" || got[0].URL != "https://github.com/acme/hive/issues/15503" { + t.Fatalf("issue 15502 linked PR also_closes = %+v, want only #15503 (not the soft-referenced #15504) with its title and url", got) + } + if got[0].Listed || got[0].State != "" { + t.Fatalf("also_closes carries only number/title/url, got %+v", got[0]) + } + other := trackerItem(t, resp, "issue", 15503) + if len(other.LinkedPRs) != 1 || other.LinkedPRs[0].DrawnUnder != 15502 { + t.Fatalf("issue 15503 linked_prs = %+v, want one listing of #15759 drawn under 15502", other.LinkedPRs) + } + if other.LinkedPRs[0].AlsoCloses != nil { + t.Fatalf("the listing drawn elsewhere must not carry also_closes, got %+v", other.LinkedPRs[0].AlsoCloses) + } + // The soft `Refs #15504` is listed on the PR (so the UI can mark it) yet + // is a reference, not a closing: it must not be named as "also closes". + pr := trackerItem(t, resp, "pr", 15759) + if k := slices.IndexFunc(pr.LinkedIssues, func(li StageTrackerLinkedIssue) bool { return li.Number == 15504 }); k < 0 || !pr.LinkedIssues[k].Listed || pr.LinkedIssues[k].Via != github.PRLinkViaRefs { + t.Fatalf("PR 15759 linked_issues = %+v, want a listed refs link to #15504", pr.LinkedIssues) + } + referenced := trackerItem(t, resp, "issue", 15504) + if len(referenced.LinkedPRs) != 1 || referenced.LinkedPRs[0].DrawnUnder != 15502 || referenced.LinkedPRs[0].AlsoCloses != nil { + t.Fatalf("issue 15504 linked_prs = %+v, want one listing of #15759 drawn under 15502 with no also_closes", referenced.LinkedPRs) + } + lone := trackerItem(t, resp, "issue", 15510) + if len(lone.LinkedPRs) != 1 || lone.LinkedPRs[0].AlsoCloses != nil { + t.Fatalf("a PR closing one listed issue has no also_closes, got %+v", lone.LinkedPRs) + } +} + +// The SPA side: the PR drawn here wears a gray "also closes #15503" pill in +// the lineage slot, every number linking to its issue, truncated to three +// numbers plus "+N" and the hover naming every issue's title; the "↳ … +// under …" listing and a PR with nothing else to close get no pill. The +// pill rides both the single-covering-PR issue row and the sub-row. +func TestStageTrackerLinkedPRAlsoClosesJS(t *testing.T) { + html := indexHTML(t) + runStageTrackerRowActionsScript(t, stageTrackerRowsPreludeJS(t, html)+"\n"+jsFunc(t, html, "stageTrackerLinkedSupersededText")+"\n"+stageTrackerActorIconJS(t, html)+stageTrackerRowsFixtureJS+` +const since = new Date(now - 3600000).toISOString(); +const li = (n) => ({ number: n, title: 'Review backlog (correctness): item ' + n, url: 'https://x/issues/' + n }); +const lp = (n, under, extra) => Object.assign({ number: n, title: 'fix', url: 'https://x/' + n, author: 'hive-bot', author_kind: 'hive', stage: 50, stage_since: since, drawn_under: under }, extra || {}); +const issue = (n, prs) => ({ repo: 'hivecommons/hive', number: n, kind: 'issue', title: 'Issue ' + n, url: 'https://x/issues/' + n, stage: 40, stage_since: since, caption: 'open PR #15759 covers it', linked_prs: prs }); +const also = (html) => Array.from(html.matchAll(/([\s\S]*?)<\/span>/g)).map(m => ({ title: m[1], text: text(m[2]), links: Array.from(m[2].matchAll(/]*>#(\d+)<\/a>/g)).map(a => a[1]) })); + +// The pure chip. +assert.strictEqual(stageTrackerAlsoClosesChipHtml(lp(15759, 15502)), '', 'no also_closes → no chip'); +assert.strictEqual(stageTrackerAlsoClosesChipHtml(lp(15759, 15502, { also_closes: [] })), ''); +let chip = stageTrackerAlsoClosesChipHtml(lp(15759, 15502, { also_closes: [li(15503)] })); +assert.deepStrictEqual(also(chip), [{ title: 'this PR also resolves #15503 (Review backlog (correctness): item 15503)', text: 'also closes #15503', links: ['https://x/issues/15503'] }], chip); +chip = stageTrackerAlsoClosesChipHtml(lp(15759, 15502, { also_closes: [li(15503), li(15504), li(15505), li(15506), li(15507)] })); +assert.strictEqual(also(chip)[0].text, 'also closes #15503, #15504, #15505 +2', 'three numbers then +N: ' + chip); +assert.deepStrictEqual(also(chip)[0].links, ['https://x/issues/15503', 'https://x/issues/15504', 'https://x/issues/15505']); +assert.ok(also(chip)[0].title.includes('#15507 (Review backlog (correctness): item 15507)'), 'the hover names every issue: ' + also(chip)[0].title); +chip = stageTrackerAlsoClosesChipHtml(lp(15759, 15502, { also_closes: [{ number: 15503, title: 'a "quoted" ' }] })); +assert.ok(chip.includes('title="this PR also resolves #15503 (a "quoted" <title>)"'), 'the hover is escaped: ' + chip); +assert.ok(chip.includes('href="#"'), 'no url → a harmless anchor: ' + chip); + +// The owning issue with one covering PR: the pill sits in the PR column beside the PR link. +let row = stageTrackerRowHtml(issue(15502, [lp(15759, 15502, { also_closes: [li(15503)] })]), stages, ctx); +assert.strictEqual(prCol(row).length, 1, row); +const head = row.slice(0, row.indexOf('aria-label="Pipeline progress"')); +assert.deepStrictEqual(also(head).map(a => a.text), ['also closes #15503'], 'the pill rides the PR column: ' + head); +assert.ok(head.indexOf('ham-pr-ref') < head.indexOf('ham-also-closes'), 'PR link first, then the pill'); + +// The other issue lists the PR as "↳ … under …" and never wears the reciprocal pill. +row = stageTrackerRowHtml(issue(15503, [lp(15759, 15502)]), stages, ctx); +assert.strictEqual(prCol(row).length, 0); +assert.ok(row.includes('↳ #15759 · under #15502'), row); +assert.deepStrictEqual(also(row), []); + +// Two covering PRs drawn here: each sub-row carries its own pill (or none). +row = stageTrackerRowHtml(issue(15502, [lp(15759, 15502, { also_closes: [li(15503)] }), lp(15761, 15502, { stage: 70 })]), stages, ctx); +assert.strictEqual(subs(row).length, 2, row); +const sub = (n) => subs(row).find(s => s.includes('data-ham-sub-key="hivecommons/hive/pr#' + n + '"')); +assert.deepStrictEqual(also(sub(15759)).map(a => a.text), ['also closes #15503'], sub(15759)); +assert.deepStrictEqual(also(sub(15761)), [], 'a PR with nothing else to close wears no pill'); + +// With a lineage chip too, both pills show: lineage first, then also-closes. +const lineage = { kind: 'adopted', from_number: 15700, from_author: 'alice', from_author_kind: 'human', from_url: 'https://x/15700', at: since, reason: 'ci-red-contributor-offline' }; +row = stageTrackerRowHtml(issue(15502, [lp(15759, 15502, { also_closes: [li(15503)], lineage })]), stages, ctx); +assert.ok(row.includes('ham-lineage') && row.includes('ham-also-closes'), row); +assert.ok(row.indexOf('ham-lineage') < row.indexOf('ham-also-closes'), 'lineage chip before the also-closes pill'); + +// A superseded adopted original (hive's copy #15762 listed open alongside it) draws as one muted line with neither pill; the copy keeps its own. +row = stageTrackerRowHtml(issue(15502, [lp(15759, 15502, { also_closes: [li(15503)], lineage, adopted_by: 15762 }), lp(15762, 15502, { also_closes: [li(15503)] })]), stages, ctx); +const allSubs = row.split('<div class="ham-sub').slice(1); +assert.strictEqual(allSubs.length, 2, row); +const anySub = (n) => allSubs.find(s => s.includes('data-ham-sub-key="hivecommons/hive/pr#' + n + '"')); +assert.ok(anySub(15759).startsWith(' ham-sub-superseded"') && anySub(15759).includes('ham-superseded-note'), 'the original reads as superseded: ' + anySub(15759)); +assert.deepStrictEqual(also(anySub(15759)), [], 'a superseded original wears no also-closes pill: ' + anySub(15759)); +assert.ok(!anySub(15759).includes('ham-lineage'), 'nor a lineage chip'); +assert.deepStrictEqual(also(anySub(15762)).map(a => a.text), ['also closes #15503'], anySub(15762)); +`) +} diff --git a/src/pkg/dashboard/stage_tracker_links.go b/src/pkg/dashboard/stage_tracker_links.go index 873c96d995..58ac10fdda 100644 --- a/src/pkg/dashboard/stage_tracker_links.go +++ b/src/pkg/dashboard/stage_tracker_links.go @@ -381,7 +381,8 @@ func stageTrackerResolveLinkedPRs(items []StageTrackerItem, open func(repo strin } // 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. + // each listing so the SPA draws the PR's strip under one parent only, + // and give the listing drawn there the other issues the PR also closes. for i := range items { it := &items[i] if it.Kind != "issue" { @@ -390,6 +391,9 @@ func stageTrackerResolveLinkedPRs(items []StageTrackerItem, open func(repo strin for j := range it.LinkedPRs { if pr := prs[it.Repo+"#"+strconv.Itoa(it.LinkedPRs[j].Number)]; pr != nil { it.LinkedPRs[j].DrawnUnder = pr.NestedUnder + if pr.NestedUnder == it.Number { + it.LinkedPRs[j].AlsoCloses = stageTrackerAlsoCloses(pr, it.Number) + } } } } @@ -401,6 +405,24 @@ func stageTrackerResolveLinkedPRs(items []StageTrackerItem, open func(repo strin stageTrackerFoldReviewNotes(items) } +// stageTrackerAlsoCloses is the PR's other listed open issues — every +// LinkedIssue with its own row in the response except the parent drawing +// the PR — slimmed to number, title and URL and sorted lowest first; nil +// when the PR closes only the parent (hivecommons/hive#15806). Soft links +// (Refs / title / mention) are references, not closings, so they never +// count as "also closes" even when listed. +func stageTrackerAlsoCloses(pr *StageTrackerItem, parent int) []StageTrackerLinkedIssue { + var out []StageTrackerLinkedIssue + for _, li := range pr.LinkedIssues { + if !li.Listed || li.Number == parent || li.Number == 0 || stageTrackerLinkSoft(li) { + continue + } + out = append(out, StageTrackerLinkedIssue{Number: li.Number, Title: li.Title, URL: li.URL}) + } + slices.SortFunc(out, func(a, b StageTrackerLinkedIssue) int { return a.Number - b.Number }) + return out +} + // Link evidence arrives after the issue's stage/new narration, including // reverse closing references from PRs. Do not narrate a completed intake // step as work the scanner still needs to do. diff --git a/src/pkg/dashboard/stage_tracker_ui_prelude_test.go b/src/pkg/dashboard/stage_tracker_ui_prelude_test.go index 7b5cb5ead3..a421d05bbf 100644 --- a/src/pkg/dashboard/stage_tracker_ui_prelude_test.go +++ b/src/pkg/dashboard/stage_tracker_ui_prelude_test.go @@ -116,6 +116,8 @@ func stageTrackerRowsPreludeJS(t *testing.T, html string) string { jsFunc(t, html, "stageTrackerSupersededOriginalClause"), jsFunc(t, html, "stageTrackerLineageTip"), jsFunc(t, html, "stageTrackerLineageChipHtml"), + jsFunc(t, html, "stageTrackerAlsoClosesChipHtml"), + jsFunc(t, html, "stageTrackerLinkedChipsHtml"), jsFunc(t, html, "stageTrackerLinkedPRItem"), jsFunc(t, html, "stageTrackerLinkedPROpen"), jsFunc(t, html, "stageTrackerNestedOpenPRs"), diff --git a/src/pkg/dashboard/static-src/css/tracker.css b/src/pkg/dashboard/static-src/css/tracker.css index 4579caa97d..7b8976aab0 100644 --- a/src/pkg/dashboard/static-src/css/tracker.css +++ b/src/pkg/dashboard/static-src/css/tracker.css @@ -426,6 +426,9 @@ .ham-plan-rails { font-size: var(--fs-xs); color: var(--text-faint); } .ham-lineage { color: var(--muted); text-decoration: none; display: inline-flex; align-items: center; gap: var(--sp-1); } .ham-lineage:hover { color: var(--text); } + .ham-also-closes { color: var(--muted); } + .ham-also-closes a { color: inherit; text-decoration: none; } + .ham-also-closes a:hover { color: var(--text); text-decoration: underline; } .ham-plan-body, .ham-plan-note { white-space: pre-wrap; } .ham-plan-note { color: var(--muted); font-size: var(--fs-xs); } .ham-seg.active .cue-acting-cap { margin-left: var(--sp-2); } diff --git a/src/pkg/dashboard/static-src/js/tracker-row.js b/src/pkg/dashboard/static-src/js/tracker-row.js index 74d8377c4d..81ea77ec45 100644 --- a/src/pkg/dashboard/static-src/js/tracker-row.js +++ b/src/pkg/dashboard/static-src/js/tracker-row.js @@ -1060,6 +1060,26 @@ const tip = 'Hive re-authored #' + af.number + (af.author ? ' (by @' + af.author + ')' : '') + ' as this PR with the same commits and sign-off' + (af.decided_by ? '; the decision on #' + af.number + ' was ' + (af.decided_action || 'yours') + ' by @' + af.decided_by : '') + '.' + (stageTrackerSupersededOriginalClause(Number(af.number), af.state) || ' #' + af.number + ' is closed as superseded when this merges.'); return `<a class="ham-badge ham-adopted-from" href="${esc(af.url || '#')}" target="_blank" rel="noopener" title="${esc(tip)}">${esc(text)}</a>`; } + // Pure: the reciprocal of the "↳ #N · under #M" chip (hivecommons/ + // hive#15806) — on the PR drawn here, "also closes #A, #B" naming the + // other listed open issues it resolves, every number a link; past + // three it reads "#A, #B, #C +N" and the hover names every title. + function stageTrackerAlsoClosesChipHtml(lp) { + const list = Array.isArray(lp && lp.also_closes) ? lp.also_closes.filter(li => li && Number(li.number) > 0) : []; + if (!list.length) return ''; + const shown = list.slice(0, 3); + const links = shown.map(li => `<a href="${esc(li.url || '#')}" target="_blank" rel="noopener">#${Number(li.number)}</a>`).join(', '); + const more = list.length > shown.length ? ' +' + (list.length - shown.length) : ''; + const tip = 'this PR also resolves ' + list.map(li => '#' + Number(li.number) + (li.title ? ' (' + li.title + ')' : '')).join(', '); + return `<span class="ham-badge ham-also-closes" title="${esc(tip)}">also closes ${links}${more}</span>`; + } + // Pure: the lineage-style chips of a covering PR drawn under an issue — + // its lineage / adopted-from chip, then the also-closes chip; null = none. + function stageTrackerLinkedChipsHtml(lp, lineage) { + const also = typeof stageTrackerAlsoClosesChipHtml === 'function' ? stageTrackerAlsoClosesChipHtml(lp) : ''; + const out = [lineage || '', also].filter(Boolean).join(' '); + return out || null; + } // The row's inline lead action (tracker-actions.js // stageTrackerLeadActionHtml), computed against the viewer's own // permissions on the item's repo; '' where the actions module or a @@ -1084,11 +1104,13 @@ // One line (hivecommons/hive: "consolidate from 3 lines of text to // 1"): connector, repo chip, author icon + #N + title, the lineage / // adopted-from chip, then the base pill — all siblings of the flex-row - // PR cell; the title ellipsizes, the pills never shrink. + // PR cell; the title ellipsizes, the pills never shrink. A superseded + // original wears neither pill — it closes as superseded, not as the + // closer of anything. const lineage = superseded ? '' : ((typeof stageTrackerLineageChipHtml === 'function' ? stageTrackerLineageChipHtml(pr, nowMs) : '') || (typeof stageTrackerAdoptedFromChipHtml === 'function' ? stageTrackerAdoptedFromChipHtml(pr, nowMs) : '')); const chip = ctx && ctx.repoChips ? stageTrackerRepoChipHtml(pr.repo, ctx) : ''; if (chip) ref = `<span class="ham-pr-line">${chip}${ref}</span>`; - ref = stageTrackerPRPillsHtml(ref, lineage || null, lp.base_ref); + ref = stageTrackerPRPillsHtml(ref, !superseded && typeof stageTrackerLinkedChipsHtml === 'function' ? stageTrackerLinkedChipsHtml(lp, lineage) : (lineage || null), lp.base_ref); ref = STAGE_TRACKER_LINKED_GLYPH + ref; if (superseded) { // The adopted original: one muted line, no chevron track, no row @@ -1348,7 +1370,8 @@ // 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 + stageTrackerPRPillsHtml(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.lineage && typeof stageTrackerLineageChipHtml === 'function' ? stageTrackerLineageChipHtml(lp, nowMs) : '') || (typeof stageTrackerAdoptedFromChipHtml === 'function' ? stageTrackerAdoptedFromChipHtml(lp, nowMs) : '') || null, lp.base_ref)]; + const lineage = (lp.lineage && typeof stageTrackerLineageChipHtml === 'function' ? stageTrackerLineageChipHtml(lp, nowMs) : '') || (typeof stageTrackerAdoptedFromChipHtml === 'function' ? stageTrackerAdoptedFromChipHtml(lp, nowMs) : ''); + prRefs = [STAGE_TRACKER_LINKED_GLYPH + stageTrackerPRPillsHtml(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 stageTrackerLinkedChipsHtml === 'function' ? stageTrackerLinkedChipsHtml(lp, lineage) : (lineage || null), lp.base_ref)]; shown = Object.assign({}, item, { via_pr: true, stage: stageTrackerLeadStage(lp), 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, claimant: lp.claimant || null, presence: lp.presence || null, rework: lp.rework || null, push: lp.push || null, merge_gate: lp.merge_gate || null, merge_train: lp.merge_train || null, left_train: lp.left_train || null, overlap: lp.overlap || null, decided: lp.decided || item.decided || null }); } else if (linked.length) { diff --git a/src/pkg/dashboard/static/index.html b/src/pkg/dashboard/static/index.html index 88a9d61473..9c9b648601 100644 --- a/src/pkg/dashboard/static/index.html +++ b/src/pkg/dashboard/static/index.html @@ -1755,6 +1755,9 @@ .ham-plan-rails { font-size: var(--fs-xs); color: var(--text-faint); } .ham-lineage { color: var(--muted); text-decoration: none; display: inline-flex; align-items: center; gap: var(--sp-1); } .ham-lineage:hover { color: var(--text); } + .ham-also-closes { color: var(--muted); } + .ham-also-closes a { color: inherit; text-decoration: none; } + .ham-also-closes a:hover { color: var(--text); text-decoration: underline; } .ham-plan-body, .ham-plan-note { white-space: pre-wrap; } .ham-plan-note { color: var(--muted); font-size: var(--fs-xs); } .ham-seg.active .cue-acting-cap { margin-left: var(--sp-2); } @@ -17385,6 +17388,26 @@ <h3 class="faq-group-title">Where to get help</h3> const tip = 'Hive re-authored #' + af.number + (af.author ? ' (by @' + af.author + ')' : '') + ' as this PR with the same commits and sign-off' + (af.decided_by ? '; the decision on #' + af.number + ' was ' + (af.decided_action || 'yours') + ' by @' + af.decided_by : '') + '.' + (stageTrackerSupersededOriginalClause(Number(af.number), af.state) || ' #' + af.number + ' is closed as superseded when this merges.'); return `<a class="ham-badge ham-adopted-from" href="${esc(af.url || '#')}" target="_blank" rel="noopener" title="${esc(tip)}">${esc(text)}</a>`; } + // Pure: the reciprocal of the "↳ #N · under #M" chip (hivecommons/ + // hive#15806) — on the PR drawn here, "also closes #A, #B" naming the + // other listed open issues it resolves, every number a link; past + // three it reads "#A, #B, #C +N" and the hover names every title. + function stageTrackerAlsoClosesChipHtml(lp) { + const list = Array.isArray(lp && lp.also_closes) ? lp.also_closes.filter(li => li && Number(li.number) > 0) : []; + if (!list.length) return ''; + const shown = list.slice(0, 3); + const links = shown.map(li => `<a href="${esc(li.url || '#')}" target="_blank" rel="noopener">#${Number(li.number)}</a>`).join(', '); + const more = list.length > shown.length ? ' +' + (list.length - shown.length) : ''; + const tip = 'this PR also resolves ' + list.map(li => '#' + Number(li.number) + (li.title ? ' (' + li.title + ')' : '')).join(', '); + return `<span class="ham-badge ham-also-closes" title="${esc(tip)}">also closes ${links}${more}</span>`; + } + // Pure: the lineage-style chips of a covering PR drawn under an issue — + // its lineage / adopted-from chip, then the also-closes chip; null = none. + function stageTrackerLinkedChipsHtml(lp, lineage) { + const also = typeof stageTrackerAlsoClosesChipHtml === 'function' ? stageTrackerAlsoClosesChipHtml(lp) : ''; + const out = [lineage || '', also].filter(Boolean).join(' '); + return out || null; + } // The row's inline lead action (tracker-actions.js // stageTrackerLeadActionHtml), computed against the viewer's own // permissions on the item's repo; '' where the actions module or a @@ -17409,11 +17432,13 @@ <h3 class="faq-group-title">Where to get help</h3> // One line (hivecommons/hive: "consolidate from 3 lines of text to // 1"): connector, repo chip, author icon + #N + title, the lineage / // adopted-from chip, then the base pill — all siblings of the flex-row - // PR cell; the title ellipsizes, the pills never shrink. + // PR cell; the title ellipsizes, the pills never shrink. A superseded + // original wears neither pill — it closes as superseded, not as the + // closer of anything. const lineage = superseded ? '' : ((typeof stageTrackerLineageChipHtml === 'function' ? stageTrackerLineageChipHtml(pr, nowMs) : '') || (typeof stageTrackerAdoptedFromChipHtml === 'function' ? stageTrackerAdoptedFromChipHtml(pr, nowMs) : '')); const chip = ctx && ctx.repoChips ? stageTrackerRepoChipHtml(pr.repo, ctx) : ''; if (chip) ref = `<span class="ham-pr-line">${chip}${ref}</span>`; - ref = stageTrackerPRPillsHtml(ref, lineage || null, lp.base_ref); + ref = stageTrackerPRPillsHtml(ref, !superseded && typeof stageTrackerLinkedChipsHtml === 'function' ? stageTrackerLinkedChipsHtml(lp, lineage) : (lineage || null), lp.base_ref); ref = STAGE_TRACKER_LINKED_GLYPH + ref; if (superseded) { // The adopted original: one muted line, no chevron track, no row @@ -17673,7 +17698,8 @@ <h3 class="faq-group-title">Where to get help</h3> // 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 + stageTrackerPRPillsHtml(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.lineage && typeof stageTrackerLineageChipHtml === 'function' ? stageTrackerLineageChipHtml(lp, nowMs) : '') || (typeof stageTrackerAdoptedFromChipHtml === 'function' ? stageTrackerAdoptedFromChipHtml(lp, nowMs) : '') || null, lp.base_ref)]; + const lineage = (lp.lineage && typeof stageTrackerLineageChipHtml === 'function' ? stageTrackerLineageChipHtml(lp, nowMs) : '') || (typeof stageTrackerAdoptedFromChipHtml === 'function' ? stageTrackerAdoptedFromChipHtml(lp, nowMs) : ''); + prRefs = [STAGE_TRACKER_LINKED_GLYPH + stageTrackerPRPillsHtml(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 stageTrackerLinkedChipsHtml === 'function' ? stageTrackerLinkedChipsHtml(lp, lineage) : (lineage || null), lp.base_ref)]; shown = Object.assign({}, item, { via_pr: true, stage: stageTrackerLeadStage(lp), 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, claimant: lp.claimant || null, presence: lp.presence || null, rework: lp.rework || null, push: lp.push || null, merge_gate: lp.merge_gate || null, merge_train: lp.merge_train || null, left_train: lp.left_train || null, overlap: lp.overlap || null, decided: lp.decided || item.decided || null }); } else if (linked.length) {