mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #1312] [MERGED] Fix refactor storage corruption recovery #5030
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#5030
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?
📋 Pull Request Information
Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/1312
Author: @cha1latte
Created: 5/26/2026
Status: ✅ Merged
Merged: 5/26/2026
Merged by: @cha1latte
Base:
refactor← Head:fix/refactor-issue-1264-storage-recovery📝 Commits (1)
956a9c7Fix refactor storage corruption recovery📊 Changes
2 files changed (+371 additions, -79 deletions)
View changed files
📝
src-tauri/crates/storage/src/lib.rs(+344 -79)📝
src-tauri/src/state.rs(+27 -0)📄 Description
Linked issue
Closes #1264
Why this change
What changed
marinara-storage: corrupt primary files are renamed with.corrupted-*, valid.bakfiles are used when available, and both corrupt primary/backup files are preserved before recreating an empty collection..bakrefresh before collection writes, while avoiding copying NUL-filled primary files over a valid backup.AppState::from_data_dirstartup path.Refactor impact
Primary owner:
Rust storage
Impact areas reviewed:
src-tauri/crates/storage/src/lib.rssrc-tauri/src/state.rsBoundary notes:
<data_dir>/data/collections/*.json; the oldpackages/server/data/storagelayout from the issue text is outside this refactor-branch PR.Pressure points touched:
Validation
pnpm checkpasses locallypnpm typecheckpasses locallypnpm buildpasses locallypnpm check:architecturepasses locallypnpm check:docspasses locallycargo check --manifest-path src-tauri/Cargo.toml --workspacepasses locallyManual verification notes
cargo test --manifest-path src-tauri/Cargo.toml -p marinara-storage corrupt_collection -- --nocapturereproduced the failure withAppError { code: "json_error", message: "expected value at line 1 column 1" }.cargo test --manifest-path src-tauri/Cargo.toml -p marinara-storage -- --nocapturepassed with 15 tests.cargo test --manifest-path src-tauri/Cargo.toml app_state_startup_recovers_when_collection_and_backup_are_corrupt -- --nocapturepassed.pnpm checkpassed architecture, frontend typecheck, Rust workspace check, and docs check.node C:\Users\celia\.codex\tools\marinara-proof-gate.mjs scratch\bugfix-verification.jsonpassed locally.<data_dir>/data/collections/as<collection>.json.corrupted-<pid>-<nonce>and, when present,<collection>.json.bak.corrupted-<pid>-<nonce>. Back those files up to a separate folder outside the Marinara data directory before attempting manual recovery.Docs and release impact
README.mdCONTRIBUTING.mddocs/developer/AGENTS.mdUI evidence
N/A - non-UI storage recovery fix. Console warning proof is covered by the Rust test output.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.