fix(people): resolve stash-away on stale suggestion cards (ISSUE-090) #1002
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/stash-away-already-assigned"
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
"Stash away" in the people suggestions carousel failed with:
The stash is insert-only by design (spec 045 / ADR 0097: a stash never steals a face). When every ref of a candidate was already occupied by a live occurrence (
state IN ('accepted','tentative')), the accept unit legitimately wrote 0 occurrences, and therequireOccurrenceWritesguard (acceptedOccurrences == 0 && !refs.isEmpty()) turned that into a hard failure.The carousel only hides the stashed-shadow variant of such cards, so a stale card stayed visible with a permanently unusable button.
Fix
New
CandidateDecisionContext.resolveFullyAssignedAsRejectedflag, set only at thestashedcall site — automated/auto-accept paths are untouched.When a card's refs are all occupied by another decision, the accept unit resolves it before the target resolver runs, so no empty shadow person is minted:
rejectedsourceType=owner_action,action=stashed,decision=all_faces_already_assigned, real actorrejected,classInstanceId: null(frontend already accepts this)Invariant safety — this path only ever writes
No ownership is ever removed or moved.
rejectPendingCandidateandafterRejectionare deliberately not called.candidate_id; a mixed own/foreign card likewise. Those keep the pre-existing 409, stay pending, and leave their allocation and review trail byte-identical (verified with transactional rollback).occurrenceType()+ the face-branch key ofinsertOneOccurrence. So the check cannot disagree with the conflict it exists for: ageneric_evidenceref carrying a knownfaceAnnotationIdis recognised as the face occurrence it becomes.false→ pre-existing conflict is reported, rather than risking a wrong rejection.null, i.e. a genuine "candidate changed" conflict, never a silent success.Tests
267 targeted tests green (229 discovery H2 + 7 Spec045 PostgreSQL + 31 Spec050 PostgreSQL), including:
stashAwayResolvesSuggestionCardWhoseFacesAreAlreadyAssignedElsewhere— production repro; carousel card leaves the list, no shadow minted, audit override + actor assertedstashAwayOnBackingCardPreservesItsOwnTentativeAllocation/stashAwayOnMixedOwnAndForeignOccupiedCardPreservesAllAllocations— 409 retained, pending state, allocations untouched, no review decisionstashOnOwnBackingCardRollsBackWithoutChangingOwnershipOrCreatingShadow/...MixedOwnAndForeign...— PostgreSQL, full-row comparison across rollbackstashAwayResolvesGenericEvidenceRefThatResolvesToAnOccupiedFace— identity parity with the writerstashAwayStillAcceptsOwnUnassignedFacesAlongsideAssignedOnes— partial overlap keeps the real stashstashDecisionDoesNotStealLiveAcceptedFaceOnH2/Spec045StashTentativePostgresTest— no-steal guaranteeFull
:apps:api:testresult recorded in the PR comments before merge.Scope note
Also records ISSUE-091 (
med,open,area:ci): while verifying this PR I found that scoped PR tests silently skip all JVM tests wheneverdetect-scopes.sh's catch-all setsrun_fallback_smoke, becausebuild-deploy.ymlgates the "Run API tests" step on it while the fallback only compiles. Not fixed here — tracked separately.Refs ISSUE-090.
a28f69b3707c4ec643a27c4ec643a2ba50998180ba509981805a17bd35b7fix(people): resolve stash-away on fully-occupied suggestion cards (ISSUE-090)to fix(people): resolve stash-away on stale suggestion cards (ISSUE-090)