From 0cd2f391ee2dbbd4a2af5cef7444ec20bf23533a Mon Sep 17 00:00:00 2001 From: Bryan Van Deusen Date: Tue, 23 Jun 2026 01:42:21 -0400 Subject: [PATCH] test(allowlist): unique image paths in coverage tests (CI fix) The new coverage tests' sequential shas (c{i:063d}) share their first 8 chars, so deriving the image path from sha[:8] collided on uq_image_record_path. Use the full sha in the path. Same hardening for test_api_suggestions._img. Co-Authored-By: Claude Opus 4.8 (1M context) Claude-Session: https://claude.ai/code/session_01XCUHUGQLrBrkgyk1t49kpX --- tests/test_api_suggestions.py | 2 +- tests/test_ml_allowlist.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/test_api_suggestions.py b/tests/test_api_suggestions.py index 36c0f89..2b1b425 100644 --- a/tests/test_api_suggestions.py +++ b/tests/test_api_suggestions.py @@ -18,7 +18,7 @@ async def _img(db, preds, sha="s" * 64): from tests._prediction_helpers import seed_predictions img = ImageRecord( - path=f"/images/{sha[:8]}.jpg", sha256=sha, size_bytes=1, + path=f"/images/{sha}.jpg", sha256=sha, size_bytes=1, mime="image/jpeg", width=1, height=1, origin="imported_filesystem", integrity_status="unknown", ) diff --git a/tests/test_ml_allowlist.py b/tests/test_ml_allowlist.py index 3d853b1..198d171 100644 --- a/tests/test_ml_allowlist.py +++ b/tests/test_ml_allowlist.py @@ -18,7 +18,9 @@ pytestmark = pytest.mark.integration async def _make_image(db, sha: str = "x" * 64): from backend.app.models import ImageRecord img = ImageRecord( - path=f"/images/{sha[:8]}.jpg", sha256=sha, size_bytes=1, + # Full sha in the path — the first 8 chars collide for sequential + # shas like c{i:063d}, and path is UNIQUE (uq_image_record_path). + path=f"/images/{sha}.jpg", sha256=sha, size_bytes=1, mime="image/jpeg", width=1, height=1, origin="imported_filesystem", integrity_status="unknown", )