bugbug 0.0.656__tar.gz → 0.0.657__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.
Files changed (190) hide show
  1. {bugbug-0.0.656 → bugbug-0.0.657}/PKG-INFO +1 -1
  2. bugbug-0.0.657/VERSION +1 -0
  3. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/bug_features.py +3 -19
  4. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/bug_snapshot.py +33 -19
  5. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/bugzilla.py +23 -10
  6. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/issue_features.py +0 -9
  7. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/model.py +92 -3
  8. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/models/accessibility.py +3 -1
  9. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/models/assignee.py +5 -3
  10. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/models/component.py +4 -3
  11. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/models/component_specific.py +4 -3
  12. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/models/defect.py +140 -10
  13. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/models/defect_enhancement_task.py +5 -0
  14. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/models/devdocneeded.py +5 -3
  15. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/models/fixtime.py +4 -3
  16. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/models/invalid_compatibility_report.py +1 -1
  17. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/models/needsdiagnosis.py +4 -1
  18. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/models/performancebug.py +4 -3
  19. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/models/qaneeded.py +5 -3
  20. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/models/regression.py +26 -1
  21. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/models/severity.py +4 -3
  22. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/models/spambug.py +4 -3
  23. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/models/testselect.py +1 -1
  24. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/models/tracking.py +5 -3
  25. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/models/uplift.py +5 -3
  26. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/models/worksforme.py +5 -3
  27. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/repository.py +11 -7
  28. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/test_scheduling.py +13 -6
  29. {bugbug-0.0.656 → bugbug-0.0.657}/scripts/bug_retriever.py +64 -39
  30. bugbug-0.0.656/VERSION +0 -1
  31. {bugbug-0.0.656 → bugbug-0.0.657}/.gitignore +0 -0
  32. {bugbug-0.0.656 → bugbug-0.0.657}/LICENSE +0 -0
  33. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/__init__.py +0 -0
  34. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/build_platforms.py +0 -0
  35. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/code_search/__init__.py +0 -0
  36. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/code_search/function_search.py +0 -0
  37. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/code_search/mozilla.py +0 -0
  38. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/code_search/parser.py +0 -0
  39. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/code_search/searchfox_api.py +0 -0
  40. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/code_search/searchfox_data.py +0 -0
  41. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/code_search/searchfox_download.py +0 -0
  42. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/commit_features.py +0 -0
  43. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/db.py +0 -0
  44. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/feature_cleanup.py +0 -0
  45. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/github.py +0 -0
  46. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/issue_snapshot.py +0 -0
  47. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/labels/annotateignore.csv +0 -0
  48. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/labels/bug_nobug.csv +0 -0
  49. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/labels/defect_enhancement_task.csv +0 -0
  50. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/labels/defect_enhancement_task_e.csv +0 -0
  51. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/labels/defect_enhancement_task_h.csv +0 -0
  52. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/labels/defect_enhancement_task_p.csv +0 -0
  53. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/labels/defect_enhancement_task_s.csv +0 -0
  54. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/labels/regression_bug_nobug.csv +0 -0
  55. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/labels/regressionrange.csv +0 -0
  56. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/labels/str.csv +0 -0
  57. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/labels/tracking.csv +0 -0
  58. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/labels.py +0 -0
  59. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/model_calibration.py +0 -0
  60. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/models/__init__.py +0 -0
  61. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/models/annotate_ignore.py +0 -0
  62. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/models/backout.py +0 -0
  63. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/models/browsername.py +0 -0
  64. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/models/bugtype.py +0 -0
  65. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/models/fenixcomponent.py +0 -0
  66. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/models/perf_regression_predictor.py +0 -0
  67. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/models/rcatype.py +0 -0
  68. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/models/regressionrange.py +0 -0
  69. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/models/regressor.py +0 -0
  70. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/models/stepstoreproduce.py +0 -0
  71. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/models/testconfigdimensions.py +0 -0
  72. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/models/testconfigselect.py +0 -0
  73. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/models/testfailure.py +0 -0
  74. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/nlp.py +0 -0
  75. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/perf/__init__.py +0 -0
  76. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/perf/calibration.py +0 -0
  77. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/perf/commit_risk.py +0 -0
  78. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/perf/datasets.py +0 -0
  79. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/perf/extraction.py +0 -0
  80. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/perf/label_policy.py +0 -0
  81. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/perf/push_status.py +0 -0
  82. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/perf/regression_commits.py +0 -0
  83. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/perf/regression_labeling.py +0 -0
  84. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/perf/selection_pairs.py +0 -0
  85. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/perf/simulation/__init__.py +0 -0
  86. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/perf/simulation/capacity.py +0 -0
  87. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/perf/simulation/detection.py +0 -0
  88. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/perf/simulation/metrics.py +0 -0
  89. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/perf/simulation/optimize.py +0 -0
  90. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/perf/simulation/splits.py +0 -0
  91. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/perf/simulation/stats.py +0 -0
  92. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/perf/simulation/strategies.py +0 -0
  93. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/perf/simulation/timeline.py +0 -0
  94. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/perf/sql/__init__.py +0 -0
  95. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/perf/sql/perf_alerts.sql +0 -0
  96. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/perf/sql/perf_capacity_background.sql +0 -0
  97. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/perf/sql/perf_capacity_builds.sql +0 -0
  98. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/perf/sql/perf_capacity_eligible.sql +0 -0
  99. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/perf/sql/perf_capacity_labels.sql +0 -0
  100. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/perf/sql/perf_capacity_pools.sql +0 -0
  101. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/perf/sql/perf_capacity_workers.sql +0 -0
  102. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/perf/sql/perf_pushes.sql +0 -0
  103. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/perf/sql/perf_task_costs.sql +0 -0
  104. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/perf/sql/perf_task_filter.sql +0 -0
  105. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/perf/task_costs.py +0 -0
  106. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/perf/task_labels.py +0 -0
  107. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/phabricator.py +0 -0
  108. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/redash.py +0 -0
  109. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/rust_code_analysis_server.py +0 -0
  110. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/swarm.py +0 -0
  111. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/test_scheduling_features.py +0 -0
  112. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/tools/__init__.py +0 -0
  113. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/tools/base.py +0 -0
  114. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/tools/code_review/__init__.py +0 -0
  115. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/tools/code_review/agent.py +0 -0
  116. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/tools/code_review/data_types.py +0 -0
  117. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/tools/code_review/database.py +0 -0
  118. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/tools/code_review/langchain_tools.py +0 -0
  119. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/tools/code_review/prompts.py +0 -0
  120. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/tools/code_review/protocols.py +0 -0
  121. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/tools/code_review/review_context.py +0 -0
  122. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/tools/code_review/review_context_schema.py +0 -0
  123. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/tools/code_review/scorer.py +0 -0
  124. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/tools/code_review/utils.py +0 -0
  125. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/tools/comment_matching/agent.py +0 -0
  126. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/tools/comment_matching/prompts.py +0 -0
  127. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/tools/comment_resolution/__init__.py +0 -0
  128. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/tools/comment_resolution/agent.py +0 -0
  129. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/tools/core/__init__.py +0 -0
  130. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/tools/core/connection.py +0 -0
  131. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/tools/core/data_types.py +0 -0
  132. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/tools/core/exceptions.py +0 -0
  133. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/tools/core/llms.py +0 -0
  134. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/tools/core/platforms/__init__.py +0 -0
  135. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/tools/core/platforms/base.py +0 -0
  136. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/tools/core/platforms/bugzilla.py +0 -0
  137. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/tools/core/platforms/patch_apply.py +0 -0
  138. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/tools/core/platforms/phabricator.py +0 -0
  139. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/tools/core/text.py +0 -0
  140. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/tools/core/validators.py +0 -0
  141. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/tools/patch_summarization/__init__.py +0 -0
  142. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/tools/patch_summarization/agent.py +0 -0
  143. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/tools/patch_summarization/prompts.py +0 -0
  144. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/tools/suggestion_filtering/__init__.py +0 -0
  145. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/tools/suggestion_filtering/agent.py +0 -0
  146. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/tools/suggestion_filtering/prompts.py +0 -0
  147. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/utils.py +0 -0
  148. {bugbug-0.0.656 → bugbug-0.0.657}/bugbug/vectordb.py +0 -0
  149. {bugbug-0.0.656 → bugbug-0.0.657}/pyproject.toml +0 -0
  150. {bugbug-0.0.656 → bugbug-0.0.657}/scripts/__init__.py +0 -0
  151. {bugbug-0.0.656 → bugbug-0.0.657}/scripts/analyze_training_metrics.py +0 -0
  152. {bugbug-0.0.656 → bugbug-0.0.657}/scripts/backout_related_test_regressions.py +0 -0
  153. {bugbug-0.0.656 → bugbug-0.0.657}/scripts/bug_classifier.py +0 -0
  154. {bugbug-0.0.656 → bugbug-0.0.657}/scripts/check.py +0 -0
  155. {bugbug-0.0.656 → bugbug-0.0.657}/scripts/check_all_metrics.py +0 -0
  156. {bugbug-0.0.656 → bugbug-0.0.657}/scripts/ci_failures_matching.py +0 -0
  157. {bugbug-0.0.656 → bugbug-0.0.657}/scripts/comment_classifier.py +0 -0
  158. {bugbug-0.0.656 → bugbug-0.0.657}/scripts/comment_level_labeler.py +0 -0
  159. {bugbug-0.0.656 → bugbug-0.0.657}/scripts/comment_resolver_runner.py +0 -0
  160. {bugbug-0.0.656 → bugbug-0.0.657}/scripts/commit_classifier.py +0 -0
  161. {bugbug-0.0.656 → bugbug-0.0.657}/scripts/commit_retriever.py +0 -0
  162. {bugbug-0.0.656 → bugbug-0.0.657}/scripts/compatibility_report_classifier.py +0 -0
  163. {bugbug-0.0.656 → bugbug-0.0.657}/scripts/gcp_logs_retriever.py +0 -0
  164. {bugbug-0.0.656 → bugbug-0.0.657}/scripts/generate_landings_risk_report.py +0 -0
  165. {bugbug-0.0.656 → bugbug-0.0.657}/scripts/generate_sheet.py +0 -0
  166. {bugbug-0.0.656 → bugbug-0.0.657}/scripts/get_type_labels.py +0 -0
  167. {bugbug-0.0.656 → bugbug-0.0.657}/scripts/get_untriaged.py +0 -0
  168. {bugbug-0.0.656 → bugbug-0.0.657}/scripts/github_issue_classifier.py +0 -0
  169. {bugbug-0.0.656 → bugbug-0.0.657}/scripts/github_issue_retriever.py +0 -0
  170. {bugbug-0.0.656 → bugbug-0.0.657}/scripts/inline_comments_data_collection.py +0 -0
  171. {bugbug-0.0.656 → bugbug-0.0.657}/scripts/integration_test.sh +0 -0
  172. {bugbug-0.0.656 → bugbug-0.0.657}/scripts/maintenance_effectiveness_indicator.py +0 -0
  173. {bugbug-0.0.656 → bugbug-0.0.657}/scripts/microannotate_generator.py +0 -0
  174. {bugbug-0.0.656 → bugbug-0.0.657}/scripts/past_bugs_by_unit.py +0 -0
  175. {bugbug-0.0.656 → bugbug-0.0.657}/scripts/perf_alerts_retriever.py +0 -0
  176. {bugbug-0.0.656 → bugbug-0.0.657}/scripts/perf_commit_risk_scorer.py +0 -0
  177. {bugbug-0.0.656 → bugbug-0.0.657}/scripts/perf_regression_predictor.py +0 -0
  178. {bugbug-0.0.656 → bugbug-0.0.657}/scripts/perf_scheduling_simulator.py +0 -0
  179. {bugbug-0.0.656 → bugbug-0.0.657}/scripts/redundant_failures.py +0 -0
  180. {bugbug-0.0.656 → bugbug-0.0.657}/scripts/regressor_finder.py +0 -0
  181. {bugbug-0.0.656 → bugbug-0.0.657}/scripts/retrieve_ci_failures.py +0 -0
  182. {bugbug-0.0.656 → bugbug-0.0.657}/scripts/retrieve_training_metrics.py +0 -0
  183. {bugbug-0.0.656 → bugbug-0.0.657}/scripts/retrieve_try_pushes.py +0 -0
  184. {bugbug-0.0.656 → bugbug-0.0.657}/scripts/review_comments_retriever.py +0 -0
  185. {bugbug-0.0.656 → bugbug-0.0.657}/scripts/revision_retriever.py +0 -0
  186. {bugbug-0.0.656 → bugbug-0.0.657}/scripts/shadow_scheduler_stats.py +0 -0
  187. {bugbug-0.0.656 → bugbug-0.0.657}/scripts/test_scheduling_history_retriever.py +0 -0
  188. {bugbug-0.0.656 → bugbug-0.0.657}/scripts/testing_policy_stats.py +0 -0
  189. {bugbug-0.0.656 → bugbug-0.0.657}/scripts/trainer.py +0 -0
  190. {bugbug-0.0.656 → bugbug-0.0.657}/scripts/trainer_extract_args.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: bugbug
