feat(api): manual face bbox create + scope update endpoints #1161
Loading…
Reference in a new issue
No description provided.
Delete branch "feature/manual-face-bbox-backend"
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?
Backend half of the manual face bbox feature. Spec: `docs/superpowers/specs/2026-10-12-manual-face-bbox-design.md` (Backend + Decisions sections).
Endpoints (contract pinned with the frontend lane)
Design choices
Tests
`ClassInstanceServiceTest` (H2-backed, real SQL):
`DiscoveryControllerTest` (Mockito, existing pattern): create delegation + manual=true passthrough; PATCH delegation; 409/404 propagation; invalid scope rejected at the controller before delegation (real validation code, service never touched). The 3 pre-existing `OccurrenceAssignmentView` constructions updated for the new `manual` component.
Verification
```
rtk ./gradlew :apps:api:test --tests 'DiscoveryControllerTest' --tests 'ClassInstanceServiceTest' → BUILD SUCCESSFUL (13 new tests, all green)
rtk ./gradlew :apps:api:test → BUILD SUCCESSFUL (1928 tests, 0 failures/errors)
```
- POST /api/media/{mediaItemId}/discovery/faces — creates a manual face (input_version='manual', confidence/worker_job_id NULL, state='accepted'), returns OccurrenceAssignmentView with manual=true - PATCH /api/discovery/faces/{faceAnnotationId}/scope — updates scope of manual faces only; 404 unknown, 409 non-manual/terminally-gone, 403 foreign - validateManualFaceScope: finite numbers, x,y >= 0, width,height in [0.05,1], x+width <= 1, y+height <= 1 (IllegalArgumentException -> 400 ProblemDetail) - OccurrenceAssignmentView gains manual flag derived from input_version - Revives ClassInstanceService.createFaceAnnotation as the real create path Spec: docs/superpowers/specs/2026-10-12-manual-face-bbox-design.md