fix(api): cap silent auto-assignment candidate size (Holger bulk incident) #892
Loading…
Reference in a new issue
No description provided.
Delete branch "hotfix/silent-auto-action-size-cap"
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?
Incident (prod, 2026-09-26 18:49)
After a 2190-face stash was disbanded, the next recognition run re-formed the identical DBSCAN density-chained blob as one
new_person_clustercandidate. Spec 047's new medium tier (auto_assigned_named_target_medium_band) then silently assigned all 2190 faces to named person "Holger" (0ec6cd50-6fda-4b5a-8990-dcc24e7ebe37) because:Fix
persistWorkerCandidatesnow computesoccurrenceRefs.size() <= SILENT_ACTION_MAX_CANDIDATE_FACESonce per candidate, before any band/consensus/embedding work (cheap first), and every silent automatic action skips oversized candidates:auto_assigned_named_target_medium_bandauto_assigned_named_target_medium_bandauto_accepted_stashed_targetauto_accepted_existing_instance_candidateauto_accepted_existing_instance_candidateSemantics: an oversized candidate is not rejected — it stays PENDING and surfaces as a regular suggestion card for explicit owner review. Explicit owner decisions (
decideCandidate/acceptCandidateForExistingInstance) are never capped.Cap value: 25 (code constant, no migration)
Checked
discovery_domainsup to the latest migration V140 (re-checked on origin/main per ISSUE-071): no column fits the knob (embedding_matching_max_resultsis a match-result limit, not a face-count cap), soSILENT_ACTION_MAX_CANDIDATE_FACES = 25is a named constant with a comment referencing this incident. No migration added.Tests
Spec047SilentActionCapPostgresTest(5 tests): a 60-face candidate in-band with a consensus-satisfying target stays PENDING with zero occurrences / no review decision on all four silent paths; below-cap 3-face control still auto-assigns. Verified red before the fix (the 4 oversized tests fail on unpatched code) and green after.ClassInstanceDiscoveryServiceTest: oversized 26-face candidate stays pending on medium/stash/strong paths; below-cap control still auto-assigns.Validation
rtk ./gradlew :apps:api:test --no-daemon: BUILD SUCCESSFUL — 122 test classes, 1252 tests, 0 failures, 0 errors, 9 skipped (includes both new test classes and the full Testcontainers suite).ci/*-api-verifyverification-branch workflow exists in.forgejo/workflowson main; the PR lane's scoped detection marksapps/api/*asrun_api_tests, so CI runs the full API suite for this PR.Refs: spec 047. KNOWN_ISSUES entry added in a follow-up commit.