def get_kb_entries()

in jobs/webcompat-kb/webcompat_kb/bugzilla.py [0:0]


def get_kb_entries(all_bugs: BugsById, site_report_blockers: set[BugId]) -> set[BugId]:
    direct_kb_entries = {bug_id for bug_id, bug in all_bugs.items() if is_kb_entry(bug)}
    kb_blockers = {
        dependency
        for bug_id in direct_kb_entries
        for dependency in all_bugs[bug_id].depends_on
        if dependency in all_bugs
    }
    # We include any bug that's blocking a site report but isn't in Web Compatibility
    platform_site_report_blockers = {
        bug_id
        for bug_id in site_report_blockers
        if bug_id not in kb_blockers and all_bugs[bug_id].product != "Web Compatibility"
    }
    # We also include all other bugs that are platform bugs but don't depend on a kb entry
    # TODO: This is probably too many bugs; platform bugs that don't block any site reports
    # should likely be excluded
    platform_kb_entries = {
        bug_id
        for bug_id in all_bugs
        if bug_id not in kb_blockers and is_webcompat_platform_bug(all_bugs[bug_id])
    }
    return direct_kb_entries | platform_site_report_blockers | platform_kb_entries