refactor(workers/ml): remove dormant legacy face stack (spec 014 phase 2, worker slice) #702
Loading…
Reference in a new issue
No description provided.
Delete branch "feature/ml-face-code-removal"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Remove the dormant legacy people/face code from
workers/ml(spec 014 phase 2, worker slice). Net: 760 lines deleted, 9 added.Deleted from
workers/ml:FaceDetectionConfig,InsightFaceRetinaFaceDetector,_normalized_embedding_or_none,_owner_face_embeddings,_owner_face_assignments,_best_existing_person_match,_density_clusters,_neighborhood,_cosine_distance,_landmarks_at,FACE_THUMBNAIL_SIZES,_face_thumbnail_jpegface_detection+owner_face_recognitionhandlers and their dispatch entries;face_detectorctor paramcore_api.py:fetch_owner_face_embeddings()and theface_thumbnailidempotency special-casemain.py:face_detection,owner_face_recognitionremoved from default advertised capabilitiespyproject.toml:insightface+opencv-python-headlessdeps; description rewordedcompose.yaml:MEMORIES_ML_FACE_DETECTION_MODEL_PATH/MEMORIES_ML_FACE_RECOGNITION_MODEL_PATHenv lines removed; capabilities env updateddeploy/README.md: face detection row in ML profile table + service description rewordedworkers/ml/README.md: face section deleted; people section rewritten (ML worker handles no face-domain jobs; both face job types → unsupported)Kept (verified by grep before deleting):
_box_iou,_non_max_suppressed_concepts,_clamp(visual-concepts L774-777 + album-shape L1284/L1294 callers),_embedding_hash(semantic_embedding ~L1193),_normalize,_input_size, display-oriented image helpers,math/hashlibimports, all other handlers (semantic_embedding, visual_concept_detection, discovery_test_image_labels, album_shape_proposal_train/score).Why (dormancy evidence)
discovery_people+owner_face_recognition(compose capabilities L236).face_detectionin the default Compose deployment.Out of scope (untouched)
acceptFaceCandidate(apps/api)workers/people/(owns discovery_people + owner_face_recognition)generate_face_thumbnail(compose L131)deploy/example.env+deploy/tests/restore-validation.shstill mentionMEMORIES_ML_FACE_*(bootstrap-hint vars for the Core model-profile system, not consumed by the ML worker; flagged for follow-up cleanup)Verification
Step A grep results (pre-deletion):
_clampin jobs.py: face callers (deleted) + visual-concepts L774-777 + album-shape L1284/L1294 → kept_embedding_hash: face caller (deleted) + semantic_embedding L1193 → keptinsightface: only inside deleted InsightFaceRetinaFaceDetector → goneimport cv2: zero direct imports anywhere under workers/ml → opencv-python-headless removed (InsightFace transitive only)MEMORIES_ML_FACE: jobs.py (deleted) + compose.yaml L164-165 (deleted); deploy/example.env + restore-validation.sh leftovers noted aboveface_thumbnail/fetch_owner_face_embeddingsin core_api.py: only face handlers used them → both removedPost-change:
rg -i "face|people|person|insightface|retinaface|arcface" workers/ml/→ only false positives: HEIC/HEIF substring in an unrelated comment, plus the new README section explaining people-worker ownership. No code hits.Tests: full ML suite green, 19 tests (was 34): removed FakeRetinaFace, insightface module stubs (onnxruntime stub kept), FakeFaceDetector/FailingFaceDetector, FakeClient face-embedding fields, and 12 face/owner-face tests incl. legacy face_recognition/face_clustering fallback tests. All album-shape, visual-concepts, semantic, display-oriented EXIF, and claim-drain tests kept (claim-drain fixture capability renamed to semantic_embedding).
ruff check workers/ml/F401/F821/F841: 3 baseline errors → 1 (pre-existing undefinedLOGGERin main.py, untouched region); total ruff findings 19 → 15 (all pre-existing style rules; zero new).Known unrelated: 8 known Playwright failures on main, unrelated to this change.
No schema changes, no API changes.