refactor: fold coverage tables into two ratios

This commit is contained in:
Abdessamad Derraz committed 2026-08-08 08:50:16 +02:00
1 parent 3e7805f838
commit 918d6bc7cd
3 files changed
+61 -63

No files matched your search

+21 -20
View File
@@ -180,6 +180,7 @@ def generate_readme(db: dict, platforms_dir: str) -> str:
)
emulator_count = len(profiles)
comp = compute_composition(db)
missing_total = sum(c["total_missing"] for c in coverages.values())
system_ids: set[str] = set()
for p in profiles.values():
@@ -290,10 +291,14 @@ def generate_readme(db: dict, platforms_dir: str) -> str:
" profile exists, the expected hashes and sizes are read from the"
" emulator's source code (the Source-backed column below).",
"",
f"- **{sum(c['total_missing'] for c in coverages.values())} files missing**"
f" from the packs: every file the platforms' emulators load is in the"
f" collection. Files needed only by emulators no platform ships yet"
f" are counted in the [gap analysis]({SITE_URL}gaps/)",
(
f"- **{missing_total} files** the platforms' emulators load are"
f" not in the collection yet, named in the"
f" [gap analysis]({SITE_URL}gaps/)"
if missing_total
else "- **Nothing missing**: every file the platforms'"
" emulators load is in the collection"
),
f"- **{len(coverages)} platforms** supported with platform-specific verification",
f"- **{emulator_count} emulators** profiled from source (RetroArch cores + standalone)",
f"- **{len(system_ids)} systems** covered (NES, SNES, PlayStation, Saturn, Dreamcast, ...)",
@@ -354,8 +359,8 @@ def generate_readme(db: dict, platforms_dir: str) -> str:
"",
"## Coverage",
"",
"| Platform | Files in pack | Declared by platform | Required by its emulators | Still missing | Verified by |",
"|----------|--------------:|---------------------:|--------------------------:|--------------:|-------------|",
"| Platform | Platform list | Its emulators need | Verified by |",
"|----------|--------------:|-------------------:|-------------|",
]
)
@@ -367,27 +372,23 @@ def generate_readme(db: dict, platforms_dir: str) -> str:
for name, cov in sorted(coverages.items(), key=lambda x: x[1]["platform"]):
display = f"{cov['platform']} *" if name in archived else cov["platform"]
files = manifest_totals(name)[0] or cov["pack_files"]
checked = mode_labels.get(cov["mode"], cov["mode"])
core_total = cov["core_present"] + cov["core_missing"]
core_cell = f"{cov['core_present']:,}/{core_total:,}" if core_total else "-"
lines.append(
f"| {display} | {files:,} | {cov['present']:,} |"
f" {cov['core_present']:,} | {cov['total_missing']} | {checked} |"
f"| {display} | {cov['present']:,}/{cov['total']:,} |"
f" {core_cell} | {checked} |"
)
lines.extend(
[
"",
"Declared by platform is the platform's own BIOS list. Required by"
" its emulators counts what the cores it ships actually load,"
" read from their source code, that the list never mentions: it is"
" routinely several times the list itself. Both ship in the pack."
" Files in pack counts what the ZIP actually holds, each file once"
" at its destination, so it does not add up from the two: a file"
" several systems need is counted once, and the data directories"
" some emulators need are counted too.",
"Still missing counts files an emulator needs that are not in the"
" collection yet; verified by is the check the platform itself runs"
" on them.",
"Each fraction reads collected over needed. Platform list is the"
" BIOS list the platform publishes. Its emulators need counts what"
" the cores it ships actually load, read from their source code,"
" that the list never mentions: routinely several times the list"
" itself. Both go in the pack, so a full pair means nothing is"
" missing. Verified by is the check the platform itself runs.",
f"The [gap analysis]({SITE_URL}gaps/) page names those missing files"
" and details how far each platform's files are corroborated against"
" emulator source code.",
+21 -23
View File
@@ -1734,8 +1734,8 @@ def generate_gap_analysis(
lines.extend([
"## What Each Pack Contains",
"",
"| Platform | Files in pack | Declared by platform | Required by its emulators | Still missing | Verified by |",
"|----------|--------------:|---------------------:|--------------------------:|--------------:|-------------|",
"| Platform | Platform list | Its emulators need | Verified by |",
"|----------|--------------:|-------------------:|-------------|",
])
mode_labels = {
@@ -1744,35 +1744,33 @@ def generate_gap_analysis(
"existence": "file presence",
}
def _ratio(done: int, total: int) -> str:
"""A collected-over-needed cell, flagged when short."""
if not total:
return "-"
cell = f"{done:,}/{total:,}"
if done < total:
return f'<span class="rb-badge rb-badge-danger">{cell}</span>'
return cell
for pname, cov in sorted(coverages.items(), key=lambda x: x[1]["platform"]):
display = cov["platform"]
gone = cov["total_missing"]
missing_str = (
f'<span class="rb-badge rb-badge-danger">{gone}</span>'
if gone > 0
else '<span class="rb-badge rb-badge-success">0</span>'
)
files = manifest_totals(pname)[0] or cov["pack_files"]
core_total = cov["core_present"] + cov["core_missing"]
lines.append(
f"| [{display}](platforms/{pname}.md) "
f"| {files:,} "
f"| {cov['present']:,} "
f"| {cov['core_present']:,} "
f"| {missing_str} "
f"| {_ratio(cov['present'], cov['total'])} "
f"| {_ratio(cov['core_present'], core_total)} "
f"| {mode_labels.get(cov['mode'], cov['mode'])} |"
)
lines.extend([
"",
"Declared by platform is the platform's own BIOS list. Required by its "
"emulators counts what the cores it ships actually load, read from "
"their source code, that the list never mentions: it is routinely "
"several times the list itself. Both ship in the pack. Files in pack "
"counts what the ZIP holds, each file once at its destination, so it "
"does not add up from the two: a file several systems need is counted "
"once, and the data directories some emulators need are counted too. "
"Still missing counts files an emulator needs that are not in the "
"collection yet, named in the sections below. Verified by is the check "
"the platform runs at runtime, replicated here "
"Each fraction reads collected over needed. Platform list is the BIOS "
"list the platform publishes. Its emulators need counts what the cores "
"it ships actually load, read from their source code, that the list "
"never mentions: routinely several times the list itself. Both go in "
"the pack, so a full pair means nothing is missing; a short one is "
"flagged and named in the sections below. Verified by is the check the "
"platform runs at runtime, replicated here "
"([how each mode works](wiki/verification-modes.md)).",
"",
"## Corroboration Against Emulator Source",