3
- Version: 0.0.656
3
+ Version: 0.0.657
4
4
  Summary: ML tools for Mozilla projects
5
5
  Author-email: Marco Castelluccio <mcastelluccio@mozilla.com>
6
6
  License-Expression: MPL-2.0
bugbug-0.0.657/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.657
@@ -8,8 +8,6 @@ import re
8
8
  import sys
9
9
  from collections import Counter, defaultdict
10
10
  from datetime import datetime, timezone
11
- from functools import partial
12
- from multiprocessing.pool import Pool
13
11
 
14
12
  import pandas as pd
15
13
  from dateutil import parser
@@ -17,7 +15,7 @@ from libmozdata import versions
17
15
  from libmozdata.bugzilla import Bugzilla
18
16
  from sklearn.base import BaseEstimator, TransformerMixin
19
17
 
20
- from bugbug import bug_snapshot, bugzilla, repository, utils
18
+ from bugbug import bugzilla, repository, utils
21
19
 
22
20
  utils.setup_libmozdata()
23
21
 
@@ -521,7 +519,8 @@ class OpSys(SingleBugFeature):
521
519
 
522
520
  class FiledVia(SingleBugFeature):
523
521
  def __call__(self, bug, **kwargs):
524
- return bug["filed_via"]
522
+ # Old bugs in the DB might not have the field.
523
+ return bug.get("filed_via")
525
524
 
