[PR #1153] [MERGED] Make profile imports atomic with rollback #4947

Closed
opened 2026-10-22 04:11:56 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/1153
Author: @Xelvanis
Created: 5/24/2026
Status: ✅ Merged
Merged: 5/24/2026
Merged by: @cha1latte

Base: refactor ← Head: fix/profile-import-failure-paths


📝 Commits (1)

  • 780003f Make profile imports atomic with rollback

📊 Changes

5 files changed (+664 additions, -45 deletions)

View changed files

📝 src-tauri/crates/storage/src/lib.rs (+264 -0)
📝 src-tauri/src/commands/storage/profile.rs (+32 -3)
📝 src-tauri/src/commands/storage/profile/assets.rs (+348 -36)
📝 src-tauri/src/commands/storage/profile/legacy.rs (+9 -3)
📝 src-tauri/src/commands/storage/profile/zip_import.rs (+11 -3)

📄 Description

Linked issue

No linked issue; PR requested directly.

Why this change

Profile imports replace both persisted collections and managed asset directories. Before this branch, a failure partway through import could leave the profile in a mixed state, with some new data installed and old data already removed.

What changed

  • Added atomic multi-collection replacement in the Rust storage crate with rollback on install failure.
  • Staged profile assets into temporary import directories, backed up existing managed asset directories, and commit or roll back the asset transaction with the collection import result.
  • Tightened profile asset manifest validation so missing JSON payloads or missing ZIP asset entries fail before replacing existing assets.
  • Covered JSON, ZIP, and legacy profile import paths through the same rollback-aware finishing flow.

Validation

  • pnpm check passes locally
  • Container (Docker / Podman) built and ran without issue
  • Ran the app, clicked through the changes manually
  • Checked edge cases (light + dark mode, mobile viewport, empty states, error paths)
  • Above manual verification completed (describe below)
  • Read and followed CONTRIBUTING.md

Local validation run:

  • git diff --check origin/refactor...HEAD passed with no whitespace errors.
  • cargo check --manifest-path src-tauri/Cargo.toml passed.
  • cargo test --manifest-path src-tauri/Cargo.toml --workspace passed.
  • pnpm check:architecture passed.

Manual verification notes

  • Not run: native Tauri app profile import through Settings and the file picker.
  • Not run: container runtime.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed
  • Version/release files updated (only if this PR includes a version bump)

Changelog: this is release-note-worthy import/storage behavior, but this refactor branch does not contain CHANGELOG.md, so no changelog file was updated.

UI evidence (if applicable)

N/A; Rust storage/profile import behavior only.

Summary by CodeRabbit

Release Notes

  • Improvements
    • Profile imports now use atomic batch processing, ensuring all collections and assets are imported together with automatic error recovery.
    • Enhanced error handling prevents partial imports from leaving the application in an inconsistent state.

Review Change Stack


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/1153 **Author:** [@Xelvanis](https://github.com/Xelvanis) **Created:** 5/24/2026 **Status:** ✅ Merged **Merged:** 5/24/2026 **Merged by:** [@cha1latte](https://github.com/cha1latte) **Base:** `refactor` ← **Head:** `fix/profile-import-failure-paths` --- ### 📝 Commits (1) - [`780003f`](https://github.com/Pasta-Devs/Marinara-Engine/commit/780003f58834ac6a006d5427f5bf9c53ad8585da) Make profile imports atomic with rollback ### 📊 Changes **5 files changed** (+664 additions, -45 deletions) <details> <summary>View changed files</summary> 📝 `src-tauri/crates/storage/src/lib.rs` (+264 -0) 📝 `src-tauri/src/commands/storage/profile.rs` (+32 -3) 📝 `src-tauri/src/commands/storage/profile/assets.rs` (+348 -36) 📝 `src-tauri/src/commands/storage/profile/legacy.rs` (+9 -3) 📝 `src-tauri/src/commands/storage/profile/zip_import.rs` (+11 -3) </details> ### 📄 Description ## Linked issue No linked issue; PR requested directly. ## Why this change Profile imports replace both persisted collections and managed asset directories. Before this branch, a failure partway through import could leave the profile in a mixed state, with some new data installed and old data already removed. ## What changed - Added atomic multi-collection replacement in the Rust storage crate with rollback on install failure. - Staged profile assets into temporary import directories, backed up existing managed asset directories, and commit or roll back the asset transaction with the collection import result. - Tightened profile asset manifest validation so missing JSON payloads or missing ZIP asset entries fail before replacing existing assets. - Covered JSON, ZIP, and legacy profile import paths through the same rollback-aware finishing flow. ## Validation - [x] `pnpm check` passes locally - [ ] Container (Docker / Podman) built and ran without issue - [ ] Ran the app, clicked through the changes manually - [ ] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [ ] Above manual verification completed (describe below) - [x] Read and followed `CONTRIBUTING.md` Local validation run: - `git diff --check origin/refactor...HEAD` passed with no whitespace errors. - `cargo check --manifest-path src-tauri/Cargo.toml` passed. - `cargo test --manifest-path src-tauri/Cargo.toml --workspace` passed. - `pnpm check:architecture` passed. ### Manual verification notes - Not run: native Tauri app profile import through Settings and the file picker. - Not run: container runtime. ## Docs and release impact - [x] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed - [ ] Version/release files updated (only if this PR includes a version bump) Changelog: this is release-note-worthy import/storage behavior, but this `refactor` branch does not contain `CHANGELOG.md`, so no changelog file was updated. ## UI evidence (if applicable) N/A; Rust storage/profile import behavior only. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Release Notes * **Improvements** * Profile imports now use atomic batch processing, ensuring all collections and assets are imported together with automatic error recovery. * Enhanced error handling prevents partial imports from leaving the application in an inconsistent state. <!-- review_stack_entry_start --> [![Review Change Stack](https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg)](https://app.coderabbit.ai/change-stack/Pasta-Devs/Marinara-Engine/pull/1153?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack) <!-- review_stack_entry_end --> <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:11:56 +07:00
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#4947
No description provided.