fix(people): pipeline fixes — embedding UNION ALL, auto-create persons, periodic scan #625

Merged
chris merged 7 commits from fix/people-pipeline-coupled-fixes into main 2026-07-15 09:22:42 +02:00
Owner

Summary\n\nFixes 3 coupled pipeline failures preventing /people from working after V115:\n\n### P0 — Embedding chicken-and-egg\nOwnerFaceEmbeddingsController now includes pending_face_embeddings via UNION ALL CTE. When no accepted occurrences exist, embeddings from pending_face_embeddings are returned. Dedup prefers accepted over pending for same (face_annotation_id, model_name, model_version).\n\n### P1 — Auto-create first persons\npersistWorkerCandidates auto-creates class_instance + accepted occurrences for new_person_cluster candidates when no embedding match found. Guarded by !autoMatched flag to prevent double-creation after embedding match.\n\n### P2 — Periodic recognition scan\nCherry-picked from unmerged PR #603: PeopleDiscoveryRecognitionScheduler with @Scheduled(fixedDelay=300000) scans for owner_tentative results and enqueues owner face recognition jobs. Idempotent via NOT EXISTS subquery.\n\n## Commits\n- feat(people): add periodic recognition scan scheduler (@Scheduled 5min)\n- fix(people): add error handling in scan loop + scheduler tests\n- fix(people): include pending_face_embeddings in embedding query (UNION ALL)\n- fix(people): auto-create persons for new_person_cluster candidates\n- fix(people): guard auto-create to prevent firing after embedding match\n- fix(tests): update MLResultAcceptanceTest assertions for P1 auto-create\n- chore: bump version to 1.12\n\n## Test results\n- Full API test suite: BUILD SUCCESSFUL (713 tests, 0 failures)\n- PeopleDiscoveryPostCompletionListenerTest: 18/18\n- MLResultAcceptanceTest: 28/28\n- PeopleDiscoveryRecognitionSchedulerTest: 8/8

## Summary\n\nFixes 3 coupled pipeline failures preventing /people from working after V115:\n\n### P0 — Embedding chicken-and-egg\nOwnerFaceEmbeddingsController now includes pending_face_embeddings via UNION ALL CTE. When no accepted occurrences exist, embeddings from pending_face_embeddings are returned. Dedup prefers accepted over pending for same (face_annotation_id, model_name, model_version).\n\n### P1 — Auto-create first persons\npersistWorkerCandidates auto-creates class_instance + accepted occurrences for new_person_cluster candidates when no embedding match found. Guarded by !autoMatched flag to prevent double-creation after embedding match.\n\n### P2 — Periodic recognition scan\nCherry-picked from unmerged PR #603: PeopleDiscoveryRecognitionScheduler with @Scheduled(fixedDelay=300000) scans for owner_tentative results and enqueues owner face recognition jobs. Idempotent via NOT EXISTS subquery.\n\n## Commits\n- feat(people): add periodic recognition scan scheduler (@Scheduled 5min)\n- fix(people): add error handling in scan loop + scheduler tests\n- fix(people): include pending_face_embeddings in embedding query (UNION ALL)\n- fix(people): auto-create persons for new_person_cluster candidates\n- fix(people): guard auto-create to prevent firing after embedding match\n- fix(tests): update MLResultAcceptanceTest assertions for P1 auto-create\n- chore: bump version to 1.12\n\n## Test results\n- Full API test suite: BUILD SUCCESSFUL (713 tests, 0 failures)\n- PeopleDiscoveryPostCompletionListenerTest: 18/18\n- MLResultAcceptanceTest: 28/28\n- PeopleDiscoveryRecognitionSchedulerTest: 8/8
PeopleDiscoveryRecognitionScheduler scans owners with unrecognized
discovery_results (state='owner_tentative') every 5 minutes and
triggers owner_face_recognition jobs if due. Idempotent — skips
owners with pending recognition jobs.
- Wrap each owner enqueue call in try-catch; one failure must not abort scan
- Add PeopleDiscoveryRecognitionSchedulerTest covering:
  - Happy path: owner_tentative → scan enqueues job
  - Empty: no tentative results → no jobs
  - Idempotency: pending job → skipped
  - Completed job → re-enqueues
  - Multiple owners → each enqueued
  - Non-people domain results ignored
  - Non-tentative state ignored
  - Correct payload fields (ownerId, domainKey, maxDistance)
fix(people): guard auto-create to prevent firing after embedding match
All checks were successful
Build and Deploy / Detect changed services and test scopes (push) Successful in 2s
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 3m10s
db1a1ef7d1
chris merged commit eed7ef2b8f into main 2026-07-15 09:22:42 +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!625
No description provided.