From df597cbe7d83d4e694cdecea807985817d7441fd Mon Sep 17 00:00:00 2001 From: Abdessamad Derraz <3028866+Abdess@users.noreply.github.com> Date: Sun, 18 Oct 2026 13:46:11 +0200 Subject: [PATCH] fix: hold data trees while packs are verified --- scripts/generate_pack.py | 3 +++ tests/test_audit_regressions.py | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/scripts/generate_pack.py b/scripts/generate_pack.py index a88958c6..5eaf49e3 100644 --- a/scripts/generate_pack.py +++ b/scripts/generate_pack.py @@ -2993,6 +2993,9 @@ def _main(held: contextlib.ExitStack) -> None: # Quick-exit modes: --verify-packs alone = verify existing packs only # Combined with --all-variants, generation runs first then verify if args.verify_packs and not args.all_variants: + # The check resolves core files against data/ like the build did; + # a refresh swapping a tree mid-check would judge another tree. + hold_data_dirs(held, load_data_dir_registry(args.platforms_dir)) with _pack_output_lock(args.output_dir, exclusive=False): _run_verify_packs(args) return diff --git a/tests/test_audit_regressions.py b/tests/test_audit_regressions.py index 6990a356..8252bc27 100644 --- a/tests/test_audit_regressions.py +++ b/tests/test_audit_regressions.py @@ -3615,6 +3615,14 @@ class ADataDirectoryIsHeldWhileRead(unittest.TestCase): refresh = pack.index("results = refresh_all(") self.assertIn("hold_data_dirs(held, data_registry)", pack[refresh:]) + def test_verify_packs_alone_holds_the_trees(self): + # --verify-packs returned before the hold and resolved core files + # against data/ while a refresh could swap a tree. + pack = (ROOT / "scripts" / "generate_pack.py").read_text() + branch = pack.index("if args.verify_packs and not args.all_variants:") + run = pack.index("_run_verify_packs(args)", branch) + self.assertIn("hold_data_dirs(held,", pack[branch:run]) + class EachRootReadsItsOwnRegistry(unittest.TestCase): """The release-asset registry was cached once per process whatever root