526
525
 
527
526
  class IsReporterADeveloper(SingleBugFeature):
@@ -727,8 +726,6 @@ class BugExtractor(BaseEstimator, TransformerMixin):
727
726
  self,
728
727
  feature_extractors,
729
728
  cleanup_functions,
730
- rollback=False,
731
- rollback_when=None,
732
729
  commit_data=False,
733
730
  merge_data=True,
734
731
  ):
@@ -741,8 +738,6 @@ class BugExtractor(BaseEstimator, TransformerMixin):
741
738
  cleanup_functions
742
739
  ), "Duplicate Cleanup Functions"
743
740
  self.cleanup_functions = cleanup_functions
744
- self.rollback = rollback
745
- self.rollback_when = rollback_when
746
741
  self.commit_data = commit_data
747
742
  self.merge_data = merge_data
748
743
 
@@ -804,17 +799,6 @@ class BugExtractor(BaseEstimator, TransformerMixin):
804
799
  "comments": " ".join(comments),
805
800
  }
806
801
 
807
- def apply_rollback(bugs_iter):
808
- with Pool() as p:
809
- yield from p.imap(
810
- partial(bug_snapshot.rollback, when=self.rollback_when),
811
- bugs_iter,
812
- chunksize=1024,
813
- )
814
-
815
- if self.rollback:
816
- bugs_iter = apply_rollback(bugs_iter)
817
-
818
802
  return pd.DataFrame(apply_transform(bug) for bug in bugs_iter)
