Datasets:
Formats:
csv
Languages:
English
Size:
1K - 10K
Tags:
arxiv-artifact
reproducibility
research-artifact
computer-science
computer-logic
formal-methods
License:
| import csv | |
| import json | |
| from pcmt.audit import corrupted_detector_drift, radius_ablation, replay_audit | |
| from pcmt.pipeline import RunConfig, run_pipeline | |
| def test_replay_audit_reconstructs_certificates(tmp_path): | |
| output = tmp_path / "run" | |
| run_pipeline(RunConfig(output=output, fixture_root=tmp_path / "fixtures", clips=3, edits=["none", "audio_shift"], use_gpu="cpu")) | |
| result = replay_audit(output) | |
| assert result["certificates_checked"] == 3 * 2 * 5 | |
| assert result["mismatch_count"] == 0 | |
| def test_audit_sidecars_have_rows(tmp_path): | |
| output = tmp_path / "run" | |
| run_pipeline(RunConfig(output=output, fixture_root=tmp_path / "fixtures", clips=2, edits=["none", "crop"], use_gpu="cpu")) | |
| radius = radius_ablation(output, output / "radius.csv", radii=[0, 1]) | |
| drift = corrupted_detector_drift(output, output / "drift.csv") | |
| assert radius["rows"] == 2 * 2 * 2 * 5 | |
| assert drift["rows"] == 2 * 2 * 4 * 5 | |
| with (output / "drift.csv").open("r", encoding="utf-8", newline="") as handle: | |
| rows = list(csv.DictReader(handle)) | |
| assert any(row["variant"] == "hallucinate_audio" for row in rows) | |
| def test_replay_audit_detects_certificate_hash_tampering(tmp_path): | |
| output = tmp_path / "run" | |
| run_pipeline(RunConfig(output=output, fixture_root=tmp_path / "fixtures", clips=2, edits=["none"], use_gpu="cpu")) | |
| cert_path = sorted((output / "certificates").glob("*.json"))[0] | |
| cert = json.loads(cert_path.read_text()) | |
| cert["certificate_hash"] = "0" * 64 | |
| cert_path.write_text(json.dumps(cert, indent=2, sort_keys=True)) | |
| result = replay_audit(output) | |
| assert result["mismatch_count"] == 1 | |
| assert result["mismatches"][0]["field"] == "certificate_hash" | |