fix(discovery): suggestSimilarInstances preview follows accepted-first representative rule (ISSUE-112) #1144

Merged
chris merged 1 commit from fix/issue-112-suggest-similar-thumbnails into main 2026-10-12 15:48:54 +02:00
Owner

Summary

The media-viewer „Assign person" dropdown (suggested-people rows, GET /api/discovery/domains/{domain}/instance-suggestions → suggestSimilarInstances) showed tentative (auto-assigned, unconfirmed) face crops as person previews: three inline thumbnail subqueries picked an arbitrary accepted-or-tentative crop (LIMIT 1, no ORDER BY, no named-instance guard).

This is ISSUE-112 — the same bug class fixed for the picker rankings in 9e11330d, deliberately left untouched there to keep that PR thumbnail-only. Not a regression from the picker-latency work (method byte-identical before/after 0740cf3f).

Change

All three subqueries (embedding path, ILIKE name-search fallback, blank-query named-instance listing) now interpolate the shared REPRESENTATIVE_FACE_THUMBNAIL_SUBQUERY, i.e. the ISSUE-095 rule:

  1. pinned manual representative (representative_occurrence_id) wins,
  2. accepted beats tentative regardless of recency,
  3. named instances never serve a tentative crop (fall back to null),
  4. unnamed instances keep tentative crops as last-resort fallback.

Display-only — scores, occurrence counts, filters, result ordering and DTOs unchanged.

Validation

  • 6 regression tests across all three statements (named-only-tentative → null; unnamed keeps tentative; accepted beats newer tentative; pin beats newer accepted; name-search + blank-query fallbacks)
  • Red on unmodified main: expected: null but was: /api/media/…/faces/…/thumbnail (tentative crop)
  • Green with fix: ClassInstanceDiscoveryServiceTest 326/326

Closes ISSUE-112 (KNOWN_ISSURES.md update follows after merge).

## Summary The media-viewer **„Assign person" dropdown** (suggested-people rows, `GET /api/discovery/domains/{domain}/instance-suggestions` → `suggestSimilarInstances`) showed **tentative (auto-assigned, unconfirmed) face crops** as person previews: three inline thumbnail subqueries picked an arbitrary accepted-or-tentative crop (`LIMIT 1`, no ORDER BY, no named-instance guard). This is **ISSUE-112** — the same bug class fixed for the picker rankings in 9e11330d, deliberately left untouched there to keep that PR thumbnail-only. Not a regression from the picker-latency work (method byte-identical before/after 0740cf3f). ## Change All three subqueries (embedding path, ILIKE name-search fallback, blank-query named-instance listing) now interpolate the shared `REPRESENTATIVE_FACE_THUMBNAIL_SUBQUERY`, i.e. the ISSUE-095 rule: 1. pinned manual representative (`representative_occurrence_id`) wins, 2. accepted beats tentative regardless of recency, 3. **named instances never serve a tentative crop** (fall back to null), 4. unnamed instances keep tentative crops as last-resort fallback. Display-only — scores, occurrence counts, filters, result ordering and DTOs unchanged. ## Validation - 6 regression tests across all three statements (named-only-tentative → null; unnamed keeps tentative; accepted beats newer tentative; pin beats newer accepted; name-search + blank-query fallbacks) - **Red on unmodified main**: `expected: null but was: /api/media/…/faces/…/thumbnail` (tentative crop) - **Green with fix**: `ClassInstanceDiscoveryServiceTest` 326/326 Closes ISSUE-112 (KNOWN_ISSURES.md update follows after merge).
fix(discovery): suggestSimilarInstances preview follows accepted-first representative rule (ISSUE-112)
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 5m13s
ad4bfa48dd
The media-viewer 'Assign person' dropdown's suggested-people rows
(suggestSimilarInstances, GET /api/discovery/domains/{domain}/instance-
suggestions) derived thumbnail_url from three inline subqueries that
picked an arbitrary accepted-or-tentative face crop (LIMIT 1, no ORDER
BY, no named-instance guard) — a named person could surface a tentative
(auto-assigned, unconfirmed) face as the preview.

All three subqueries (embedding path, ILIKE name-search fallback,
blank-query named-instance listing) now use the shared
REPRESENTATIVE_FACE_THUMBNAIL_SUBQUERY, the exact rule the picker
rankings got in 9e11330d: pinned representative first, accepted beats
tentative regardless of recency, named instances never serve a
tentative crop, unnamed keep it as last-resort fallback. Display-only:
scores, occurrence counts, filters and result ordering unchanged.

Six regression tests across all three statements; red on unmodified
main (expected null, got tentative crop URL), green with the fix
(ClassInstanceDiscoveryServiceTest 326/326).
chris merged commit 261a1ba735 into main 2026-10-12 15:48:54 +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!1144
No description provided.