fix(convex): scale the library scanner and search to large libraries #102

Closed
joshuafhiggins wants to merge 2 commits from t3/scale-scanner-and-search into main
pull from: t3/scale-scanner-and-search
2 Commits
  • fix: hide unknown release years on every platform
    Unknown years are stored as 0 and dates as "". Album detail now returns a
    null year and the Siri catalog sends an empty year instead of "0", so no
    client has to special-case 0.
    
    Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
  • fix(convex): scale the library scanner and search to large libraries
    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>