Date: 2026-03-18 20:24 Model: Gemini 3 Pro (Preview) Type: general Artifact: ## Offline Download — Draft Proposal ### Problem Cloud tracks can only be streamed. No way to make
Here is a critique of the draft proposal for the Offline Download feature.
The core identification of risks is solid, particularly the conflict between OS-level cache purging and database state (Risk #2). However, the proposal misses a critical architectural flaw regarding the storage location assumption.
~/Library/Caches/ as the download location. This directly contradicts the requirement for "persistent downloads" (implied by "Offline Download" vs. "Cache"). If a user explicitly clicks "Download," they expect that file to remain until they delete it. Caches/ is for disposable data the OS can reap when disk space is low.
~/Library/Application Support/MixBoard/Downloads/ or ~/Music/MixBoard/Offline/, excluded from iCloud backup if necessary, but provenly persistent.Routing Logic fragility (Risk #1): The risk is correctly identified but the analysis stops short.
hasLocalFile = !filePath.isEmpty && !isCloudisCloud become false? If so, you break syncing logic. If not, how do existing consumers know to look at filePath?isOfflineAvailable. The routing logic must change from if isCloud to if isCloud && !isOfflineAvailable.Format Compatibility (Risk #5): You mention OGG Vorbis support via stb_vorbis but question if it's in AudioEngine.
StreamingPlayer uses AVPlayer (which supports HLS/HTTP streaming natively but not raw OGG usually) and AudioEngine is AVAudioEngine, switching engines based on download state is dangerous. AVAudioFile (standard input for AVAudioEngine) does not natively support OGG Vorbis without third-party codecs or custom buffers..ogg stream, downloading it as a file and feeding it to AVAudioEngine will crash or fail silently unless your custom decoder is hooked into the file reading pipeline.Concurrency & Queue Management: You mentioned "Concurrent downloads across multiple albums" (Risk #4) but didn't propose a mechanism.
OperationQueue or TaskGroup with a maxConcurrentOperationCount (e.g., 2 or 3). Dumping 500 tasks into URLSession simultaneously is bad practice.Partial State Handling: What happens if the app crashes halfway through a download?
.downloading state in the model or a separate DownloadJob table. SwiftData must not record a valid filePath until the file is fully moved to its final destination and validated.Permissions: Since this is macOS, does the app have App Sandbox enabled? If so, writing to arbitrary locations requires entitlements, though standard Application Support/Caches are usually fine.
The recommendation to extend DownloadService is logical, but the specific implementation detail of using ~/Library/Caches is fatal to the "Offline" consumer promise. It must be Application Support.
The transition from StreamingPlayer (AVPlayer) to AudioEngine (AVAudioEngine) for downloaded files is high risk for OGG/FLAC edge cases.
stb_vorbis: [UNVERIFIED] - This is a real C library for OGG decoding. However, claiming MixBoard uses it is unverified based on the provided text alone, though User Context implies it exists.~/Library/Caches/MixBoard/CloudTracks/: [VERIFIED PLACEMENT] - This is a standard macOS path structure, not a hallucination, but mechanically incorrect for persistent downloads.Chad Music: [UNVERIFIED] - Likely internal project name or typo for valid service.Track @Model: [VERIFIED] - Confirmed in User Context.Status: No hallucinations detected in external libraries; potential confusion on internal implementation details vs. standard macOS behaviors.