Skip to content

feat(health): delete corrupted files instead of triggering repair#764

Merged
javi11 merged 1 commit into
mainfrom
session/sleepy-euclid-550d91
Jul 5, 2026
Merged

feat(health): delete corrupted files instead of triggering repair#764
javi11 merged 1 commit into
mainfrom
session/sleepy-euclid-550d91

Conversation

@javi11

@javi11 javi11 commented Jul 5, 2026

Copy link
Copy Markdown
Owner

Summary

  • Adds a new health.corruption_action config option (repair default, delete) that changes what happens when the health checker or a live streaming read confirms real (non-degraded) corruption.
  • When set to delete, AltMount removes the file's metadata (and source NZB if configured), the physical library file, the health-DB record, and cleans up any now-empty parent directories — instead of triggering an Arr rescan/redownload.
  • Wired into both trigger points: the periodic health-check retry-exhaustion path (internal/health/worker.go) and the live streaming-failure path (internal/nzbfilesystem/metadata_remote_file.go), plus the repair-retry sweep for files already stuck in repair_triggered.
  • Degraded (still-playable) files are never deleted or repaired — unchanged from existing behavior.
  • Adds a matching "On Corruption" selector to the Health config UI.

Test plan

  • go build ./... / go vet ./...
  • go test -race ./internal/health/... ./internal/nzbfilesystem/... ./internal/config/... ./internal/metadata/...
  • go test ./... (full repo)
  • bun run check / bun run build in frontend/
  • Manual: toggle "On Corruption" to "Delete file" in the Configuration → Health UI and confirm it round-trips via /api/config

Adds health.corruption_action ("repair" default, "delete") so users without
a reliable ARR-driven repair loop can have AltMount remove confirmed
(non-degraded) corrupted files instead of endlessly retriggering redownloads.
Wired into both the periodic health-check exhaustion path and the live
streaming-failure path; deletion cleans up metadata, the health record, the
physical library file, and any now-empty parent directories.
@javi11 javi11 merged commit f440d29 into main Jul 5, 2026
2 checks passed
@javi11 javi11 deleted the session/sleepy-euclid-550d91 branch July 5, 2026 14:52
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