Skip to content

Unused media: never offer another project's files (data loss with two projects in one folder) - #81

Open
marcin-koziol wants to merge 2 commits into
BurningTreeC:mainfrom
marcin-koziol:unused-media-own-files
Open

marcin-koziol wants to merge 2 commits into
BurningTreeC:mainfrom
marcin-koziol:unused-media-own-files

Conversation

@marcin-koziol

@marcin-koziol marcin-koziol commented Nov 14, 2026 •

Copy link
Copy Markdown

Fixes #82 (critical: loses user data).

What happened

A song and its master project were saved side by side in the same folder, so they shared one Audio folder. When the master project was closed, the unused-media prompt offered every file in that folder the master did not use, which included all of the song's recordings. They were moved to the trash, and the song then opened with every audio track offline. The files were recovered from the trash, but anyone who empties their trash would lose them for good.

Cause

Session::unused_media started from every audio file in Audio/ and removed the ones the saved project and its versions use. A file that no source of this project ever named, such as another project's recording, therefore always counted as unused.

Fix

A file is a candidate only if the project itself brought it into the folder, meaning a source names it in at least one of:

  • the saved file;
  • any saved version;
  • the open session.

Among those, files that nothing saved still uses are offered, as before. A file that no source of the project names is never offered, whether it belongs to another project or was put there by hand. The rest of the behaviour is unchanged: files named elsewhere in a saved file are kept, subfolders are left alone, and nothing is offered when a saved file cannot be read.

Tests

  • New: another_projects_files_in_the_same_folder_are_never_offered. Two projects are saved in one folder. Closing the master offers only its own removed scrap, never the song's vocal. Closing the song offers nothing of the master's.
  • Changed: only_files_no_saved_state_uses_are_unused. A stray file in Audio/ that no source names used to be offered. It is now kept, because it cannot be told apart from another project's recording.
  • Both tests fail without the fix and pass with it. scratch_pads passes, clippy -D warnings on faderframe-session is clean, and so is fmt --check.

docs/ARCHITECTURE.md, in the Unused media section, now describes the new rule.

🤖 Generated with Claude Code

Projects saved in one folder share its Audio folder (a song and its
master side by side). Closing one offered every file there that it did
not use, so the master's close sent the song's recordings to the trash
and the song opened with every track offline.

Unused media are now only the files the project brought there itself: a
source of the saved file, a saved version or the open session names it,
and nothing saved uses it any more. A file no source of the project
names (another project's, one put there by hand) is never offered.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A project saved under a new name and cut down still lists the original's
recordings among its sources, so its unused media offered files the
original plays. Every other project file in the folder now counts: what
it uses is never offered.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Critical] Closing a project trashes another project's recordings when both are saved in the same folder

2 participants