feat(web): zoom suggestion-carousel face tiles onto the face box #1046

Merged
chris merged 1 commit from feat/carousel-face-bbox into main 2026-10-06 00:43:11 +02:00
Owner

Problem

Suggestion-carousel face thumbnails showed the whole photo instead of zooming onto the face (user request: same framing as the people page's "Vis område" toggle).

Root cause

  • enrichEvidenceRefs only enriched refs with type: "face_annotation", but discovery_people refs historically carry just mediaItemId + face id (no type) — those fell into the else branch and got the whole-photo /derived/thumbnail URL, short-circuiting the client's face-crop builder.
  • Refs carried no scope, so even a client-built URL had nothing to zoom with.

Fix (additive both sides)

Backend (ClassInstanceDiscoveryService):

  • isFaceEvidenceRef(): declared type trusted when present, else face id ⇒ face (mirrors client refIsFace / occurrenceType()).
  • scopeByFaceAnnotationIds(): batched discovery_results.scope lookup (same filters as representativeBboxByMediaItem: state <> 'superseded', lifecycle_state = 'active'), putIfAbsent("scope", …) in the face branch — purely additive, existing fields untouched.

Web:

  • refPreview(): bbox present ⇒ whole-photo /derived/thumbnail zoomed via ScopedInstanceThumbnail (the people-page helper family) — bbox wins because it delivers the "Vis område" framing deterministically without the historically-absent face-crop asset (ISSUE-029: 0/16411 faces have thumbnail_derived_asset_id). No bbox ⇒ unchanged face-crop → derived → null chain.
  • refIsFace treats type-less refs with a face id as faces.
  • ScopedInstanceThumbnail: optional dataTestId passthrough so candidate-tile survives.

Tests

  • New discovery-review.spec.ts test: bbox ref renders /derived/thumbnail with crop style, sibling without box keeps face crop with empty style, zero face-crop requests, same assertions on suggestion-detail-crops.
  • No existing expectations changed (all pre-existing fixtures lack scope).
  • svelte-check 0 errors; vitest 66/66; playwright discovery-review 110/110; regression sweep 192 passed (2 flaky on unrelated assertions, green on retry); :apps:api:test BUILD SUCCESSFUL.

Version

gradle.properties 1.21.66 → 1.21.67 (API-touching).

## Problem Suggestion-carousel face thumbnails showed the whole photo instead of zooming onto the face (user request: same framing as the people page's "Vis område" toggle). ## Root cause - `enrichEvidenceRefs` only enriched refs with `type: "face_annotation"`, but `discovery_people` refs historically carry just `mediaItemId` + face id (no `type`) — those fell into the else branch and got the whole-photo `/derived/thumbnail` URL, short-circuiting the client's face-crop builder. - Refs carried no `scope`, so even a client-built URL had nothing to zoom with. ## Fix (additive both sides) **Backend** (`ClassInstanceDiscoveryService`): - `isFaceEvidenceRef()`: declared type trusted when present, else face id ⇒ face (mirrors client `refIsFace` / `occurrenceType()`). - `scopeByFaceAnnotationIds()`: batched `discovery_results.scope` lookup (same filters as `representativeBboxByMediaItem`: `state <> 'superseded'`, `lifecycle_state = 'active'`), `putIfAbsent("scope", …)` in the face branch — purely additive, existing fields untouched. **Web**: - `refPreview()`: bbox present ⇒ whole-photo `/derived/thumbnail` zoomed via `ScopedInstanceThumbnail` (the people-page helper family) — bbox wins because it delivers the "Vis område" framing deterministically without the historically-absent face-crop asset (ISSUE-029: 0/16411 faces have `thumbnail_derived_asset_id`). No bbox ⇒ unchanged face-crop → derived → null chain. - `refIsFace` treats type-less refs with a face id as faces. - `ScopedInstanceThumbnail`: optional `dataTestId` passthrough so `candidate-tile` survives. ## Tests - New `discovery-review.spec.ts` test: bbox ref renders `/derived/thumbnail` with crop style, sibling without box keeps face crop with empty style, zero face-crop requests, same assertions on `suggestion-detail-crops`. - No existing expectations changed (all pre-existing fixtures lack `scope`). - svelte-check 0 errors; vitest 66/66; playwright discovery-review **110/110**; regression sweep 192 passed (2 flaky on unrelated assertions, green on retry); `:apps:api:test` BUILD SUCCESSFUL. ## Version `gradle.properties` 1.21.66 → **1.21.67** (API-touching).
feat(web): zoom suggestion-carousel face tiles onto the face box
All checks were successful
Wiki Sync / Sync wiki from docs (push) Has been skipped
Build and Deploy / Detect changed services and test scopes (push) Successful in 2s
Build and Deploy / Android unit tests and debug APK (push) Has been skipped
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 / Smoke people worker (push) Has been skipped
Build and Deploy / Build postgres image (push) Has been skipped
Build and Deploy / Build plants worker image (push) Has been skipped
Build and Deploy / Build converter worker image (push) Has been skipped
Build and Deploy / Deploy postgres (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 people 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 10m54s
20abc0b5e1
Card tiles and detail-dialog crops showed the whole photo whenever a
candidate ref's thumbnailUrl fell through to `/derived/thumbnail`, so the
intended face was often unidentifiable.

- api: `enrichEvidenceRefs` now detects face evidence the way
  `occurrenceType()` documents it — type-less discovery_people refs that
  carry a face id no longer fall into the whole-photo branch — and additively
  enriches face refs with `scope`, the normalized `discovery_results` face
  box (one extra batched query per listing, no N+1).
- web: `refPreview()` resolves each ref into {croppedUrl, plainUrl, bbox};
  card tiles and detail-dialog crops both render through
  `ScopedInstanceThumbnail`, so a ref with a box zooms the whole photo onto
  the face (same result as the people page "Vis område" toggle) while refs
  without a box keep their server face crop.
- ScopedInstanceThumbnail gains an optional `dataTestId` passthrough.

Bumps memoriesVersion to 1.21.67 (origin/main already moved to 1.21.66).
chris merged commit 5db437633b into main 2026-10-06 00:43:11 +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!1046
No description provided.