feat(disk): on-demand orphan cleanup from Settings#4
Merged
Conversation
Add a manual "Scan & delete" action for on-disk files that have no torrent in the listing — pre-existing leftovers, a client "rem", or a delete-that-kept- files. Without a disk cap these were never reclaimed automatically (deleting orphans unattended is unsafe for a shared folder), so this gives an explicit, confirmed way to sweep them. - engine: ListOrphans() previews them, CleanOrphans() removes them. Both reuse the filesystem reconciliation, so active/seeding content and records still in the listing are never touched. - api: GET /api/disk/orphans (preview) + DELETE /api/disk/orphans (run), both behind auth like the rest of /api/*. - UI: Settings -> Disk cleanup shows the item count and total size, then asks for confirmation before deleting. en/es strings. Tests: ListOrphans/CleanOrphans remove only untracked files, keep records. Verified live: two orphan folders (300MB + 150MB) previewed and deleted via the endpoints. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012bj3G2zzqEaALFa8ufbkDJ
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.
Qué hace
Añade una acción manual "Escanear y borrar" para archivos en disco sin torrent en la lista — restos preexistentes (de antes de la retención), de un
remde cliente, o de un borrado que conservó archivos. Sin tope de disco, esos huérfanos no se recuperaban solos (borrarlos desatendido es inseguro en una carpeta compartida), así que esto da una vía explícita y con confirmación para barrerlos.Backend
ListOrphans()los previsualiza,CleanOrphans()los borra. Ambos reutilizan la reconciliación por sistema de archivos → nunca tocan lo activo/seed vivo ni records que siguen en la lista.GET /api/disk/orphans(preview) +DELETE /api/disk/orphans(ejecutar), protegidos como el resto de/api/*.UI
Verificación
ListOrphans/CleanOrphansborran solo lo no rastreado y conservan los records. Backendbuild+vet+testverde; frontendtsc+vite buildOK.GETlas lista,DELETElas elimina (removed: 2, freedBytes: 471859200),GETqueda vacío,/downloadslimpio.🤖 Generated with Claude Code