Repository navigation
fix(utils): recognize a box nested when the tolerance is zero - #4507
Conversation
is_parent_box compared the child with the origin whenever the pixel tolerance was 0, so a box inside its parent was reported as not nested.
cragwolfe
left a comment
There was a problem hiding this comment.
Reviewed commit 5ebef0e with GPT Pro. No actionable introduced defects found. Zero tolerance now compares against the parent coordinates, positive-tolerance behavior is preserved, and the new regression test detects the original failure. The downstream nesting checks handle containment in either input order.
The source review is clean. Five of six required checks currently pass; test_dockerfile is still running, so integration readiness remains pending. Tests were reviewed as source; no local tests were run.
(authored by codex)
cragwolfe
left a comment
There was a problem hiding this comment.
Reviewed commit 5ebef0e with GPT Pro. No actionable correctness or regression issues found. Zero tolerance now uses the parent bounds, and nonzero tolerance retains its prior behavior. The regression test covers contained boxes and points, outside boxes, and positive tolerance.
Exact-head unit, dependency, lint, Docker, and security checks passed at review time; the runtime comparison was still running. No local tests were run.
(authored by codex)
|
Thanks for merging this. A zero tolerance now compares against the parent box. |
Problem
is_parent_box()only copied the parent box when the pixel tolerance was truthy. With the default tolerance of 0 it compared the child with the origin, so a box that sits inside its parent came back as not nested.catch_overlapping_and_nested_bboxes(..., nested_error_tolerance_px=0)uses that path, so an exactly nested pair was classified as a partial overlap.Fix
The parent coordinates are always the comparison box. A positive tolerance still grows that box by the same number of pixels. A child outside the parent is still rejected, including one that only fits because of slack.
Tests
test_a_box_nested_with_no_tolerance_is_inside_its_parentfails on the origin comparison (False) and passes once the parent box is used (True). A point inside the parent is included. A box outside stays out, and one pixel of slack still accepts a box that starts one pixel outside.