feat(api,web): spec 045 P3-P4 — auto-assigned provenance labels, carousel suppression, stash hardening #885
Loading…
Reference in a new issue
No description provided.
Delete branch "spec/045-stash-p3p4-provenance-hardening"
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 045 P3 + P4 (follow-up to merged P0–P2, PR #876). Exposes
assignment_basisprovenance in every occurrence-bearing view, replaces the hardcoded "Confirmed", adds per-instanceautoAssignedCount, suppresses stash-targeted cards from the suggestions carousel (the residual gap flagged in the P1 review), and hardens the stash interactions (unstash/naming recognition re-arm, merge-into-stash 409, accept-into-stash guard).ADR:
docs/adr/0097-stash-auto-assignments-are-tentative-and-never-anchors.json.API contract chosen (documented on the view records)
Instance listing / single instance (
ClassInstanceView)autoAssignedCount: accepted occurrences withassignment_basis='auto_assigned', regardless of stash state (stashes and post-unstash instances both count).null= legacy producer (badge hidden).tentativeCountsemantics untouched (tentative_countstays structurally 0 for stashes).Person-level views (
ClassInstanceRecordView,ClassInstanceDetailView)assignmentStateis derived, replacing the hardcoded"accepted":"accepted"— zero auto-assigned occurrences (all confirmed),"auto_assigned"— ALL accepted occurrences auto-assigned (pure shadow),"partially_auto_assigned"— mix of confirmed + auto-assigned.autoAssignedCount(int) accompanies both;ClassInstanceDetailViewgains it next tofaceCount/mediaCount.user_confirmed(ADR 0097 ruling); the UI treats that as the normal Confirmed state, not an error.Per-occurrence views (
OccurrenceAssignmentView,ClassInstanceMediaItemView,ClassInstanceRepresentativeOccurrenceView)assignmentState="auto_assigned"when the assigned occurrence's basis is auto-assigned,"accepted"otherwise (NULLwhen unassigned;"owner_tentative"unchanged for pending proposals). Applies topersonMedia,facesForMedia/faceAssignment,representativeFaces.Carousel suppression (hidden, never deleted)
candidatesPaged+countCandidates(mirrored predicate so paging metadata stays consistent) now hide:existing_instance_idis a stashed shadow;new_person_clustercandidates whose refs already sit auto-assigned on a stashed instance (old-worker skew residual — P1's guard only covers stash-targeted matches).Suppressed rows stay
pending(asserted); the state machine is untouched.P4 hardening
unstashInstancemarks the owner's recognition dirty (anchor set changes: auto-assigned faces become full anchors); a test proves the reconcile scheduler then enqueues the re-match run.applyDisplayNameIfUnnamedmarks dirty on a successful rename (naming promotes a shadow to a curated person) and now takes the domain key.mergeInstancerejects a stashed TARGET with 409 (IllegalStateException); merging FROM a stash into a named person remains allowed and moves auto-assigned occurrences with labels intact.acceptCandidateForExistingInstanceanddecideCandidate's into-existing accept require an unstashed target (same guard asconfirmTentativeCandidates).Web (bounded, existing patterns only)
discovery.ts:autoAssignedCount+ extendedassignmentStateunions.DiscoveryDomainInstances.svelte: "N auto-assigned" badge using the exact tentative-badge pattern (cards + stashed cards).DiscoveryInstanceDetail.svelte: accepted filter tab reads Auto-assigned for a pure shadow (count badge reused from the tentative-count pattern); Confirmed stays for curated instances.Confirmed/Auto-assigned/Partly auto-assigned), newAuto-assigned (n)filter option, media badges reuse the existing amber not-confirmed styling. No layout/design changes;StashDisbandSplit.svelteuntouched.Test evidence
rtk ./gradlew :apps:api:test --no-daemon→ 1225 tests, 0 failures, 9 skipped (rebased onorigin/main@8a1c982f).autoAssignedCount, detail + per-occurrence basis, carousel suppression (stash target + absorbed cluster, control candidates stay), unstash dirty + reconcile enqueue, naming dirty, merge both directions + label survival, accept-into-stash rejection (both decision paths), disband over auto_assigned (signature + release), different-instance re-proposal rejected as already-assigned (not absorbed by the P1 skew guard).npm run check→ 0 errors (20 pre-existing warnings);npm run build→ success. Playwright suite not run (not part of scoped CI, needs a live server).Notes / follow-ups
docs/dev/versioning.md).'accepted'(out of scope; auto-assigned occurrences live on owner-local stashes).c322c485eb465f841412