819
803
 
820
804
 
@@ -108,18 +108,20 @@ def target_milestone(target_milestone):
108
108
  return mapping.get(target_milestone, target_milestone)
109
109
 
110
110
 
111
- def null_str(val):
111
+ def null_int(val):
112
112
  if val == "":
113
113
  return None
114
114
 
115
- return val
115
+ return int(val)
116
116
 
117
117
 
118
- def null_int(val):
118
+ def timestamp(val):
119
+ # Bugzilla returns timestamps in history as "YYYY-MM-DD HH:MM:SS" (UTC),
120
+ # while bug fields use ISO 8601 with a "Z" suffix.
119
121
  if val == "":
120
122
  return None
121
123
 
122
- return int(val)
124
+ return dateutil.parser.parse(val).strftime("%Y-%m-%dT%H:%M:%SZ")
123
125
 
124
126
 
125
127
  FIELD_TYPES = {
@@ -139,7 +141,8 @@ FIELD_TYPES = {
139
141
  "platform": platform,
140
142
  "product": product,
141
143
  "target_milestone": target_milestone,
142
- "cf_due_date": null_str,
144
+ "cf_due_date": timestamp,
145
+ "cf_last_resolved": timestamp,
143
146
  }
144
147
 
145
148
 
@@ -542,7 +545,15 @@ def is_expected_inconsistent_change_flag(flag, obj_id):
542
545
  )
