mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #2476] [Issue]: Managed-thumbnail cache is never pruned when backgrounds, lorebook images, or gallery items are deleted #1219
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#1219
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Romuromylus on GitHub (Jun 6, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2476
Originally assigned to: @SpicyMarinara on GitHub.
Summary
Severity: Low — resource leak. The
.managed-thumbnailscache (backgrounds, gallery, game, lorebook images) is never pruned when its source asset is deleted, replaced, or renamed, while the parallel avatar-thumbnail cache is cleaned. Disk usage grows monotonically with asset churn and is never reclaimed.Expected behavior
Deleting/renaming/replacing a managed image should remove its cached thumbnails, mirroring the avatar path (
remove_avatar_file→remove_avatar_thumbnail_files).Actual behavior
The write path creates up to 4 cached PNGs per asset:
But no delete path removes them. A repo-wide grep for
.managed-thumbnailsfinds it only inmanaged_thumbnails.rs(write/read) plus FS-scope config and read-delivery wiring — there is no remove call from any delete path. Traced delete paths are source-file-only:delete_background(backgrounds.rs:153),remove_lorebook_image_file(lorebook_images.rs:29), gallery delete (entities.rs:2366→remove_managed_record_fileinmedia_uploads.rs:143-166). Contrast avatars, which are cleaned viaremove_avatar_thumbnail_files(avatars.rs:171/278).rename_backgroundalso moves the source, stranding the old-name-keyed thumbnails.Steps to reproduce
.managed-thumbnails/background/<size>/<name>.thumb.png)..managed-thumbnailsentries remain.Impact area
Environment
1fae2c42Logs, screenshots, or video
Static trace:
managed_thumbnails.rs:144-156(write), delete pathsbackgrounds.rs:153/lorebook_images.rs:29/entities.rs:2366→media_uploads.rs:143-166; contrastavatars.rs:171/278.Regression notes
Not a regression — the managed-thumbnail cache (and the avatar cache it mirrors) is a refactor-only Rust asset-layer surface with no main/web equivalent. Filing as a refactor
bug(fix-pattern-already-in-repo inconsistency).Additional context
The cache is regeneratable and bounded by the count of distinct assets ever thumbnailed, hence Low. Fix: add a
remove_managed_thumbnail_files(state, kind, relative)helper mirroringremove_avatar_thumbnail_files(iterateMANAGED_THUMBNAIL_SIZES, resolverelativevia the canonical kind root asmanaged_thumbnail_pathdoes), and call it fromdelete_background,rename_background(old name),remove_lorebook_image_file, andremove_gallery_file.Template check
Please uncheck the box below before submitting so we know you read the template. It is intentionally pre-checked:
@SpicyMarinara commented on GitHub (Jun 6, 2026):
Fixed on refactor in
038b7220.Managed thumbnail cache files are pruned when backgrounds, lorebook images, gallery items, and game assets are deleted, renamed, or moved.
Verification: pnpm typecheck; pnpm build; pnpm check:architecture; cargo check --manifest-path src-tauri/Cargo.toml --workspace; focused Rust backup/profile tests; git diff --check; no .test.ts/.test.tsx files present.