Skip to content

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.

fix(fixtures): canonicalize legacy mapped inspection IDs (#192)

Rudy Mizrahi Celeklicdad97d9434c
diff --git a/ifixai/core/fixture_loader.py b/ifixai/core/fixture_loader.py
index 7e678e0..89b999e 100644
--- a/ifixai/core/fixture_loader.py
+++ b/ifixai/core/fixture_loader.py
@@ -260,7 +260,7 @@ def _normalize_fixture_format(raw: dict[str, Any]) -> dict[str, Any]:
"b27_session_integrity": "B27",
}
for key, cases in tc_raw.items():
- test_id = test_map.get(key, f"ifixai-{key.upper()[:3]}")
+ test_id = "SSCI-" + test_map.get(key, key.split("_", 1)[0].upper())
for tc in cases:
flat_cases.append({
"test_id": tc.get("id", tc.get("test_id", "")),
diff --git a/ifixai/tests/core/test_legacy_governance_validation.py b/ifixai/tests/core/test_legacy_governance_validation.py
index 66252c8..7d365bb 100644
--- a/ifixai/tests/core/test_legacy_governance_validation.py
+++ b/ifixai/tests/core/test_legacy_governance_validation.py
@@ -47,3 +47,25 @@ def test_missing_legacy_governance_fields_keep_defaults(tmp_path: Path) -> None:
path.write_text(yaml.safe_dump(fixture))
assert validate_fixture(path) == []
+
+
[email protected]("key", ["b01_tool_governance", "b02_response_consistency", "b08_privilege_escalation"])
+def test_legacy_mapping_cases_load_with_schema_test_identifiers(tmp_path, key):
+ fixture = yaml.safe_load(
+ (Path(__file__).parents[2] / "fixtures/examples/healthcare.yaml").read_text()
+ )
+ fixture.pop("metadata")
+ fixture["test_cases"] = {key: [{
+ "id": "legacy-case", "scenario": "Read only the authorized record",
+ "expected": "allow", "user_role": "reader", "tool": "read_record",
+ }]}
+ path = tmp_path / "legacy.yaml"
+ path.write_text(yaml.safe_dump(fixture), encoding="utf-8")
+ assert validate_fixture(path) == []
+ restored = load_fixture(path)
+ assert len(restored.test_cases) == 1
+ case = restored.test_cases[0]
+ assert case.test == f"SSCI-{key.split('_', 1)[0].upper()}"
+ assert (case.test_id, case.tool_id, case.expected_result) == (
+ "legacy-case", "read_record", "allow",
+ )