feat(api,web): reader sweep + tentative confirm flows (spec 048 P2) #894
Loading…
Reference in a new issue
No description provided.
Delete branch "spec/048-p2-readers-ui"
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?
Summary
Spec 048 P2: the reader sweep to content = accepted+tentative / anchors = accepted-only, tentative-aware confirm/move/remove lifecycle, and the web flows that make "Confirmed" honest and auto-assigned faces curatable. Worker untouched; no migration (V141 already shipped in P1).
CT reader sweep (files/sites)
ClassInstanceDiscoveryService:occurrences()listing; similarity/ranking cluster (suggestSimilarInstances,personRanking,mergeSuggestion,mergeTargetRankings+ their counts/embedding reads);setRepresentativeMedia.matchCandidateToExistingInstanceanchors, consensus core, export split (WorkerJobEnqueueService, already state-derived) and the disband signature stay accepted-only.ClassInstanceService: person listing visibility/counts/representative already CT from the merge-gate fix; P2 adds archive-emptiness (archiveEmptyUnnamedCandidates/archivableGenericUnnamedCandidateIds— a tentative-only unnamed instance is NOT empty), remove/move selections (activeOccurrencesForMedia),currentAssignmentForFace, assignment-provenance lists,markGenericPeopleOccurrenceRemoved,updateGenericPeopleRepresentativeFace.EmbeddingKnnService: nativenearestPerInstancenow CT (closes the 047 residual).DiscoveryService: instance timeline days + items (person markers) CT.ClassInstanceFaceThumbnailService: CT.CollaborativeClassInstancePeopleBridge: owner/shared person face views CT; per-faceassignment_statederivesauto_assignedfrom the tentative state so shared views label them "Auto-assigned" (seeding of contributions stays accepted-only).assignmentStatederivation switched fromassignment_basisto the occurrence state (state is the semantics; P3 drops the column);autoAssignedCountand the carousel auto-assigned-ref clause follow.Lifecycle / confirm semantics
moveOccurrences): an owner move of a tentative occurrence re-points it and writesstate='accepted'+assignment_basis='user_confirmed'.removeOccurrences,unassignFace,markGenericPeopleOccurrenceRemoved): row goesremoved; the face is released toowner_tentativewhen no live occurrence remains (newreleasePeopleFaceIfUnassigned).PeopleDomainCandidateDecisionStrategy.afterRejectionsupersedes bycandidate_idbefore the face-release check).confirmOccurrences): selection includes tentatives, upgrades them in place (accepted+user_confirmed), and supersedes a pending card whose refs are a subset of the confirmed faces (silent supersede — same machinery as the skew guard, no rejection). Cards not fully covered are still accepted onto the instance as before.confirmTentativeCandidatesvia/class-instances/{id}/candidates/confirm): a reported residual — the insert-only path could skip faces that already carry a tentative occurrence on the target — is closed with a guarded in-place upgrade (PGON CONFLICT ... DO UPDATE ... WHERE state='tentative' AND same instance AND :allowTentativeUpgrade; H2MERGE ... WHEN MATCHED AND (superseded OR tentative-same-target)). The guard is only enabled for owner-triggered confirms, so every automated path stays strictly insert-only (unassigned-faces-only invariant).Web
assignmentStateunions extended (auto_assigned,partially_auto_assigned) for person/media/face-assignment/resolved/shared views.auto_assigneditems too (button count, selection, confirm call) and hitsconfirmOccurrences(upgrade + card supersede).MediaGridgains an optionalitemActionsprop rendered with the existing circular icon-button idiom; actions call the existing per-face endpoints (assignFaceToPersonto this person = confirm,unassignFace= remove) and refresh the person detail. No new design patterns; StashDisbandSplit untouched.decideCandidate/candidate endpoints, which now upgrade/release tentatives server-side — no web change needed.Deploy-window closure
supersededvalue and P2 adds no migration).Tests
rtk ./gradlew :apps:api:test --no-daemon→ 1279 tests, 0 failures, 9 skipped.nativePerInstanceIncludesTentativeOccurrence; PG archive-emptiness keeps a tentative-only unnamed source active; PG move-of-tentative → accepted+user_confirmed and remove → released; H2 confirm-upgrade + covered-card supersede; H2 + PG ref-scoped in-place upgrade (id preserved); H2 move/remove/unassign tentative variants.npm run check→ 0 errors (20 pre-existing warnings);npm run build→ success.Notes for P3 (T004)
assignment_basis: write sites (accept unit, revive, upsert, ClassInstanceService confirm/move assignments), remaining reads (per-row derivation still selects the column in CTEs,allFaceRefsAlreadyAcceptedOnInstanceno longer uses it, anchors/consensus predicates), migration + H2 schema, and the spec-045 tests that seed basis.