Fix #3187: calibrate checks the report folder before the sweep, not after it

This commit is contained in:
Niko1221 committed 2026-10-20 14:13:34 +02:00
1 parent f74ba2ea53
commit 52ecf67ef7
2 files changed
+10 -1

No files matched your search

+3 -1
View File
@@ -290,8 +290,10 @@ def _measure_locked(ref: str, path: Path, profile: dict | None, revision: str |
_exclusive_preflight(cfg, profile)
if output.exists() or output.is_symlink():
raise ProfileError("calibration report path already exists", 2)
if not output.parent.is_dir(): # before the 19 minute sweep, not after it (#3187)
raise ProfileError("report output directory does not exist", 5)
identity = _identity(path, cfg, profile, revision)
cal = _full_folder("tools.calibrate")
cal =_full_folder("tools.calibrate")
execute = runner or cal.run
runner_cfg = _runtime_cfg(cfg, profile)
runner_cfg["exe"] = str(_resolved(cfg["exe"], cfg, path))
+7
View File
@@ -326,6 +326,13 @@ class CalibrationFlowTests(unittest.TestCase):
["engine.calibrate.rollback", "engine.calibrate.apply",
"engine.calibrate.measure"])
def test_missing_report_folder_is_refused_before_the_sweep(self):
# #3187: the sweep takes ~19 minutes; the folder check must not wait until after it
for output in (self.root / "no-such-dir" / "report.json", self.config / "report.json"):
with self.assertRaisesRegex(profiles.ProfileError, "report output directory does not exist"):
calibration.measure("local", output, exclusive_ack=True,
runner=lambda *_a, **_k: self.fail("the sweep must not start"))
def test_calibration_rechecks_reviewed_digests_inside_operation_lock(self):
report_path = self.root / "pinned-calibration.json"
with self.assertRaisesRegex(profiles.ProfileError, "source changed after review"):