fix(api): register worker result handlers as Spring beans (registry was empty in prod) #1498

Merged
chris merged 1 commit from fix/worker-result-handler-beans into main 2026-11-13 08:53:43 +01:00
Owner

Prod outage — every worker result submission 400s since deploy 0.67.421

Symptom: Since the API deploy 2026-11-12 18:14, ALL worker result submissions fail with 400 Unknown or unsupported result type: <type> — for class_instance_candidate AND the fallback issue (people worker), and for media-worker results too. Evidence: 0 rows in worker_job_results since deploy vs 2 613 in the prior 24h. owner_face_recognition attempts fail at the submit step; face clustering is effectively down.

Root cause: PR #1493 (commit 9c3d1809, 'WorkerResultService splittet — ét handler-objekt per resultattype') moved result-type persistence into 15 WorkerResultHandler classes — none registered as Spring beans — and made WorkerResultService build its handler registry from an @Autowired List<WorkerResultHandler>. Spring injects an empty list → empty registry → every result type rejected. The API starts healthy (UP), so nothing surfaces until workers submit. Tests stayed green because the suite wires the service via the explicit-list fixture constructor, bypassing Spring collection.

Fix: Single @Configuration (WorkerResultHandlerConfiguration) exposing 15 @Bean methods — wiring mirrors WorkerResultService.productionHandlers(...) exactly (javadoc cross-references it). Nested handlers (Thumbnail/Backfill) are covered by the same factory.

Validation: ./gradlew :apps:api:test --tests 'dev.memories.api.worker.*' — 28 test classes green incl. new WorkerResultHandlerConfigurationTest (asserts 15 beans produced; class_instance_candidate and issue resolve; every produced resultType() present without duplicates). Runs green against the pre-fix state by construction (no configuration class → no beans → assertions fail).

After merge: requeue the failed owner_face_recognition job(s); worker rerun will submit normally.

## Prod outage — every worker result submission 400s since deploy 0.67.421 **Symptom:** Since the API deploy 2026-11-12 18:14, ALL worker result submissions fail with `400 Unknown or unsupported result type: <type>` — for `class_instance_candidate` AND the fallback `issue` (people worker), and for media-worker results too. Evidence: **0 rows** in `worker_job_results` since deploy vs **2 613** in the prior 24h. owner_face_recognition attempts fail at the submit step; face clustering is effectively down. **Root cause:** PR #1493 (commit 9c3d1809, 'WorkerResultService splittet — ét handler-objekt per resultattype') moved result-type persistence into 15 `WorkerResultHandler` classes — **none registered as Spring beans** — and made `WorkerResultService` build its handler registry from an `@Autowired List<WorkerResultHandler>`. Spring injects an **empty list** → empty registry → every result type rejected. The API starts healthy (`UP`), so nothing surfaces until workers submit. Tests stayed green because the suite wires the service via the explicit-list fixture constructor, bypassing Spring collection. **Fix:** Single `@Configuration` (`WorkerResultHandlerConfiguration`) exposing 15 `@Bean` methods — wiring mirrors `WorkerResultService.productionHandlers(...)` exactly (javadoc cross-references it). Nested handlers (Thumbnail/Backfill) are covered by the same factory. **Validation:** `./gradlew :apps:api:test --tests 'dev.memories.api.worker.*'` — 28 test classes green incl. new `WorkerResultHandlerConfigurationTest` (asserts 15 beans produced; `class_instance_candidate` and `issue` resolve; every produced `resultType()` present without duplicates). Runs green against the pre-fix state by construction (no configuration class → no beans → assertions fail). **After merge:** requeue the failed `owner_face_recognition` job(s); worker rerun will submit normally.
fix(api): register worker result handlers as Spring beans (registry was empty in prod)
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 3s
Build and Deploy / Build plants worker image (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 Android CI image (push) Has been skipped
Build and Deploy / Build converter worker image (push) Has been skipped
Build and Deploy / Android unit tests and debug APK (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 / Deploy review instance (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 3m50s
63eafaa527
Root cause: PR #1493 (9c3d1809) split result-type persistence into 15 plain
WorkerResultHandler classes with no Spring registration, so the @Autowired
List<WorkerResultHandler> injected into WorkerResultService was empty and
handlersByResultType rejected every submission with 400 "Unknown or
unsupported result type" since deploy 0.67.421.

Evidence: 0 rows in worker_job_results since the API deploy 2026-11-12
18:14 (vs 2613 in the prior 24h); people- and media-workers both got 400s;
job owner_face_recognition failed all 3 attempts.

Fix: single WorkerResultHandlerConfiguration @Configuration exposing @Bean
methods for all 15 handlers (the nested thumbnail/backfill handlers cannot
be component-scanned anyway), mirroring
WorkerResultService.productionHandlers(...) exactly; productionHandlers and
the fixture/deployment constructor are unchanged. No @Component on the
handlers — the registry is fail-fast on duplicate result types.

Regression test: WorkerResultHandlerConfigurationTest asserts the Spring
context exposes exactly 15 handler beans, every wire result type (primary +
aliases) resolves through handlerFor, no duplicate result types, and the
configuration mirrors productionHandlers.
chris merged commit 529cf3148f into main 2026-11-13 08:53:43 +01: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!1498
No description provided.