mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #3683] [Issue]: Profile import can fail after partially overwriting live data and assets #1990
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#1990
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 @Xelvanis on GitHub (Jul 16, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/3683
Originally assigned to: @SpicyMarinara on GitHub.
Summary
Severity: High — restore integrity / partial failure. A native profile import updates live file-storage rows before it fully reads, decompresses, CRC-checks, and writes the archive assets. If a later asset is corrupt or cannot be written, Marinara reports that the import failed but leaves the earlier row updates and any already-written assets in place.
Expected behavior
A fatal profile-import error should leave the existing profile unchanged, or restore it to its pre-import state. All present archive assets should be validated before live rows or files are modified.
Missing assets may remain an explicit best-effort exception: the documented behavior is to warn and import everything else when an asset is absent.
Actual behavior
importProfileStorageSnapshot()processes the import in this order:Relevant paths on
staging:packages/server/src/routes/backup.routes.ts:656-702mutates every table before asset processing starts.packages/server/src/routes/backup.routes.ts:704-729reads and writes assets afterward.packages/server/src/routes/backup.routes.ts:1502-1557preflights ZIP headers and declared sizes, but decompression and CRC validation happen later inreadProfileArchiveAsset()/readProfileArchiveEntryBuffer().packages/server/src/routes/backup.routes.ts:2328-2348reports the later exception asInvalid profile exportorProfile import failedwithout rollback.File-storage inserts/updates mutate the in-memory tables immediately and schedule debounced persistence, so skipping the final explicit
flushDB()does not undo or reliably contain the partial changes. Earlier asset writes are also direct writes to their final paths.Steps to reproduce
Environment
stagingat77f9f2a61e3647cad9f41399430648a00a735210Logs, screenshots, or video
Static source trace; the corrupt-archive scenario was not executed against a live profile.
Additional context
This is distinct from the intentionally tolerant missing-asset behavior added in #1019 and documented in
docs/data/backup-and-restore.md: a missing media file produces a warning and successful partial import. A present but corrupt/unreadable asset is instead treated as a fatal error, yet its fatal validation occurs after live data has changed.This is also distinct from #1250, which covered ST/direct import paths in the former Tauri/refactor implementation.
Smallest safe direction:
Tradeoff: preflight requires temporary disk space and delays the first visible import mutation, but avoids leaving a mixed old/new profile after a failed recovery operation.
Template check
Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked: