[PR #2378] [MERGED] Delete sprite directories when a character or persona is deleted #5567

Closed
opened 2026-10-22 04:17:26 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/2378
Author: @Romuromylus
Created: 6/5/2026
Status: ✅ Merged
Merged: 6/6/2026
Merged by: @Romuromylus

Base: refactor ← Head: fix/sprite-dir-delete-leak


📝 Commits (2)

  • 70f0465 Delete sprite directories when a character or persona is deleted
  • 294a4ef Decouple sprite delete cleanup from legacy migration

📊 Changes

3 files changed (+107 additions, -3 deletions)

View changed files

📝 src-tauri/src/commands/storage/admin.rs (+1 -0)
📝 src-tauri/src/commands/storage/commands/entities.rs (+78 -3)
📝 src-tauri/src/commands/storage/sprites.rs (+28 -0)

📄 Description

Linked issue

Closes #2328

Why this change

Sprite packs are written under sprites/<characterId> and sprites/personas/<personaId>, but remove_owned_media only cleaned up avatars, so the whole sprite directory leaked on entity delete. clear_runtime_media (admin reset) also skipped sprites.

What changed

  • Add a best-effort remove_owned_sprite_dir helper (mirrors the avatar-cleanup pattern, reuses the validated sprites_dir path resolver, logs and swallows errors) and call it from the characters and personas branches of remove_owned_media.
  • Wipe the sprites directory in clear_runtime_media.

Refactor impact

Primary owner: Rust storage (src-tauri/src/commands/storage/)

Impact areas reviewed:

  • entities.rs (remove_owned_media), sprites.rs (helper), admin.rs (clear_runtime_media). No new DeleteCleanup variant — reuses the existing RemoveOwnedMedia path.

Boundary notes:

  • none

Pressure points touched:

  • none

Validation

  • Matching validation command passes locally
  • Full pnpm check passes before PR push/handoff
  • Human/manual validation completed by contributor or reviewer

Manual verification notes

  • cargo clippy --workspace --all-targets -- -D warnings — clean
  • cargo test --workspace — green, including new deleting_character_removes_its_sprite_directory and deleting_persona_removes_its_sprite_directory.

Feature Discoverability

  • N/A because this PR is a disk-leak bugfix and does not add a new thing users need to find.

Reason:

  • Cleanup of an existing delete path.

Docs and release impact

  • No docs changes needed

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/2378 **Author:** [@Romuromylus](https://github.com/Romuromylus) **Created:** 6/5/2026 **Status:** ✅ Merged **Merged:** 6/6/2026 **Merged by:** [@Romuromylus](https://github.com/Romuromylus) **Base:** `refactor` ← **Head:** `fix/sprite-dir-delete-leak` --- ### 📝 Commits (2) - [`70f0465`](https://github.com/Pasta-Devs/Marinara-Engine/commit/70f04657b5f118fd92751633578dbaae4e3dfc93) Delete sprite directories when a character or persona is deleted - [`294a4ef`](https://github.com/Pasta-Devs/Marinara-Engine/commit/294a4efd2a6624fb1bb5223dc417b36f0bcc74ea) Decouple sprite delete cleanup from legacy migration ### 📊 Changes **3 files changed** (+107 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `src-tauri/src/commands/storage/admin.rs` (+1 -0) 📝 `src-tauri/src/commands/storage/commands/entities.rs` (+78 -3) 📝 `src-tauri/src/commands/storage/sprites.rs` (+28 -0) </details> ### 📄 Description ## Linked issue Closes #2328 ## Why this change Sprite packs are written under `sprites/<characterId>` and `sprites/personas/<personaId>`, but `remove_owned_media` only cleaned up avatars, so the whole sprite directory leaked on entity delete. `clear_runtime_media` (admin reset) also skipped sprites. ## What changed - Add a best-effort `remove_owned_sprite_dir` helper (mirrors the avatar-cleanup pattern, reuses the validated `sprites_dir` path resolver, logs and swallows errors) and call it from the `characters` and `personas` branches of `remove_owned_media`. - Wipe the `sprites` directory in `clear_runtime_media`. ## Refactor impact Primary owner: Rust storage (`src-tauri/src/commands/storage/`) Impact areas reviewed: - `entities.rs` (`remove_owned_media`), `sprites.rs` (helper), `admin.rs` (`clear_runtime_media`). No new `DeleteCleanup` variant — reuses the existing `RemoveOwnedMedia` path. Boundary notes: - none Pressure points touched: - none ## Validation - [ ] Matching validation command passes locally - [ ] Full `pnpm check` passes before PR push/handoff - [ ] Human/manual validation completed by contributor or reviewer ### Manual verification notes - `cargo clippy --workspace --all-targets -- -D warnings` — clean - `cargo test --workspace` — green, including new `deleting_character_removes_its_sprite_directory` and `deleting_persona_removes_its_sprite_directory`. ## Feature Discoverability - [x] N/A because this PR is a disk-leak bugfix and does not add a new thing users need to find. Reason: - Cleanup of an existing delete path. ## Docs and release impact - [x] No docs changes needed --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:17:26 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#5567
No description provided.