Independent Auditing of AI Agents. Run by human or the agent itself, to answer the most crucial question in the AI Agent Economy. Is the agent doing what is supposed to do? With iFixAi you can have this answer in less than 120 seconds.
Python agent-evaluationaiai-alignmentai-evaluationai-governanceai-safetyclidiagnostic-tooleu-ai-acthallucination-detectioniso-42001llm-evaluationllm-securitynist-ai-rmfowasp-llmprompt-injectionpythonresponsible-airisk-assessmentrisk-management
fix(manifest): fingerprint the actual inspection corpus and outcome rubrics (#152)
Rudy Mizrahi Celekli482fd856e5b1
diff --git a/ifixai/tests/test_manifest_inspection_artifact_digests.py b/ifixai/tests/test_manifest_inspection_artifact_digests.pynew file mode 100644index 0000000..0ad6834--- /dev/null+++ b/ifixai/tests/test_manifest_inspection_artifact_digests.py@@ -0,0 +1,42 @@+import pytest++from ifixai.evaluation.manifest import compute_run_id+from ifixai.utils.rubric_digest import compute_rubric_digests_for_tests_layout+++ "artifact",+ [+ "corpus.yaml",+ "definition.yaml",+ "references.yaml",+ "rubric_comply.yaml",+ "rubric_refuse.yaml",+ ],+)+def test_actual_inspection_artifact_change_invalidates_manifest_identity(+ tmp_path, artifact+):+ folder = tmp_path / "b12_prompt_injection"+ folder.mkdir()+ (folder / "rubric.yaml").write_text("dimensions: []\n")+ changed = folder / artifact+ changed.write_text("version: before\n")+ before = compute_rubric_digests_for_tests_layout(tmp_path)+ changed.write_text("version: after\n")+ after = compute_rubric_digests_for_tests_layout(tmp_path)+ assert before != after+ assert compute_run_id({"rubric_hashes": before}) != compute_run_id(+ {"rubric_hashes": after}+ )+++def test_legacy_default_rubric_and_prompts_keys_are_retained(tmp_path):+ folder = tmp_path / "b12_prompt_injection"+ folder.mkdir()+ (folder / "rubric.yaml").write_text("dimensions: []\n")+ (folder / "prompts.yaml").write_text("prompts: []\n")+ assert set(compute_rubric_digests_for_tests_layout(tmp_path)) == {+ "b12_prompt_injection",+ "b12_prompt_injection:prompts",+ }diff --git a/ifixai/utils/rubric_digest.py b/ifixai/utils/rubric_digest.pyindex 2c17fce..85dea7a 100644--- a/ifixai/utils/rubric_digest.py+++ b/ifixai/utils/rubric_digest.py@@ -72,10 +72,22 @@ def compute_rubric_digests_for_tests_layout(tests_dir: Path | str) -> dict[str,hashes: dict[str, str] = {path.parent.name: compute_rubric_digest(path) for path in rubric_files}- # Also hash any prompts.yaml corpus files so a corpus change invalidates- # the run_id, preventing seed-based replay from silently producing a- # different prompt subset.- for corpus_file in sorted(directory.glob("b*_*/prompts.yaml")):- key = f"{corpus_file.parent.name}:prompts"- hashes[key] = compute_rubric_digest(corpus_file)+ # A pinned seed is reproducible only with the exact prompt corpus, plan,+ # references and outcome-specific rubric that the inspection consumes.+ # Preserve the existing default-rubric key and legacy prompts key.+ for folder in sorted({path.parent for path in rubric_files}):+ artifacts = sorted(+ path+ for path in folder.iterdir()+ if path.is_file()+ and path.suffix in _YAML_SUFFIXES+ and path.stem != "rubric"+ and (+ path.stem in {"prompts", "corpus", "definition", "references"}+ or path.stem.startswith("rubric_")+ )+ )+ for artifact in artifacts:+ key = f"{folder.name}:{artifact.stem}"+ hashes[key] = compute_rubric_digest(artifact)return hashes