KaiWu Cursor commited on
Commit
698d302
·
1 Parent(s): 3ce633c

refactor(eval): extract compare_bbox from evaluate_bbox

Browse files

Split the dimension comparison out of evaluate_bbox so callers that
already have a bounding box (e.g. runtime verification) can reuse the
same tolerance logic without loading a STEP file.

Co-authored-by: Cursor <cursoragent@cursor.com>

Files changed (1) hide show
  1. agent_core/eval/checks.py +6 -0
agent_core/eval/checks.py CHANGED
@@ -83,6 +83,12 @@ def evaluate_bbox(step_path: Path | None, check: dict[str, Any] | None) -> dict[
83
  "error_type": type(exc).__name__,
84
  "error": str(exc),
85
  }
 
 
 
 
 
 
86
 
87
  dimensions = check.get("dimensions_mm", [])
88
  mode = check.get("mode", "unordered")
 
83
  "error_type": type(exc).__name__,
84
  "error": str(exc),
85
  }
86
+ return compare_bbox(actual, check)
87
+
88
+
89
+ def compare_bbox(actual: dict[str, float], check: dict[str, Any] | None) -> dict[str, Any]:
90
+ if not check:
91
+ return {"checked": False, "passed": None, "reason": "no_bbox_check"}
92
 
93
  dimensions = check.get("dimensions_mm", [])
94
  mode = check.get("mode", "unordered")