Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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-merged-ledger.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- The Activity Monitor's merge count no longer resets on reload: a persistent merged ledger under `/data` records every pull request the hive tracked that reached merged (whoever merged it) and `/api/stage-tracker` carries `merged{today, total_7d, total_30d, all_time, recent}`; the chip, now **Merged** (all-time, with today / this week beneath), is pinned at the top of the tracker with the column header strip, opens a popover of recent merges, and a merge raises a bee (or "+1") from the row's βœ“ cell to the chip or off the top of the screen plus a dismissible bottom-right banner with a *Show row* link ([#15147](https://github.com/hivecommons/hive/issues/15147)).
678 changes: 339 additions & 339 deletions src/docs/api-reference.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/docs/dashboard-sections.md

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/pkg/dashboard/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ func (s *Server) RegisterAPI(deps *Dependencies) {
}
s.deps = deps
s.loadSidebarFromDisk()
s.mergedLedger()
s.registerContributeRoutes()
// Issue claims (hivecommons/hive#8380). Routes register unconditionally;
// handlers answer "not enabled" when deps.IssueClaims is nil.
Expand Down
21 changes: 19 additions & 2 deletions src/pkg/dashboard/audit.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (

"github.com/hivecommons/hive/pkg/config"
"github.com/hivecommons/hive/pkg/dashboard/collect"
"github.com/hivecommons/hive/pkg/github"
"gopkg.in/natefinch/lumberjack.v2"
)

Expand Down Expand Up @@ -165,6 +166,18 @@ type AuditLog struct {
// they persist; "" keeps them in memory only (no /data volume, tests).
prCounters PRThroughputCounters
prCountersPath string
// onPRMerged, when set, is called (outside the lock) with each pr_merged
// entry the log accepts β€” the first record of a PR's merge, the
// duplicates having been dropped by notePRThroughput. The merged ledger
// (merged_ledger.go) is its consumer.
onPRMerged func(AuditEntry)
}

// SetPRMergedHook installs the pr_merged observer; nil removes it.
func (a *AuditLog) SetPRMergedHook(fn func(AuditEntry)) {
a.mu.Lock()
a.onPRMerged = fn
a.mu.Unlock()
}

func newAuditLog() *AuditLog {
Expand Down Expand Up @@ -249,12 +262,11 @@ func (a *AuditLog) logRecordAt(timestamp, user, action, detail, agent, repo stri
}

a.mu.Lock()
defer a.mu.Unlock()

if len(a.ring) >= auditRingCap {
a.ring = a.ring[1:]
}
if prThroughputActions[entry.Action] && !a.notePRThroughput(entry) && prThroughputTerminalAction(entry.Action) {
a.mu.Unlock()
return
}
a.ring = append(a.ring, entry)
Expand All @@ -267,6 +279,11 @@ func (a *AuditLog) logRecordAt(timestamp, user, action, detail, agent, repo stri
}
}
}
onMerged := a.onPRMerged
a.mu.Unlock()
if onMerged != nil && entry.Action == github.AuditActionPRMerged {
onMerged(entry)
}
}

// noteUserAction records ts as user's most recent audited action, skipping
Expand Down
Loading
Loading