fix: key the fbneo dat cache by commit

fetch_pack refilled one fbneo-dats folder for whatever revision was
asked, and the offline arcade import rebuilt its paths by hand: a parent
map labelled with the profile's pin could be read from another commit's
DATs. The folder is now fbneo-dats/<sha>, and cached_pack() next to
fetch_pack is the offline read, raising NotCached.
This commit is contained in:
Abdessamad Derraz committed 2026-11-21 19:50:10 +01:00
1 parent bc48d4028a
commit 398782a5cd
3 files changed
+54 -17

No files matched your search

+17 -1
View File
@@ -931,7 +931,7 @@ class FbneoFetchReadsOneRevision(unittest.TestCase):
self.served = FBNEO_DAT.replace(b"1.0.0.03", b"1.0.0.02")
with self._patched(), self.assertRaises(self.importer.BlobMismatchError):
self.importer.fetch_pack("fbneo", "latest", self.dir)
self.assertFalse((self.dir / "fbneo-dats" / "Demo.dat").exists())
self.assertFalse((self.dir / "fbneo-dats" / "c0ffee" / "Demo.dat").exists())
def test_the_named_revision_is_the_one_listed(self):
with self._patched():
@@ -943,6 +943,22 @@ class FbneoFetchReadsOneRevision(unittest.TestCase):
)
self.assertEqual(list(blobs), ["Demo.dat"])
def test_the_cache_is_keyed_by_the_commit(self):
with self._patched():
target, blobs = self.importer.fetch_pack("fbneo", "v1.0.0.02", self.dir)
self.assertEqual(target, self.dir / "fbneo-dats" / "c0ffee")
self.assertEqual(self.importer.cached_pack("fbneo", "c0ffee", self.dir), (target, blobs))
def test_another_commit_is_not_cached(self):
with self._patched():
self.importer.fetch_pack("fbneo", "latest", self.dir)
with self.assertRaises(self.importer.NotCached):
self.importer.cached_pack("fbneo", "da14132b", self.dir)
def test_an_uncached_listxml_is_named(self):
with self.assertRaises(self.importer.NotCached):
self.importer.cached_pack("mame", "mame0289", self.dir)
def test_latest_reads_the_default_branch(self):
with self._patched():
self.importer.fetch_pack("fbneo", "latest", self.dir)