fix(explore): fallback to full-photo thumbnail when face crop missing #657

Merged
chris merged 1 commit from fix/face-thumbnail-404 into main 2026-07-20 16:49:13 +02:00
Owner

Fix

Person face thumbnails on /explore returned 404 because ClassInstanceService.enrichPeopleFaces() unconditionally constructed face-crop URLs when a representative face existed, even when no derived_assets record (face thumbnail) existed in the database.

Changes

ClassInstanceService.java:

  1. Added faceThumbnailKey field to ClassInstanceRepresentativeEnrichment record
  2. Added face_thumbnail_key to the final SELECT in representativeEnrichmentForPeople() — the two CTEs already selected it but it was not propagated
  3. Updated result mapping to include face_thumbnail_key
  4. Guarded URL construction: when faceThumbnailKey is null, representativePreviewUrl is null (frontend already falls back to representativeThumbnailUrl)

ClassInstanceServiceTest.java:

  • Fixed personWithoutFaceThumbnailReturnsNullPreviewUrl assertion (was asserting the broken behavior)
  • Added enrichPeopleFacesFallsBackWhenNoThumbnailKey — verifies null preview URL when no face thumbnail exists
  • Added enrichPeopleFacesUsesCroppedUrlWhenThumbnailKeyExists — verifies face-crop URL when face thumbnail key exists

No frontend changes needed

The explore page already uses: instance.representativeCroppedThumbnailUrl ?? instance.representativeThumbnailUrl

Out of scope (follow-ups)

  • Part B: Data backfill for orphaned V108 face thumbnails (10,547 discovery_results with thumbnail_derived_asset_id = NULL)
  • Part C: Orphan cleanup for 51,149 stale face_thumbnail derived_assets with variant UUIDs
## Fix Person face thumbnails on /explore returned 404 because `ClassInstanceService.enrichPeopleFaces()` unconditionally constructed face-crop URLs when a representative face existed, even when no `derived_assets` record (face thumbnail) existed in the database. ### Changes **ClassInstanceService.java:** 1. Added `faceThumbnailKey` field to `ClassInstanceRepresentativeEnrichment` record 2. Added `face_thumbnail_key` to the final SELECT in `representativeEnrichmentForPeople()` — the two CTEs already selected it but it was not propagated 3. Updated result mapping to include `face_thumbnail_key` 4. Guarded URL construction: when `faceThumbnailKey` is null, `representativePreviewUrl` is null (frontend already falls back to `representativeThumbnailUrl`) **ClassInstanceServiceTest.java:** - Fixed `personWithoutFaceThumbnailReturnsNullPreviewUrl` assertion (was asserting the broken behavior) - Added `enrichPeopleFacesFallsBackWhenNoThumbnailKey` — verifies null preview URL when no face thumbnail exists - Added `enrichPeopleFacesUsesCroppedUrlWhenThumbnailKeyExists` — verifies face-crop URL when face thumbnail key exists ### No frontend changes needed The explore page already uses: `instance.representativeCroppedThumbnailUrl ?? instance.representativeThumbnailUrl` ### Out of scope (follow-ups) - Part B: Data backfill for orphaned V108 face thumbnails (10,547 discovery_results with thumbnail_derived_asset_id = NULL) - Part C: Orphan cleanup for 51,149 stale face_thumbnail derived_assets with variant UUIDs
fix(explore): fallback to full-photo thumbnail when face crop missing
All checks were successful
Build and Deploy / Detect changed services and test scopes (push) Successful in 2s
Build and Deploy / Smoke API and media worker (push) Has been skipped
Build and Deploy / Smoke web (push) Has been skipped
Build and Deploy / Smoke ML worker (push) Has been skipped
Build and Deploy / Build plants worker image (push) Has been skipped
Build and Deploy / Build people worker image (push) Has been skipped
Build and Deploy / Build converter worker image (push) Has been skipped
Build and Deploy / Build API image (push) Has been skipped
Build and Deploy / Build media worker image (push) Has been skipped
Build and Deploy / Build ML worker image (push) Has been skipped
Build and Deploy / Build web image (push) Has been skipped
Build and Deploy / Deploy API (push) Has been skipped
Build and Deploy / Deploy web (push) Has been skipped
Build and Deploy / Deploy media worker (push) Has been skipped
Build and Deploy / Deploy ML worker (push) Has been skipped
Build and Deploy / Deploy plants worker (push) Has been skipped
Build and Deploy / Deploy people worker (push) Has been skipped
Build and Deploy / Deploy converter worker (push) Has been skipped
Build and Deploy / Clean Docker build artifacts (push) Has been skipped
Build and Deploy / Run scoped PR tests (push) Successful in 1m46s
ebc954d521
Propagate face_thumbnail_key through representativeEnrichmentForPeople
SQL result and ClassInstanceRepresentativeEnrichment record. When key is
NULL, representativePreviewUrl is set to null instead of a 404-prone
face-crop URL. Frontend already falls back to representativeThumbnailUrl.

Bump version to 1.21.14.
chris merged commit 58d639ccc3 into main 2026-07-20 16:49:13 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
chris/memories!657
No description provided.