fix: read PR hashes the way the resolver does

load_profile_hashes and load_platform_hashes read hash fields by hand: crc32 was never indexed and a comma list of sha256 stayed one key. A contribution a profile names by crc32 alone (clk's Electron os.rom, among 626 entries) or by one of mesence's four sha256 was reported as referenced nowhere. Both indexes now read through parse_hash_list, and a crc32 counts where no stronger hash is declared, bounded by the declared size.
This commit is contained in:
Abdessamad Derraz committed 2026-10-20 02:12:54 +02:00
1 parent ac47faf7f2
commit 23a999153d
2 files changed
+39 -10

No files matched your search

+18
View File
@@ -361,5 +361,23 @@ class AFileOutsideBiosIsToldWhereToGo(unittest.TestCase):
self.assertFalse(any("Duplicate" in m for _s, m in result.checks))
class ProfileHashesReadAsTheResolverDoes(unittest.TestCase):
"""A file a profile names by crc32 alone (clk's Electron os.rom, 626
entries) or by a comma list of sha256 (mesence's BS-X.bin) was reported
as referenced nowhere, needing manual review."""
def test_crc32_only_and_comma_lists_are_indexed(self):
with tempfile.TemporaryDirectory() as tmp:
Path(tmp, "core.yml").write_text(
"emulator: Core\ntype: libretro\nsystems: [x]\nfiles:\n"
" - name: os.rom\n crc32: BF63FB1F\n size: 16384\n"
" - name: bsx.bin\n sha256: \"aa,bb\"\n",
encoding="utf-8",
)
known = validate_pr.load_profile_hashes(tmp)
self.assertEqual(known["crc32"][("bf63fb1f", 16384)], {"core"})
self.assertIn("bb", known["sha256"])
if __name__ == "__main__":
unittest.main()