From 0add1486c2f9b1388870a6a32600ed83f65184ec Mon Sep 17 00:00:00 2001 From: Aleksandr Nogikh Date: Fri, 7 Mar 2025 13:55:24 +0100 Subject: [PATCH] dashboard: verify bug-crash repro consistency in findCrashForBug Other logic heavily depends on it, which provokes unpleasant situations like described in #5829. When picking the most representative crash for a bug, make sure it's the one we expected to get. --- dashboard/app/reporting.go | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/dashboard/app/reporting.go b/dashboard/app/reporting.go index 9601d27185a4..81a9562e1490 100644 --- a/dashboard/app/reporting.go +++ b/dashboard/app/reporting.go @@ -1288,14 +1288,17 @@ func findCrashForBug(c context.Context, bug *Bug) (*Crash, *db.Key, error) { return nil, nil, fmt.Errorf("no crashes") } crash, key := crashes[0], keys[0] + // There seem to be some bugs around HeadReproLevel / queryCrashesForBug consistency. + // Let's be strict about it here as the other logic relies on it being correct (see e.g. #5829). + hasNeededRepro := true if bug.HeadReproLevel == ReproLevelC { - if crash.ReproC == 0 { - log.Errorf(c, "bug '%v': has C repro, but crash without C repro", bug.Title) - } + hasNeededRepro = !crash.ReproIsRevoked && crash.ReproC != 0 } else if bug.HeadReproLevel == ReproLevelSyz { - if crash.ReproSyz == 0 { - log.Errorf(c, "bug '%v': has syz repro, but crash without syz repro", bug.Title) - } + hasNeededRepro = !crash.ReproIsRevoked && (crash.ReproC != 0 || crash.ReproSyz != 0) + } + if !hasNeededRepro { + return nil, nil, fmt.Errorf("bug has repro level %d, but the 'top' crash %v doesn't", + bug.HeadReproLevel, key.IntID()) } return crash, key, nil }