Repository navigation
fix(locallibrary): keep rekordbox's demo samples out of backups - #495
Queued
botandbang wants to merge 3 commits into
Queued
botandbang wants to merge 3 commits into
botandbang wants to merge 3 commits into
Conversation
Every clean copied the demo audio it deleted into its backup. A refresh runs a clean after each export, and each export brings the samples back, so copies piled up on the drive, and a drive too full for the copy couldn't be cleaned at all. A clean now uses delete_unbacked, which leaves the deleted files out of the backup and out of the space check. Undo brings the tracks back without their files and says which, in place of the refusal for a replaced library. Fixes LOC-176
bnb
previously approved these changes
Nov 7, 2026
SizeCompared with main. KiB are 1,024 bytes.
|
Rust coverageFrom run 572. Both are held to the thresholds in .cargo/config.toml.
|
botandbang
added this pull request to the merge queue
Nov 7, 2026
Any commits made after this event will not be merged.
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Nov 7, 2026
… fits the runner's disk
# Conflicts: # crates/locallibrary/src/edit.rs
bnb
approved these changes
Nov 9, 2026
botandbang
added this pull request to the merge queue
Nov 9, 2026
Any commits made after this event will not be merged.
This branch has not been deployed
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.
What and why
Fixes LOC-176.
cleandeletes rekordbox's demo samples with an ordinarydelete_tracksedit (plugins/demos/src/lib.rs), and a commit backs up every file it deletes (commit.rs).refreshrunscleanafter every export and every export brings the samples back, so a copy of the same audio went into a new backup each time. The plan also counted that copy (edit.rs), so a drive too full for it refused the clean withno_space. That formula isedit::plan's own.backup::needed_bytes, which the issue names, only serves library writes and doesn't change.Added
delete_unbacked, an edit that deletes tracks asdelete_tracksdoes and leaves their files out of the backup. The journal records it, soedits replaybehaves the same way. A journal holding one is version 5, which older builds refuse.library:delete-unbacked, the capability a plugin needs to ask for it. Only built-in plugins can have it, because no backup can bring those files back.edit.planandedit.applyrefuse the edit from any sidecar client.BackupInfo.unbacked: the files a change deleted and left out.drive backupsandundo --listcount them.unbacked_audioonundo.plananddrive.restore.preview: the tracks that come back without their audio.Changed
cleanusesdelete_unbacked, so its backup holds only the databases and its space check counts only those. The plan says so: "delete 1 track(s) (rekordbox's next export brings their files back, undo can't)".undoanddrive restoreno longer refuse a backup over audio a change on that drive left out on purpose.missing_audiopasses over those tracks and the plan warns about them instead. This also covers older backups that list the samples. Audio gone for any other reason is refused as before.Removed
restore_preview's copy of themissing_audiocheck (diff.rs). It callsbackup::missing_audionow.What undo can't do any more
Undoing a clean brings back the tracks, their playlist entries and the rows they used, without their audio, analysis or artwork. Those tracks stay without files until rekordbox's next export or another
clean. Backups of samples taken by earlier versions stay on the drive until they're pruned as usual. A clean an earlier version recorded in the journal is replayed as it was made, with its files backed up.How it was tested
Locally on macOS, on this branch merged with main at d7cc328:
cargo coverage --workspacepassed 4904 of 4904 tests, at 98.38% lines, 97.69% functions and 97.02% regions, against today's gates of 96.8%, 96.2% and 95.3%.cargo clippy --workspace --all-targets -- -D warningsis clean, also forx86_64-pc-windows-gnu, and with-p locallibrary -p locallibrary-cli --no-default-features.cargo docwith-D warningsand the doctests pass, and the contract inapps/locallibrary/docs/rpcis regenerated. An earlier full run under heavy load had one failure,doctor::tests::measured_offsets_are_the_delay_or_say_why_not, which this change doesn't touch and which passed alone and in the coverage run.Again on main at 2cf2cf9, which only changed web files since: the contract is regenerated, clippy is clean for
locallibrary,loclib-plugin, the demos plugin andlocallibrary-cli, and their tests that touch cleaning, backups, undo, plugins, the manifest, the journal and the sidecar pass, 1001 of 1003 in one run. The other two timed out while the machine was busy and pass alone:a_drawn_keys_account_type_is_valid_and_broken_in_one_place_is_refused_therein 8.7 s (its limit is 60 s) andthe_sound_plugin_measures_tracksin 67.7 s (120 s). Neither reaches this change.The issue's two conditions run through the real CLI with the plugin hosted, in
apps/locallibrary/tests/it/cli.rs:a_refresh_leaves_no_demo_audio_in_a_backup: two exports and two refreshes, with no audio in any backup and no.wavon the drive.clean_and_refresh_run_on_a_drive_too_full_to_copy_the_demo_samples: a sparse sample twice the size of the free space stops neithercleannorrefresh, also with an olderdelete_tracksclean left on the journal. It runs on Unix only, with file writes capped at about 100 MB, so a copy of that sample fails there instead of filling the disk.crates/locallibrary/tests/it/demos.rscoversedit.planrefusing the edit, the backup's contents, a plaindelete_tracksof the same sample still being refused for space, undo saying what it can't restore, and replays.props_demos.rshas a new Hegel property for edits mixingdelete_unbackedwith other deletes: what the backup holds, the space the plan asks for, andedit.planrefusing the edit.cleaning_removes_exactly_the_demo_tracksnow checks what undo says about the tracks that come back without audio, and that it leaves only the planned files changed.only_built_in_plugins_delete_without_a_backupis a Hegel property over drawn capability lists.The change was broken on purpose 19 ways, one at a time, and at least one test failed each time. With the plugin put back on
delete_tracks, which is the bug, 11 fail, including both CLI tests above.demo_tracks_go_from_both_databases_and_come_back_on_undoasserted the samples' files came back. It's renamed and asserts they don't, since that's the change.Checklist
apps/locallibrary/changes/<branch>.mdhas a changelog line, if people using it will noticedocs/and--helpstill say what the code does (apps/locallibrary/docs/rpc/too, for a sidecar change)