From 5e0a8713147249217794367d431966d48d5ca5fd Mon Sep 17 00:00:00 2001 From: Holden Date: Wed, 17 Jun 2026 17:47:31 +0000 Subject: [PATCH] =?UTF-8?q?fix:=202=20low=20findings=20from=20audit=20?= =?UTF-8?q?=E2=80=94=20consistent=20500=20match=20source,=20accurate=20ret?= =?UTF-8?q?urn=20type?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use full_body for the 500 'could not process' permanent-rejection check, consistent with the 400 'face' check on the line above. error_detail is truncated to 100 chars via the fallback path, which could silently miss the phrase in a long response body. Remove | None from process_face_mode return type — every code path returns tuple[int,int] or str; None is unreachable. Update docstring to match. --- winnow/executor.py | 2 +- winnow/image_processing.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/winnow/executor.py b/winnow/executor.py index 5b0aeb6..992c93d 100644 --- a/winnow/executor.py +++ b/winnow/executor.py @@ -573,7 +573,7 @@ def upload_to_frigate(jobs: list[dict]) -> None: _is_permanent = ( (resp.status_code == 400 and "face" in full_body.lower()) or resp.status_code == 422 - or (resp.status_code == 500 and "could not process" in error_detail.lower()) + or (resp.status_code == 500 and "could not process" in full_body.lower()) ) if _is_permanent: asset_id = asset_map.get(fname) diff --git a/winnow/image_processing.py b/winnow/image_processing.py index c9c9b85..0d18d2b 100644 --- a/winnow/image_processing.py +++ b/winnow/image_processing.py @@ -68,11 +68,11 @@ def process_face_mode( count: int, min_width: int | None = None, insightface_app=None, -) -> tuple[int, int] | str | None: +) -> tuple[int, int] | str: """Crop face based on Immich metadata and save to output directory. - Returns (width, height) of the saved crop, a skip-reason string if the - face was filtered out, or None if no crop was saved for other reasons. + Returns (width, height) of the saved crop, or a skip-reason string if the + face was filtered out. When insightface_app is provided and ENABLE_FACE_ALIGNMENT is True, re-detects the face in the Immich bbox region using InsightFace to get precise landmarks for a proper 112x112 aligned crop. Falls back to