The scanner loaded every artist, album and song several times per run with
full collects, so large libraries hit Convex read limits and every cron run
failed. Search and browse also collected the whole library per call.
- Scanner reads the library once in pages, walks the disk once, parses only
untracked files and writes only what changed. A re-scan of an unchanged
library makes no library writes.
- Albums are created together with their songs; untitled files fall back to
the filename so their album is never left empty and recreated.
- A lease lock keeps the cron and the admin button from running concurrently;
empty album/artist deletes re-check inside the mutation.
- Search uses name search indexes with capped results; browseSongs and the
library play queue are bounded.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>