refactor(api): drop assignment_basis - state-only semantics (spec 048 P3) #896
Loading…
Reference in a new issue
No description provided.
Delete branch "spec/048-p3-basis-drop"
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 P3 (final phase): retires the spec 045
assignment_basiscolumn so occurrence state alone carries the semantics (accepted = user-confirmed via explicit owner action or owner-activated strong-band policy; tentative = system-assigned awaiting owner review; superseded = released). Forensics remain inclass_instance_review_decisions. Worker untouched.Checklist items (from the P2 merge review) — all done
matchCandidateToExistingInstanceanchors andconsensusPassescore are nowstate='accepted'only; every other double-basis read converted or deleted.acceptedOccurrenceExistsverified + documented. Kept accepted-only ("already user-confirmed on this instance?"), with an explicit doc note: tentative rows are upgraded through the guarded owner paths (upsert / guarded ON CONFLICT DO UPDATE) or counted as live assignments by the insert-only no-steal arms — never conflicts.occurrenceBasis/BASIS_*removed fromCandidateDecisionContext, the accept unit,insertOccurrenceNoSteal(H2MERGE USING+ PGON CONFLICTarms),reviveSupersededOccurrence,upsertCandidateOccurrence, and all call sites; SQL column lists writestateonly.tentativeAssignmentsreview endpoint retired. The owner-wideClassInstanceService.tentativeAssignments(userAccountId)method had no controller mapping, no web caller, and no test caller — deleted (state-based auto-assigned views replaced it in P2).FaceRecognitionProgressService.tentativeWithEmbedding,FaceRecognitionReconcileSchedulersteady-state count andPeopleDiscoveryRecognitionSchedulerowner scan now only count faces with NO live occurrence (accepted OR tentative) as pending work — an assigned face cannot re-arm recognition churn. Regression tests added for both schedulers.V142__retire_occurrence_assignment_basis.sql): latest on main was V141 (verified; no other lane had taken V142). Drops the basis-partial indexidx_class_instance_occurrences_auto_assigned_instanceand the column,DROP ... IF EXISTSfor idempotency,RAISE NOTICEreports column/index presence before and after. No state-partial replacement index is created: V074's compositeidx_class_instance_occurrences_instance_state (class_instance_id, state, accepted_at DESC)already serves everyclass_instance_id + state='tentative'access (autoAssignedCount subqueries, listing counts, carousel ref checks) — documented in the migration. No backfill (state complete since V141).Grep-proof (zero remaining basis reads)
Remaining hits are only:
V139created it,V141wrote it,V142drops it);Spec048BasisRetirementMigrationPostgresTestasserting the column is absent.Regression coverage (final gate)
assignments/tentativeAssignments(listener suite, green).AssignmentBasisMigrationPostgresTest(V139 column no longer exists) andSpec048TentativeStateMigrationPostgresTest(V141 cannot be re-executed after V142 dropped the column; fresh-DB Flyway ordering still applies V141 before V142 in every PG test).Tests
rtk ./gradlew :apps:api:test --no-daemon→ 1278 tests, 0 failures, 9 skipped (one known-flakyCandidateDecisionConcurrencyTestrepetition can fail on retry; it is green in isolation and BUILD stays successful — same flake observed on the P2 CI run).apps/web:npm run check→ 0 errors (comment-only changes);npm run build→ success.Notes