feat(api,web): search filter for tentative vs approved face assignments #1108

Merged
chris merged 3 commits from feat/search-approval-filter into main 2026-10-11 13:49:38 +02:00
Owner

Summary

Adds an approval search filter (token + URL param + dropdown) that narrows results by face-assignment approval status:

  • approval:tentative → media with at least one open tentative face assignment (class_instance_occurrences.state = 'tentative', people/person, face_annotation)
  • approval:approved → media with at least one accepted assignment (state = 'accepted'), regardless of other pending ones
  • Aliases pending / accepted accepted and normalized; malformed values stay literal free text; duplicate token → 400 (like year: / favorite:)
  • Owner-scoped class_instance_occurrences → discovery_results join identical to the person: filter; applies to all search legs including filter-only browsing
  • Opt-in "Face approval" select in the shared FilterSortMenu (other surfaces unchanged)

Test plan

  • API: 10 new tests in SearchQueryParserTest / SearchServiceTest (tentative/approved/both/neither fixtures, aliases, malformed, duplicate, param merge) — green after rebase on latest main
  • Web: queryTokens.spec.ts (new), searchMediaFilters.spec.ts (new), 85 unit tests green, svelte-check 0 errors
  • Playwright search-filters.spec.ts (36 passed) + filter-sort.spec.ts (9 passed, shared-menu regression)
  • CI on PR

Version bump 1.21.75 → 1.21.76 + changelog.

## Summary Adds an `approval` search filter (token + URL param + dropdown) that narrows results by face-assignment approval status: - `approval:tentative` → media with at least one **open tentative** face assignment (`class_instance_occurrences.state = 'tentative'`, people/person, face_annotation) - `approval:approved` → media with at least one **accepted** assignment (`state = 'accepted'`), regardless of other pending ones - Aliases `pending` / `accepted` accepted and normalized; malformed values stay literal free text; duplicate token → 400 (like `year:` / `favorite:`) - Owner-scoped `class_instance_occurrences` → `discovery_results` join identical to the `person:` filter; applies to all search legs including filter-only browsing - Opt-in "Face approval" select in the shared FilterSortMenu (other surfaces unchanged) ## Test plan - [x] API: 10 new tests in `SearchQueryParserTest` / `SearchServiceTest` (tentative/approved/both/neither fixtures, aliases, malformed, duplicate, param merge) — green after rebase on latest main - [x] Web: `queryTokens.spec.ts` (new), `searchMediaFilters.spec.ts` (new), 85 unit tests green, svelte-check 0 errors - [x] Playwright `search-filters.spec.ts` (36 passed) + `filter-sort.spec.ts` (9 passed, shared-menu regression) - [ ] CI on PR Version bump 1.21.75 → 1.21.76 + changelog.
Adds an approval: query token and matching approval= request param to
GET /api/search: tentative matches media with at least one open
tentative face assignment (class_instance_occurrences.state =
'tentative', spec 048 — the plan's 'pending' value does not exist on
occurrences), approved matches at least one user-confirmed assignment
('accepted'), regardless of other pending faces. Aliases pending/
accepted normalize; malformed values stay literal free text and a
duplicate token is a 400, mirroring the favorite: token. The token
appears in the filter summary (kind "approval") and wins over the
param in mergeFilters.
Adds the approval token key to the query grammar (tentative/pending/
approved/accepted, case-insensitive; malformed values stay free text),
the approval param on searchMedia, an opt-in Face approval select in the
shared FilterSortMenu (rendered only when the search page passes options
+label, so other surfaces are unchanged), the Approval chip
("Approval: Tentative|Approved"), badge counting and chip-removal
focus. Unit specs cover token parse/format/replace and the request
param; e2e coverage extends tests/search-filters.spec.ts with dropdown
interaction and alias deep-link sync.
chore: version bump 1.21.75 -> 1.21.76 + changelog
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 2s
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 22m22s
c0c4442bfd
chris merged commit 413435be63 into main 2026-10-11 13:49:38 +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!1108
No description provided.