fix(activity): bound recent batch age and show only in-flight lanes #901

Merged
chris merged 1 commit from fix/media-activity-stale-batch-scroll into main 2026-09-27 11:31:42 +02:00
Owner

Problem

The Media activity dialog showed huge lifetime 'done' counts (e.g. 6901 done on idle lanes) and could not scroll to its last entry.

Root cause

  1. Stale zombie batches (ISSUE-060): ProcessingSummaryService.recentBatch() treats every upload_sessions row with notified_at IS NULL as an active batch — including sessions whose browser never committed. The dialog then counts ALL completed worker jobs of those media with no time window, so every reprocessing run keeps inflating 'done'.
  2. Done-only lanes rendered: the dialog filter kept lanes with only finished work (finishedCount > 0), violating the agreed product intent that the dialog only shows currently in-flight processes.
  3. Scroll clipping: the card used max-h-[70vh] + overflow-hidden, but the list's max-h-[calc(70vh-4rem)] ignored header + footer + padding, so the bottom of the list was cut off.

Fix

  • Backend: recent-batch session COUNT and lane queries (batchActivities, batchDiscoveryActivities) now exclude unnotified sessions older than 7 days (created_at >= now - 7d). Lifetime counters unchanged; no migration needed (created_at already exists).
  • Frontend: dialog lane filter now requires queued/processing/failed > 0 — done-only lanes are hidden.
  • Frontend: card becomes flex flex-col, list uses min-h-0 flex-1 overflow-y-auto so scrolling respects header/footer. Visual design unchanged.
  • E2E: added a done-only 'Things' lane to the recentBatch mock to guard the in-flight-only filter.
  • Tests: 3 new backend tests (stale session deactivates batch; 6-day session stays active; stale session jobs excluded when mixed with fresh session).

Validation

  • rtk ./gradlew :apps:api:test --tests ProcessingSummaryServiceTest --tests UploadBatchCompletionServiceTest → 29 tests green
  • npm run check → 0 errors (20 pre-existing warnings)
  • npm run build → ok
  • Playwright upload-status.spec.ts: desktop 4 passed (1 unrelated upload-timing flake passed on retry), mobile 5 passed

No version bump (spec 015: pipeline-computed versioning).

## Problem The Media activity dialog showed huge lifetime 'done' counts (e.g. 6901 done on idle lanes) and could not scroll to its last entry. ## Root cause 1. **Stale zombie batches (ISSUE-060):** `ProcessingSummaryService.recentBatch()` treats every `upload_sessions` row with `notified_at IS NULL` as an active batch — including sessions whose browser never committed. The dialog then counts ALL completed worker jobs of those media with no time window, so every reprocessing run keeps inflating 'done'. 2. **Done-only lanes rendered:** the dialog filter kept lanes with only finished work (`finishedCount > 0`), violating the agreed product intent that the dialog only shows currently in-flight processes. 3. **Scroll clipping:** the card used `max-h-[70vh]` + `overflow-hidden`, but the list's `max-h-[calc(70vh-4rem)]` ignored header + footer + padding, so the bottom of the list was cut off. ## Fix - Backend: recent-batch session COUNT and lane queries (`batchActivities`, `batchDiscoveryActivities`) now exclude unnotified sessions older than 7 days (`created_at >= now - 7d`). Lifetime counters unchanged; no migration needed (`created_at` already exists). - Frontend: dialog lane filter now requires queued/processing/failed > 0 — done-only lanes are hidden. - Frontend: card becomes `flex flex-col`, list uses `min-h-0 flex-1 overflow-y-auto` so scrolling respects header/footer. Visual design unchanged. - E2E: added a done-only 'Things' lane to the recentBatch mock to guard the in-flight-only filter. - Tests: 3 new backend tests (stale session deactivates batch; 6-day session stays active; stale session jobs excluded when mixed with fresh session). ## Validation - `rtk ./gradlew :apps:api:test --tests ProcessingSummaryServiceTest --tests UploadBatchCompletionServiceTest` → 29 tests green - `npm run check` → 0 errors (20 pre-existing warnings) - `npm run build` → ok - Playwright `upload-status.spec.ts`: desktop 4 passed (1 unrelated upload-timing flake passed on retry), mobile 5 passed No version bump (spec 015: pipeline-computed versioning).
fix(activity): bound recent batch age and show only in-flight lanes
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 / Build postgres 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 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 16m17s
4e92a0d26a
Treat unnotified upload sessions older than 7 days as stale so zombie
sessions (ISSUE-060) no longer keep lifetime completed-job counts alive
in the Media activity dialog. Apply the same window to the batch lane
counts so stale sessions cannot leak into a coexisting fresh batch.

The dialog now hides done-only lanes and its card uses a flex column
layout so the scroll container no longer clips the last entry behind
the footer.
chris merged commit 76b2534ca9 into main 2026-09-27 11:31:42 +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!901
No description provided.