def bug_data_failure()

in sync/notify/bugs.py [0:0]


def bug_data_failure(sync: DownstreamSync,
                     test_results: list[ResultsEntry],
                     treeherder_url: str | None,
                     wpt_sha: str | None,
                     ) -> tuple[str, str]:
    summary = make_summary(test_results,
                           "New wpt failures")

    by_type = defaultdict(list)
    for (test, subtest, result) in test_results:
        if result.is_browser_only_failure("firefox"):
            by_type["firefox-only"].append((test, subtest, result))
        elif result.has_regression("firefox"):
            by_type["regression"].append((test, subtest, result))
        elif result.has_new_non_passing("firefox"):
            by_type["new-non-passing"].append((test, subtest, result))

    detail_msg = []
    for (details_type, test_results, include_other_browser) in [
            ("Firefox-only failures", by_type["firefox-only"], False),
            ("Tests with a Worse Result After Changes", by_type["regression"], True),
            ("New Tests That Don't Pass", by_type["new-non-passing"], True)]:
        if not test_results:
            continue
        part = detail_part(details_type, test_results, None, "head",
                           include_other_browser)
        if part is not None:
            detail_msg.append(part)

    if treeherder_url is not None:
        treeherder_text = "[Gecko CI (Treeherder)](%s)" % treeherder_url
    else:
        treeherder_text = "Missing results from treeherder"

    if wpt_sha is not None:
        wpt_text = "[GitHub PR Head](https://wpt.fyi/results/?sha=%s&label=pr_head)" % wpt_sha
    else:
        wpt_text = "Missing results from GitHub"

    comment = """Syncing wpt \