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(judge): reject malformed dimension names as contract errors (#208)
Rudy Mizrahi Celekli1984db47bdd4
diff --git a/ifixai/evaluation/analytic_judge.py b/ifixai/evaluation/analytic_judge.pyindex 6256b5a..eeec990 100644--- a/ifixai/evaluation/analytic_judge.py+++ b/ifixai/evaluation/analytic_judge.py@@ -671,6 +671,8 @@ def build_judge_dim_map(entry = rescuedif "name" not in entry:continue+ if not isinstance(entry["name"], str):+ raise JudgeContractError("Judge dimension 'name' must be a string")canonical = _fuzzy_match_dim(entry["name"], rubric)if canonical is None:logger.warning(diff --git a/ifixai/tests/test_analytic_judge_verdict_booleans.py b/ifixai/tests/test_analytic_judge_verdict_booleans.pyindex 8767d45..b2a2e57 100644--- a/ifixai/tests/test_analytic_judge_verdict_booleans.py+++ b/ifixai/tests/test_analytic_judge_verdict_booleans.py@@ -16,7 +16,7 @@ from ifixai.judge.config import JudgeConfigfrom ifixai.reporting.scorecard import generate_json_report-async def _run_verdict_envelope(envelope, verdict):+async def _run_verdict_envelope(envelope, verdict, dimension_name=None):rubric = await load_analytic_rubric("B19", "comply")dimensions = [{"name": dim.name, "passed": verdict, "reasoning": "offline control"} for dim in rubric.dimensions]replies = {@@ -26,6 +26,8 @@ async def _run_verdict_envelope(envelope, verdict):"flat-dict": {dim.name: {"passed": verdict, "reasoning": "offline control"} for dim in rubric.dimensions},"flat-scalar": {dim.name: verdict for dim in rubric.dimensions},}+ if dimension_name is not None:+ dimensions[0]["name"] = dimension_name[0]calls = {"sut": 0, "judge": 0}async def complete(request):@@ -115,3 +117,13 @@ async def test_other_numeric_or_structural_verdicts_remain_unscored(value):assert result.status == TestStatus.INCONCLUSIVEassert all(item.extraction_error is not None for item in result.evidence)assert report["test_results"][0]["score"] is None++[email protected]("name", [None, 42, True, [], {}])+async def test_malformed_dimension_name_is_unscored_in_public_run(name, tmp_path):+ result, calls, report = await _run_verdict_envelope("dimensions", True, dimension_name=[name])+ (tmp_path / "scorecard.json").write_text(json.dumps({"name": name, "calls": calls, "row": report["test_results"][0]}, indent=2))+ assert result.status == TestStatus.INCONCLUSIVE+ assert calls["sut"] == 60 and calls["judge"] == 30+ assert all(item.extraction_error is not None for item in result.evidence)+ assert report["test_results"][0]["score"] is None