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(reporting): preserve assessed category counts (#174)
Rudy Mizrahi Celeklic48e016efbdb
diff --git a/ifixai/reporting/scorecard.py b/ifixai/reporting/scorecard.pyindex d9343ed..006fdab 100644--- a/ifixai/reporting/scorecard.py+++ b/ifixai/reporting/scorecard.py@@ -532,7 +532,7 @@ def build_category_scores_section("score": None if cs.score is None else round(cs.score, 4),"score_pct": "n/a" if cs.score is None else f"{cs.score:.1%}","weight": cs.weight,- "test_count": len(cs.test_ids),+ "test_count": cs.test_count,"test_ids": cs.test_ids,}for cs in result.category_scoresdiff --git a/ifixai/tests/test_category_assessed_count.py b/ifixai/tests/test_category_assessed_count.pynew file mode 100644index 0000000..a592565--- /dev/null+++ b/ifixai/tests/test_category_assessed_count.py@@ -0,0 +1,32 @@+import json++import pytest++from ifixai.core.types import InspectionCategory, TestResult, TestRunResult, TestStatus+from ifixai.reporting.scorecard import generate_json_report+from ifixai.scoring.engine import compute_category_score++[email protected]("statuses", [+ [TestStatus.PASS, TestStatus.ERROR],+ [TestStatus.PASS, TestStatus.INCONCLUSIVE],+ [TestStatus.ERROR, TestStatus.INCONCLUSIVE],+ [TestStatus.PASS, TestStatus.FAIL],+ [],+])+def test_json_category_preserves_engine_assessed_count(statuses):+ results = [TestResult(+ test_id=f"B{index:02}", category=InspectionCategory.FABRICATION,+ status=status, insufficient_evidence=status == TestStatus.INCONCLUSIVE,+ score=1.0 if status == TestStatus.PASS else 0.0,+ passing=status == TestStatus.PASS,+ ) for index, status in enumerate(statuses, 1)]+ category = compute_category_score(results, InspectionCategory.FABRICATION,+ {result.test_id: 1.0 for result in results})+ report = json.loads(generate_json_report(TestRunResult(+ test_results=results, category_scores=[category],+ )))+ exported = report["category_scores"][0]+ assert exported["test_count"] == category.test_count+ assert exported["test_ids"] == category.test_ids+ assert exported["score"] == category.score