Skip to content

feat(disk): on-demand orphan cleanup from Settings#4

Merged
jodacame merged 1 commit into
mainfrom
feat/orphan-cleanup-ui
Jul 1, 2026
Merged

feat(disk): on-demand orphan cleanup from Settings#4
jodacame merged 1 commit into
mainfrom
feat/orphan-cleanup-ui

Conversation

@jodacame

@jodacame jodacame commented Jul 1, 2026

Copy link
Copy Markdown
Owner

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 rem de 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.
  • API: GET /api/disk/orphans (preview) + DELETE /api/disk/orphans (ejecutar), protegidos como el resto de /api/*.

UI

  • Settings → Disk cleanup: botón que muestra cuántos elementos y cuánto pesan, y pide confirmación antes de borrar. Textos ES/EN.

Verificación

  • Tests: ListOrphans/CleanOrphans borran solo lo no rastreado y conservan los records. Backend build+vet+test verde; frontend tsc+vite build OK.
  • En vivo: dos carpetas huérfanas (300MB + 150MB) → GET las lista, DELETE las elimina (removed: 2, freedBytes: 471859200), GET queda vacío, /downloads limpio.

🤖 Generated with Claude Code

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
@jodacame
jodacame merged commit f6a555d into main Jul 1, 2026
@jodacame
jodacame deleted the feat/orphan-cleanup-ui branch July 1, 2026 14:45
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