fix: keep a romm entry whole without a size

RomM compares file_size_bytes with the entry's size before any hash. A
new hash the truth gives no size for went out beside the old size and
was reported as a size removal. The entry now stays as written and the
correction is withheld and named.
This commit is contained in:
Abdessamad Derraz committed 2026-10-21 05:13:46 +02:00
1 parent 4670e0442e
commit 4a6b654bdc
3 files changed
+48 -7

No files matched your search

+2 -1
View File
@@ -913,7 +913,8 @@ class TheSummaryCountsWhatTheFileCarries(unittest.TestCase):
return NativeFile(
"scph5501.bin", "scph5501.bin", "psx",
platform={"size": 524288, "crc32": "deadbeef", "md5": A, "sha1": "1" * 40},
truth={"md5": B},
# With a size of its own: without one, RomM keeps its entry whole.
truth={"md5": B, "size": 524288},
)
def test_romm_drops_the_hashes_it_counts_cleared(self):
+11 -3
View File
@@ -1509,9 +1509,17 @@ class RommSizeIsNeverNone(unittest.TestCase):
produced = exporter.render(systems, report, {}, None)
return exporter, systems, produced, json.loads(produced["known_bios_files.json"])
def test_the_platform_size_stands_when_none_is_settled(self):
_, _, _, data = self._export(524288)
self.assertEqual(data["psx:scph5501.bin"]["size"], "524288")
def test_an_entry_the_truth_takes_without_a_size_stays_whole(self):
"""RomM compares the size before any hash: the new md5 beside the
old size never verified, and the report said the size was removed."""
from export_native import landed_changes # noqa: PLC0415
exporter, systems, _, data = self._export(524288)
self.assertEqual(
data["psx:scph5501.bin"], {"size": "524288", "md5": "a" * 32}
)
self.assertEqual(landed_changes(exporter, systems).records, [])
self.assertEqual(len(exporter.withheld()), 1)
def test_no_size_is_written_rather_than_none(self):
exporter, systems, produced, data = self._export(None)