fix(api): resolve embeddingString missing candidate.modelName lookup #637

Merged
chris merged 1 commit from fix/people-regressions into main 2026-07-18 11:14:30 +02:00
Owner

Root Cause

embeddingString() only checked candidate.embeddingModelName and candidate.faceEmbedding.modelName, ignoring candidate.modelName sent directly by the people worker.

For discovery_people jobs, the worker sends modelName (e.g. arcface-r50) in each face candidate. But upsertDiscoveryPeopleFaceEmbeddings passes the job payload's modelName as the default — and the discoveryPayload doesn't include modelName. All three lookups returned null, so embeddings were buffered to pending_face_embeddings with model_name = null.

When PendingEmbeddingFlushListener later tried to INSERT into class_occurrence_embeddings (which has model_name VARCHAR(255) NOT NULL\}), the INSERT failed silently (listener transaction rolled back). The 24h cleanup in PendingEmbeddingReconciliationScheduler` then deleted the orphaned pending embeddings.

Result: both class_occurrence_embeddings and pending_face_embeddings empty → no merge suggestions on people page.

Fix

Added candidate.get(nestedKey) as a third fallback in embeddingString(), before the defaultValue. This picks up the worker's modelName from the candidate when embeddingModelName isn't set.

## Root Cause `embeddingString()` only checked `candidate.embeddingModelName` and `candidate.faceEmbedding.modelName`, ignoring `candidate.modelName` sent directly by the people worker. For `discovery_people` jobs, the worker sends `modelName` (e.g. `arcface-r50`) in each face candidate. But `upsertDiscoveryPeopleFaceEmbeddings` passes the job payload's `modelName` as the default — and the `discoveryPayload` doesn't include `modelName`. All three lookups returned null, so embeddings were buffered to `pending_face_embeddings` with `model_name = null`. When `PendingEmbeddingFlushListener` later tried to INSERT into `class_occurrence_embeddings` (which has `model_name VARCHAR(255) NOT NULL\}), the INSERT failed silently (listener transaction rolled back). The 24h cleanup in `PendingEmbeddingReconciliationScheduler` then deleted the orphaned pending embeddings. Result: both `class_occurrence_embeddings` and `pending_face_embeddings` empty → no merge suggestions on people page. ## Fix Added `candidate.get(nestedKey)` as a third fallback in `embeddingString()`, before the `defaultValue`. This picks up the worker's `modelName` from the candidate when `embeddingModelName` isn't set.
fix(api): resolve embeddingString missing candidate.modelName lookup
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 web image (push) Has been skipped
Build and Deploy / Build ML worker 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 2m5s
2f44b16b7c
embeddingString() only checked candidate.embeddingModelName and
candidate.faceEmbedding.modelName, ignoring candidate.modelName sent
by the people worker. This left modelName null when buffering pending
face embeddings from discovery_people jobs, causing the flush into
class_occurrence_embeddings (NOT NULL model_name) to fail silently.

Both class_occurrence_embeddings and pending_face_embeddings ended up
empty — breaking merge suggestions on the people page.

Added candidate.get(nestedKey) as a third fallback before defaultValue.
chris merged commit 85e054379f into main 2026-07-18 11:14:30 +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!637
No description provided.