feat(web): zoomed face tiles render the spec-052 scope-crop asset, CSS-zoom fallback #1058

Merged
chris merged 1 commit from feat/face-scope-crop-web into main 2026-10-07 08:56:58 +02:00
Owner

Spec 052, task S052T003 (web consumption). Web-only — no version bump.

What

Wherever a zoomed face-region view renders today (whole photo ?size=512 +
scopeCropFit), the ref now first asks for the pre-composed scope crop and
renders it 1:1:

  • Carousel card tiles + detail-dialog crops (DomainSuggestionsCarousel.svelte,
    the refTileMedia / candidate-face-zoom paths from #1054): a ref with a
    boundingBox (+ media item + face annotation id) requests
    /api/media/{mediaItemId}/faces/{faceAnnotationId}/thumbnail?size=512&crop=scope
    and renders it with object-fit: cover only — no transform, no object-position
    slice shift.
  • People-page "Vis område" (DiscoveryInstanceDetail.svelte, the two
    candidate-scope-crop render sites, now one candidateZoomMedia snippet): same
    1:1 rendering, face annotation id taken from the candidate's first
    face_annotation ref (the same ref representativeBbox is resolved from
    server-side).

Fallback (deploy order does not matter)

The scope attempt is a plain <img> — deliberately not ThumbnailImage, so a
missing asset never enters the derived-asset retry loop (10 × 6 s cache-busted
probes). On error (404 / older API build) the URL is recorded in a component
SvelteSet, and that tile and every other surface showing the same face
(card tile + dialog crop) re-renders through the existing whole-photo
derived/thumbnail?size=512 + scopeCropFit path. The failure is remembered, so
the dialog never re-asks for a known-missing asset (one 404 total).

Box-less refs and the legacy scope-lane rendering are untouched.

Shared URL builder: src/lib/utils/scopeAsset.ts (faceScopeThumbnailUrl).

Tests

apps/web/tests/discovery-review.spec.ts

  • rewritten: boundingBox refs request the scope crop and render it without a
    transform; box-less refs keep the face crop
    — card and dialog assert
    size=512&crop=scope, data-scope-asset="true", no transform:, zero
    ?size=512 whole-photo requests, zero tight-face-crop requests, box-less
    sibling unchanged.
  • new: a missing scope crop asset falls back to the whole-photo scopeCropFit
    zoom on tile and dialog
    — crop=scope mocked 404 → card + dialog render
    ?size=512 with transform:, exactly one scope request (recorded
    failure reused by the dialog).

apps/web/tests/discovery-instance-tentative.spec.ts

  • rewritten: region overlay toggle switches bbox candidates to the pre-composed
    scope crop
    — exact src with size=512&crop=scope, naturalWidth > 0, no
    transform, zero whole-photo requests.
  • new: region overlay falls back to the whole-photo zoom when the scope crop
    asset is missing
    — 404 → scale( transform + whole photo fetched.

Verification

  • npm run check → 0 errors (22 warnings, unchanged from baseline).
  • npm test (full Playwright suite, desktop + mobile) → 815 passed, 23
    skipped, 0 failed
    .

Bookkeeping

  • KNOWN_ISSUES.md → [ISSUE-107] low open area:web (blurry zoomed face tiles,
    being fixed by these assets) [spec:052].
  • spec-query: S052T003 pending → done (committed in this PR).

Note for the API lane

Spec S3 says crop=scope falls back to the tight face crop when the scope
asset is absent, while this lane's contract says 404 → fall back. The web
handles both: 404 → CSS-zoom fallback (tested); a 200 tight crop is rendered 1:1
(sharp, but without the context margin). Worth confirming which one the API
implements.

Spec 052, task `S052T003` (web consumption). Web-only — no version bump. ## What Wherever a zoomed face-region view renders today (whole photo `?size=512` + `scopeCropFit`), the ref now first asks for the pre-composed scope crop and renders it **1:1**: * **Carousel card tiles + detail-dialog crops** (`DomainSuggestionsCarousel.svelte`, the `refTileMedia` / `candidate-face-zoom` paths from #1054): a ref with a `boundingBox` (+ media item + face annotation id) requests `/api/media/{mediaItemId}/faces/{faceAnnotationId}/thumbnail?size=512&crop=scope` and renders it with `object-fit: cover` only — no transform, no object-position slice shift. * **People-page "Vis område"** (`DiscoveryInstanceDetail.svelte`, the two `candidate-scope-crop` render sites, now one `candidateZoomMedia` snippet): same 1:1 rendering, face annotation id taken from the candidate's first `face_annotation` ref (the same ref `representativeBbox` is resolved from server-side). ## Fallback (deploy order does not matter) The scope attempt is a **plain `<img>`** — deliberately not `ThumbnailImage`, so a missing asset never enters the derived-asset retry loop (10 × 6 s cache-busted probes). On `error` (404 / older API build) the URL is recorded in a component `SvelteSet`, and that tile **and every other surface showing the same face** (card tile + dialog crop) re-renders through the existing whole-photo `derived/thumbnail?size=512` + `scopeCropFit` path. The failure is remembered, so the dialog never re-asks for a known-missing asset (one 404 total). Box-less refs and the legacy `scope`-lane rendering are untouched. Shared URL builder: `src/lib/utils/scopeAsset.ts` (`faceScopeThumbnailUrl`). ## Tests `apps/web/tests/discovery-review.spec.ts` * rewritten: *boundingBox refs request the scope crop and render it without a transform; box-less refs keep the face crop* — card **and** dialog assert `size=512&crop=scope`, `data-scope-asset="true"`, no `transform:`, zero `?size=512` whole-photo requests, zero tight-face-crop requests, box-less sibling unchanged. * new: *a missing scope crop asset falls back to the whole-photo scopeCropFit zoom on tile and dialog* — `crop=scope` mocked 404 → card + dialog render `?size=512` with `transform:`, exactly **one** scope request (recorded failure reused by the dialog). `apps/web/tests/discovery-instance-tentative.spec.ts` * rewritten: *region overlay toggle switches bbox candidates to the pre-composed scope crop* — exact `src` with `size=512&crop=scope`, `naturalWidth > 0`, no transform, **zero** whole-photo requests. * new: *region overlay falls back to the whole-photo zoom when the scope crop asset is missing* — 404 → `scale(` transform + whole photo fetched. ## Verification * `npm run check` → **0 errors** (22 warnings, unchanged from baseline). * `npm test` (full Playwright suite, desktop + mobile) → **815 passed, 23 skipped, 0 failed**. ## Bookkeeping * `KNOWN_ISSUES.md` → `[ISSUE-107] low open area:web` (blurry zoomed face tiles, being fixed by these assets) `[spec:052]`. * spec-query: `S052T003` pending → **done** (committed in this PR). ## Note for the API lane Spec S3 says `crop=scope` falls back to the *tight face crop* when the scope asset is absent, while this lane's contract says *404 → fall back*. The web handles both: 404 → CSS-zoom fallback (tested); a 200 tight crop is rendered 1:1 (sharp, but without the context margin). Worth confirming which one the API implements.
feat(web): zoomed face tiles use the spec-052 scope-crop asset, CSS-zoom fallback
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 3m51s
297e1a2ea5
Carousel card tiles, carousel detail-dialog crops and the people-page
"Vis område" cards now ask for the pre-composed scope crop
(`faces/{faceId}/thumbnail?size=512&crop=scope`) whenever the ref carries a
boundingBox, and render it 1:1 (object-fit: cover, no transform, no slice
shift) — the asset already frames bbox + context, so tiles stop CSS-zooming a
512px whole photo (ISSUE-107).

Fallback is per-URL and immediate: a plain <img> (not ThumbnailImage, so a 404
never enters the derived-asset retry loop) records the failure in a reactive
set shared by card and dialog, and every surface showing that face re-renders
through the existing whole-photo ?size=512 + scopeCropFit path — worker/API/web
deploy order does not matter. Box-less refs and the legacy `scope` lane are
untouched.

Tests: scope request + no-transform render (card + dialog), 404 fallback
(card + dialog, one failed request only), box-less ref unchanged, people-page
Vis område scope asset + its 404 fallback. [ISSUE-107] logged, S052T003 done.
chris force-pushed feat/face-scope-crop-web from 297e1a2ea5
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 3m51s
to a3c0b07fe6
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 4s
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 5m10s
2026-10-07 08:46:43 +02:00
Compare
chris merged commit a131a349f6 into main 2026-10-07 08:56:58 +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!1058
No description provided.