perf(m49): defer fresh stage revalidation

This commit is contained in:
DCCONSTRUCTIONS
2026-08-31 18:42:31 +03:00
parent 73a7d28065
commit b57c3e94da
2 changed files with 41 additions and 3 deletions
@@ -540,6 +540,32 @@ def test_dynamic_source_materializer_is_source_derived_and_tamper_evident(
validate_m49_portable_source_stage(stage.root)
def test_fresh_source_stage_defers_full_validation_until_execution_boundary(
tmp_path: Path, monkeypatch: pytest.MonkeyPatch
) -> None:
original = source_module.validate_m49_portable_source_stage
validated_roots: list[Path] = []
def counting_validator(root: Path) -> source_module.M49PortableSourceStage:
validated_roots.append(root)
return original(root)
monkeypatch.setattr(
source_module,
"validate_m49_portable_source_stage",
counting_validator,
)
first_root, _expected = _materialized_source(tmp_path, monkeypatch)
assert validated_roots == []
validated = original(first_root)
assert validated.timeline_frame_count == 3
second_root, _expected = _materialized_source(tmp_path, monkeypatch)
assert second_root == first_root
assert validated_roots == [first_root]
def test_source_materializer_rejects_unadmitted_adjacent_metadata(
tmp_path: Path, monkeypatch: pytest.MonkeyPatch
) -> None: