feat(api): occurrence tentative state + symmetric bands (spec 048 P0-P1) #893
Loading…
Reference in a new issue
No description provided.
Delete branch "spec/048-accepted-means-confirmed"
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 P0+P1.
acceptednow always means user-confirmed (explicit owner action OR owner-activated strong-band policy); system assignments live in the new occurrence lifecycle statetentative(assigned, awaiting owner review, never an anchor). Bands are symmetric for named and stash targets, the worker export split is state-derived, and the structural invariant "automatic writes consume only unassigned faces" is pinned by tests.assignment_basisis still written in lockstep (tentative ⇔ auto_assigned) and dropped later in P3 — no readers were removed in this lane. Worker and web untouched.Migration (V141, next free after V140)
V141__occurrence_tentative_state.sql:class_instance_occurrences_state_checkwidened to(accepted|tentative|superseded|removed);SET state='tentative' WHERE state='accepted' AND assignment_basis='auto_assigned';discovery_resultsrows (accepted→owner_recognized, joined byoccurrence_key = discovery_results.id);RAISE NOTICEcount report (occurrences backfilled, faces mirrored).Write arms were updated in the same PR so nothing orphans: the accept unit threads
occurrenceStatealongside the basis throughinsertOccurrenceNoSteal(H2 MERGE USING + PG ON CONFLICT),reviveSupersededOccurrenceandupsertCandidateOccurrence; dissolve supersede, merge/split moves, overlap removal and the rejection guard all covertentative; the disband negative signature stays accepted-only (confirmed core).Gate matrix (implemented)
dist ≤ V104 min_distance AND conf ≥ V104 min_confidence≤ suggest_max, not strongmin(0.5, suggest_max)) → tentative (policy-independent); else cardsuggest_maxSILENT_ACTION_MAX_CANDIDATE_FACES, #892) gates every silent path, including the new strong-policy-off arm; oversized → pending card, never rejected.weakMatch=truestays suggestions-only on named targets (stashes keep the spec 039 promise via the symmetric gates).skippedCount=1and the assigned face keeps its tentative state).matchCandidateToExistingInstanceanchors / consensus core are accepted-only (basis predicate kept during P1); the skew guard and ref filtering accept accepted-or-tentative.Visible behavior changes
tentativeinstead ofaccepted; the face mirror showsowner_recognized(not accepted). This is the headline semantic change.user_confirmed), no consensus needed; medium stays consensus-gated → tentative.Skew matrix
tentativeAssignmentstentativeAssignmentsdegrades to empty (unchanged); no crashTests
rtk ./gradlew :apps:api:test --no-daemon→ 1265 tests, 0 failures, 9 skipped.Spec048TentativeStateMigrationPostgresTest(V141 re-run: predicate matrix, face mirror, idempotency, constraint swap, flyway history) andSpec048SymmetricBandsPostgresTest(strong policy matrix named+stash; medium tentative + face mirror; disband releases tentatives with core-only signature via a release-strategy-wired service; merge/split move tentatives; skew re-proposal of a live tentative superseded).Notes
merge-base(main, HEAD); this changeset includes a migration +api/worker/*path, which classifies it as a fallback-smoke changeset (compile + web/CLI/ML smoke) — the API unit steps are skipped by the workflow's own condition. Full API suite verified locally; covered on main by the deploy/daily-full-tests lanes.accepted; they need accepted+tentative reads, honest "Confirmed" tab, cards-for-tentatives accept/reject and person-page bulk confirm (which must upgrade an existing tentative occurrence in place). For P3 (T004): dropassignment_basisand the remaining basis predicates, plus the regression suite (revival loop, Holger cap, disband releases, merge/split, export shapes, face mirror, automatic-paths-never-touch-assigned).