Repository navigation
refactor(locallibrary)!: rekordbox's demo tracks are found by a check and removed by the demos plugin - #247
Merged
Merged
Conversation
… demos plugin's clean `locallibrary clean` moves out of the library into a first-party plugin, demos, the first that contributes a check. Its check lists the demo tracks on a drive in `check` and doctor, fixed by its `clean` operation, which keeps the command's place on the command line and is `refresh`'s first step. The demo track list lives in the plugin. The plugin's plan is one `delete_tracks` edit naming the tracks' audio files, so a delete now removes every row of a named file (two rows can share one, and the file goes with them) and may name a track only OneLibrary lists, which is deleted there; replayed, one whose tracks are gone does nothing. Deleting a playlist with its tracks, packing a drive and replacing a track leave alone a file a kept track shares. The core clean plan and apply, the CLI command, and the `clean.plan` and `clean.apply` RPC methods are gone; the helpers other writes share move to track_files.rs and `onelibrary::open_plus`.
# Conflicts: # apps/locallibrary/CHANGELOG.md # apps/locallibrary/docs/how-it-works.md # apps/locallibrary/docs/plugins.md # apps/locallibrary/docs/sidecar.md # apps/locallibrary/src/plugins.rs # apps/locallibrary/tests/it/plugins.rs # crates/locallibrary/Cargo.toml # crates/locallibrary/tests/it/props_api.rs
SizeCompared with main. KiB are 1,024 bytes.
|
Rust coverageFrom run 457. Both are held to the thresholds in .cargo/config.toml.
|
bnb
previously approved these changes
Oct 25, 2026
botandbang
marked this pull request as draft
October 25, 2026 18:02
# Conflicts: # apps/locallibrary/CHANGELOG.md # apps/locallibrary/Cargo.toml
botandbang
marked this pull request as ready for review
October 25, 2026 18:16
bnb
approved these changes
Oct 25, 2026
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
locallibrary clean(removing the demo tracks rekordbox ships in its collection, which every export puts back on a drive) was a core command with its own plan, apply, render and RPC methods. It's now a first-party plugin,demos, and the first one that contributes a check.Added:
plugins/demos/: the plugin. Itstrackscheck (on by default, run withcheckand doctor) reports the demo tracks on a drive as oneinfofinding naming them, fixed by itscleanoperation.cleanhascli = "clean", solocallibrary clean [DRIVE] [--dry-run] [--yes]still works, and it's offered in the player's drive menu and palette like any plugin operation. The demo track list (DEMO_TRACKS) moved here from core. It reads the drive's combined library (both databases) and plans onedelete_tracksedit naming the tracks' audio files, each once. A demo track whose file a track of the DJ's also uses stays, with a warning, since the edit names tracks by file. The id isdemosrather thancleansoplugin listsays what it's about, not what it does.plugins/and the CLI's dependency on it (build.rs links in every folder there, and the CLI's tests read the shipped plugins from them), docs/plugins.md, the layout in docs/how-it-works.md and a CHANGELOG entry. No area label fits it (locallibrary: pluginsalready coversplugins/**).cleandeletes exactly the files of the demo tracks no other track shares, each once, and the check names exactly those tracks. In the library's tests,demos.rs,props_demos.rs(fromprops_clean.rs) andprops_disk2_demos.rs(fromprops_disk2_clean.rs) serve the real plugin in process, answer its read with the host's owndrive.library, and plan and apply its edits on fixture and drawn drives. That covers both databases, OneLibrary-only tracks and drives, files shared with other tracks, audio outsideContents/, an unreadable OneLibrary or exportExt.pdb, rekordbox's playlist sync, OneLibrary artwork, stale plans and undo.Changed:
delete_tracksedits (crates/locallibrary/src/edit.rs). This is what lets the plugin remove everythingcleanremoved:tracks_removed, which already counted every row. That left a row pointing at a deleted file.tracks_removed, and its files go.Op::DeleteTrackscarries these files aselsewhere, which a database without them leaves alone.edits replay, and a refresh's replay step right after itsclean), a delete whose tracks are all gone does nothing, noting them, rather than being skipped as an edit selecting nothing.replace_trackrefuses a duplicate on the keeper's own file.refresh's first step (clean) is the demos plugin'scleanoperation, planned and planned again the way a refresh runs any plugin operation (OperationStep::again). Skipped, it says so; without the plugin hosted, it says "the demos plugin isn't there"; with no demo tracks, "no demo samples on the drive". docs/editing.md's list of refresh steps says whose operation it is.removable_files,analysis_files) move from clean.rs to track_files.rs, andopen_plusmoves toonelibrary.clean's plan is now an edit plan, so it's journaled, its backup reason is "before editing", and its output is the edit plan's.plugins::jobs) no longer expects acleanstep to run, since the demos plugin isn't hosted there: the second operation is still planned again on the drive as the first left it.crates/locallibrary/examples/test-plugin, which no longer exists. It now points atcrates/locallibrary/src/bin/test-plugin.Removed:
clean::plan,clean::apply,CleanPlan,CleanReport,USELESS_TRACKSandunused_lookups(edits prune unused lookup rows themselves). Alsoapi::clean_planandapi::clean_apply, and the tests that only covered them.LineageOp::Cleanstays, since drives record it.cleancommand and its renderers. The plugin'sclitakes its place.clean.planandclean.apply. Desktop apps useplugins.op.plan {plugin: "demos", operation: "clean", context: {drive}}andplugins.op.apply. docs/rpc was regenerated.How it was tested
cargo fmt --all --check,cargo clippy --workspace --all-targets --locked -- -D warnings,git diff --check: clean.cargo nextest run --locked -p locallibrary -p locallibrary-plugin-demos -p locallibrary-plugin-tracklist: 2132 tests, all passing.cargo nextest run --locked -p locallibrary-cli: 1067 tests, all passing. That includeslocallibrary cleanthrough the hosted plugin (cli,drives::sync),refreshrunning it first and its replay step finding the sample gone (jobs), the check's place inplugin checksand the player's check settings form, and docs/rpc being current (regenerated withLOCALLIBRARY_BLESS=1).demos::a_demo_track_only_onelibrary_lists_goes_toofails. With the plugin no longer leaving out demo tracks that share a file with another track,props_demos::cleaning_removes_exactly_the_demo_tracksand the plugin's own property both fail.cargo clippy -p locallibrary-cli --no-default-features --locked -- -D warnings,cargo deny --locked check advisories bans licenses sourcesandtools/policy.sh(60/60 policy tests, 41 conftest checks) pass.New app or plugin
CODEOWNERSif someone else reviews it, a changelog line, and READMEs that say what it doesChecklist
apps/locallibrary/CHANGELOG.mdhas a line under Unreleased, if people using it will noticedocs/and--helpstill say what the code does (apps/locallibrary/docs/rpc/too, for a sidecar change)