Skip to content

Fix comm-central error-line cache selection in get_error_summary#9670

Draft
camd wants to merge 1 commit into
masterfrom
worktree-camd+error-summary-comm-central-cache
Draft

Fix comm-central error-line cache selection in get_error_summary#9670
camd wants to merge 1 commit into
masterfrom
worktree-camd+error-summary-comm-central-cache

Conversation

@camd

@camd camd commented Jul 5, 2026

Copy link
Copy Markdown
Collaborator

Summary

get_error_summary() selects a per-tree error-line cache with:

if job.repository == "comm-central":
    lcache = MemDBCache("cc_error_lines")
else:
    lcache = MemDBCache("mc_error_lines")

But job.repository is a Repository model instance, not a string, so job.repository == "comm-central" is always False. As a result comm-central jobs never used the cc_error_lines cache — they fell through to mc_error_lines and 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 uses str(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 how bug_suggestions_line already inspects the repository name.

Testing

  • Added parametrized unit tests asserting the error-line cache keyroot is chosen from the repository name (comm-centralcc_error_lines; autoland/mozilla-central/trymc_error_lines). Verified the comm-central case fails against the pre-fix code and passes after.
  • tests/model/test_error_summary.py passes (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 .name fix if ever re-enabled.

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-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.60%. Comparing base (740daac) to head (6ab20ba).

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants