feat(api): publish thumbnails_ready SSE event on derived asset acceptance #948

Merged
chris merged 2 commits from feat/thumbnail-sse-ready-events into main 2026-09-28 22:48:13 +02:00
Owner

Summary

  • New SSE event thumbnails_ready with payload {"mediaItemIds":[...]} (camelCase, deduped, chunked at 200) on the existing /api/events/stream channel.
  • Published AFTER_COMMIT from WorkerResultService.submitResult whenever a worker result accepts >=1 thumbnail/preview derived asset; owner-scoped via the same viewer resolution as timeline_visibility_changed (items with different viewer sets are batched separately so IDs never cross visibility boundaries).
  • Existing timeline_visibility_changed (reason preview_ready) emit unchanged. Discovery/plant thumbnails out of scope.

Why

Frontend currently blind-retry-probes pending thumbnails every 6s (max 10 attempts). This event lets clients resolve exactly the spinners that became ready (frontend lane: feat/thumbnail-sse-web).

Verification

  • rtk ./gradlew :apps:api:compileJava green
  • rtk ./gradlew :apps:api:test --tests '*WorkerResult*' green (61 tests incl. new WorkerResultThumbnailsReadyEventTest: emit on accept, dedupe, no-op when nothing accepted, discovery_thumbnail excluded, owner-scoped viewers)
## Summary - New SSE event `thumbnails_ready` with payload `{"mediaItemIds":[...]}` (camelCase, deduped, chunked at 200) on the existing `/api/events/stream` channel. - Published AFTER_COMMIT from `WorkerResultService.submitResult` whenever a worker result accepts >=1 `thumbnail`/`preview` derived asset; owner-scoped via the same viewer resolution as `timeline_visibility_changed` (items with different viewer sets are batched separately so IDs never cross visibility boundaries). - Existing `timeline_visibility_changed` (reason `preview_ready`) emit unchanged. Discovery/plant thumbnails out of scope. ## Why Frontend currently blind-retry-probes pending thumbnails every 6s (max 10 attempts). This event lets clients resolve exactly the spinners that became ready (frontend lane: `feat/thumbnail-sse-web`). ## Verification - `rtk ./gradlew :apps:api:compileJava` green - `rtk ./gradlew :apps:api:test --tests '*WorkerResult*'` green (61 tests incl. new `WorkerResultThumbnailsReadyEventTest`: emit on accept, dedupe, no-op when nothing accepted, discovery_thumbnail excluded, owner-scoped viewers)
feat(api): publish thumbnails_ready SSE event on derived asset acceptance
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 18s
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 9m41s
121c83e95d
test(api): cover thumbnails_ready viewer-set batching, 200-cap, after-commit semantics
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 7s
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 22m50s
f00f01dce7
chris merged commit d860369730 into main 2026-09-28 22:48:13 +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!948
No description provided.