[file_crash_bug] Set version status flags based on regressors

This commit is contained in:
Suhaib Mujahid 2023-07-10 13:47:48 -04:00 коммит произвёл Suhaib Mujahid
Родитель e1fa05db82
Коммит 2094bb2ee8
2 изменённых файлов: 13 добавлений и 3 удалений

Просмотреть файл

@ -107,7 +107,7 @@ class BugAnalyzer:
"""
return self._bug.get(field)
def detect_version_status_updates(self) -> list[VersionStatus] | None:
def detect_version_status_updates(self) -> list[VersionStatus]:
"""Detect the status for the version flags that should be updated.
The status of the version flags is determined by the status of the
@ -118,12 +118,12 @@ class BugAnalyzer:
"""
if len(self._bug["regressed_by"]) > 1:
# Currently only bugs with one regressor are supported
return None
return []
regressor_bug = self.regressed_by_bugs[0]
regressed_version = regressor_bug.oldest_fixed_firefox_version
if not regressed_version:
return None
return []
fixed_version = self.oldest_fixed_firefox_version

Просмотреть файл

@ -8,6 +8,7 @@ import jinja2
import requests
from bugbot import logger
from bugbot.bug.analyzer import BugAnalyzer
from bugbot.bzcleaner import BzCleaner
from bugbot.crash import socorro_util
from bugbot.crash.analyzer import DevBugzilla, SignatureAnalyzer, SignaturesDataFetcher
@ -172,6 +173,15 @@ class FileCrashBug(BzCleaner):
if signature.is_potential_security_crash:
bug_data["groups"] = ["core-security"]
# NOTE: The following will have no effect on bugzilla-dev since we
# don't fill the `regressed_by` field. Anyway, setting the version
# status flag will cause errors on bugzilla-dev since the fields are
# out of sync.
bug_analyzer = BugAnalyzer(bug_data, signature.bugs_store)
updates = bug_analyzer.detect_version_status_updates()
for update in updates:
bug_data[update.flag] = update.status
if self.dryrun:
logger.info("Dry-run bug:")
pprint.pprint(bug_data)