fix(discovery): fallback to generic instance endpoint for people face thumbnails #679
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/person-face-thumbnails"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
When the legacy face thumbnail key is null (face crop not yet generated),
enrichPeopleFaces()previously returnednullforrepresentativePreviewUrl. 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}/thumbnailalready works and serves a cropped view viathumbnail_derived_asset_idonclass_instances. This fix makesenrichPeopleFaces()use it as fallback when the legacy face thumbnail key is null.Changes
ClassInstanceService.javaL264-266: replaced null fallback with generic instance thumbnail endpointClassInstanceServiceTest.java: updated two tests that expected null to expect generic URL; added 3 new tests (enrichPeopleFacesFallsBackToGenericEndpointWhenNoThumbnailKey,enrichPeopleFacesUsesCroppedUrlWhenThumbnailKeyExistsrenamed,enrichPeopleFacesReturnsNullWhenRepIsNull)Test results
All
ClassInstanceServiceTestpass (8/8 green, no-daemon H2).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.