Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
881f1fb
🐛 fix: scope tracker link memo to the excluded PR
mendezr Oct 29, 2026
98730f1
📝 docs: add tracker link memo changelog fragment
mendezr Oct 29, 2026
0ed63b0
🐛 fix: share tracker issue lookups and filter closers per row
mendezr Oct 29, 2026
2c12c9c
🌱 chore: retry CI after transient Go proxy failure
mendezr Oct 29, 2026
fc19faa
Merge branch 'v5' into fix/15495-link-memo
hivecommons-hive[bot] Oct 29, 2026
5400580
Merge branch 'v5' into hive/adopt-15508
hivecommons-hive[bot] Oct 29, 2026
af15cac
test(dashboard): give link-memo closer fixture a same-repo PR url
hivecommons-hive[bot] Oct 29, 2026
2023767
Merge branch 'v5' into hive/adopt-15508
hivecommons-hive[bot] Oct 29, 2026
8321a93
Merge branch 'v5' into hive/adopt-15508
hivecommons-hive[bot] Oct 29, 2026
9fb8c38
Merge branch 'v5' into hive/adopt-15508
hivecommons-hive[bot] Oct 29, 2026
44fa8d4
Merge branch 'v5' into hive/adopt-15508
hivecommons-hive[bot] Oct 29, 2026
271d21f
Merge branch 'v5' into hive/adopt-15508
hivecommons-hive[bot] Oct 29, 2026
7ba900a
Merge branch 'v5' into hive/adopt-15508
hivecommons-hive[bot] Oct 29, 2026
8dcb542
Merge branch 'v5' into hive/adopt-15508
hivecommons-hive[bot] Oct 30, 2026
2e10d5a
Merge branch 'v5' into hive/adopt-15508
hivecommons-hive[bot] Oct 30, 2026
3238243
Merge branch 'v5' into hive/adopt-15508
hivecommons-hive[bot] Oct 30, 2026
47f81bf
Merge branch 'v5' into hive/adopt-15508
hivecommons-hive[bot] Oct 30, 2026
cad267e
Merge branch 'v5' into hive/adopt-15508
hivecommons-hive[bot] Oct 30, 2026
3a674b4
Merge branch 'v5' into hive/adopt-15508
hivecommons-hive[bot] Oct 30, 2026
0f50da1
Merge branch 'v5' into hive/adopt-15508
hivecommons-hive[bot] Oct 30, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/fixed-15508-link-memo.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Cache the dashboard tracker’s unfiltered issue closer once per issue and exclude the carrying PR per row, preserving correct sibling links without extra lookups. This defensively preserves correct links if merged PR rows are included; current open-only tracker behavior is unchanged ([#15495](https://github.com/hivecommons/hive/issues/15495)).
11 changes: 8 additions & 3 deletions src/pkg/dashboard/stage_tracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -2964,7 +2964,8 @@ type stageTrackerLinkInfo struct {
at time.Time
}

// stageTrackerLinkMemo memoises link lookups keyed by owner/repo#number.
// stageTrackerLinkMemo memoises link lookups keyed by owner/repo#issue.
// The cached closer is unfiltered; each carrying PR excludes itself below.
type stageTrackerLinkMemo struct {
mu sync.Mutex
m map[string]stageTrackerLinkInfo
Expand Down Expand Up @@ -3040,7 +3041,7 @@ func (s *Server) stageTrackerEnrichSoftLinks(items []StageTrackerItem, qualify f
in, hit := s.stageTrackerLinks.get(key, now)
if !hit && lookups < stageTrackerLinkLookups && ctx.Err() == nil {
lookups++
facts, err := s.deps.GHClient.IssueLinkState(ctx, owner, name, li.Number, pr.Number)
facts, err := s.deps.GHClient.IssueLinkState(ctx, owner, name, li.Number, 0)
in = stageTrackerLinkInfo{title: facts.Title, state: facts.State, stateReason: facts.StateReason, closedBy: facts.ClosedBy, pr: facts.IsPR, ok: err == nil}
// Running out of this rebuild's budget says nothing
// about the issue: leave it for the next rebuild.
Expand All @@ -3054,7 +3055,11 @@ func (s *Server) stageTrackerEnrichSoftLinks(items []StageTrackerItem, qualify f
if in.ok {
li.Title, li.State = in.title, in.state
if in.state == "closed" {
li.StateReason, li.ClosedBy = in.stateReason, in.closedBy
li.StateReason, li.ClosedBy = in.stateReason, 0
// Exclude the carrying PR per row, not in the shared lookup.
if in.closedBy != pr.Number {
li.ClosedBy = in.closedBy
}
}
}
}
Expand Down
60 changes: 60 additions & 0 deletions src/pkg/dashboard/stage_tracker_link_memo_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
package dashboard

import (
"fmt"
"net/http"
"net/http/httptest"
"strings"
"sync/atomic"
"testing"
"time"

"github.com/hivecommons/hive/pkg/github"
)

func TestStageTrackerLinkMemoSharesLookupAndExcludesCarryingPR(t *testing.T) {
var gets, closerReads atomic.Int32
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if r.Method == http.MethodPost && strings.HasSuffix(r.URL.Path, "/graphql") {
closerReads.Add(1)
fmt.Fprint(w, `{"data":{"repository":{"issue":{"closedByPullRequestsReferences":{"nodes":[{"number":70,"url":"https://github.com/hivecommons/hive/pull/70","merged":true,"mergedAt":"2026-10-27T12:00:00Z"}]}}}}}`)
return
}
gets.Add(1)
fmt.Fprint(w, `{"number":76,"title":"Delivered issue","state":"closed","state_reason":"completed"}`)
}))
defer ts.Close()
s := newTestServer()
s.deps = &Dependencies{GHClient: github.NewClientForTest(ts.URL, "hivecommons", []string{"hive"}, s.logger)}
qualify := func(string) string { return "hivecommons/hive" }
now := time.Date(2026, 10, 27, 18, 0, 0, 0, time.UTC)

// Merged PRs are not tracker rows today. Exercise both row orders so a
// future inclusion cannot let a row's exclusion poison its sibling's memo.
for _, order := range [][]int{{70, 90}, {90, 70}} {
s.stageTrackerLinks = stageTrackerLinkMemo{}
beforeGets, before := gets.Load(), closerReads.Load()
for rebuild := 0; rebuild < 2; rebuild++ {
var items []StageTrackerItem
for _, number := range order {
items = append(items, StageTrackerItem{Repo: "hive", Number: number, Kind: "pr", LinkedIssues: []StageTrackerLinkedIssue{{Number: 76}}})
}
s.stageTrackerEnrichSoftLinks(items, qualify, now.Add(time.Duration(rebuild)*time.Minute))
for _, item := range items {
want := 70
if item.Number == 70 {
want = 0
}
if got := item.LinkedIssues[0].ClosedBy; got != want {
t.Fatalf("order %v rebuild %d PR #%d: closer = %d, want %d", order, rebuild, item.Number, got, want)
}
}
}
if got := gets.Load() - beforeGets; got != 1 {
t.Fatalf("order %v: issues GETs = %d, want 1 shared across siblings and rebuilds", order, got)
}
if got := closerReads.Load() - before; got != 1 {
t.Fatalf("order %v: closer reads = %d, want 1 shared across siblings and rebuilds", order, got)
}
}
}
Loading