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".
This commit is contained in:
Abdessamad Derraz committed 2026-11-06 08:54:23 +01:00
1 parent a1ddee8e5e
commit a343be0da1
2 files changed
+11 -1

No files matched your search

+2 -1
View File
@@ -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,
+9
View File
@@ -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):