fix(dashboard): Reclaimable pulse cell opens an interactive picker#143
Merged
Conversation
7d65eaa to
ea9aa18
Compare
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>
ea9aa18 to
1bfc891
Compare
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
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: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-previewendpoint with Pydantic-validated body.Files missing
duration_secondsorbitrate_kbpsdrop out (probe failures the transcode couldn't act on anyway).Files at or below the target bitrate are excluded (transcoding up would inflate).
Frontend
useDashboardReclaimPreviewmutation hook (mutate-shape because inputs change on every form interaction).ReclaimPickercomponent 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 --noEmitclean.vitest run src/features/dashboard— 40/40 pass.Dashboard overhaul complete
This closes out the three-PR series:
unknown).🤖 Generated with Claude Code