fix(api,web): show honest Confirmed count and ignore superseded auto-assigned occurrences #909

Merged
chris merged 2 commits from fix/people-instance-counts into main 2026-09-27 12:51:21 +02:00
Owner

Problem

Person detail page for e.g. Rikke: people-list card says "818 photos · 42 auto-assigned", but the detail tabs showed "Confirmed 42 · Tentative 0".

Root cause (spec 048 follow-up): the Confirmed tab badge rendered autoAssignedCount (occurrences in state tentative) — a spec 045 leftover that spec 048 superseded ("auto-assigned is never Confirmed"). The real accepted count was never displayed. "Tentative 0" is correct for its unit (pending spec-041 candidate cards). Secondary: auto_assigned_count lacked the non-superseded discovery_results join that media/face counts use, so superseded-backed tentative occurrences inflated it.

Fix

  • API: people enrichment (ClassInstanceService.faceEnrichmentForPeople) now computes acceptedCount (SUM(state='accepted')) with the same non-superseded discovery_results join, and applies that join to auto_assigned_count as well; generic listing (ClassInstanceDiscoveryService.instances) and single-instance views carry acceptedCount and exclude superseded-backed tentative rows via a portable anti-join (generic occurrence keys are not always UUIDs). tentative_count (candidate cards) untouched. No migration.
  • Web: Confirmed tab badge shows the real accepted count; mixed instances get a separate Auto-assigned chip (same badge styling); pure shadows keep the Auto-assigned label + single badge; Tentative tab unchanged. Badge renders only when acceptedCount is present (defensive for legacy responses).
  • People-list card unchanged (was already correct).

Tests

  • API: acceptedCount + superseded-exclusion fixtures in ClassInstanceServiceTest (41) and ClassInstanceDiscoveryServiceTest (209), controller mapping in DiscoveryControllerTest (63) — all green.
  • Web: npm run check 0 errors, build ok; discovery-instance-tentative.spec.ts extended for mixed (5/42) and pure-shadow badges — 36 passed; all tests/discovery-* 238 passed / 4 skipped.
  • Branch synced with current main (#905, #906).
## Problem Person detail page for e.g. Rikke: people-list card says "818 photos · 42 auto-assigned", but the detail tabs showed "Confirmed 42 · Tentative 0". Root cause (spec 048 follow-up): the Confirmed tab badge rendered `autoAssignedCount` (occurrences in state `tentative`) — a spec 045 leftover that spec 048 superseded ("auto-assigned is never Confirmed"). The real accepted count was never displayed. "Tentative 0" is correct for its unit (pending spec-041 candidate cards). Secondary: `auto_assigned_count` lacked the non-superseded `discovery_results` join that media/face counts use, so superseded-backed tentative occurrences inflated it. ## Fix - API: people enrichment (`ClassInstanceService.faceEnrichmentForPeople`) now computes `acceptedCount` (`SUM(state='accepted')`) with the same non-superseded `discovery_results` join, and applies that join to `auto_assigned_count` as well; generic listing (`ClassInstanceDiscoveryService.instances`) and single-instance views carry `acceptedCount` and exclude superseded-backed tentative rows via a portable anti-join (generic occurrence keys are not always UUIDs). `tentative_count` (candidate cards) untouched. No migration. - Web: Confirmed tab badge shows the real accepted count; mixed instances get a separate Auto-assigned chip (same badge styling); pure shadows keep the Auto-assigned label + single badge; Tentative tab unchanged. Badge renders only when `acceptedCount` is present (defensive for legacy responses). - People-list card unchanged (was already correct). ## Tests - API: acceptedCount + superseded-exclusion fixtures in `ClassInstanceServiceTest` (41) and `ClassInstanceDiscoveryServiceTest` (209), controller mapping in `DiscoveryControllerTest` (63) — all green. - Web: `npm run check` 0 errors, build ok; `discovery-instance-tentative.spec.ts` extended for mixed (5/42) and pure-shadow badges — 36 passed; all `tests/discovery-*` 238 passed / 4 skipped. - Branch synced with current main (#905, #906).
Spec 048 left the Confirmed tab badge rendering autoAssignedCount (spec 045
leftover): person detail pages showed the auto-assigned subset as Confirmed
and never the real accepted count.

- People and generic instance listings expose acceptedCount (occurrences in
  state='accepted'); the people enrichment query computes it with the same
  non-superseded discovery_results join as media/face counts.
- auto_assigned_count in the people enrichment now uses that join too, and
  the generic listing plus single-instance view ignore tentative occurrences
  whose backing discovery_result is superseded.
- Web detail tabs: Confirmed badge shows confirmedCount (acceptedCount);
  mixed instances add a separate Auto-assigned chip after it; pure shadows
  keep the Auto-assigned label and single amber badge; Tentative unchanged.
- Tests: superseded-join fixtures, mixed vs pure-shadow counts, controller
  mapping assertion, and Playwright coverage for both badge shapes.
- KNOWN_ISSUES: ISSUE-076 archived as resolved.
chore: sync branch with origin/main
All checks were successful
Wiki Sync / Sync wiki from docs (push) Has been skipped
Build and Deploy / Detect changed services and test scopes (push) Successful in 4s
Build and Deploy / Android unit tests and debug APK (push) Has been skipped
Build and Deploy / Smoke API and media worker (push) Has been skipped
Build and Deploy / Smoke web (push) Has been skipped
Build and Deploy / Smoke ML worker (push) Has been skipped
Build and Deploy / Smoke people worker (push) Has been skipped
Build and Deploy / Build postgres image (push) Has been skipped
Build and Deploy / Build plants worker image (push) Has been skipped
Build and Deploy / Build converter worker image (push) Has been skipped
Build and Deploy / Deploy postgres (push) Has been skipped
Build and Deploy / Build API image (push) Has been skipped
Build and Deploy / Build media worker image (push) Has been skipped
Build and Deploy / Build ML worker image (push) Has been skipped
Build and Deploy / Build people worker image (push) Has been skipped
Build and Deploy / Build web image (push) Has been skipped
Build and Deploy / Deploy API (push) Has been skipped
Build and Deploy / Deploy web (push) Has been skipped
Build and Deploy / Deploy media worker (push) Has been skipped
Build and Deploy / Deploy ML worker (push) Has been skipped
Build and Deploy / Deploy plants worker (push) Has been skipped
Build and Deploy / Deploy people worker (push) Has been skipped
Build and Deploy / Deploy converter worker (push) Has been skipped
Build and Deploy / Clean Docker build artifacts (push) Has been skipped
Build and Deploy / Run scoped PR tests (push) Successful in 14m3s
cbc3fc16ab
chris merged commit 33fc79adca into main 2026-09-27 12:51:21 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
chris/memories!909
No description provided.