From a0700ab370dee41fe86b24228de0761c52f92e96 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 26 Oct 2026 22:20:21 +0000 Subject: [PATCH] validation: select the frozen DFG manifest without reading the checkout 36ad523 made a manifest file missing from the checkout a 'Source mismatch', which also broke the tests' manifest-selection helper: it reused verify_source with hashing neutralised but still read the (renamed) files. run_refined_dfg.source_manifest(collision, observation_mode) now owns the frozen-manifest selection; verify_source uses it, then verifies the checkout. The test helper calls source_manifest directly; source identity stays owned by test_source_pin. Same errors, manifests and pins. Co-Authored-By: Claude Opus 5.5 --- tests/unit/test_refined_dfg.py | 21 +++------------------ tests/validation/run_refined_dfg.py | 13 +++++++++---- 2 files changed, 12 insertions(+), 22 deletions(-) diff --git a/tests/unit/test_refined_dfg.py b/tests/unit/test_refined_dfg.py index 433b550..0d22323 100644 --- a/tests/unit/test_refined_dfg.py +++ b/tests/unit/test_refined_dfg.py @@ -164,26 +164,11 @@ def frozen_manifest(observation_mode): def selected_manifest(collision, observation_mode): - """verify_source's manifest selection with its working-tree hash comparison neutralised. + """The frozen manifest verify_source selects for (collision, observation_mode). - Source identity is owned by test_source_pin; this exercises only which frozen manifest - verify_source selects and returns for (collision, observation_mode). + Source identity is owned by test_source_pin; this reads no checkout files. """ - from unittest.mock import patch - - class Digest(str): - def __ne__(self, other): - return False - - class Hash: - def __init__(self, data=b""): - pass - - def hexdigest(self): - return Digest() - - with patch.object(r.hashlib, "sha256", Hash): - return r.verify_source(r.DEFAULT_SOURCE, collision, observation_mode) + return r.source_manifest(collision, observation_mode) def test_full_requires_completed_pilot(): diff --git a/tests/validation/run_refined_dfg.py b/tests/validation/run_refined_dfg.py index b375906..9cbeb70 100644 --- a/tests/validation/run_refined_dfg.py +++ b/tests/validation/run_refined_dfg.py @@ -281,16 +281,21 @@ def host_geometry(source, h, collision="SRT", jet_scenario="none", placement="wi return cfg, pair, body, host -def verify_source(source, collision="SRT", observation_mode="last_base_step", jet_scenario="none", observe_cv=False): +def source_manifest(collision="SRT", observation_mode="last_base_step"): + """The frozen historical manifest for this collision/observation mode (no checkout read).""" if collision not in ("SRT", "MRT"): raise ValueError("Matched collision must be SRT or MRT") if observation_mode not in ("last_base_step", "window"): raise ValueError("Unknown refined observation mode") - if observe_cv and jet_scenario == "none": - raise ValueError("--observe-cv requires an explicit public Jet scenario") name = ("source_manifest_window.json" if observation_mode == "window" else "source_manifest.json" if collision == "SRT" else "source_manifest_mrt.json") - expected = json.loads((HERE / "data/refined_dfg" / name).read_text()) + return json.loads((HERE / "data/refined_dfg" / name).read_text()) + + +def verify_source(source, collision="SRT", observation_mode="last_base_step", jet_scenario="none", observe_cv=False): + expected = source_manifest(collision, observation_mode) + if observe_cv and jet_scenario == "none": + raise ValueError("--observe-cv requires an explicit public Jet scenario") if jet_scenario != "none": if collision != "MRT" or observation_mode != "window": raise ValueError("Public Jet scenarios require MRT and --exchange-window")