fix: judge path conflicts by the builder verdict

This commit is contained in:
Abdessamad Derraz committed 2026-10-17 11:47:42 +02:00
1 parent dcb25f4a48
commit 6cc969e043
2 files changed
+23 -5

No files matched your search

+10 -5
View File
@@ -726,18 +726,23 @@ def generate_pack(
# its own, so this one is counted by what it resolves to:
# an unresolved one counted OK had the pack claim a file
# verify reports missing.
_conflict_path, conflict_status = resolve_file(
conflict_path, conflict_status = resolve_file(
file_entry, db, bios_dir, zip_contents,
data_dir_registry=data_registry, offline=offline,
)
# The verdict of the main path: a zipped_file archive is
# judged by the member inside, and a frontend that hashes
# one digest accepts a file another declared hash
# contradicts, as verify judges it.
conflict_status, refusal = baseline_verdict(
file_entry, conflict_path, conflict_status, verification_mode
)
if conflict_status == "not_found":
file_status[dedup_key] = "missing"
file_reasons[dedup_key] = "not found"
elif conflict_status == "hash_mismatch" and (
hash_mismatch_excludes_file(verification_mode)
):
elif refusal:
file_status[dedup_key] = "excluded"
file_reasons[dedup_key] = "hash mismatch"
file_reasons[dedup_key] = refusal
else:
file_status.setdefault(dedup_key, "ok")
continue
+13
View File
@@ -2576,6 +2576,19 @@ class AnArchiveShipsWholeUnderARegion(unittest.TestCase):
)
class APathConflictKeepsTheMainVerdict(unittest.TestCase):
"""The builder's file/directory conflict branch judged a declaration by
the raw resolver status: a zipped_file archive whose member is right was
counted excluded while verify counted it OK."""
def test_the_branch_reads_baseline_verdict(self):
source = (ROOT / "scripts" / "generate_pack.py").read_text(encoding="utf-8")
branch = source[source.index("Content ships under the conflicting shape"):]
branch = branch[: branch.index("storage = file_entry.get")]
self.assertIn("baseline_verdict(", branch)
self.assertNotIn('conflict_status == "hash_mismatch"', branch)
class TheDatabaseCacheIsWrittenWhole(unittest.TestCase):
"""A crash while serializing left a truncated db_cache.json behind, and
the next run rehashed the whole collection from scratch."""