import re CAP = 3 PASSES = ("architecture", "full scan", "security", "stability", "product-owner", "prose") ROUND = re.compile(r"^Answer (.+?) round ([0-9]+):", re.IGNORECASE) def round_counts(titles: list[str]) -> dict[str, int]: """Each pass's highest round among the branch's `Answer round :` commit titles; a pass with none has 0, and a title naming no known pass adds its name. Case is ignored, so a mis-cased title still counts.""" counts = dict.fromkeys(PASSES, 0) for title in titles: if named := ROUND.match(title): name = named.group(1).lower() counts[name] = max(counts.get(name, 0), int(named.group(2))) return counts