fix(discovery): fallback to generic instance endpoint for people face thumbnails #679

Merged
chris merged 2 commits from fix/person-face-thumbnails into main 2026-07-21 19:47:23 +02:00
Owner

Problem

When the legacy face thumbnail key is null (face crop not yet generated), enrichPeopleFaces() previously returned null for representativePreviewUrl. This caused the explore page to show the full photo instead of a face crop.

Solution

The new generic endpoint /api/media/{mediaItemId}/instances/{classInstanceId}/thumbnail already works and serves a cropped view via thumbnail_derived_asset_id on class_instances. This fix makes enrichPeopleFaces() use it as fallback when the legacy face thumbnail key is null.

Changes

  • ClassInstanceService.java L264-266: replaced null fallback with generic instance thumbnail endpoint
  • ClassInstanceServiceTest.java: updated two tests that expected null to expect generic URL; added 3 new tests (enrichPeopleFacesFallsBackToGenericEndpointWhenNoThumbnailKey, enrichPeopleFacesUsesCroppedUrlWhenThumbnailKeyExists renamed, enrichPeopleFacesReturnsNullWhenRepIsNull)

Test results

All ClassInstanceServiceTest pass (8/8 green, no-daemon H2).

## Problem When the legacy face thumbnail key is null (face crop not yet generated), `enrichPeopleFaces()` previously returned `null` for `representativePreviewUrl`. This caused the explore page to show the full photo instead of a face crop. ## Solution The new generic endpoint `/api/media/{mediaItemId}/instances/{classInstanceId}/thumbnail` already works and serves a cropped view via `thumbnail_derived_asset_id` on `class_instances`. This fix makes `enrichPeopleFaces()` use it as fallback when the legacy face thumbnail key is null. ## Changes - `ClassInstanceService.java` L264-266: replaced null fallback with generic instance thumbnail endpoint - `ClassInstanceServiceTest.java`: updated two tests that expected null to expect generic URL; added 3 new tests (`enrichPeopleFacesFallsBackToGenericEndpointWhenNoThumbnailKey`, `enrichPeopleFacesUsesCroppedUrlWhenThumbnailKeyExists` renamed, `enrichPeopleFacesReturnsNullWhenRepIsNull`) ## Test results All `ClassInstanceServiceTest` pass (8/8 green, no-daemon H2).
fix(discovery): fallback to generic instance endpoint for people face thumbnails
All checks were successful
Build and Deploy / Detect changed services and test scopes (push) Successful in 3s
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 4m9s
04bb563e08
When the legacy face thumbnail key is null (face crop not yet generated),
enrichPeopleFaces() previously returned null for representativePreviewUrl.

The new generic endpoint /api/media/{mediaItemId}/instances/{classInstanceId}/thumbnail
already works and serves a cropped view via thumbnail_derived_asset_id on class_instances.
This fix makes enrichPeopleFaces() use it when the legacy face thumbnail key is null.

Closes the explore page showing full photo instead of face crop for people
whose legacy face thumbnails have not been generated.
chore: bump version to v1.21.18
All checks were successful
Build and Deploy / Detect changed services and test scopes (push) Successful in 3s
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 1m57s
af12aef700
chris merged commit c52ffb69b2 into main 2026-07-21 19:47:23 +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!679
No description provided.