543
546
 
544
547
 
545
- def rollback(bug, when=None, do_assert=False):
548
+ def rollback(bug, when=None, do_assert=False, before=None):
549
+ """Roll back a bug to a previous state.
550
+
551
+ By default, the bug is rolled back to its state at creation. If `when` is
552
+ given, the bug is rolled back to the first change for which `when` returns
553
+ True. If `before` (a timezone-aware datetime) is given, the bug is rolled back
554
+ to its state right before that moment.
555
+ """
556
+
546
557
  def assert_or_log(msg):
547
558
  msg = f"{msg}, in bug {bug['id']}"
548
559
  if do_assert:
@@ -569,7 +580,9 @@ def rollback(bug, when=None, do_assert=False):
569
580
  last_product = bug["product"]
570
581
 
571
582
  change_to_return = None
572
- if when is not None:
583
+ if before is not None:
584
+ rollback_date = before
585
+ elif when is not None:
573
586
  for history in bug["history"]:
574
587
  for change in history["changes"]:
575
588
  if when(change):
@@ -594,6 +607,9 @@ def rollback(bug, when=None, do_assert=False):
594
607
  if ret:
595
608
  break
596
609
 
610
+ if before is not None and dateutil.parser.parse(history["when"]) < before:
611
+ break
612
+
597
613
  for change in history["changes"]:
598
614
  if change is change_to_return:
599
615
  ret = True
@@ -813,12 +829,14 @@ def rollback(bug, when=None, do_assert=False):
813
829
  assert_or_log(
814
830
  f"Exception while transforming {change['removed']} from {bug[field]} (field {field})"
815
831
  )
832
+ continue
816
833
  try:
817
834
  new_value = FIELD_TYPES[field](change["added"])
818
835
  except Exception:
819
836
  assert_or_log(
820
837
  f"Exception while transforming {change['added']} from {bug[field]} (field {field})"
821
838
  )
839
+ continue
822
840
  else:
823
841
  old_value = change["removed"]
824
842
  new_value = change["added"]
@@ -860,18 +878,14 @@ def rollback(bug, when=None, do_assert=False):
860
878
  },
861
879
  )
862
880
 
863
- bug["comments"] = [
864
- c
865
- for c in bug["comments"]
866
- if dateutil.parser.parse(c["creation_time"]) - relativedelta(seconds=3)
867
- <= rollback_date
868
- ]
869
- bug["attachments"] = [
870
- a
871
- for a in bug["attachments"]
872
- if dateutil.parser.parse(a["creation_time"]) - relativedelta(seconds=3)
873
- <= rollback_date
874
- ]
881
+ def is_before_rollback(obj):
882
+ creation_time = dateutil.parser.parse(obj["creation_time"])
883
+ if before is not None:
884
+ return creation_time < before
885
+ return creation_time - relativedelta(seconds=3) <= rollback_date
886
+
887
+ bug["comments"] = [c for c in bug["comments"] if is_before_rollback(c)]
888
+ bug["attachments"] = [a for a in bug["attachments"] if is_before_rollback(a)]
875
889
 
876
890
  return bug
877
891
 
@@ -10,7 +10,7 @@ import math
10
10
  import re
11
11
  from datetime import datetime
12
12
  from logging import INFO, basicConfig, getLogger
13
- from typing import Iterable, Iterator, NewType
13
+ from typing import Collection, Iterable, Iterator, NewType
14
14
  from urllib.parse import urlencode
15
15
 
16
16
  import tenacity
@@ -243,16 +243,29 @@ def get_ids_between(date_from, date_to=None, security=False, resolution=None):
243
243
  return get_ids(params)
244
244
 
245
245
 
