mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #2473] [Issue]: duplicate_persona shares the original's avatar file; deleting one persona breaks the duplicate's avatar #1215
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#1215
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/2473
Originally assigned to: @SpicyMarinara on GitHub.
Summary
Severity: Medium — data-loss.
duplicate_personaclones the record verbatim without copying the managed avatar file, so the duplicate'savatarFilePathpoints at the original persona's file. Because personas now have active delete-time avatar cleanup, deleting the original (or editing its avatar) breaks the duplicate's image. The siblingduplicate_charactercopies the file correctly.Expected behavior
Duplicating a persona should make a fresh on-disk copy of its managed avatar and rewrite the avatar fields on the copy, exactly like
duplicate_character, so the two records do not share a file.Actual behavior
By contrast
duplicate_character(characters.rs:548-580) callsduplicate_managed_character_avatar→persist_image_file_copyand rewritesavatar/avatarPath/avatarFilePath/avatarFilenameon the copy. Personas use the same managed-avatar scheme (avatars/personas) and carryMEDIA_CLEANUP = RemoveOwnedMedia, so deleting the original persona runsremove_avatar_file_preserving_persona_snapshots→remove_avatar_file, which unlinks the shared file by path. The persona-snapshot guard only matches message snapshots bypersonaId, so a duplicate persona record pointing at the same file is not protected — its avatar becomes a broken image. Editing/cropping one persona's avatar also mutates the file shared by the other.Steps to reproduce
avatars/personas).storage_duplicateentitypersonas).avatarFilePathpointed at the deleted file).Impact area
Environment
1fae2c42Logs, screenshots, or video
Static trace:
personas.rs:4-20(no avatar copy) vscharacters.rs:548-580(duplicate_managed_character_avatar); cleanupavatars.rs:170-199.Regression notes
Not a regression — main shares avatar paths on duplicate for both personas and characters and never deletes the avatar file on persona delete (so main's duplicate+delete merely leaks the file, it doesn't break the image). The break is refactor-only: the refactor added delete-time avatar cleanup and hardened
duplicate_characterwith a fresh-copy path, while leavingduplicate_personacloning verbatim. Filing as a refactorbug(fix-pattern-already-in-repo inconsistency).Additional context
Recoverable by re-uploading the avatar (broken reference, not destruction of unrelated data), hence Medium. Fix: generalize the
DuplicateAvatarcopy/rewrite pattern fromduplicate_charactertoduplicate_persona— copy the managed file (managed_record_file_pathonavatars/personas+persist_image_file_copy), rewriteavatar/avatarPath/avatarFilePath/avatarFilename, and null the managed metadata when the source file is missing.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.duplicate_persona now copies managed persona avatar files and rewrites avatar metadata so the duplicate no longer shares the original avatar file.
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.