bugbug 0.0.651__tar.gz → 0.0.652__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {bugbug-0.0.651 → bugbug-0.0.652}/PKG-INFO +1 -1
- bugbug-0.0.652/VERSION +1 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/bug_features.py +7 -3
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/models/qaneeded.py +6 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/models/stepstoreproduce.py +3 -1
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/tools/code_review/agent.py +5 -1
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/tools/code_review/data_types.py +13 -1
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/tools/code_review/prompts.py +8 -4
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/tools/code_review/scorer.py +58 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/tools/code_review/utils.py +2 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/tools/core/data_types.py +23 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/scripts/regressor_finder.py +38 -9
- {bugbug-0.0.651 → bugbug-0.0.652}/scripts/shadow_scheduler_stats.py +257 -64
- bugbug-0.0.651/VERSION +0 -1
- {bugbug-0.0.651 → bugbug-0.0.652}/.gitignore +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/LICENSE +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/__init__.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/bug_snapshot.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/bugzilla.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/build_platforms.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/code_search/__init__.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/code_search/function_search.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/code_search/mozilla.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/code_search/parser.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/code_search/searchfox_api.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/code_search/searchfox_data.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/code_search/searchfox_download.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/commit_features.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/db.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/feature_cleanup.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/github.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/issue_features.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/issue_snapshot.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/labels/annotateignore.csv +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/labels/bug_nobug.csv +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/labels/defect_enhancement_task.csv +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/labels/defect_enhancement_task_e.csv +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/labels/defect_enhancement_task_h.csv +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/labels/defect_enhancement_task_p.csv +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/labels/defect_enhancement_task_s.csv +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/labels/regression_bug_nobug.csv +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/labels/regressionrange.csv +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/labels/str.csv +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/labels/tracking.csv +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/labels.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/model.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/model_calibration.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/models/__init__.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/models/accessibility.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/models/annotate_ignore.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/models/assignee.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/models/backout.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/models/browsername.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/models/bugtype.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/models/component.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/models/component_specific.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/models/defect.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/models/defect_enhancement_task.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/models/devdocneeded.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/models/fenixcomponent.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/models/fixtime.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/models/invalid_compatibility_report.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/models/needsdiagnosis.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/models/perf_regression_predictor.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/models/performancebug.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/models/rcatype.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/models/regression.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/models/regressionrange.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/models/regressor.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/models/severity.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/models/spambug.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/models/testconfigdimensions.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/models/testconfigselect.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/models/testfailure.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/models/testselect.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/models/tracking.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/models/uplift.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/models/worksforme.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/nlp.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/perf/__init__.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/perf/commit_risk.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/perf/datasets.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/perf/extraction.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/perf/label_policy.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/perf/push_status.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/perf/regression_commits.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/perf/regression_labeling.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/perf/selection_pairs.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/perf/sql/__init__.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/perf/sql/perf_alerts.sql +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/perf/sql/perf_pushes.sql +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/perf/sql/perf_task_costs.sql +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/perf/task_costs.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/perf/task_labels.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/phabricator.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/redash.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/repository.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/rust_code_analysis_server.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/swarm.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/test_scheduling.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/test_scheduling_features.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/tools/__init__.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/tools/base.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/tools/code_review/__init__.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/tools/code_review/database.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/tools/code_review/langchain_tools.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/tools/code_review/protocols.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/tools/code_review/review_context.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/tools/code_review/review_context_schema.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/tools/comment_matching/agent.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/tools/comment_matching/prompts.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/tools/comment_resolution/__init__.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/tools/comment_resolution/agent.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/tools/core/__init__.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/tools/core/connection.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/tools/core/exceptions.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/tools/core/llms.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/tools/core/platforms/__init__.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/tools/core/platforms/base.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/tools/core/platforms/bugzilla.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/tools/core/platforms/patch_apply.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/tools/core/platforms/phabricator.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/tools/core/text.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/tools/core/validators.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/tools/patch_summarization/__init__.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/tools/patch_summarization/agent.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/tools/patch_summarization/prompts.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/tools/suggestion_filtering/__init__.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/tools/suggestion_filtering/agent.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/tools/suggestion_filtering/prompts.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/utils.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/bugbug/vectordb.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/pyproject.toml +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/scripts/__init__.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/scripts/analyze_training_metrics.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/scripts/backout_related_test_regressions.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/scripts/bug_classifier.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/scripts/bug_retriever.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/scripts/check.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/scripts/check_all_metrics.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/scripts/ci_failures_matching.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/scripts/comment_classifier.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/scripts/comment_level_labeler.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/scripts/comment_resolver_runner.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/scripts/commit_classifier.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/scripts/commit_retriever.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/scripts/compatibility_report_classifier.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/scripts/gcp_logs_retriever.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/scripts/generate_landings_risk_report.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/scripts/generate_sheet.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/scripts/get_type_labels.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/scripts/get_untriaged.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/scripts/github_issue_classifier.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/scripts/github_issue_retriever.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/scripts/inline_comments_data_collection.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/scripts/integration_test.sh +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/scripts/maintenance_effectiveness_indicator.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/scripts/microannotate_generator.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/scripts/past_bugs_by_unit.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/scripts/perf_alerts_retriever.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/scripts/perf_regression_predictor.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/scripts/redundant_failures.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/scripts/retrieve_ci_failures.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/scripts/retrieve_training_metrics.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/scripts/retrieve_try_pushes.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/scripts/review_comments_retriever.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/scripts/revision_retriever.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/scripts/test_scheduling_history_retriever.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/scripts/testing_policy_stats.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/scripts/trainer.py +0 -0
- {bugbug-0.0.651 → bugbug-0.0.652}/scripts/trainer_extract_args.py +0 -0
bugbug-0.0.652/VERSION
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0.0.652
|
|
@@ -203,7 +203,9 @@ class DeltaRequestMerge(SingleBugFeature):
|
|
|
203
203
|
def __call__(self, bug, **kwargs):
|
|
204
204
|
for history in bug["history"]:
|
|
205
205
|
for change in history["changes"]:
|
|
206
|
-
if change["
|
|
206
|
+
if change["field_name"] == "flagtypes.name" and change[
|
|
207
|
+
"added"
|
|
208
|
+
].startswith("approval-mozilla"):
|
|
207
209
|
uplift_request_datetime = datetime.strptime(
|
|
208
210
|
history["when"], "%Y-%m-%dT%H:%M:%SZ"
|
|
209
211
|
).replace(tzinfo=timezone.utc)
|
|
@@ -223,7 +225,8 @@ class DeltaNightlyRequestMerge(SingleBugFeature):
|
|
|
223
225
|
for history in bug["history"]:
|
|
224
226
|
for change in history["changes"]:
|
|
225
227
|
if not (
|
|
226
|
-
change["
|
|
228
|
+
change["field_name"] == "flagtypes.name"
|
|
229
|
+
and change["added"].startswith("approval-mozilla")
|
|
227
230
|
and change["added"].endswith("?")
|
|
228
231
|
):
|
|
229
232
|
continue
|
|
@@ -600,7 +603,8 @@ class CCNumber(SingleBugFeature):
|
|
|
600
603
|
class IsUplifted(SingleBugFeature):
|
|
601
604
|
def __call__(self, bug, **kwargs):
|
|
602
605
|
return any(
|
|
603
|
-
change["
|
|
606
|
+
change["field_name"] == "flagtypes.name"
|
|
607
|
+
and change["added"].startswith("approval-mozilla")
|
|
604
608
|
and change["added"].endswith("+")
|
|
605
609
|
for history in bug["history"]
|
|
606
610
|
for change in history["changes"]
|
|
@@ -97,6 +97,12 @@ class QANeededModel(BugModel):
|
|
|
97
97
|
if not found_qa:
|
|
98
98
|
for entry in bug_data["history"]:
|
|
99
99
|
for change in entry["changes"]:
|
|
100
|
+
if change["field_name"] not in (
|
|
101
|
+
"keywords",
|
|
102
|
+
"flagtypes.name",
|
|
103
|
+
):
|
|
104
|
+
continue
|
|
105
|
+
|
|
100
106
|
if any(
|
|
101
107
|
change["removed"].startswith(label)
|
|
102
108
|
for label in ["qawanted", "qe-verify", "qaurgent"]
|
|
@@ -88,7 +88,9 @@ class StepsToReproduceModel(BugModel):
|
|
|
88
88
|
else:
|
|
89
89
|
for entry in bug_data["history"]:
|
|
90
90
|
for change in entry["changes"]:
|
|
91
|
-
if change["
|
|
91
|
+
if change["field_name"] == "keywords" and change[
|
|
92
|
+
"removed"
|
|
93
|
+
].startswith("stepswanted"):
|
|
92
94
|
classes[int(bug_data["id"])] = 1
|
|
93
95
|
|
|
94
96
|
logger.info(
|
|
@@ -51,6 +51,7 @@ from bugbug.tools.code_review.utils import (
|
|
|
51
51
|
convert_generated_comments_to_inline,
|
|
52
52
|
format_patch_set,
|
|
53
53
|
)
|
|
54
|
+
from bugbug.tools.core.data_types import CommentCategory, CommentSeverity
|
|
54
55
|
from bugbug.tools.core.exceptions import (
|
|
55
56
|
LargeDiffError,
|
|
56
57
|
RecursionLimitError,
|
|
@@ -317,10 +318,13 @@ class CodeReviewTool(GenerativeModelTool):
|
|
|
317
318
|
filtered_suggestions = self.suggestion_filterer.run(unfiltered_suggestions)
|
|
318
319
|
|
|
319
320
|
# The patch-scope suggestion is a deliberate, meta-level comment, so it
|
|
320
|
-
# bypasses the suggestion filterer
|
|
321
|
+
# bypasses the suggestion filterer, is always sorted last, and always
|
|
322
|
+
# has a fixed `minor` severity regardless of what the model chose.
|
|
321
323
|
scope_suggestions = await self.assess_patch_scope(patch, patch_summary)
|
|
322
324
|
for offset, suggestion in enumerate(scope_suggestions):
|
|
323
325
|
suggestion.order = len(filtered_suggestions) + offset + 1
|
|
326
|
+
suggestion.severity = CommentSeverity.MINOR
|
|
327
|
+
suggestion.category = CommentCategory.SCOPE
|
|
324
328
|
|
|
325
329
|
inline_comments = list(
|
|
326
330
|
convert_generated_comments_to_inline(
|
|
@@ -6,7 +6,11 @@ import tenacity
|
|
|
6
6
|
from pydantic import BaseModel, Field, PrivateAttr
|
|
7
7
|
|
|
8
8
|
from bugbug.tools.core.connection import get_http_client
|
|
9
|
-
from bugbug.tools.core.data_types import
|
|
9
|
+
from bugbug.tools.core.data_types import (
|
|
10
|
+
CommentCategory,
|
|
11
|
+
CommentSeverity,
|
|
12
|
+
InlineComment,
|
|
13
|
+
)
|
|
10
14
|
|
|
11
15
|
|
|
12
16
|
class GeneratedReviewComment(BaseModel):
|
|
@@ -31,6 +35,14 @@ class GeneratedReviewComment(BaseModel):
|
|
|
31
35
|
description="An integer representing the priority of the comment, with 1 being the highest confidence/importance."
|
|
32
36
|
),
|
|
33
37
|
]
|
|
38
|
+
severity: Annotated[
|
|
39
|
+
CommentSeverity,
|
|
40
|
+
Field(description="How much the issue matters, from critical to nit."),
|
|
41
|
+
]
|
|
42
|
+
category: Annotated[
|
|
43
|
+
CommentCategory,
|
|
44
|
+
Field(description="The kind of problem the comment reports."),
|
|
45
|
+
]
|
|
34
46
|
|
|
35
47
|
|
|
36
48
|
class AgentResponse(BaseModel):
|
|
@@ -33,10 +33,14 @@ Follow this systematic approach to review the patch:
|
|
|
33
33
|
- When uncertain about an issue, use available tools to verify before commenting
|
|
34
34
|
- Do not suggest issues you cannot verify with available context
|
|
35
35
|
|
|
36
|
-
**Step 4:
|
|
37
|
-
-
|
|
38
|
-
-
|
|
39
|
-
-
|
|
36
|
+
**Step 4: Classify Each Comment**
|
|
37
|
+
- Assign a `severity` using this rubric:
|
|
38
|
+
- `critical`: a security vulnerability, data loss or corruption, a crash, or a break that would affect users if the patch landed
|
|
39
|
+
- `major`: a functional bug, logic error, or regression on a realistic code path; the code does not do what the patch intends
|
|
40
|
+
- `minor`: correct but not ideal; performance, robustness, error handling, or maintainability problems that will not break users
|
|
41
|
+
- `nit`: style, naming, readability, or a coding-standard preference that is safe to ignore
|
|
42
|
+
- Assign a `category`: `security`, `correctness`, `performance`, `maintainability`, `style`, or `scope`
|
|
43
|
+
- When unsure between two severities, pick the lower one
|
|
40
44
|
|
|
41
45
|
**Step 5: Write Clear, Constructive Comments**
|
|
42
46
|
- Use direct, declarative language - state the problem definitively, then suggest the fix
|
|
@@ -4,6 +4,7 @@ from logging import getLogger
|
|
|
4
4
|
import weave
|
|
5
5
|
|
|
6
6
|
from bugbug.tools.comment_matching.agent import CommentMatchingTool
|
|
7
|
+
from bugbug.tools.core.data_types import CommentSeverity
|
|
7
8
|
from bugbug.tools.suggestion_filtering.agent import SuggestionFilteringTool
|
|
8
9
|
|
|
9
10
|
logger = getLogger(__name__)
|
|
@@ -212,6 +213,12 @@ class LLMCommentMatchingScorer(weave.Scorer):
|
|
|
212
213
|
"matched_valid_excluded": matched_valid_excluded,
|
|
213
214
|
"matched_invalid_retained": matched_invalid_retained,
|
|
214
215
|
"matched_invalid_excluded": matched_invalid_excluded,
|
|
216
|
+
# Severity breakdown
|
|
217
|
+
"severity_breakdown": build_severity_breakdown(
|
|
218
|
+
generated_comments,
|
|
219
|
+
matched_valid_retained + matched_valid_excluded,
|
|
220
|
+
matched_invalid_retained + matched_invalid_excluded,
|
|
221
|
+
),
|
|
215
222
|
}
|
|
216
223
|
|
|
217
224
|
def summarize(self, score_rows: list[dict]) -> dict:
|
|
@@ -291,4 +298,55 @@ class LLMCommentMatchingScorer(weave.Scorer):
|
|
|
291
298
|
if total_matched_invalid > 0
|
|
292
299
|
else 0
|
|
293
300
|
),
|
|
301
|
+
**summarize_severity_breakdowns(score_rows),
|
|
294
302
|
}
|
|
303
|
+
|
|
304
|
+
|
|
305
|
+
def build_severity_breakdown(
|
|
306
|
+
generated_comments: list,
|
|
307
|
+
matched_valid: list[dict],
|
|
308
|
+
matched_invalid: list[dict],
|
|
309
|
+
) -> dict[str, dict[str, int]]:
|
|
310
|
+
"""Count generated and matched comments per severity for one example.
|
|
311
|
+
|
|
312
|
+
Comments without a severity, e.g. from runs before severities existed, are
|
|
313
|
+
left out of the breakdown.
|
|
314
|
+
"""
|
|
315
|
+
breakdown = {
|
|
316
|
+
severity.value: {"generated": 0, "matched_valid": 0, "matched_invalid": 0}
|
|
317
|
+
for severity in CommentSeverity
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
def count(comment, key: str) -> None:
|
|
321
|
+
severity = getattr(comment, "severity", None)
|
|
322
|
+
if severity is not None:
|
|
323
|
+
breakdown[severity][key] += 1
|
|
324
|
+
|
|
325
|
+
for comment in generated_comments:
|
|
326
|
+
count(comment, "generated")
|
|
327
|
+
for match in matched_valid:
|
|
328
|
+
count(match["generated_comment"], "matched_valid")
|
|
329
|
+
for match in matched_invalid:
|
|
330
|
+
count(match["generated_comment"], "matched_invalid")
|
|
331
|
+
|
|
332
|
+
return breakdown
|
|
333
|
+
|
|
334
|
+
|
|
335
|
+
def summarize_severity_breakdowns(score_rows: list[dict]) -> dict:
|
|
336
|
+
"""Aggregate per-severity counts across examples into flat summary metrics."""
|
|
337
|
+
summary: dict[str, float] = {}
|
|
338
|
+
for severity in CommentSeverity:
|
|
339
|
+
totals = {"generated": 0, "matched_valid": 0, "matched_invalid": 0}
|
|
340
|
+
for row in score_rows:
|
|
341
|
+
row_counts = row.get("severity_breakdown", {}).get(severity.value, {})
|
|
342
|
+
for key in totals:
|
|
343
|
+
totals[key] += row_counts.get(key, 0)
|
|
344
|
+
|
|
345
|
+
summary[f"{severity}_generated"] = totals["generated"]
|
|
346
|
+
summary[f"{severity}_matched_valid"] = totals["matched_valid"]
|
|
347
|
+
summary[f"{severity}_matched_invalid"] = totals["matched_invalid"]
|
|
348
|
+
summary[f"{severity}_valid_match_rate"] = (
|
|
349
|
+
totals["matched_valid"] / totals["generated"] if totals["generated"] else 0
|
|
350
|
+
)
|
|
351
|
+
|
|
352
|
+
return summary
|
|
@@ -6,6 +6,27 @@
|
|
|
6
6
|
"""Core data types used across bugbug tools."""
|
|
7
7
|
|
|
8
8
|
from dataclasses import dataclass
|
|
9
|
+
from enum import StrEnum
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class CommentSeverity(StrEnum):
|
|
13
|
+
"""How much a review comment matters, from most to least urgent."""
|
|
14
|
+
|
|
15
|
+
CRITICAL = "critical"
|
|
16
|
+
MAJOR = "major"
|
|
17
|
+
MINOR = "minor"
|
|
18
|
+
NIT = "nit"
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class CommentCategory(StrEnum):
|
|
22
|
+
"""The kind of problem a review comment reports."""
|
|
23
|
+
|
|
24
|
+
SECURITY = "security"
|
|
25
|
+
CORRECTNESS = "correctness"
|
|
26
|
+
PERFORMANCE = "performance"
|
|
27
|
+
MAINTAINABILITY = "maintainability"
|
|
28
|
+
STYLE = "style"
|
|
29
|
+
SCOPE = "scope"
|
|
9
30
|
|
|
10
31
|
|
|
11
32
|
@dataclass
|
|
@@ -28,6 +49,8 @@ class InlineComment:
|
|
|
28
49
|
is_generated: bool | None = None
|
|
29
50
|
explanation: str | None = None
|
|
30
51
|
order: int | None = None
|
|
52
|
+
severity: CommentSeverity | None = None
|
|
53
|
+
category: CommentCategory | None = None
|
|
31
54
|
details: dict | None = None
|
|
32
55
|
|
|
33
56
|
|
|
@@ -82,6 +82,22 @@ def get_deleted_lines(patch: bytes) -> dict[str, list[int]]:
|
|
|
82
82
|
return deleted_lines
|
|
83
83
|
|
|
84
84
|
|
|
85
|
+
def annotate_path(
|
|
86
|
+
hg: hglib.client.hgclient, rev: str, path: str, skip: str | None
|
|
87
|
+
) -> bytes:
|
|
88
|
+
"""Return the node that last touched each line of path, as of the parent of rev."""
|
|
89
|
+
return hg.rawcommand(
|
|
90
|
+
hglib.util.cmdbuilder(
|
|
91
|
+
b"annotate",
|
|
92
|
+
b"path:" + path.encode("utf-8"),
|
|
93
|
+
r=f"p1({rev})",
|
|
94
|
+
w=True,
|
|
95
|
+
skip=skip,
|
|
96
|
+
T="{lines % '{node}\\n'}",
|
|
97
|
+
)
|
|
98
|
+
)
|
|
99
|
+
|
|
100
|
+
|
|
85
101
|
def find_bug_introducing_revs(
|
|
86
102
|
hg: hglib.client.hgclient,
|
|
87
103
|
rev: str,
|
|
@@ -107,16 +123,29 @@ def find_bug_introducing_revs(
|
|
|
107
123
|
continue
|
|
108
124
|
|
|
109
125
|
skip = " + ".join(ignored_revs_by_path.get(path, [])) or None
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
126
|
+
|
|
127
|
+
try:
|
|
128
|
+
annotate = annotate_path(hg, rev, path, skip)
|
|
129
|
+
except hglib.error.ServerError:
|
|
130
|
+
# Mercurial can crash while annotating (e.g. IndexError in
|
|
131
|
+
# dag_util._annotatepair when skipping revisions). The command
|
|
132
|
+
# server is dead at this point, so restart it and retry without
|
|
133
|
+
# skipping revisions, which is the code path that crashes.
|
|
134
|
+
# Remove this workaround once Mercurial fixes the bug:
|
|
135
|
+
# https://foss.heptapod.net/mercurial/mercurial-devel/-/work_items/10162
|
|
136
|
+
logger.exception(
|
|
137
|
+
"hg annotate crashed for %s at %s, retrying without --skip", path, rev
|
|
118
138
|
)
|
|
119
|
-
|
|
139
|
+
hg.open()
|
|
140
|
+
if skip is None:
|
|
141
|
+
continue
|
|
142
|
+
try:
|
|
143
|
+
annotate = annotate_path(hg, rev, path, None)
|
|
144
|
+
except hglib.error.ServerError:
|
|
145
|
+
logger.exception("hg annotate crashed again for %s at %s", path, rev)
|
|
146
|
+
hg.open()
|
|
147
|
+
continue
|
|
148
|
+
|
|
120
149
|
line_revs = annotate.decode("ascii").splitlines()
|
|
121
150
|
bug_introducing_revs.update(
|
|
122
151
|
line_revs[lineno - 1] for lineno in linenos if lineno <= len(line_revs)
|