246
- def download_bugs(bug_ids: Iterable[int], security: bool = False) -> list[BugDict]:
247
- old_bug_count = 0
248
- new_bug_ids_set = set(int(bug_id) for bug_id in bug_ids)
249
- for bug in get_bugs(
250
- include_invalid=True, include_additional_products=ADDITIONAL_PRODUCTS
251
- ):
252
- old_bug_count += 1
253
- new_bug_ids_set.discard(int(bug["id"]))
246
+ def download_bugs(
247
+ bug_ids: Iterable[int],
248
+ security: bool = False,
249
+ existing_ids: Collection[int] | None = None,
250
+ ) -> list[BugDict]:
251
+ """Download the given bugs and append them to the bugs DB.
254
252
 
255
- logger.info("Loaded %d bugs.", old_bug_count)
253
+ Bugs already in the DB are skipped. If `existing_ids` is passed, it is
254
+ used as the set of IDs of the bugs already in the DB, instead of scanning
255
+ the whole DB to find them.
256
+ """
257
+ new_bug_ids_set = set(int(bug_id) for bug_id in bug_ids)
258
+ if existing_ids is None:
259
+ old_bug_count = 0
260
+ for bug in get_bugs(
261
+ include_invalid=True, include_additional_products=ADDITIONAL_PRODUCTS
262
+ ):
263
+ old_bug_count += 1
264
+ new_bug_ids_set.discard(int(bug["id"]))
265
+
266
+ logger.info("Loaded %d bugs.", old_bug_count)
267
+ else:
268
+ new_bug_ids_set.difference_update(existing_ids)
256
269
 
257
270
  new_bug_ids = sorted(list(new_bug_ids_set))
258
271
 
@@ -8,8 +8,6 @@ import sys
8
8
  import pandas as pd
9
9
  from sklearn.base import BaseEstimator, TransformerMixin
10
10
 
11
- from bugbug import issue_snapshot
12
-
13
11
 
14
12
  class CommentCount(object):
15
13
  name = "# of comments"
@@ -23,8 +21,6 @@ class IssueExtractor(BaseEstimator, TransformerMixin):
23
21
  self,
24
22
  feature_extractors,
25
23
  cleanup_functions,
26
- rollback=False,
27
- rollback_when=None,
28
24
  ):
29
25
  assert len(set(type(fe) for fe in feature_extractors)) == len(
30
26
  feature_extractors
@@ -35,8 +31,6 @@ class IssueExtractor(BaseEstimator, TransformerMixin):
35
31
  cleanup_functions
36
32
  ), "Duplicate Cleanup Functions"
37
33
  self.cleanup_functions = cleanup_functions
38
- self.rollback = rollback
39
- self.rollback_when = rollback_when
40
34
 
41
35
  def fit(self, x, y=None):
42
36
  for feature in self.feature_extractors:
@@ -49,9 +43,6 @@ class IssueExtractor(BaseEstimator, TransformerMixin):
49
43
  results = []
50
44
 
51
45
  for issue in issues():
52
- if self.rollback:
53
- issue = issue_snapshot.rollback(issue, self.rollback_when)
54
-
55
46
  data = {}
56
47
 
57
48
  for feature_extractor in self.feature_extractors:
@@ -6,8 +6,11 @@
6
6
  import logging
7
7
  import pickle
8
8
  from collections import defaultdict
9
+ from collections.abc import Callable, Iterable, Iterator
10
+ from datetime import datetime
11
+ from multiprocessing import Pool
9
12
  from os import makedirs, path
10
- from typing import Any
13
+ from typing import Any, Literal
11
14
 
12
15
  import numpy as np
13
16
  from imblearn.metrics import (
@@ -25,7 +28,7 @@ from sklearn.preprocessing import LabelEncoder
25
28
  from tabulate import tabulate
26
29
  from xgboost import XGBModel
27
30
 
28
- from bugbug import bugzilla, db, repository
31
+ from bugbug import bug_snapshot, bugzilla, db, issue_snapshot, repository
29
32
  from bugbug.github import Github
30
33
  from bugbug.nlp import lemmatizing_tfidf_vectorizer
31
34
  from bugbug.utils import split_tuple_generator, to_array
@@ -55,6 +58,32 @@ def get_transformer_pipeline(pipeline: Pipeline) -> Pipeline:
55
58
  )
56
59
 
57
60
 
