{{ message }}
fix: don't auto-purge the desktop library (skip job TTL sweep)#229
Merged
Conversation
The desktop app persists its track list permanently in ~/Documents/StemDeck/user-data.json, but stems under jobs/<id>/ were subject to the 24h job TTL sweep that runs at every startup. After a day (or any app restart past the TTL -- e.g. installing a new release) the sweep deleted the stems while the library entries remained, surfacing "This track's audio is no longer available. Re-upload to restore it." The TTL is a disk-hygiene default for the shared server/Docker deployment. On desktop the library is user-curated (folders + Trash), so skip the sweep when running under the desktop shell (STEMDECK_DESKTOP=1, set by the Tauri launcher on Windows/macOS/Linux). Disk stays under user control.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Problem
On desktop, the library track list is persisted permanently in
~/Documents/StemDeck/user-data.json, but the stems underjobs/<id>/are subject to the 24h job TTL sweep that runs at every server startup. So a day later — or whenever the app restarts past the TTL, e.g. installing a new release — the sweep deletes the stems while the library entries survive, leaving orphaned tracks that show:Users read this as "every new release loses my songs", but it's really the TTL firing on the post-update restart (reopening the app the next day does the same).
Fix
The TTL is a sensible disk-hygiene default for the shared server / Docker deployment. On desktop the library is user-curated (folders + Trash), so the sweep shouldn't auto-purge it. Skip the sweep when running under the desktop shell —
STEMDECK_DESKTOP=1, which the Tauri launcher sets unconditionally on Windows, macOS, and Linux (main.rs:595). Disk usage stays under the user's control via the existing Trash/delete UI. The server/Docker path is unchanged.Scope
app/main.py):_sweep_loopreturns early when_sweep_disabled()(desktop).Tests
_sweep_disabled()true underSTEMDECK_DESKTOP=1, false otherwise._sweep_loop()returns immediately (doesn't enter the hourly loop) in desktop mode.ruff format --checkclean.