mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-22 17:47:48 -06:00
fix: gaps badge reads verify's severity counts
The badge refiltered coverage details for missing required firmware and ignored hle_fallback: a required file the core replaces by HLE is INFO in verify and passes --strict, yet showed as a red required gap. The count now comes from severity_counts through packs.verdicts.blocking_missing.
This commit is contained in:
1 parent
ff3b2699bd
commit
380b3df823
5 files changed
+33
-23
No files matched your search
@@ -269,6 +269,18 @@ def compute_severity(
|
||||
return Severity.OK
|
||||
|
||||
|
||||
def blocking_missing(severity_counts: dict[str, int], mode: str) -> int:
|
||||
"""Destinations whose missing file stops the console, from verify's counts.
|
||||
|
||||
compute_severity gives a required firmware gap with no HLE fallback
|
||||
CRITICAL where the frontend reads the bytes and WARNING where it only
|
||||
checks the file is there, and nothing else reaches that severity in an
|
||||
existence frontend.
|
||||
"""
|
||||
severity = Severity.CRITICAL if reads_file_contents(mode) else Severity.WARNING
|
||||
return severity_counts.get(severity, 0)
|
||||
|
||||
|
||||
def storage_verdict(file_entry: dict, emulator_pack: bool) -> dict | None:
|
||||
"""The result a storage tier fixes before any lookup, as the builder sees it.
|
||||
|
||||
|
||||
+1
-14
@@ -321,19 +321,6 @@ def _platform_lists_sentence(
|
||||
)
|
||||
|
||||
|
||||
def _missing_required_firmware(cov: dict) -> int:
|
||||
"""Entries of a platform's list that are missing, required and firmware.
|
||||
|
||||
Only those stop a console from starting. Game data and files no core
|
||||
opens are counted apart, and red on every short row carried no signal.
|
||||
"""
|
||||
return len({
|
||||
(d.get("system", ""), d.get("name", "")) for d in cov.get("details") or []
|
||||
if d.get("status") == "missing" and d.get("required", True)
|
||||
and d.get("category", "bios") == "bios" and not d.get("settled_by")
|
||||
})
|
||||
|
||||
|
||||
def _ratio_cell(done: int, total: int, alarm: int = 0) -> str:
|
||||
"""A held-over-needed cell: the numbers, a bar, and a badge only when
|
||||
required firmware is missing."""
|
||||
@@ -453,7 +440,7 @@ def _pack_content_rows(coverages: dict) -> list[str]:
|
||||
)
|
||||
rows.append(
|
||||
f"| [{display}](platforms/{pname}.md) "
|
||||
f"| {_ratio_cell(cov['present'], cov['total'], _missing_required_firmware(cov))} "
|
||||
f"| {_ratio_cell(cov['present'], cov['total'], cov['required_missing'])} "
|
||||
f"| {_ratio_cell(cov['core_present'], core_total)} "
|
||||
f"| {check_label(cov['mode'], cov['config'].get('hash_rule'))} |"
|
||||
)
|
||||
|
||||
@@ -29,6 +29,7 @@ from model.profiles import load_emulator_profiles, unique_emulator_profiles
|
||||
from model.registry import VERSIONS_FILE, list_registered_platforms, load_platform_registry
|
||||
from model.systems import system_index
|
||||
from packs.coverage import verify_platform
|
||||
from packs.verdicts import blocking_missing
|
||||
from resolve.cores import resolve_platform_cores
|
||||
from resolve.review import LARGE_FILE_ISSUE_URL
|
||||
from sitegen.config import REPO_SLUG, REPO_URL, SITE_URL, UPLOAD_ROOT
|
||||
@@ -103,6 +104,9 @@ def compute_coverage(
|
||||
"pack_files": present + core_present,
|
||||
"total_missing": missing + core_missing,
|
||||
"mode": config.get("verification_mode", "existence"),
|
||||
# The gaps page badge: verify's count, never refiltered from details.
|
||||
"required_missing": blocking_missing(
|
||||
result["severity_counts"], result["verification_mode"]),
|
||||
"details": result["details"],
|
||||
"config": config,
|
||||
"ground_truth": result.get(
|
||||
@@ -116,7 +120,7 @@ def compute_coverage(
|
||||
# stores it here and the second reads it back, instead of verifying every
|
||||
# platform twice (about a minute of the site build).
|
||||
COVERAGE_CACHE_DIR = REPO_ROOT / "tmp" / "coverage-cache"
|
||||
_COVERAGE_CACHE_FORMAT = "3"
|
||||
_COVERAGE_CACHE_FORMAT = "4"
|
||||
|
||||
|
||||
def _coverage_inputs(db_path: Path, platforms_dir: str, emulators_dir: str) -> str:
|
||||
|
||||
@@ -44,7 +44,8 @@ class CoverageReadsTheGivenProfiles(unittest.TestCase):
|
||||
|
||||
def fake_verify(_config, _db, emulators_dir, **_kwargs):
|
||||
seen.append(emulators_dir)
|
||||
return {"status_counts": {}, "total_files": 0, "undeclared_files": [], "details": []}
|
||||
return {"status_counts": {}, "severity_counts": {}, "verification_mode": "existence",
|
||||
"total_files": 0, "undeclared_files": [], "details": []}
|
||||
|
||||
with mock.patch.object(readme, "verify_platform", fake_verify), \
|
||||
mock.patch.object(readme, "load_emulator_profiles", return_value={}):
|
||||
|
||||
@@ -82,6 +82,7 @@ import core
|
||||
from sitegen import sources
|
||||
from model import releaserecord
|
||||
from core import upstream
|
||||
from packs.verdicts import Severity, blocking_missing, compute_severity
|
||||
|
||||
REPO_ROOT = Path(__file__).resolve().parents[1]
|
||||
|
||||
@@ -329,13 +330,18 @@ class GapsPageNumbers(unittest.TestCase):
|
||||
self.assertNotIn("rb-badge", gaps._ratio_cell(99, 100))
|
||||
self.assertIn('class="rb-bar"', gaps._ratio_cell(99, 100))
|
||||
self.assertIn("rb-badge-danger", gaps._ratio_cell(99, 100, 1))
|
||||
cov = {"details": [
|
||||
{"name": "a", "system": "s", "status": "missing", "required": True, "category": "bios"},
|
||||
{"name": "b", "system": "s", "status": "missing", "required": True,
|
||||
"category": "game_data"},
|
||||
{"name": "c", "system": "s", "status": "missing", "required": False},
|
||||
]}
|
||||
self.assertEqual(gaps._missing_required_firmware(cov), 1)
|
||||
self.assertNotIn("_missing_required_firmware", script_source("generate_site.py"))
|
||||
|
||||
def test_blocking_missing_reads_verify_severity(self):
|
||||
"""The badge is verify's count: a required gap with an HLE fallback
|
||||
is INFO there and stopped no console, yet the page counted it."""
|
||||
def gap(mode: str, hle: bool) -> int:
|
||||
severity = compute_severity("missing", True, mode, hle)
|
||||
return blocking_missing({severity: 1}, mode)
|
||||
for mode in ("existence", "md5", "sha1"):
|
||||
self.assertEqual(gap(mode, False), 1, mode)
|
||||
self.assertEqual(gap(mode, True), 0, mode)
|
||||
self.assertEqual(blocking_missing({Severity.WARNING: 2}, "md5"), 0)
|
||||
|
||||
def test_headings_and_header(self):
|
||||
source = script_source("generate_site.py")
|
||||
|
||||
Reference in new issue
Block a user