From e3a9d6479b2d64049e19cbb3f2642526e40143cc Mon Sep 17 00:00:00 2001 From: Abdessamad Derraz <3028866+Abdess@users.noreply.github.com> Date: Thu, 5 Nov 2026 12:16:59 +0100 Subject: [PATCH] fix: badge a differing hash as Other hash --- scripts/generate_site.py | 8 +++++--- tests/test_site_platform_density.py | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/scripts/generate_site.py b/scripts/generate_site.py index d355bc57d..e76d55ada 100644 --- a/scripts/generate_site.py +++ b/scripts/generate_site.py @@ -3534,21 +3534,23 @@ def _launcher_refs(config: dict) -> dict[str, list[str]]: # The hash a row shows first, when the list does not say which it checks. _ROW_HASHES = ("sha1", "md5", "sha256", "crc32") # An untested entry whose reason is a hash the bytes do not match. -_WRONG_HASH = re.compile(r"hash|mismatch|expected|must match", re.IGNORECASE) +_OTHER_HASH = re.compile(r"hash|mismatch|expected|must match", re.IGNORECASE) # A list this long gets a filter box above it, as a table of RECORD_ROWS # rows does (website/src/plugins/rehype-stack-tables.mjs). FILTER_ROWS = 20 def _status_chip(f: dict) -> str: - """The row's status as a chip, its word and its colour saying the same.""" + """The row's status as a chip, its word and its colour saying the same. A + declared hash the held copy does not have is "Other hash": the two differ, + which says nothing of whose is right (a platform may pin its own bundle).""" status = f.get("status") if status == "ok": word, tone = "OK", "success" elif status == "missing": word, tone = "Missing", "danger" elif status == "untested": - word = "Wrong hash" if _WRONG_HASH.search(str(f.get("reason") or "")) else "Untested" + word = "Other hash" if _OTHER_HASH.search(str(f.get("reason") or "")) else "Untested" tone = "warning" else: word, tone = str(status), "muted" diff --git a/tests/test_site_platform_density.py b/tests/test_site_platform_density.py index dae52b5ec..df7d981fc 100644 --- a/tests/test_site_platform_density.py +++ b/tests/test_site_platform_density.py @@ -126,8 +126,8 @@ class ARowPerFile(unittest.TestCase): def test_status_words(self): cases = { ("missing", ""): ("Missing", "danger"), - ("untested", "declared hash contradicted by the local file"): ("Wrong hash", "warning"), - ("untested", "expected 1234... got 5678..."): ("Wrong hash", "warning"), + ("untested", "declared hash contradicted by the local file"): ("Other hash", "warning"), + ("untested", "expected 1234... got 5678..."): ("Other hash", "warning"), ("untested", "bios/x read error"): ("Untested", "warning"), } for (status, reason), (word, tone) in cases.items():