diff options
| author | Aleksandr Nogikh <nogikh@google.com> | 2025-07-21 14:08:15 +0200 |
|---|---|---|
| committer | Aleksandr Nogikh <nogikh@google.com> | 2025-07-23 10:08:31 +0000 |
| commit | e0b9ac936f136a5a03a40283b911bc4802d98bef (patch) | |
| tree | eb6d22026987409b7909248a8d673854acf2a641 /dashboard/app | |
| parent | 4aa75a1288d3ac4aa13407f4ad0fb29ed136955e (diff) | |
all: simplify subsystem revision updates
Don't specify the subsystem revision in the dashboard config and instead
let it be nested in the registered subsystems. This reduces the amount
of the manual work needed to switch syzbot to a newer subsystem list.
Diffstat (limited to 'dashboard/app')
| -rw-r--r-- | dashboard/app/api.go | 7 | ||||
| -rw-r--r-- | dashboard/app/app_test.go | 6 | ||||
| -rw-r--r-- | dashboard/app/config.go | 2 | ||||
| -rw-r--r-- | dashboard/app/subsystem.go | 8 | ||||
| -rw-r--r-- | dashboard/app/util_test.go | 7 |
5 files changed, 11 insertions, 19 deletions
diff --git a/dashboard/app/api.go b/dashboard/app/api.go index 4a9b03171..c1d77881c 100644 --- a/dashboard/app/api.go +++ b/dashboard/app/api.go @@ -876,10 +876,13 @@ func reportCrash(c context.Context, build *Build, req *dashapi.Crash) (*Bug, err log.Infof(c, "not saving crash for %q", bug.Title) } + subsystemService := getNsConfig(c, ns).Subsystems.Service + newSubsystems := []*subsystem.Subsystem{} // Recalculate subsystems on the first saved crash and on the first saved repro, // unless a user has already manually specified them. - calculateSubsystems := save && + calculateSubsystems := subsystemService != nil && + save && !bug.hasUserSubsystems() && (bug.NumCrashes == 0 || bug.ReproLevel == ReproLevelNone && reproLevel != ReproLevelNone) @@ -910,7 +913,7 @@ func reportCrash(c context.Context, build *Build, req *dashapi.Crash) (*Bug, err bug.HasReport = true } if calculateSubsystems { - bug.SetAutoSubsystems(c, newSubsystems, now, getNsConfig(c, ns).Subsystems.Revision) + bug.SetAutoSubsystems(c, newSubsystems, now, subsystemService.Revision) } bug.increaseCrashStats(now) bug.HappenedOn = mergeString(bug.HappenedOn, build.Manager) diff --git a/dashboard/app/app_test.go b/dashboard/app/app_test.go index 445fcf785..693ca61ee 100644 --- a/dashboard/app/app_test.go +++ b/dashboard/app/app_test.go @@ -128,7 +128,7 @@ var testConfig = &GlobalConfig{ }, }, Subsystems: SubsystemsConfig{ - Service: subsystem.MustMakeService(testSubsystems), + Service: subsystem.MustMakeService(testSubsystems, 0), }, }, "test2": { @@ -326,7 +326,7 @@ var testConfig = &GlobalConfig{ }, RetestRepros: true, Subsystems: SubsystemsConfig{ - Service: subsystem.MustMakeService(testSubsystems), + Service: subsystem.MustMakeService(testSubsystems, 0), Redirect: map[string]string{ "oldSubsystem": "subsystemA", }, @@ -517,7 +517,7 @@ var testConfig = &GlobalConfig{ }, }, Subsystems: SubsystemsConfig{ - Service: subsystem.MustMakeService(testSubsystems), + Service: subsystem.MustMakeService(testSubsystems, 0), Reminder: &BugListReportingConfig{ SourceReporting: "public", BugsInReport: 6, diff --git a/dashboard/app/config.go b/dashboard/app/config.go index 409b99ce5..8c9d9fb6e 100644 --- a/dashboard/app/config.go +++ b/dashboard/app/config.go @@ -200,8 +200,6 @@ type DiscussionEmailConfig struct { type SubsystemsConfig struct { // If Service is set, dashboard will use it to infer and recalculate subsystems. Service *subsystem.Service - // If all existing subsystem labels must be recalculated, increase this integer. - Revision int // Periodic per-subsystem reminders about open bugs. Reminder *BugListReportingConfig // Maps old subsystem names to new ones. diff --git a/dashboard/app/subsystem.go b/dashboard/app/subsystem.go index 293f67481..c49bc081b 100644 --- a/dashboard/app/subsystem.go +++ b/dashboard/app/subsystem.go @@ -28,7 +28,7 @@ func reassignBugSubsystems(c context.Context, ns string, count int) error { return err } log.Infof(c, "updating subsystems for %d bugs in %#v", len(keys), ns) - rev := getNsConfig(c, ns).Subsystems.Revision + rev := service.Revision for i, bugKey := range keys { if bugs[i].hasUserSubsystems() { // It might be that the user-set subsystem no longer exists. @@ -54,7 +54,7 @@ func reassignBugSubsystems(c context.Context, ns string, count int) error { func bugsToUpdateSubsystems(c context.Context, ns string, count int) ([]*Bug, []*db.Key, error) { now := timeNow(c) - rev := getSubsystemRevision(c, ns) + rev := getSubsystemService(c, ns).Revision queries := []*db.Query{ // If revision has been updated, first update open bugs. db.NewQuery("Bug"). @@ -194,10 +194,6 @@ func getSubsystemService(c context.Context, ns string) *subsystem.Service { return getNsConfig(c, ns).Subsystems.Service } -func getSubsystemRevision(c context.Context, ns string) int { - return getNsConfig(c, ns).Subsystems.Revision -} - func subsystemListURL(c context.Context, ns string) string { if getNsConfig(c, ns).Subsystems.Service == nil { return "" diff --git a/dashboard/app/util_test.go b/dashboard/app/util_test.go index 2040f879e..f403d8f2b 100644 --- a/dashboard/app/util_test.go +++ b/dashboard/app/util_test.go @@ -216,12 +216,7 @@ func (c *Ctx) setSubsystems(ns string, list []*subsystem.Subsystem, rev int) { c.transformContext = func(c context.Context) context.Context { newConfig := replaceNamespaceConfig(c, ns, func(cfg *Config) *Config { ret := *cfg - ret.Subsystems.Revision = rev - if list == nil { - ret.Subsystems.Service = nil - } else { - ret.Subsystems.Service = subsystem.MustMakeService(list) - } + ret.Subsystems.Service = subsystem.MustMakeService(list, rev) return &ret }) return contextWithConfig(c, newConfig) |
