Skip to content

Instantly share code, notes, and snippets.

@davehunt
Last active July 26, 2023 13:27
Show Gist options
  • Save davehunt/34a04705fb3445b1c6bb5535bec6eee8 to your computer and use it in GitHub Desktop.
Save davehunt/34a04705fb3445b1c6bb5535bec6eee8 to your computer and use it in GitHub Desktop.
Add [sp3] to whiteboard for all bugs blocking the speedometer3 meta bug
# TODO exclude intermittents?
from datetime import datetime, timedelta
import re
import bugzilla
PROD_URL = "bugzilla.mozilla.org"
PROD_API_KEY = ""
bzapi = bugzilla.Bugzilla(PROD_URL, api_key=PROD_API_KEY)
MAX_DEPTH = 2
META_BUG = 1800713
WHITEBOARD_TAG = "sp3"
EXCLUDE_FURTHER_DEPENDENCIES = [
1707955, # Disable Spectre Mitigations for Desktop
1808579, # Quality of life improvements for spidermonkey performance work
]
EXCLUDE_BUGS = [
1672121, # Investigate making GC slices interruptible
1686592, # Responsiveness: On Twitter, switching from Home to Explore takes 2.5x as long as in Chrome
1689413, # Remove ObjectGroup
1725567, # Implement FetchService to support performing fetch in parent process
1774651, # Add (Gecko) perfstats probes for basic GC timings
1804104, # 43% regression on AWFY-Sunspider-access-nsieve on 30-Nov
1804759, # Asserting in EmberJS-Debug-TodoMVC does a lot of work to build the error message
1814078, # Evaluate how many objects are effectively immutable
1798927, # Large percentage of time spent in StructuredCloneData::Read and Write on Proxx-Tables-Canvas benchmark
1821183, # EmberJS-TodoMVC spends a lot of time in Ion-compiled code for Cache.prototype.get
1821108, # EmberJS-TodoMVC spends a lot more time in removeListenerFrom doing array splicing than in V8
1821137, # EmberJS-TodoMVC spends a lot of time in js::NativeObject::ensureDenseElements during addToListeners
]
all_bugs = []
today = datetime.now()
def get_recursive_blocking(bugs, got_bugs, depth=0):
blocked_ids = []
for bug in bugs:
if bug.id in EXCLUDE_FURTHER_DEPENDENCIES:
print(f"Excluding dependencies of bug: {bug.weburl} - {bug.summary}")
else:
blocked_ids.extend(
list({bug_id for bug_id in bug.depends_on if bug_id not in got_bugs})
)
if len(blocked_ids) == 0:
return
got_bugs.update(blocked_ids)
query = bzapi.build_query(bug_id=",".join(map(str, blocked_ids)))
bugs = bzapi.query(query)
all_bugs.extend(bugs)
if depth == MAX_DEPTH:
return
get_recursive_blocking(bugs, got_bugs, depth + 1)
def exclude_meta(bug):
if "meta" in bug.keywords:
print(f"{bug.weburl} - {bug.summary}")
return False
return True
def exclude_bugs(bug):
if bug.id in EXCLUDE_BUGS:
print(f"{bug.weburl} - {bug.summary}")
return False
return True
def exclude_tagged(bug):
return f"[{WHITEBOARD_TAG}" not in bug.whiteboard
query = bzapi.build_query(bug_id=META_BUG)
bugs = bzapi.query(query)
get_recursive_blocking(bugs, set())
print(
f"Found {len(all_bugs)} bugs blocking bug {META_BUG} with a max depth of {MAX_DEPTH}."
)
print(f"\nExcluding meta bugs:")
bugs = list(filter(exclude_meta, all_bugs))
print(f"\nExcluding bugs:")
bugs = list(filter(exclude_bugs, bugs))
bugs = list(filter(exclude_tagged, bugs))
print(
f"\nFound {len(bugs)} bugs without a [{WHITEBOARD_TAG}] or [{WHITEBOARD_TAG}-*] whiteboard tag:"
)
for bug in bugs:
print(f"{bug.weburl} - {bug.summary}")
print(f"View as bug list: https://bugzilla.mozilla.org/buglist.cgi?bug_id={','.join([str(bug.id) for bug in bugs])}")
query = bzapi.build_query(
status_whiteboard=f"\[{WHITEBOARD_TAG}.*\]",
status_whiteboard_type="notregexp",
)
query.update(
{
"f1": "see_also",
"v1": "mozilla-hub\.atlassian\.net\/browse\/SP3.*",
"o1": "regexp",
}
)
orphaned_bugs = bzapi.query(query)
print(
f"\nFound {len(orphaned_bugs)} bugs with a reference to Jira but no [{WHITEBOARD_TAG}] or [{WHITEBOARD_TAG}-*] whiteboard tag:"
)
for bug in orphaned_bugs:
print(f"{bug.weburl} - {bug.summary}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment