Skip to content

Fix stale media after deletions and moves out of the library - #57

Merged
vyrti merged 1 commit into
mainfrom
fix/deleted-media-cleanup
Oct 17, 2026
Merged

vyrti merged 1 commit into
mainfrom
fix/deleted-media-cleanup

Conversation

@vyrti

@vyrti vyrti commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

Deleting the last media file or folder left its rows indexed because a successful empty scan was treated as an unavailable library. Paired folder moves outside a watched library also returned without removing the source subtree, and backend rescan signals without paths were discarded before reconciliation.

This change reconciles readable empty libraries, removes media and derived content when a path moves outside the library, and schedules reconciliation for every watched root when the backend reports lost events. Directory pruning, browse-cache invalidation, and UPnP change notifications use the existing deletion path. Unreadable roots still keep their indexed media.

Validation:

  • Reproduced the empty-library and moved-folder failures with regression tests before applying the fixes.
  • Added coverage for recursive and nonrecursive empty scans, unreadable roots, recovery from an old empty-root availability state, backend rescan signals, and a real UPnP subscriber receiving the removal revision.
  • cargo test -p vuio-core: 835 passed, 8 ignored, including integration tests and doctests.
  • cargo fmt -p vuio-core -p vuio-cli -p vuio-cast -p vuio-web -- --check
  • cargo clippy -p vuio-core -p vuio-cli -p vuio-cast -p vuio-web --all-targets --all-features -- -D clippy::all -D clippy::string_slice -D warnings

A readable empty root is now treated as empty rather than offline; root read failures continue to use the existing unavailable-root grace policy.

@vyrti vyrti closed this Oct 17, 2026
@vyrti vyrti reopened this Oct 17, 2026
@vyrti
vyrti force-pushed the fix/deleted-media-cleanup branch from c4c6f9e to d17229a Compare October 17, 2026 03:41
@vyrti

vyrti commented Oct 17, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto be42474 (#56 — merged via squash) and force-pushed the branch. The two PRs fix disjoint holes — this PR handled #56's leftover gaps locally and kept every guard: readable empty roots are no longer marked unavailable in the first tick, and validate_and_cleanup_deleted_files runs every tick, so empty libraries are reconciled within five minutes rather than after the unavailable-root grace period.

Combined validation on the rebased tip (#56 + this fix):

  • cargo test -p vuio-core: 841 passed, 8 ignored, 0 failed
  • cargo fmt -p vuio-cli -p vuio-core -p vuio-cast -p vuio-web: clean
  • cargo clippy -p vuio-cli -p vuio-core -p vuio-cast -p vuio-web --all-targets: 0 warnings

@vyrti
vyrti merged commit 3207020 into main Oct 17, 2026
21 checks passed
@vyrti
vyrti deleted the fix/deleted-media-cleanup branch October 17, 2026 03:53
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