fix: tell an offline cache miss from absence

Offline, fetch_file answered None for a path the cache never
stored, the same answer as a path known to be absent, and
profile_sync reported existing files as gone. A miss now raises
NotCachedError and the profile is reported unverified.
This commit is contained in:
Abdessamad Derraz committed 2026-10-18 02:46:57 +02:00
1 parent b91449590d
commit 9802804a9a
6 files changed
+59 -9

No files matched your search

+14
View File
@@ -3932,5 +3932,19 @@ class UpstreamVendoredAsASubmodule(unittest.TestCase):
self.assertEqual(views[1].head, "nesbox-tip")
class OfflineCacheMissIsNotGone(TestBuildReport):
"""Offline, a file the cache never stored came back as None and the
report read "GONE (absent at HEAD, no rename found)" for files that
exist. The miss now stops the profile as unverified."""
def test_an_uncached_file_is_not_reported_gone(self):
def cold(repo, sha, path, cache_dir, offline=False):
raise profile_sync.upstream.NotCachedError(f"{path} not cached")
profile_sync.upstream.fetch_file = cold
with self.assertRaises(profile_sync.upstream.NotCachedError):
build_report("test", self._profile(["a.c:2"]), self.dir, offline=True)
if __name__ == "__main__":
unittest.main()