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: require exact manifest hex identifiers (#235)
Rudy Mizrahi Celekli143801c89602
diff --git a/ifixai/evaluation/manifest.py b/ifixai/evaluation/manifest.pyindex 49f4297..0cb7be4 100644--- a/ifixai/evaluation/manifest.py+++ b/ifixai/evaluation/manifest.py@@ -47,7 +47,7 @@ _LEGACY_V1_EXTRA_EXCLUDE: frozenset[str] = frozenset(def is_valid_run_nonce(value: str) -> bool:"""Return True if `value` is exactly 16 lowercase hex characters."""- return bool(_RUN_NONCE_RE.match(value))+ return bool(_RUN_NONCE_RE.fullmatch(value))def generate_run_nonce() -> str:@@ -108,7 +108,7 @@ class RunManifest(BaseModel):def _validate_run_nonce(cls, value: str) -> str:if value == _EMPTY_RUN_NONCE:return value- if not _RUN_NONCE_RE.match(value):+ if not _RUN_NONCE_RE.fullmatch(value):raise ValueError(f"run_nonce must be 16 lowercase hex chars or empty (legacy v1); got {value!r}")@@ -117,7 +117,7 @@ class RunManifest(BaseModel):@field_validator("fixture_digest")@classmethoddef _validate_fixture_digest(cls, value: str) -> str:- if not _SHA256_HEX_RE.match(value):+ if not _SHA256_HEX_RE.fullmatch(value):raise ValueError(f"fixture_digest must be a 64-char lowercase sha256 hex string; got {value!r}")diff --git a/ifixai/tests/test_manifest_exact_identifiers.py b/ifixai/tests/test_manifest_exact_identifiers.pynew file mode 100644index 0000000..1103836--- /dev/null+++ b/ifixai/tests/test_manifest_exact_identifiers.py@@ -0,0 +1,40 @@+import pytest+from pydantic import ValidationError++from ifixai.core.types import RunMode+from ifixai.evaluation.manifest import RunManifest, is_valid_run_nonce+from ifixai.evaluation.types import ModelDescriptor+++def manifest(**changes):+ return RunManifest(+ **dict(+ run_id="run",+ timestamp="now",+ mode=RunMode.STANDARD,+ model_under_test=ModelDescriptor(+ provider="mock", model_id="test", version="1"+ ),+ normalizer_version="1",+ test_versions={},+ fixture_digest="a" * 64,+ )+ | changes+ )+++def test_nonce_helper_rejects_trailing_newline():+ assert not is_valid_run_nonce("a" * 16 + "\n")+++ "field,value", [("run_nonce", "a" * 16 + "\n"), ("fixture_digest", "a" * 64 + "\n")]+)+def test_manifest_rejects_trailing_newline(field, value):+ with pytest.raises(ValidationError):+ manifest(**{field: value})+++def test_exact_identifiers_are_accepted():+ assert is_valid_run_nonce("a" * 16)+ assert manifest(run_nonce="a" * 16).run_nonce == "a" * 16