Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use the new Fenix components model to move bugs out of Fenix:General #2399

Merged
merged 17 commits into from
Jul 8, 2024
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 50 additions & 3 deletions bugbot/rules/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ def __init__(self):
super().__init__()
self.autofix_component = {}
self.frequency = "daily"
self.general_confidence_threshold = self.get_config(
"general_confidence_threshold"
)
self.component_confidence_threshold = self.get_config("confidence_threshold")
self.fenix_confidence_threshold = self.get_config("fenix_confidence_threshold")

def add_custom_arguments(self, parser):
parser.add_argument(
Expand Down Expand Up @@ -76,6 +81,9 @@ def get_bz_params(self, date):
"f9": "CP",
}

def meets_threshold(self, bug_data, threshold):
return bug_data["prob"][bug_data["index"]] >= threshold

suhaibmujahid marked this conversation as resolved.
Show resolved Hide resolved
def get_bugs(self, date="today", bug_ids=[]):
# Retrieve the bugs with the fields defined in get_bz_params
raw_bugs = super().get_bugs(date=date, bug_ids=bug_ids, chunk_size=7000)
Expand All @@ -89,6 +97,44 @@ def get_bugs(self, date="today", bug_ids=[]):
# Classify those bugs
bugs = get_bug_ids_classification("component", bug_ids)

suhaibmujahid marked this conversation as resolved.
Show resolved Hide resolved
# Collect bugs classified as Fenix::General
fenix_general_bug_ids = {
bug_id
for bug_id, bug_data in bugs.items()
if bug_data.get("class") == "Fenix"
and self.meets_threshold(bug_data, self.general_confidence_threshold)
}

# Collection bugs that were originally Fenix::General but reclassified to another product with low confidence
originally_fenix_general_bug_ids = {
bug_id
for bug_id, bug_data in bugs.items()
if raw_bugs[bug_id]["product"] == "Fenix"
and raw_bugs[bug_id]["component"] == "General"
and not self.meets_threshold(
bug_data,
self.general_confidence_threshold
if bug_data["class"] == "General"
else self.component_confidence_threshold,
)
}

fenix_general_bug_ids.update(originally_fenix_general_bug_ids)

# Reclassify the Fenix::General bugs using the fenixcomponent model
if fenix_general_bug_ids:
fenix_general_classification = get_bug_ids_classification(
"fenixcomponent", fenix_general_bug_ids
)
suhaibmujahid marked this conversation as resolved.
Show resolved Hide resolved

for bug_id, data in fenix_general_classification.items():
new_confidence = data["prob"][data["index"]]
suhaibmujahid marked this conversation as resolved.
Show resolved Hide resolved

# Only reclassify if the new confidence meets the Fenix component confidence threshold
suhaibmujahid marked this conversation as resolved.
Show resolved Hide resolved
if new_confidence > self.fenix_confidence_threshold:
data["class"] = f"Fenix::{data['class']}"
bugs[bug_id] = data

results = {}

for bug_id in sorted(bugs.keys()):
Expand All @@ -106,9 +152,10 @@ def get_bugs(self, date="today", bug_ids=[]):
prob = bug_data["prob"]
index = bug_data["index"]
suggestion = bug_data["class"]
conflated_components_mapping = bug_data["extra_data"][
"conflated_components_mapping"
]

conflated_components_mapping = bug_data["extra_data"].get(
"conflated_components_mapping", {}
)
suhaibmujahid marked this conversation as resolved.
Show resolved Hide resolved

# Skip product-only suggestions that are not useful.
if "::" not in suggestion and bug["product"] == suggestion:
Expand Down
1 change: 1 addition & 0 deletions configs/rules.json
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,7 @@
},
"component": {
"confidence_threshold": 0.35,
"fenix_confidence_threshold": 0.6,
"general_confidence_threshold": 0.8,
"days_lookup": 365,
"max_days_in_cache": 7,
Expand Down