From 1bdfb8d75e01ca19492de42209d28294a465be42 Mon Sep 17 00:00:00 2001 From: Abdessamad Derraz <3028866+Abdess@users.noreply.github.com> Date: Sun, 18 Oct 2026 02:50:18 +0200 Subject: [PATCH] fix: list passing entries in verbose verify JSON verify accepted --verbose beside --json and dropped it in every mode, so the output was the same with or without it. The JSON now lists every entry with its ground truth under --verbose. --- scripts/verify.py | 20 +++++++++++++------- tests/test_audit_regressions.py | 30 ++++++++++++++++++++++++++++++ wiki/troubleshooting.md | 4 +++- 3 files changed, 46 insertions(+), 8 deletions(-) diff --git a/scripts/verify.py b/scripts/verify.py index a2af70bd..6f9f682a 100644 --- a/scripts/verify.py +++ b/scripts/verify.py @@ -2165,9 +2165,7 @@ def _main(held: contextlib.ExitStack) -> None: regions=requested_regions, platforms_dir=args.platforms_dir, ) if args.json: - result["details"] = [ - d for d in result["details"] if d["status"] != Status.OK - ] + result["details"] = _json_details(result["details"], args.verbose) print(json.dumps(result, indent=2)) else: print_emulator_result(result, verbose=args.verbose) @@ -2182,9 +2180,7 @@ def _main(held: contextlib.ExitStack) -> None: regions=requested_regions, platforms_dir=args.platforms_dir, ) if args.json: - result["details"] = [ - d for d in result["details"] if d["status"] != Status.OK - ] + result["details"] = _json_details(result["details"], args.verbose) print(json.dumps(result, indent=2)) else: print_emulator_result(result, verbose=args.verbose) @@ -2255,12 +2251,22 @@ def _main(held: contextlib.ExitStack) -> None: if args.json: for r in all_results.values(): - r["details"] = [d for d in r["details"] if d["status"] != Status.OK] + r["details"] = _json_details(r["details"], args.verbose) print(json.dumps(all_results, indent=2)) _exit_if_strict(args.strict, [r for r, _ in group_results]) +def _json_details(details: list[dict], verbose: bool) -> list[dict]: + """The entries a JSON report lists: what needs attention, or every one. + + --verbose shows each entry with its ground truth in the text report; it + used to be accepted beside --json and dropped, the output byte for byte + the same, so a script asking for the passing entries got nothing. + """ + return list(details) if verbose else [d for d in details if d["status"] != Status.OK] + + def _exit_if_strict(strict: bool, results: list[dict]) -> None: """Exit 1 under --strict when a platform result counts a critical file: a required file missing or rejected where the frontend reads hashes.""" diff --git a/tests/test_audit_regressions.py b/tests/test_audit_regressions.py index c3c4d57b..94798a0b 100644 --- a/tests/test_audit_regressions.py +++ b/tests/test_audit_regressions.py @@ -345,6 +345,36 @@ class DoubledCitationPaths(unittest.TestCase): self.assertEqual(errors, []) +class VerboseAppliesToJson(unittest.TestCase): + """verify accepted --verbose beside --json in every mode and dropped it: + the output was byte for byte the same, and the passing entries a script + asked for never came.""" + + def _run(self, *args: str) -> dict: + import json + import subprocess + + completed = subprocess.run( + [sys.executable, "scripts/verify.py", *args, "--json"], + capture_output=True, text=True, cwd=ROOT, timeout=900, check=False, + ) + self.assertEqual(completed.returncode, 0, completed.stderr[-2000:]) + return json.loads(completed.stdout) + + def test_emulator_and_system_modes_list_the_passing_entries(self): + for mode in (("--emulator", "handy"), ("--system", "atari-lynx")): + with self.subTest(mode=mode[0]): + plain = self._run(*mode) + verbose = self._run(*mode, "--verbose") + self.assertGreater(len(verbose["details"]), len(plain["details"])) + self.assertIn("ok", {d["status"] for d in verbose["details"]}) + + def test_every_json_branch_reads_the_flag(self): + source = (ROOT / "scripts" / "verify.py").read_text() + self.assertEqual(source.count("_json_details("), 4) + self.assertNotIn('if d["status"] != Status.OK\n ]', source) + + class FaqRegressions(unittest.TestCase): """The FAQ states facts the code owns; these tie it back to the source. diff --git a/wiki/troubleshooting.md b/wiki/troubleshooting.md index 85d56c9f..bb7aacd0 100644 --- a/wiki/troubleshooting.md +++ b/wiki/troubleshooting.md @@ -210,8 +210,10 @@ python scripts/verify.py --system sony-playstation # By hardware target python scripts/verify.py --platform retroarch --target switch -# JSON for scripted processing +# JSON for scripted processing: the entries that need attention python scripts/verify.py --platform retroarch --json +# every entry, passing ones included, with its ground truth +python scripts/verify.py --platform retroarch --json --verbose ``` ## Installation script fails