diff --git a/scripts/generate_pack.py b/scripts/generate_pack.py index a541cf54..a04467a2 100644 --- a/scripts/generate_pack.py +++ b/scripts/generate_pack.py @@ -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 diff --git a/tests/test_audit_regressions.py b/tests/test_audit_regressions.py index 5a5494ae..d376806f 100644 --- a/tests/test_audit_regressions.py +++ b/tests/test_audit_regressions.py @@ -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."""