From b89383ba6819c38ed48d61263a1e86b830b670b8 Mon Sep 17 00:00:00 2001 From: Abdessamad Derraz <3028866+Abdess@users.noreply.github.com> Date: Wed, 21 Oct 2026 10:16:14 +0200 Subject: [PATCH] fix: open the gap page on what is missing The page opened on a slogan and four tiles that read Verified (100%) for 5,437 of 5,438 files and Missing 0, above a table of red cells. It now opens on what it covers and one sentence that says every count of the platforms' own lists and points to the emulator files below. --- scripts/generate_site.py | 59 +++++++++++++++++++------------------- tests/test_site_exports.py | 17 +++++++++++ 2 files changed, 46 insertions(+), 30 deletions(-) diff --git a/scripts/generate_site.py b/scripts/generate_site.py index 13cefaea..e04b154b 100644 --- a/scripts/generate_site.py +++ b/scripts/generate_site.py @@ -4138,6 +4138,30 @@ def _render_problem_files( return lines +def _platform_lists_sentence(total: int, verified: int, untested: int, missing: int) -> str: + """The platforms' own lists in one sentence, every count said. + + Four tiles opened the page: "Verified (100%)" for 5,437 of 5,438 and + "Missing 0", above a table of red cells, on the page about what is + missing. The gaps are in the files the emulators load, and the sentence + says so. + """ + def _is(count: int) -> str: + return "is" if count == 1 else "are" + + parts = [f"{verified:,} {_is(verified)} held and pass the platform's own check"] + if untested: + parts.append(f"{untested:,} {_is(untested)} held but not verified " + "(listed under Untested below)") + parts.append(f"{missing:,} {_is(missing)} missing") + listed = ", ".join(parts[:-1]) + f" and {parts[-1]}" + return ( + f"Of the {total:,} files on the platforms' own BIOS lists, {listed}. " + "The files the emulators load beyond those lists are counted per " + "platform in the table below." + ) + + def generate_gap_analysis( profiles: dict, coverages: dict, @@ -4198,44 +4222,19 @@ def generate_gap_analysis( "path": d.get("path") or "", }) - pct_verified = ( - f"{total_verified / total_files_verify * 100:.0f}%" - if total_files_verify - else "0%" - ) - lines = [ "# Gap analysis", "", - "Unified view of BIOS verification, file provenance, and coverage gaps.", + "What each platform and its emulators still lack, and where the " + "collection's copies come from.", "", "[Download gaps CSV](downloads/gaps.csv){ .md-button } " "[Open gaps API](api/v1/gaps.json){ .md-button } " "[All data exports](data.md){ .md-button }", "", - '
', - "", - '
', - f'{total_files_verify:,}', - 'Total files (all platforms)', - "
", - "", - '
', - f'{total_verified:,}', - f'Verified ({pct_verified})', - "
", - "", - '
', - f'{total_untested:,}', - 'Untested', - "
", - "", - '
', - f'{total_missing_verify:,}', - 'Missing', - "
", - "", - "
", + _platform_lists_sentence( + total_files_verify, total_verified, total_untested, total_missing_verify + ), "", ] diff --git a/tests/test_site_exports.py b/tests/test_site_exports.py index 91643f13..2285d234 100644 --- a/tests/test_site_exports.py +++ b/tests/test_site_exports.py @@ -882,6 +882,23 @@ class NestedProfileBlocksRenderAsLists(unittest.TestCase): self.assertIn("name: a.bin, size: 2", html) +class TheGapPageOpensOnCounts(unittest.TestCase): + """The page opened on a slogan and on tiles reading "Verified (100%)" + for 5,437 of 5,438 files and "Missing 0", above a table of red cells.""" + + def test_every_count_is_said(self): + import generate_site # noqa: PLC0415 + + text = generate_site._platform_lists_sentence(5438, 5437, 1, 0) + self.assertIn("Of the 5,438 files", text) + self.assertIn("5,437 are held", text) + self.assertIn("1 is held but not verified", text) + self.assertIn("0 are missing", text) + self.assertNotIn("%", text) + source = (Path(__file__).resolve().parents[1] / "scripts" / "generate_site.py").read_text() + self.assertNotIn("Unified view of BIOS verification", source) + + class EveryPageLinksItsOwnData(unittest.TestCase): """An emulator page linked its YAML and JSON. A platform page linked nothing, and a tool had to download platforms.json (2.8 MB) and filter