Fix comm-central error-line cache selection in get_error_summary#9670
Draft
camd wants to merge 1 commit into
Draft
Fix comm-central error-line cache selection in get_error_summary#9670camd wants to merge 1 commit into
camd wants to merge 1 commit into
Conversation
get_error_summary picked the error-line cache with `job.repository == "comm-central"`, but job.repository is a Repository instance, so that comparison is always False. comm-central jobs therefore fell through to the "mc_error_lines" cache and shared a namespace with mozilla-central/autoland error-line counts, which skews the recent-failure counts used to flag lines as new in a revision. Compare job.repository.name instead, matching how bug_suggestions_line already inspects the repository name. Add unit tests asserting the cache keyroot is chosen from the repository name for comm-central vs other branches.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #9670 +/- ##
==========================================
+ Coverage 82.59% 82.60% +0.01%
==========================================
Files 622 622
Lines 36580 36596 +16
Branches 3279 3340 +61
==========================================
+ Hits 30213 30230 +17
+ Misses 6217 5983 -234
- Partials 150 383 +233 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
get_error_summary()selects a per-tree error-line cache with:But
job.repositoryis aRepositorymodel instance, not a string, sojob.repository == "comm-central"is always False. As a result comm-central jobs never used thecc_error_linescache — they fell through tomc_error_linesand shared a namespace with mozilla-central/autoland error-line counts.Those counts feed the recent-failure counter and the "new in revision" detection in
bug_suggestions_line(which correctly usesstr(project.name)), so cross-contaminating the namespaces skews which failure lines get flagged as new for comm-central.The fix compares
job.repository.name, consistent with howbug_suggestions_linealready inspects the repository name.Testing
comm-central→cc_error_lines;autoland/mozilla-central/try→mc_error_lines). Verified the comm-central case fails against the pre-fix code and passes after.tests/model/test_error_summary.pypasses (29 tests).Note
There is a second, currently commented-out occurrence of the same pattern in
treeherder/webapp/api/note.py(disabled under Bug 2026428 for performance). It is left untouched here since it is inactive, but would need the same.namefix if ever re-enabled.