in bugbot/bug/analyzer.py [0:0]
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
regressor bug.
Returns:
A list of `VersionStatus` objects.
"""
if len(self._bug["regressed_by"]) > 1:
# Currently only bugs with one regressor are supported
return []
regressor_bug = self.regressed_by_bugs[0]
regressed_version = regressor_bug.oldest_fixed_firefox_version
if not regressed_version:
return []
fixed_version = self.oldest_fixed_firefox_version
# If the latest status flag is wontfix or fix-optional, we ignore
# setting flags with the status "affected" to newer versions.
is_latest_wontfix = self.latest_firefox_version_status in (
"wontfix",
"fix-optional",
)
flag_updates = []
for flag, channel, version in self._store.current_version_flags:
if flag not in self._bug and channel == "esr":
# It is okay if an ESR flag is absent (we try two, the current
# and the previous). However, the absence of other flags is a
# sign of something wrong.
continue
if self._bug[flag] != "---":
# We don't override existing flags
# XXX maybe check for consistency?
continue
if fixed_version and fixed_version <= version:
# Bug was fixed in an earlier version, don't set the flag
continue
if (
version >= regressed_version
# ESR: If the regressor was uplifted, so the regression affects
# this version.
or regressor_bug.get_field(flag) in ("fixed", "verified")
):
if is_latest_wontfix:
continue
flag_updates.append(VersionStatus(channel, version, "affected"))
else:
flag_updates.append(VersionStatus(channel, version, "unaffected"))
return flag_updates