61
+ # Where to roll back a training item to, before extracting its features (see
62
+ # Model.get_rollback_point).
63
+ RollbackPoint = Literal["creation"] | datetime | Callable[[dict], bool] | None
64
+
65
+
66
+ def drop_vectorizers_stop_words(estimator) -> None:
67
+ """Drop the terms ignored by the fitted text vectorizers.
68
+
69
+ The vectorizers store the terms they ignored (e.g. because of `min_df` or
70
+ `max_features`) in `stop_words_`, which is only useful for introspection and
71
+ can make up most of the size of a pickled model.
72
+ """
73
+ if hasattr(estimator, "stop_words_"):
74
+ estimator.stop_words_ = None
75
+
76
+ if isinstance(estimator, Pipeline):
77
+ children = [step for _, step in estimator.steps]
78
+ else:
79
+ children = [
80
+ transformer for _, transformer, _ in getattr(estimator, "transformers_", [])
81
+ ]
82
+
83
+ for child in children:
84
+ drop_vectorizers_stop_words(child)
85
+
86
+
58
87
  def classification_report_imbalanced_values(
59
88
  y_true, y_pred, labels, target_names=None, sample_weight=None, digits=2, alpha=0.1
60
89
  ):
@@ -381,6 +410,26 @@ class Model:
381
410
  else:
382
411
  self.clf.fit(X, y, estimator__sample_weight=sample_weight)
383
412
 
413
+ def get_rollback_point(self, item: Any, label: Any) -> RollbackPoint:
414
+ """Return the point a training item should be rolled back to.
415
+
416
+ Subclasses can override this to train on the items as they were at some
417
+ point in the past (e.g. when the models are applied to them), instead of
418
+ their current state. Items are only rolled back for training, not when
419
+ they are classified.
420
+
421
+ The point is either "creation", a datetime (the item is rolled back to its
422
+ state right before that moment), or a function returning True for the
423
+ change to roll back to. None means no rollback.
424
+ """
425
+ return None
426
+
427
+ def rollback_training_items(
428
+ self, items: Iterable[tuple[Any, Any]]
429
+ ) -> Iterable[tuple[Any, Any]]:
430
+ """Roll back the training items (see get_rollback_point)."""
431
+ return items
432
+
384
433
  def get_labels(self) -> tuple[dict[Any, Any], list[Any]]:
385
434
  """Subclasses implement their own function to gather labels."""
386
435
  raise NotImplementedError("The model must implement this method")
@@ -390,7 +439,9 @@ class Model:
390
439
  self.class_names = sort_class_names(self.class_names)
391
440
 
392
441
  # Get items and labels, filtering out those for which we have no labels.
393
- X_gen, y = split_tuple_generator(lambda: self.items_gen(classes))
442
+ X_gen, y = split_tuple_generator(
443
+ lambda: self.rollback_training_items(self.items_gen(classes))
444
+ )
394
445
 
395
446
  # Extract features from the items.
396
447
  X = self.extraction_pipeline.transform(X_gen)
@@ -668,6 +719,8 @@ class Model:
668
719
  estimator = estimator.__class__(**hyperparameters)
669
720
  self.clf.steps.append((step_name, estimator))
670
721
 
722
+ drop_vectorizers_stop_words(self.clf)
723
+
671
724
  model_path = path.join(model_directory, "model.pkl")
672
725
  with open(model_path, "wb") as f:
673
726
  pickle.dump(self, f, protocol=pickle.HIGHEST_PROTOCOL)
@@ -807,6 +860,17 @@ class Model:
807
860
  return {}
808
861
 
809
862
 
863
+ def _rollback_bug(bug_label_point):
864
+ bug, label, point = bug_label_point
865
+ if point == "creation":
866
+ bug = bug_snapshot.rollback(bug)
867
+ elif isinstance(point, datetime):
868
+ bug = bug_snapshot.rollback(bug, before=point)
869
+ elif point is not None:
870
+ bug = bug_snapshot.rollback(bug, when=point)
871
+ return bug, label
872
+
873
+
810
874
  class BugModel(Model):
811
875
  def __init__(self, lemmatization=False, commit_data=False):
812
876
  Model.__init__(self, lemmatization)
@@ -843,6 +907,23 @@ class BugModel(Model):
843
907
 
844
908
  yield bug, classes[bug_id]
845
909
 
