diff --git a/scripts/pipeline.py b/scripts/pipeline.py index 792b0420..b854a129 100644 --- a/scripts/pipeline.py +++ b/scripts/pipeline.py @@ -119,11 +119,11 @@ def parse_pack_exclusions(output: str) -> dict[str, int]: for line in output.splitlines(): label_match = re.match(r"Generating (?:shared )?pack for (.+)\.\.\.", line) if label_match: - current_label = re.sub( - r"\s+\[source=[^\]]+\]$", "", label_match.group(1).strip() - ) + # The same reading as parse_pack_counts: a reduced variant must + # not overwrite the full pack's count under the shared label. + current_label = _full_pack_label(label_match.group(1).strip()) continue - if "files packed" not in line: + if not current_label or "files packed" not in line: continue excluded_match = re.search(r"(\d+) unsafe excluded", line) exclusions[current_label] = ( diff --git a/tests/test_audit_regressions.py b/tests/test_audit_regressions.py index e1f1f2a0..b5a6c6db 100644 --- a/tests/test_audit_regressions.py +++ b/tests/test_audit_regressions.py @@ -511,6 +511,16 @@ class PipelineRegressions(unittest.TestCase): ]) self.assertEqual(pipeline.parse_pack_counts(output), {"RetroArch": (535, 535)}) + def test_exclusions_read_only_the_full_variant(self): + """--all-variants printed six packs under one label; the last won.""" + output = "\n".join([ + "Generating pack for Batocera [source=full]...", + " a.zip: 5 files packed (5 baseline + 0 from cores), 5/5 files OK, 3 unsafe excluded", + "Generating pack for Batocera [source=truth, required]...", + " b.zip: 2 files packed (0 baseline + 2 from cores), 2/2 files OK", + ]) + self.assertEqual(pipeline.parse_pack_exclusions(output), {"Batocera": 3}) + def test_slot_step_reaches_the_summary(self): source = Path(pipeline.__file__).read_text(encoding="utf-8") self.assertIn('results["slots"] = ok', source)