From 4107180b394a7e0f9da017f7a34b20dd98bfaf48 Mon Sep 17 00:00:00 2001 From: ModSync CI Date: Mon, 23 Nov 2026 21:12:46 +0000 Subject: [PATCH 1/2] fix(ci): restore the verified baseline across the lane's loop-mounted storage Every install lane (all 12: k1/k2 x cli/gui x three patcher backends) failed at "Recover and verify the lane-local game baseline", so no patcher lane ever installed anything and the cross-lane comparison had nothing to compare. Exhaustive lanes loop-mount a compressed btrfs image as FULLRUN_STORAGE_ROOT. recover() verified the baseline under RUNNER_TEMP and then renamed the verified tree into the mount, which crosses filesystems (EXDEV). The broad OSError handler reported that as "No verified baseline is available". On EXDEV, restore the same already-verified seal directly at the destination with verify_seal (unpack + inventory verification), so only freshly verified bytes are materialized and nothing is copied unverified. Any other OSError still fails recovery. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01QDKiomK3BZE8fScCAGRfuq --- tools/modsync-ci/fullrun_baseline.py | 13 ++++++++++- tools/modsync-ci/test_fullrun_baseline.py | 27 +++++++++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/tools/modsync-ci/fullrun_baseline.py b/tools/modsync-ci/fullrun_baseline.py index 5dc3772f..dc3f9ac7 100644 --- a/tools/modsync-ci/fullrun_baseline.py +++ b/tools/modsync-ci/fullrun_baseline.py @@ -11,6 +11,7 @@ the local game-cache unpack process, never to an application process. """ import argparse +import errno import hashlib import os from pathlib import Path @@ -206,7 +207,17 @@ def verify(candidate, label): shutil.copyfile(seal, staging) os.replace(staging, seal_dir / game_backup.RESTORED_SEAL) game_dir.parent.mkdir(parents=True, exist_ok=True) - verified_game.rename(game_dir) + try: + verified_game.rename(game_dir) + except OSError as error: + # Exhaustive lanes put the game on a loop-mounted filesystem, so the + # verified tree under RUNNER_TEMP cannot be renamed into it. Restore + # the same verified seal directly at the destination instead of + # copying, so only freshly verified bytes are ever materialized. + if error.errno != errno.EXDEV: + raise + verify_seal(game, seal_dir / game_backup.RESTORED_SEAL, game_dir, environ) + print("baseline verified at destination (separate filesystem)", flush=True) result["available"] = True return result diff --git a/tools/modsync-ci/test_fullrun_baseline.py b/tools/modsync-ci/test_fullrun_baseline.py index b60ce08d..2dd16eaa 100644 --- a/tools/modsync-ci/test_fullrun_baseline.py +++ b/tools/modsync-ci/test_fullrun_baseline.py @@ -1,5 +1,6 @@ """Credential-free recovery/namespace tests; no Rust or game processes run.""" import contextlib +import errno import io import os from pathlib import Path @@ -91,6 +92,32 @@ def test_valid_cache_is_verified_and_missing_current_backup_requires_publication self.assertEqual(self.verified, [b"cache-good"]) self.assertEqual(self.clients, [("owner/current", "current-only")]) + def rename_raising(self, code): + original = Path.rename + + def rename(path, target): + if Path(target) == self.game: + raise OSError(code, os.strerror(code)) + return original(path, target) + return mock.patch.object(Path, "rename", autospec=True, side_effect=rename) + + def test_a_game_dir_on_another_filesystem_is_restored_from_the_verified_seal(self): + # Exhaustive lanes loop-mount the game storage, so the verified tree under + # RUNNER_TEMP cannot be renamed into it (EXDEV). + self.cached() + with self.rename_raising(errno.EXDEV): + result = self.recover() + self.assertEqual(result, {"available": True, "origin": "cache", "backup_required": True}) + self.assertEqual((self.game / "verified.txt").read_bytes(), b"cache-good") + # Verified once as a candidate and once again at the destination, never copied. + self.assertEqual(self.verified, [b"cache-good", b"cache-good"]) + + def test_other_rename_failures_still_fail_recovery(self): + self.cached() + with self.rename_raising(errno.EACCES), self.assertRaises(PermissionError): + self.recover() + self.assertFalse(self.game.exists()) + def test_corrupt_cache_tries_current_before_legacy_and_preserves_other_candidates(self): self.cached(b"bad-cache", "old.seal") self.backup() From 7e3fdc27908dd0cfef3ae4a7d7efea393d8cd399 Mon Sep 17 00:00:00 2001 From: ModSync CI Date: Mon, 23 Nov 2026 21:39:37 +0000 Subject: [PATCH 2/2] test(ci): pin that a failed cross-filesystem baseline restore exits 1 cleanly When the verified tree cannot be renamed into the lane's loop-mounted storage (EXDEV) and the restore at the destination then fails verification, main() must report ::error, exit 1, and leave no game tree behind. Replacing the verified restore with an unverified copy makes this test and the existing EXDEV test fail. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01QDKiomK3BZE8fScCAGRfuq --- tools/modsync-ci/test_fullrun_baseline.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tools/modsync-ci/test_fullrun_baseline.py b/tools/modsync-ci/test_fullrun_baseline.py index 2dd16eaa..18f7437d 100644 --- a/tools/modsync-ci/test_fullrun_baseline.py +++ b/tools/modsync-ci/test_fullrun_baseline.py @@ -112,6 +112,27 @@ def test_a_game_dir_on_another_filesystem_is_restored_from_the_verified_seal(sel # Verified once as a candidate and once again at the destination, never copied. self.assertEqual(self.verified, [b"cache-good", b"cache-good"]) + def test_a_failed_restore_on_another_filesystem_exits_1_and_leaves_no_game_tree(self): + self.cached() + calls = [] + + def verify_then_fail(game, candidate, destination, environ): + calls.append(destination) + if len(calls) == 2: # the restore at the destination fails verification + raise subprocess.CalledProcessError(1, ["game_cache.py", "inventory"]) + return self.verify(game, candidate, destination, environ) + + output = io.StringIO() + with self.rename_raising(errno.EXDEV), \ + mock.patch.object(baseline, "verify_seal", side_effect=verify_then_fail), \ + mock.patch.dict(os.environ, self.environ, clear=True), contextlib.redirect_stdout(output): + code = baseline.main(["--game", "k1", "--seal-dir", str(self.seals), "--game-dir", str(self.game), + "--required", "--local-only"]) + self.assertEqual(code, 1) + self.assertEqual(len(calls), 2) + self.assertFalse(self.game.exists()) + self.assertIn("::error::No verified k1 baseline", output.getvalue()) + def test_other_rename_failures_still_fail_recovery(self): self.cached() with self.rename_raising(errno.EACCES), self.assertRaises(PermissionError):