Bug Filing Description Improvements#418
Conversation
Some libraries would like to have the full commit details for all commits when a bug is filed. Right now we will make bug descriptions less and less verbose to fit into the one-comment text limit. Instead, we can keep it at full verbosity and just split the text into multiple comments on bugzilla.
There was a problem hiding this comment.
Pull request overview
This PR improves Bugzilla bug filing descriptions by introducing an optional “chained” mode that preserves full commit details and splits them across multiple Bugzilla comments when the per-comment size limit is reached. It updates the vendoring and commitalert flows to post overflow chunks as follow-up comments, and adds focused unit tests for the new behavior.
Changes:
- Add commit-block rendering helpers and a chained, greedy chunking implementation in
SCMProvider.build_bug_description. - Update vendoring and commitalert tasktypes to file the first chunk in the initial bug description and post remaining chunks as additional comments.
- Add new unit tests covering verbosity levels, dispatch behavior, compare URL inclusion, and chunk splitting.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| components/scmprovider.py | Adds compare URL support and implements chained multi-comment chunking for commit details. |
| tasktypes/vendoring.py | Posts overflow commit description chunks as follow-up Bugzilla comments. |
| tasktypes/commitalert.py | Posts overflow commit description chunks as follow-up Bugzilla comments. |
| tests/build_bug_description.py | Adds unit tests validating commit block rendering and chained/single behavior. |
| test.py | Registers the new build_bug_description test module in the test runner. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| def repo_and_compare_url(repo, old_commit, new_commit): | ||
| if not repo or not any(h in repo for h in ["github.com", "gitlab.com"]): | ||
| return None | ||
| return repo.replace(".git", "") + "/compare/" + old_commit + "..." + new_commit |
There was a problem hiding this comment.
Repo urls are specified by mozilla engineers in peer-reviewed commits, they are not untrusted data.
| # Format each commit at full detail, but drop to a lower verbosity for | ||
| # any single commit whose block would not otherwise fit in a comment. | ||
| # A comment is a leading separator followed by entries, so budget for it. | ||
| entry_budget = max_length - len(COMMENT_SEPARATOR) | ||
| entries = [self._commit_entry(c, entry_budget) for c in list_of_commits] | ||
|
|
||
| # If the whole thing fits in one comment, post it as-is, with no header. | ||
| whole_length = len(COMMENT_SEPARATOR) + sum(len(e) for e in entries) | ||
| if whole_length <= max_length: | ||
| return [COMMENT_SEPARATOR + "".join(entries)] | ||
|
|
||
| # It needs multiple comments: head the first one with a link to the | ||
| # whole commit range so it can be reviewed at a glance. Passing the | ||
| # header to _chunk_comments lets its length count against the budget. | ||
| compare_url = repo_and_compare_url(repo_url, base_revision, newest_revision) if (repo_url and base_revision) else None | ||
|
|
||
| if compare_url: | ||
| first_header = "All %s commits: %s\n(continued in following comments)\n\n" % (len(list_of_commits), compare_url) | ||
| else: | ||
| first_header = "" | ||
| return self._chunk_comments(entries, max_length, first_header) |
There was a problem hiding this comment.
This is a possible if unlikely edge case.
Adds a new mode that chunks full details across comments. Supersedes #416