[GH-ISSUE #1512] Import Profile is a destructive full-replace with no confirmation and wipes collections absent from the file #760

Closed
opened 2026-10-20 17:33:01 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @Romuromylus on GitHub (May 29, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/1512

Originally assigned to: @Romuromylus on GitHub.

Summary

Importing a profile replaces the entire local profile with no warning. Collections that are not present in the imported file are wiped to empty rather than left untouched.

Repro

  1. Start from an instance with data (e.g. 31 characters, 32 lorebooks, 20 personas, 5 chats).
  2. Import a profile whose fileStorage.tables contains only chats and messages.
  3. Result: chats/messages are replaced as expected, but characters -> 0, lorebooks -> 0, personas -> 0. Every collection not in the file is wiped.

Root cause

src-tauri/src/commands/storage/profile/legacy.rs builds replacements for the full fixed table-mapping list and calls replace_all_many_and_then(...). Any mapped collection missing from the imported file is replaced with an empty array. src/features/shell/settings/components/ProfileImportSection.tsx calls importProfileFile immediately after the file picker, with no confirmation dialog and no "this will replace your data" warning.

Impact

A full, complete backup restores correctly. But importing a partial profile, an older backup missing a table, or a hand-built export silently destroys everything not included, with no prompt and no undo.

Suggested directions (for discussion)

  • Add a confirmation step before import that states the data will be replaced.
  • Consider leaving collections absent from the file untouched instead of wiping them, or make replace-vs-merge explicit in the UI.

Environment

refactor @ ef244c80, Windows 11, Tauri desktop (pnpm tauri dev).


Found during smoke test #1484 (Heavy Data / Legacy / Import Pass). Project board: https://github.com/orgs/Pasta-Devs/projects/4

Originally created by @Romuromylus on GitHub (May 29, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/1512 Originally assigned to: @Romuromylus on GitHub. ## Summary Importing a profile replaces the entire local profile with no warning. Collections that are not present in the imported file are wiped to empty rather than left untouched. ## Repro 1. Start from an instance with data (e.g. 31 characters, 32 lorebooks, 20 personas, 5 chats). 2. Import a profile whose `fileStorage.tables` contains only `chats` and `messages`. 3. Result: chats/messages are replaced as expected, but characters -> 0, lorebooks -> 0, personas -> 0. Every collection not in the file is wiped. ## Root cause `src-tauri/src/commands/storage/profile/legacy.rs` builds `replacements` for the full fixed table-mapping list and calls `replace_all_many_and_then(...)`. Any mapped collection missing from the imported file is replaced with an empty array. `src/features/shell/settings/components/ProfileImportSection.tsx` calls `importProfileFile` immediately after the file picker, with no confirmation dialog and no "this will replace your data" warning. ## Impact A full, complete backup restores correctly. But importing a partial profile, an older backup missing a table, or a hand-built export silently destroys everything not included, with no prompt and no undo. ## Suggested directions (for discussion) - Add a confirmation step before import that states the data will be replaced. - Consider leaving collections absent from the file untouched instead of wiping them, or make replace-vs-merge explicit in the UI. ## Environment refactor @ ef244c80, Windows 11, Tauri desktop (`pnpm tauri dev`). --- Found during smoke test #1484 (Heavy Data / Legacy / Import Pass). Project board: https://github.com/orgs/Pasta-Devs/projects/4
bsakaguchi 2026-10-20 17:33:01 +07:00
Author
Owner

@Romuromylus commented on GitHub (May 29, 2026):

Fixed by #1518 (merged into refactor as a9cc0827). The legacy import no longer wipes collections absent from the file (and a present-but-non-array table is now rejected rather than treated as a clear), and a confirmation dialog gates the import. The modern data.collections import path still full-replaces absent collections; that is tracked separately in #1521.

<!-- gh-comment-id:4574413438 --> @Romuromylus commented on GitHub (May 29, 2026): Fixed by #1518 (merged into `refactor` as a9cc0827). The legacy import no longer wipes collections absent from the file (and a present-but-non-array table is now rejected rather than treated as a clear), and a confirmation dialog gates the import. The modern `data.collections` import path still full-replaces absent collections; that is tracked separately in #1521.
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#760
No description provided.