feat(alerts): raise one alert per open issue and pull request

Each open issue now has its own alert. An issue with recent activity is issue_fresh. An issue idle for issue_stale_after or longer is issue_stale. This replaces the single issues_stale line per repo.

A non-draft pull request younger than pr_warn_after now raises pr_fresh. Older pull requests keep pr_waiting.

All new alerts have warn severity, so a repo with open work is no longer green. The pr_open alert for auto actions is unchanged.
This commit is contained in:
2026-10-06 14:14:26 +01:00
parent eff9559aee
commit 5bca4c38f0
8 changed files with 67 additions and 57 deletions
+3 -3
View File
@@ -138,10 +138,10 @@ func TestNewAutoRunnerNilWithoutAutoActions(t *testing.T) {
func TestStateCarriesPROpenRef(t *testing.T) {
st := buildState(autoView(autoPR(1, "abc", "x", nil)), true)
if len(st.Alerts) != 1 || st.Alerts[0].Kind != collector.KindPROpen || st.Alerts[0].Ref != "abc" || st.Alerts[0].Severity != "ok" {
if len(st.Alerts) != 2 || st.Alerts[0].Kind != collector.KindPROpen || st.Alerts[0].Ref != "abc" || st.Alerts[0].Severity != "ok" || st.Alerts[1].Kind != collector.KindPRFresh {
t.Fatalf("alerts = %+v", st.Alerts)
}
if st.Counts.Crit != 0 || st.Counts.Warn != 0 || st.Repos[0].Health != "ok" {
t.Fatalf("counts/health changed: %+v %s", st.Counts, st.Repos[0].Health)
if st.Repos[0].Health != "warn" {
t.Fatalf("health = %s, want warn", st.Repos[0].Health)
}
}