910
+ def rollback_training_items(self, items):
911
+ if type(self).get_rollback_point is Model.get_rollback_point:
912
+ return items
913
+
914
+ return self._rollback_bugs(items)
915
+
916
+ def _rollback_bugs(self, items) -> Iterator[tuple[Any, Any]]:
917
+ with Pool() as p:
918
+ yield from p.imap(
919
+ _rollback_bug,
920
+ (
921
+ (bug, label, self.get_rollback_point(bug, label))
922
+ for bug, label in items
923
+ ),
924
+ chunksize=256,
925
+ )
926
+
846
927
 
847
928
  class CommitModel(Model):
848
929
  def __init__(self, lemmatization=False, bug_data=False):
@@ -898,6 +979,14 @@ class IssueModel(Model):
898
979
 
899
980
  yield issue, classes[issue_number]
900
981
 
982
+ def rollback_training_items(self, items):
983
+ for issue, label in items:
984
+ point = self.get_rollback_point(issue, label)
985
+ if point is not None:
986
+ assert point == "creation", "Issues can only be rolled back to creation"
987
+ issue = issue_snapshot.rollback(issue)
988
+ yield issue, label
989
+
901
990
 
902
991
  class CommentModel(Model):
903
992
  def __init__(self, lemmatization=False):
@@ -49,7 +49,6 @@ class AccessibilityModel(BugModel):
49
49
  bug_features.BugExtractor(
50
50
  feature_extractors,
51
51
  cleanup_functions,
52
- rollback=True,
53
52
  ),
54
53
  ),
55
54
  ]
@@ -80,6 +79,9 @@ class AccessibilityModel(BugModel):
80
79
  )
81
80
 
82
81
  @staticmethod
82
+ def get_rollback_point(self, item, label):
83
+ return "creation"
84
+
83
85
  def __is_accessibility_bug(bug):
84
86
  """Check if a bug is an accessibility bug."""
85
87
  return (
@@ -63,8 +63,6 @@ class AssigneeModel(BugModel):
63
63
  bug_features.BugExtractor(
64
64
  feature_extractors,
65
65
  cleanup_functions,
66
- rollback=True,
67
- rollback_when=self.rollback,
68
66
  ),
69
67
  ),
70
68
  ]
@@ -93,6 +91,9 @@ class AssigneeModel(BugModel):
93
91
  ]
94
92
  )
95
93
 
94
+ def get_rollback_point(self, item, label):
95
+ return self.rollback
96
+
96
97
  def get_labels(self):
97
98
  classes = {}
98
99
 
@@ -125,5 +126,6 @@ class AssigneeModel(BugModel):
125
126
  def get_feature_names(self):
126
127
  return self.clf.named_steps["union"].get_feature_names_out()
127
128
 
128
- def rollback(self, change):
129
+ @staticmethod
130
+ def rollback(change):
129
131
  return change["field_name"].startswith("assigned_to")
@@ -79,9 +79,7 @@ class BaseComponentModel(BugModel):
79
79
  [
80
80
  (
81
81
  "bug_extractor",
82
- bug_features.BugExtractor(
83
- feature_extractors, cleanup_functions, rollback=True
84
- ),
82
+ bug_features.BugExtractor(feature_extractors, cleanup_functions),
85
83
  ),
86
84
  ]
87
85
  )
@@ -146,6 +144,9 @@ class BaseComponentModel(BugModel):
146
144
  ]
147
145
  )
148
146
 
147
+ def get_rollback_point(self, item, label):
148
+ return "creation"
149
+
149
150
  def items_gen(self, classes):
150
151
  # Remember when each bug was filed and in which component, for the evaluation.
151
152
  self.items_metadata = []
@@ -100,9 +100,7 @@ class ComponentSpecificModel(BugModel):
100
100
  [
101
101
  (
102
102
  "bug_extractor",
103
- bug_features.BugExtractor(
104
- feature_extractors, cleanup_functions, rollback=True
105
- ),
103
+ bug_features.BugExtractor(feature_extractors, cleanup_functions),
106
104
  ),
107
105
  ]
108
106
  )
@@ -136,6 +134,9 @@ class ComponentSpecificModel(BugModel):
136
134
  ]
137
135
  )
138
136
 
137
+ def get_rollback_point(self, item, label):
138
+ return "creation"
139
+
139
140
  def was_in_component_at(self, states, when):
140
141
  current = None
141
142
  for product, component, set_when, _ in states: