fix(discovery): only self-exclude live occurrences in instance suggestions #1244
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/face-suggest-self-exclusion"
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?
Problem
In
GET /api/discovery/domains/{domainKey}/instance-suggestions(ClassInstanceDiscoveryService.suggestSimilarInstances), step 0 resolves the source face's own instance for self-exclusion fromclass_instance_occurrenceswithout a state filter. A revoked assignment leaves the occurrence row withstate='removed'still pointing at the previous person, so that person was excluded from all three suggestion paths:Verified live: for unassigned faces the previously assigned person never appeared in the "Assign person" dropdown — even typing their name yielded an empty list.
Fix
Resolve
excludeInstanceIdonly from a LIVE occurrence (cio.state IN ('accepted','tentative')). Aremoved/supersededrow is history: the face is unassigned and the previous person is exactly what the user wants to re-tag.Currently accepted- or tentatively-assigned faces keep excluding their own instance exactly as before.
Tests
Four new regression tests in
ClassInstanceDiscoveryServiceTest:suggestSimilarInstancesSuggestsPreviouslyAssignedPersonAfterAssignmentRemoved— removed occurrence: previous person is ranked (embedding path, pending source embedding) and findable via a typed name query. Fails on unfixed code.suggestSimilarInstancesNameFallbacksSuggestPreviouslyAssignedPersonAfterAssignmentRemoved— removed occurrence with no embeddings: person appears in blank-query named listing and typed ILIKE fallback. Fails on unfixed code.suggestSimilarInstancesStillExcludesCurrentlyAssignedInstance— accepted occurrence: own instance still excluded from all paths.suggestSimilarInstancesStillExcludesTentativelyAssignedInstance— tentative occurrence: own instance still excluded.Verification:
rtk ./gradlew :apps:api:test --tests '*ClassInstanceDiscoveryServiceTest*'— 333 tests, 0 failures. Fullrtk ./gradlew :apps:api:test— BUILD SUCCESSFUL (8m27s).The 'Assign person' dialog resolves the source face's own instance for self-exclusion from class_instance_occurrences without filtering on state. A revoked assignment leaves the occurrence row with state='removed' still pointing at the previous person, so that person was excluded from all three suggestion paths (embedding ranking, typed ILIKE fallback, blank-query named listing) — the user could not re-tag an unassigned face back to the person it was previously assigned to, even by typing their name. Resolve excludeInstanceId only from LIVE occurrences (state IN ('accepted','tentative')). removed/superseded rows no longer suppress the old person; currently accepted- or tentatively-assigned faces keep excluding their own instance exactly as before.a5e506c1013482e21798