Storage cleanup tools (#70) #130

Merged
crowmaki merged 1 commit from issue-70-storage-cleanup into main 2026-10-09 22:20:54 +00:00
Owner

Closes #70 (part of #24).

Storage now suggests what could go, and nothing runs until the filmmaker acts. Suggestion chips tick rows only. Each row says which action takes it, and the selection bar offers those actions.

What changed

  • Suggestions: NG Takes, Replaced by a final, Unused sheets, Orphan files, _Removed/ and Compact. Each one ticks the rows it names and also shows every kind, so the ticked rows are visible. Only rows an action can take now are suggested: a circled or promoting item never is.
    • "Replaced by a final" means the drafts and latents of Takes whose final still has its files.
  • Orphan files: opening Storage scans the media folder for files that no Rendition records. Files that belong to a Rendition still being rendered or finishing are left alone. Purge deletes orphan files through the same plan and confirmation as Rendition files.
  • Source sheets:
    • Storage can delete an unused sheet. This is an undoable edit, because the sheet's pixels stay in the file until the Project is next opened.
    • A sheet in use lists each Reference version cut from it. Each entry links to the Character, Location or Prop that holds its set.
  • Empty _Removed/: deletes what re-exports set aside. It warns that clips still linked in a DaVinci Resolve project will go offline. It can't be undone.
  • Compact: runs VACUUM and then folds the WAL back into the file, so the file really shrinks.
  • Dailies shortcuts:
    • "Free space on N NG…" asks Storage for the NG suggestion in this Scene and purges through the shared PurgeDialog.
    • "Delete N failed…" asks for confirmation, then deletes the Scene's failed Takes by the same rule a single delete follows.
  • CONTEXT.md: adds Orphan file, Suggestion and Compact.

For review

  • "With the queue paused": Compact holds the session while VACUUM runs, so no job can start or land, not even the one ComfyUI is running. It doesn't write the queue's paused flag, so the user's paused setting stays as it was, even if Compact fails.
  • Suggestion chip sizes: a chip shows the selected rows' size, not what deleting them reclaims. Deleting an unused sheet frees space inside the project file, and that space only reaches the disk after Compact. Reclaimable bytes would show 0 B there, which reads as useless.
  • Dailies "Free space" count: the button only shows while an NG Take has a playable Rendition. If an NG Take has only its latents left, the button doesn't appear, but Storage's NG suggestion still selects those latents.

Tests

  • cargo test --workspace --all-features, bun test src scripts and bun run check all pass.
  • New core tests in crates/studio-core/tests/storage.rs:
    • deleting a sheet, and undoing and redoing the delete
    • suggestion selection, including a final whose files were purged
    • the orphan scan and orphan purge, and refusing a Rendition's own file or ../
    • emptying _Removed/ after a re-export
    • Compact giving the free pages back and leaving the queue state as it was
    • deleting a Scene's failed Takes
  • New front-end tests for the suggestion, selection and jump-link helpers.

Screenshots

These come from a sample Project. ComfyUI was offline, so there are no Renditions. The _Removed/ folder was set up by hand.

Storage with suggestions

Orphan files suggestion ticks its rows

An in-use Source sheet lists its uses, with jump links

Compact confirmation

After Compact: 4.3 MB to 1.1 MB

Unused sheets deleted, and undo offered

Purging orphan files

Empty _Removed warns about Resolve links

Closes #70 (part of #24). Storage now suggests what could go, and nothing runs until the filmmaker acts. Suggestion chips tick rows only. Each row says which action takes it, and the selection bar offers those actions. ## What changed - **Suggestions:** NG Takes, Replaced by a final, Unused sheets, Orphan files, `_Removed/` and Compact. Each one ticks the rows it names and also shows every kind, so the ticked rows are visible. Only rows an action can take now are suggested: a circled or promoting item never is. - "Replaced by a final" means the drafts and latents of Takes whose final still has its files. - **Orphan files:** opening Storage scans the media folder for files that no Rendition records. Files that belong to a Rendition still being rendered or finishing are left alone. Purge deletes orphan files through the same plan and confirmation as Rendition files. - **Source sheets:** - Storage can delete an unused sheet. This is an undoable edit, because the sheet's pixels stay in the file until the Project is next opened. - A sheet in use lists each Reference version cut from it. Each entry links to the Character, Location or Prop that holds its set. - **Empty `_Removed/`:** deletes what re-exports set aside. It warns that clips still linked in a DaVinci Resolve project will go offline. It can't be undone. - **Compact:** runs `VACUUM` and then folds the WAL back into the file, so the file really shrinks. - **Dailies shortcuts:** - "Free space on N NG…" asks Storage for the NG suggestion in this Scene and purges through the shared `PurgeDialog`. - "Delete N failed…" asks for confirmation, then deletes the Scene's failed Takes by the same rule a single delete follows. - **CONTEXT.md:** adds Orphan file, Suggestion and Compact. ### For review - **"With the queue paused":** Compact holds the session while `VACUUM` runs, so no job can start or land, not even the one ComfyUI is running. It doesn't write the queue's paused flag, so the user's paused setting stays as it was, even if Compact fails. - **Suggestion chip sizes:** a chip shows the selected rows' size, not what deleting them reclaims. Deleting an unused sheet frees space inside the project file, and that space only reaches the disk after Compact. Reclaimable bytes would show `0 B` there, which reads as useless. - **Dailies "Free space" count:** the button only shows while an NG Take has a playable Rendition. If an NG Take has only its latents left, the button doesn't appear, but Storage's NG suggestion still selects those latents. ## Tests - `cargo test --workspace --all-features`, `bun test src scripts` and `bun run check` all pass. - New core tests in `crates/studio-core/tests/storage.rs`: - deleting a sheet, and undoing and redoing the delete - suggestion selection, including a final whose files were purged - the orphan scan and orphan purge, and refusing a Rendition's own file or `../` - emptying `_Removed/` after a re-export - Compact giving the free pages back and leaving the queue state as it was - deleting a Scene's failed Takes - New front-end tests for the suggestion, selection and jump-link helpers. ## Screenshots These come from a sample Project. ComfyUI was offline, so there are no Renditions. The `_Removed/` folder was set up by hand. ![Storage with suggestions](https://git.crowmaki.me/attachments/7739441b-1826-40d9-824c-37f465dd3d92) ![Orphan files suggestion ticks its rows](https://git.crowmaki.me/attachments/550f2e93-ca1f-4206-ae3e-02f18b41572b) ![An in-use Source sheet lists its uses, with jump links](https://git.crowmaki.me/attachments/cb55b567-5f9a-4ccd-aa35-a26fa057e60a) ![Compact confirmation](https://git.crowmaki.me/attachments/9d09e525-38c0-4698-9e27-ef4cd90b3992) ![After Compact: 4.3 MB to 1.1 MB](https://git.crowmaki.me/attachments/32286316-62de-488d-acff-200e5b85dfb0) ![Unused sheets deleted, and undo offered](https://git.crowmaki.me/attachments/9f7d6f45-6021-41dc-8a70-684e45dceda6) ![Purging orphan files](https://git.crowmaki.me/attachments/1a3e3406-4431-4d41-a392-4b7d4bee1646) ![Empty _Removed warns about Resolve links](https://git.crowmaki.me/attachments/a75ed527-bac5-4c54-8355-7caa6f30a58e)
Storage suggests what could go and never runs anything on its own.
Suggestion chips (NG Takes, what a playing final replaced, unused Source
sheets, orphan files, _Removed/, Compact) only tick rows; each row says
which action takes it, and the ticked rows offer that action.

Opening Storage scans the media folder for orphan files no Rendition
records, leaving alone files of Renditions still on their way. Purge
takes orphan files like Rendition files, through the same plan and
confirmation.

An unused Source sheet is deleted from Storage as an undoable edit; one in
use lists the Reference versions cut from it, each linking to the
Character, Location or Prop that holds its set. Empty _Removed/ warns that
Resolve links to those clips go offline. Compact runs VACUUM while it
holds the session, so no job starts or lands, and leaves the queue's
paused state as it was. Neither can be undone.

Dailies frees space on a Scene's NG Takes by asking Storage for the same
suggestion and purging through the shared dialog, and deletes the
Scene's failed Takes by the rule a single delete follows, after a
confirmation.

Co-Authored-By: Claude <noreply@anthropic.com>
crowmaki deleted branch issue-70-storage-cleanup 2026-10-09 22:20:54 +00:00
Sign in to join this conversation.
No description provided.