From 6a5fcca423a42e14346de8637cc30d79530bf034 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Thu, 21 Feb 2019 18:18:18 +0100 Subject: dashboard/app: implement bug notifications/actions Currently dashboard can only report new bugs and add reproducers to already reported bugs. This change adds infrastructure for the dashboard to actively act on existing bugs in different ways. 4 new notifications (actions) added: - dashboard can auto-upstream bugs from moderation after an embargo period - dashboard can auto-upstream bugs if reporting criteria changes (e.g. it reported a bug into moderation because there was no repro, but then repro appears and the bug is automatically sent upstream) - dashboard detects when a fixing commit does not appear in any tested trees for too long and sends a notification about this - dashboard detects stale bugs (last happened monts ago, no repro, no activity) and auto-invalidates them This will also be useful to send pings for old bugs and do other automation. --- dashboard/dashapi/dashapi.go | 69 ++++++++++++++++++++++++++++++++++++++------ 1 file changed, 60 insertions(+), 9 deletions(-) (limited to 'dashboard/dashapi/dashapi.go') diff --git a/dashboard/dashapi/dashapi.go b/dashboard/dashapi/dashapi.go index 02d7ea132..ed95d0f38 100644 --- a/dashboard/dashapi/dashapi.go +++ b/dashboard/dashapi/dashapi.go @@ -262,6 +262,7 @@ type BugReport struct { JobID string ExtID string // arbitrary reporting ID forwarded from BugUpdate.ExtID First bool // Set for first report for this bug. + Moderation bool Title string Maintainers []string CC []string // additional CC emails @@ -297,15 +298,17 @@ type BugReport struct { } type BugUpdate struct { - ID string - ExtID string - Link string - Status BugStatus - ReproLevel ReproLevel - DupOf string - FixCommits []string // Titles of commits that fix this bug. - CC []string // Additional emails to add to CC list in future emails. - CrashID int64 + ID string + ExtID string + Link string + Status BugStatus + ReproLevel ReproLevel + DupOf string + OnHold bool // If set for open bugs, don't upstream this bug. + Notification bool // Reply to a notification. + FixCommits []string // Titles of commits that fix this bug. + CC []string // Additional emails to add to CC list in future emails. + CrashID int64 } type BugUpdateReply struct { @@ -325,6 +328,31 @@ type PollBugsResponse struct { Reports []*BugReport } +type BugNotification struct { + Type BugNotif + Namespace string + Config []byte + ID string + ExtID string // arbitrary reporting ID forwarded from BugUpdate.ExtID + Title string + Text string // meaning depends on Type + CC []string // additional CC emails + Maintainers []string + // Public is what we want all involved people to see (e.g. if we notify about a wrong commit title, + // people need to see it and provide the right title). Not public is what we want to send only + // to a minimal set of recipients (our mailing list) (e.g. notification about an obsoleted bug + // is mostly "for the record"). + Public bool +} + +type PollNotificationsRequest struct { + Type string +} + +type PollNotificationsResponse struct { + Notifications []*BugNotification +} + type PollClosedRequest struct { IDs []string } @@ -344,6 +372,17 @@ func (dash *Dashboard) ReportingPollBugs(typ string) (*PollBugsResponse, error) return resp, nil } +func (dash *Dashboard) ReportingPollNotifications(typ string) (*PollNotificationsResponse, error) { + req := &PollNotificationsRequest{ + Type: typ, + } + resp := new(PollNotificationsResponse) + if err := dash.Query("reporting_poll_notifs", req, resp); err != nil { + return nil, err + } + return resp, nil +} + func (dash *Dashboard) ReportingPollClosed(ids []string) ([]string, error) { req := &PollClosedRequest{ IDs: ids, @@ -384,6 +423,7 @@ func (dash *Dashboard) UploadManagerStats(req *ManagerStatsReq) error { type ( BugStatus int + BugNotif int ReproLevel int ) @@ -395,6 +435,17 @@ const ( BugStatusUpdate // aux info update (i.e. ExtID/Link/CC) ) +const ( + // Upstream bug into next reporting. + // If the action succeeds, reporting sends BugStatusUpstream update. + BugNotifUpstream BugNotif = iota + // Bug needs to be closed as obsoleted. + // If the action succeeds, reporting sends BugStatusInvalid update. + BugNotifObsoleted + // Bug fixing commit can't be discovered (wrong commit title). + BugNotifBadCommit +) + const ( ReproLevelNone ReproLevel = iota ReproLevelSyz -- cgit mrf-deployment