Skip to content

Treat missing paths reported as modified as deletions - #61

Open
vyrti wants to merge 1 commit into
mainfrom
fix/tv-folder-deletion-refresh
Open

vyrti wants to merge 1 commit into
mainfrom
fix/tv-folder-deletion-refresh

Conversation

@vyrti

@vyrti vyrti commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

Problem

Deleting a folder from disk while VuIO is running did not remove it from DLNA/TV listings. The folder and its files stayed in the index, and no ContentDirectory revision was published.

Root cause

On macOS, FSEvents emits Remove(Folder) plus Modify(Metadata(Extended)) for a deleted directory. notify-debouncer-full 0.7 can discard the Remove when a delayed Create for the same path is still in its queue: push_remove_event drops the whole queue when was_created() is true. The only event left for the app is then Modify(Metadata).

convert_watcher_events only handled Modify as Modified. A deleted directory fails path_is_relevant (it is no longer a dir and has no media extension), so the last event was dropped. No Deleted means no index cleanup, no revision bump, and no UPnP NOTIFY — so the TV kept listing the folder.

Since #58 removed the five-minute deleted-file probe and defaults full_rescan_interval_hours to 0, nothing else reconciled the index while the server was running.

A live index reproduced the end state: media.db still contained a deleted folder and two files from ~/Downloads, while none existed on disk.

Fix

Any Modify(Data|Metadata|Any|Other) event for a path that no longer exists (try_exists() == Ok(false)) and belongs to a configured library is now converted to FileSystemEvent::Deleted. I/O and permission errors (Err) are still not treated as deletions. This also fixes deleted media files that were being misclassified as modifications.

Tests

  • New regression test: a missing directory and a missing file in a Modify(Metadata) batch become deletions, while an existing file stays Modified.
  • Updated the existing modify-conversion test to use an existing file.
  • Verified end-to-end with the real OS watcher and event handler: with the fix the folder is removed from the index; without it, the check times out after 15 seconds.
  • cargo test -p vuio-core --no-default-features --lib watcher::tests — 11 passed
  • cargo test -p vuio-core --no-default-features --lib lifecycle::media_service — 20 passed

This branch has not been deployed

No deployments
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