From a343be0da15df6e03f21966ea460db05a597e0ab Mon Sep 17 00:00:00 2001 From: Abdessamad Derraz <3028866+Abdess@users.noreply.github.com> Date: Fri, 6 Nov 2026 08:54:23 +0100 Subject: [PATCH] fix: validate_pr json says failed, not new The JSON report put "outcome": "new" on every file without another outcome, so a path that does not exist, or a file that failed a check, was listed as a new contribution. A failed file now reads "failed". --- scripts/validate_pr.py | 3 ++- tests/test_validate_pr.py | 9 +++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/scripts/validate_pr.py b/scripts/validate_pr.py index e3050f83c..59bd1c45a 100644 --- a/scripts/validate_pr.py +++ b/scripts/validate_pr.py @@ -847,7 +847,8 @@ def main() -> None: { "file": r.filepath, "passed": r.passed, - "outcome": r.outcome or "new", + # A file that failed, unread or refused, is not a new one. + "outcome": r.outcome or ("new" if r.passed else "failed"), "destination": r.destination, "sha1": r.sha1, "md5": r.md5, diff --git a/tests/test_validate_pr.py b/tests/test_validate_pr.py index 642420795..5f631cd1b 100644 --- a/tests/test_validate_pr.py +++ b/tests/test_validate_pr.py @@ -522,6 +522,15 @@ class FlagsAreAppliedOrRefused(unittest.TestCase): self.assertEqual(result.returncode, 2) self.assertIn("not allowed with", result.stderr) + def test_a_failed_file_is_not_reported_new(self): + """A path that does not exist came out as "outcome": "new", and a + reader listing new contributions announced a BIOS nobody sent.""" + import json # noqa: PLC0415 + + result = self._run("--json", "bios/nope.bin") + report = json.loads(result.stdout) + self.assertEqual([(r["passed"], r["outcome"]) for r in report], [(False, "failed")]) + class AFileOutsideBiosIsToldWhereToGo(unittest.TestCase):