feat: add by_sha256 index, fix reporting attribution

generate_db: add by_sha256 index for O(1) variant lookup.
verify: _find_best_variant uses indexed sha256 instead of O(n) scan.
validation: check_file_validation returns (reason, emulators) tuple,
attributing mismatch only to emulators whose check actually failed.
beetle_psx: remove incorrect size field for ps1_rom.bin (code does
not validate size, swanstation is sole size authority).
This commit is contained in:
Abdessamad Derraz
2026-04-02 00:59:01 +02:00
parent 95b7a9813c
commit 0401d058a1
7 changed files with 7382 additions and 51 deletions

View File

@@ -1308,10 +1308,11 @@ def generate_pack(
and validation_index
):
fname = file_entry.get("name", "")
reason = check_file_validation(
check = check_file_validation(
local_path, fname, validation_index, bios_dir
)
if reason:
if check:
reason, emus_list = check
better = _find_candidate_satisfying_both(
file_entry,
db,
@@ -1322,8 +1323,7 @@ def generate_pack(
if better:
local_path = better
else:
ventry = validation_index.get(fname, {})
emus = ", ".join(ventry.get("emulators", []))
emus = ", ".join(emus_list)
file_reasons.setdefault(
dedup_key,
f"{platform_display} says OK but {emus} says {reason}",