fix(api/people): include confirmed (state='accepted') anchors in owner-face-embeddings feed #976

Merged
chris merged 1 commit from fix/anchor-feed-accepted-state into main 2026-10-01 10:42:23 +02:00
Owner

PR #969 shipped the constrained forward clustering (ADR 0100). PR #975 fixed the worker segfault (OOM at 26k faces). This PR fixes the remaining defect that keeps merge suggestions from appearing.

Chain: auto-accept (06:37 today, 50 accepted new_person_cluster candidates) moved those faces' discovery_results.state to accepted via PeopleDomainCandidateDecisionStrategy.afterAcceptance. But the accepted-occurrence branch of GET /api/worker/jobs/{id}/owner-face-embeddings filters dr.state IN ('owner_tentative','owner_recognized') — so all 289 anchor embeddings (193 assignments in payload, 289 accepted faces with occurrence embeddings) are missing from the feed the worker fetches.

Consequence: _anchor_labels(embeddings, assignments) returns {} (anchors must exist in the feed) → zero graph identities → every component takes the 0-identity path → 100% new_person_cluster, no existing_person_match, no cluster_person_match, no suggestions for existing people. Verified against prod DB: exact feed CTE returns 9399 pending rows, 0 accepted-branch rows, while 289 anchors with embeddings exist.

Fix: admit dr.state = 'accepted' in the accepted-occurrence branch. Still gated on accepted people occurrence + stored occurrence embedding, so nothing but confirmed anchor faces is re-exposed. Tentative/pending branch unchanged.

Test: returnsConfirmedAnchorFacesWithAcceptedDiscoveryState (Testcontainers, mirrors existing suite): accepted-state anchor + owner_tentative face both appear in the feed response.

Post-merge

Re-trigger recognition (dirty mark). The next run should finally produce existing_person_match / cluster_person_match suggestions against the 195 confirmed anchors.

## Root cause of 'carousel only shows new people' (part 2 of the clustering regression) PR #969 shipped the constrained forward clustering (ADR 0100). PR #975 fixed the worker segfault (OOM at 26k faces). This PR fixes the remaining defect that keeps merge suggestions from appearing. **Chain:** auto-accept (06:37 today, 50 accepted `new_person_cluster` candidates) moved those faces' `discovery_results.state` to `accepted` via `PeopleDomainCandidateDecisionStrategy.afterAcceptance`. But the accepted-occurrence branch of `GET /api/worker/jobs/{id}/owner-face-embeddings` filters `dr.state IN ('owner_tentative','owner_recognized')` — so all 289 anchor embeddings (193 assignments in payload, 289 accepted faces with occurrence embeddings) are **missing from the feed** the worker fetches. **Consequence:** `_anchor_labels(embeddings, assignments)` returns `{}` (anchors must exist in the feed) → zero graph identities → every component takes the 0-identity path → 100% `new_person_cluster`, no `existing_person_match`, no `cluster_person_match`, no suggestions for existing people. Verified against prod DB: exact feed CTE returns 9399 pending rows, 0 accepted-branch rows, while 289 anchors with embeddings exist. **Fix:** admit `dr.state = 'accepted'` in the accepted-occurrence branch. Still gated on accepted people occurrence + stored occurrence embedding, so nothing but confirmed anchor faces is re-exposed. Tentative/pending branch unchanged. **Test:** `returnsConfirmedAnchorFacesWithAcceptedDiscoveryState` (Testcontainers, mirrors existing suite): accepted-state anchor + owner_tentative face both appear in the feed response. ## Post-merge Re-trigger recognition (dirty mark). The next run should finally produce `existing_person_match` / `cluster_person_match` suggestions against the 195 confirmed anchors.
fix(api/people): include confirmed (state='accepted') anchors in owner-face-embeddings feed
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 / Build plants worker image (push) Has been skipped
Build and Deploy / Build converter worker image (push) Has been skipped
Build and Deploy / Build postgres image (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 / 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 3m48s
368c1a7af4
Auto-accepted candidates move discovery_results.state to 'accepted'
(PeopleDomainCandidateDecisionStrategy.afterAcceptance), but the
accepted-occurrence branch of the owner-face-embeddings feed only
admitted owner_tentative/owner_recognized faces. Every confirmed anchor
therefore vanished from the worker's embedding feed: _anchor_labels
resolves against feed ids only, so the constrained density pass
(ADR 0100) found zero anchors, zero identities per component, and every
unassigned face degraded to new_person_cluster — the suggestion carousel
only ever offered new people and never merge suggestions after the
first auto-accept round (ISSUE-082).

Admit dr.state='accepted' in the accepted-occurrence branch. The branch
still requires an accepted people occurrence plus a stored
class_occurrence_embedding, so this only re-exposes faces the worker
explicitly needs as anchors; the tentative branch (raw pending
embeddings) is unchanged.

Regression test pins: a state='accepted' anchor face and an
owner_tentative face both appear in one feed response (Testcontainers
Postgres, mirroring the existing suite).
chris merged commit 1e5f529176 into main 2026-10-01 10:42:23 +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!976
No description provided.