Skip to content

fix(dashboard): Reclaimable pulse cell opens an interactive picker#143

Merged
ShogyX merged 1 commit into
mainfrom
fix/dashboard-reclaimable-picker
May 27, 2026
Merged

fix(dashboard): Reclaimable pulse cell opens an interactive picker#143
ShogyX merged 1 commit into
mainfrom
fix/dashboard-reclaimable-picker

Conversation

@ShogyX
Copy link
Copy Markdown
Owner

@ShogyX ShogyX commented May 27, 2026

Summary

Third and final PR for the Dashboard overhaul. Replaces the static "estimated across N fat titles" hint on the Reclaimable pulse cell with a drawer that lets the operator shape the estimate to a real transcode they'd consider running:

  • pick target codec / container / bitrate
  • filter the source pool by current codec / container / min size / min bitrate
  • see candidate count, total current size, projected total size after transcode, and the reclaim — plus the top 20 biggest-reclaim individual files

The actual transcode is queued via the existing optimization-profile flow (the Open Optimization → CTA links there); this endpoint is preview-only per the user's answer to the scope question.

Backend

  • New app/services/dashboard/reclaim_preview.py. The reclaim math is intentionally simple:

    est_new_size = duration_seconds * target_bitrate_kbps * 125
    reclaim      = max(0, size - est_new)
    

    Bitrate is the COMBINED video+audio target. Container muxing weight (~1-3%) is ignored — the dashboard preview just needs to be roughly right; the actual transcode is the source of truth.

  • New POST /api/v1/dashboard/reclaim-preview endpoint with Pydantic-validated body.

  • Files missing duration_seconds or bitrate_kbps drop out (probe failures the transcode couldn't act on anyway).

  • Files at or below the target bitrate are excluded (transcoding up would inflate).

Frontend

  • New useDashboardReclaimPreview mutation hook (mutate-shape because inputs change on every form interaction).
  • Reclaimable pulse cell now opens a Reclaimable storage drawer instead of jumping straight to /optimization.
  • New ReclaimPicker component inside the drawer renders the form + headline stats + top-candidate list. Auto-runs the preview on mount.

Test plan

  • pytest backend/tests/integration/test_dashboard_reclaim_preview_v111.py — 7 pass (estimate math, at-or-below-target exclusion, source codec / min size filters, files missing probe data drop out, sample ordering, empty-library zero).
  • npx tsc --noEmit clean.
  • vitest run src/features/dashboard — 40/40 pass.
  • Manual on the live install: click Reclaimable, tweak target bitrate / source codec, verify candidates list updates and the per-file reclaim is consistent with operator expectations.

Dashboard overhaul complete

This closes out the three-PR series:

🤖 Generated with Claude Code

@ShogyX ShogyX force-pushed the fix/dashboard-reclaimable-picker branch from 7d65eaa to ea9aa18 Compare May 27, 2026 18:35
Replaces the static "estimated across N fat titles" hint on the
Reclaimable pulse cell with a drawer that lets the operator
shape the estimate to a real transcode they'd consider running:

  * pick target codec / container / bitrate
  * filter the source pool by current codec / container, a min
    size floor, and a min bitrate floor
  * see the candidate count, the total current size, the
    projected total size after transcode, and the reclaim — plus
    the top 20 biggest-reclaim individual files

The actual transcode is queued via the existing optimization-
profile flow (the "Open Optimization →" CTA links there); this
endpoint is preview-only.

  * New ``app/services/dashboard/reclaim_preview.py``.
    Reclaim math is intentionally simple:

        est_new_size = duration_seconds * target_bitrate_kbps * 125
        reclaim      = max(0, size - est_new)

    Bitrate is the COMBINED video+audio target — the operator's
    number on the picker. Container muxing weight (~1-3%) is
    ignored because the actual transcode is the source of truth;
    the dashboard preview just needs to be roughly right.

  * New ``POST /api/v1/dashboard/reclaim-preview`` endpoint with
    Pydantic-validated body (target codec / container / bitrate +
    filters).

  * Files missing ``duration_seconds`` or ``bitrate_kbps`` drop out
    — we can't estimate the new size without them, and a
    transcode profile couldn't act on them either.

  * Files at or below the target bitrate are excluded —
    transcoding to a higher bitrate would inflate, not reclaim.

  * New ``useDashboardReclaimPreview`` mutation hook (mutate-shape
    because inputs change on every form interaction).
  * The Reclaimable pulse cell now opens a "Reclaimable storage"
    drawer instead of jumping straight to /optimization.
  * New ``ReclaimPicker`` component inside the drawer renders the
    form + headline stats + top-candidate list. Auto-runs the
    preview on mount.

  * ``tests/integration/test_dashboard_reclaim_preview_v111.py``
    — 7 tests pin the contract: estimate math, the at-or-below
    bitrate exclusion, source codec + min size filters, files
    missing probe data drop out, samples are sorted by reclaim
    desc, empty-library zero.
  * Backend: 7/7 pass; Frontend: ``tsc --noEmit`` clean, ``vitest
    run src/features/dashboard`` 40/40 pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@ShogyX ShogyX force-pushed the fix/dashboard-reclaimable-picker branch from ea9aa18 to 1bfc891 Compare May 27, 2026 18:56
@ShogyX ShogyX merged commit d25cf83 into main May 27, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant