aboutsummaryrefslogtreecommitdiffstats
path: root/dashboard/app/reporting.go
diff options
context:
space:
mode:
authorAleksandr Nogikh <nogikh@google.com>2023-05-17 21:34:04 +0200
committerAleksandr Nogikh <wp32pw@gmail.com>2023-05-19 16:19:18 +0200
commit07fe138212dd4a056ec1a199109a39c22633866f (patch)
tree5d6acf993311d41b70919463d9081b2eebb1504f /dashboard/app/reporting.go
parent3bb7af1def6b7b99e4c1c9573162eb41b5893cd3 (diff)
dashboard: optionally disable bug obsoletion
This allows us to write cleaner tests.
Diffstat (limited to 'dashboard/app/reporting.go')
-rw-r--r--dashboard/app/reporting.go17
1 files changed, 15 insertions, 2 deletions
diff --git a/dashboard/app/reporting.go b/dashboard/app/reporting.go
index 3ace1787e..0e9133df4 100644
--- a/dashboard/app/reporting.go
+++ b/dashboard/app/reporting.go
@@ -212,7 +212,7 @@ func handleReportNotif(c context.Context, typ string, bug *Bug) (*dashapi.BugNot
return createNotification(c, dashapi.BugNotifUpstream, true, "", bug, reporting, bugReporting)
}
if len(bug.Commits) == 0 &&
- bug.canBeObsoleted() &&
+ bug.canBeObsoleted(c) &&
timeSince(c, bug.LastActivity) > notifyResendPeriod &&
timeSince(c, bug.LastTime) > bug.obsoletePeriod() {
log.Infof(c, "%v: obsoleting: %v", bug.Namespace, bug.Title)
@@ -237,13 +237,26 @@ func bugObsoletionReason(bug *Bug) dashapi.BugStatusReason {
return dashapi.InvalidatedByNoActivity
}
+var noObsoletionsKey = "Temporarily disable bug obsoletions"
+
+func contextWithNoObsoletions(c context.Context) context.Context {
+ return context.WithValue(c, &noObsoletionsKey, struct{}{})
+}
+
+func getNoObsoletions(c context.Context) bool {
+ return c.Value(&noObsoletionsKey) != nil
+}
+
// TODO: this is what we would like to do, but we need to figure out
// KMSAN story: we don't do fix bisection on it (rebased),
// do we want to close all old KMSAN bugs with repros?
// For now we only enable this in tests.
var obsoleteWhatWontBeFixBisected = false
-func (bug *Bug) canBeObsoleted() bool {
+func (bug *Bug) canBeObsoleted(c context.Context) bool {
+ if getNoObsoletions(c) {
+ return false
+ }
if bug.HeadReproLevel == ReproLevelNone {
return true
}