[PR #2125] [MERGED] Add profile import preview confirmation #5450

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/2125
Author: @Xelvanis
Created: 6/4/2026
Status: ✅ Merged
Merged: 6/4/2026
Merged by: @Xelvanis

Base: refactor ← Head: feature/profile-import-preview


📝 Commits (4)

  • 6a2bc64 Add profile import preview confirmation
  • 578dc30 Harden profile import preview parity
  • b5f3047 Bound profile ZIP asset reads
  • db07885 Cap inline profile asset payloads

📊 Changes

10 files changed (+1642 additions, -178 deletions)

View changed files

📝 src-tauri/src/commands/storage/commands/profile.rs (+23 -2)
📝 src-tauri/src/commands/storage/profile.rs (+689 -60)
📝 src-tauri/src/commands/storage/profile/assets.rs (+194 -9)
📝 src-tauri/src/commands/storage/profile/legacy.rs (+92 -13)
📝 src-tauri/src/commands/storage/profile/zip_import.rs (+296 -40)
📝 src-tauri/src/http_dispatch.rs (+2 -0)
📝 src-tauri/src/http_server.rs (+49 -0)
📝 src-tauri/src/lib.rs (+2 -0)
📝 src/features/shell/settings/components/ProfileImportSection.tsx (+249 -52)
📝 src/shared/api/profile-api.ts (+46 -2)

📄 Description

Linked issue

N/A

Why this change

  • Profile import preview needed to line up with the real import path so users can review what will be replaced before committing a profile restore.
  • Legacy profile compatibility needed safer preview coverage for JSON/ZIP assets, legacy array assets, and connection rows without writing secrets during preview.

What changed

  • Added profile import preview commands for local files and uploads, plus a remote /api/profile/import/preview route.
  • Refactored profile import and ZIP import through shared preview/commit mode paths so format detection and import planning stay aligned.
  • Added preview validation/counting for profile assets and legacy tables without writing collections, assets, or connection secret keys.
  • Updated the Settings profile import flow to scan first, show source/conversion/count/warning details, then confirm before import.
  • Guarded local file imports with a preview fingerprint so changed files are rejected before commit.

Refactor impact

Primary owner:

  • Rust storage profile imports, shared profile API wrapper, and Settings profile import UI.

Impact areas reviewed:

  • Embedded Tauri profile import commands.
  • Hostable remote profile upload/preview route.
  • Profile JSON and ZIP import paths.
  • Native refactor profile exports, legacy fileStorage profiles, and legacy array profiles.
  • Asset restore/preview validation and connection secret handling.

Boundary notes:

  • Feature UI continues to call the focused profileApi wrapper.
  • Runtime wrapper owns embedded-vs-remote preview/import routing.
  • Rust storage modules own privileged parsing, asset handling, collection replacement, and preview validation.
  • No engine imports or mode-owner boundaries changed.

Pressure points touched:

  • src-tauri/src/lib.rs command registration.
  • Profile import modules under src-tauri/src/commands/storage/profile*.
  • Dedicated HTTP route wiring in src-tauri/src/http_server.rs.

Validation

  • Matching validation command passes locally (for example pnpm typecheck, pnpm build, pnpm check:architecture, pnpm check:docs, or full pnpm check when warranted)
  • Full pnpm check passes before PR push/handoff
  • Human/manual validation completed by contributor or reviewer

Manual verification notes

  • cargo test --manifest-path src-tauri/Cargo.toml profile_import_preview -- --nocapture passed.
  • cargo test --manifest-path src-tauri/Cargo.toml profile_import_legacy_array -- --nocapture passed.
  • cargo test --manifest-path src-tauri/Cargo.toml preview_profile_zip -- --nocapture passed.
  • cargo test --manifest-path src-tauri/Cargo.toml profile_file_import_rejects_file_changed_after_preview -- --nocapture passed.
  • cargo test --manifest-path src-tauri/Cargo.toml storage_commands::profile:: -- --nocapture passed on the rebased branch.
  • pnpm typecheck passed.
  • pnpm check:architecture passed.
  • cargo check --manifest-path src-tauri/Cargo.toml passed.
  • pnpm check passed on the rebased branch.
  • git diff --check passed.
  • Native Tauri UI/manual import flow verification was not run.

Feature Discoverability

Check exactly one:

  • Updated src/features/shell/discovery/ because this PR adds or materially changes a user-discoverable feature, workflow, setting, mode, panel, import path, agent, media capability, or advanced tool.
  • N/A because this PR is only a bugfix, refactor, test, docs, internal wiring, visual polish, copy edit, or compatibility fix and does not add a new thing users need to find.

Reason:

  • Existing Settings profile import workflow improved; no new discoverable feature entry was added.

Docs and release impact

  • No docs changes needed
  • Updated README.md
  • Updated CONTRIBUTING.md
  • Updated docs/developer/
  • Updated repo skills or AGENTS.md
  • Confirmed this PR does not restore old staging/package-workspace/release claims

Notes:

  • No root changelog file exists in this checkout.
  • No docs changes were needed for this compatibility and safety improvement.

UI evidence

  • Not captured. Remaining gap: native Tauri manual confirmation-flow QA.

Summary by CodeRabbit

  • New Features
    • Profile imports now include a preview phase before confirming the import
    • Import statistics display detailed counts of records and any warnings
    • File fingerprinting validates that imported files remain unchanged between preview and import

🔄 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/2125 **Author:** [@Xelvanis](https://github.com/Xelvanis) **Created:** 6/4/2026 **Status:** ✅ Merged **Merged:** 6/4/2026 **Merged by:** [@Xelvanis](https://github.com/Xelvanis) **Base:** `refactor` ← **Head:** `feature/profile-import-preview` --- ### 📝 Commits (4) - [`6a2bc64`](https://github.com/Pasta-Devs/Marinara-Engine/commit/6a2bc64eef1b5f99f28506c925c54eac009c006f) Add profile import preview confirmation - [`578dc30`](https://github.com/Pasta-Devs/Marinara-Engine/commit/578dc30d3166d37080339fa32ae45595f21639ab) Harden profile import preview parity - [`b5f3047`](https://github.com/Pasta-Devs/Marinara-Engine/commit/b5f3047b8ad3ff88e905f1407e351a4c93c9cd01) Bound profile ZIP asset reads - [`db07885`](https://github.com/Pasta-Devs/Marinara-Engine/commit/db078857fd1bc502a77aa486dc376e1ce75b559f) Cap inline profile asset payloads ### 📊 Changes **10 files changed** (+1642 additions, -178 deletions) <details> <summary>View changed files</summary> 📝 `src-tauri/src/commands/storage/commands/profile.rs` (+23 -2) 📝 `src-tauri/src/commands/storage/profile.rs` (+689 -60) 📝 `src-tauri/src/commands/storage/profile/assets.rs` (+194 -9) 📝 `src-tauri/src/commands/storage/profile/legacy.rs` (+92 -13) 📝 `src-tauri/src/commands/storage/profile/zip_import.rs` (+296 -40) 📝 `src-tauri/src/http_dispatch.rs` (+2 -0) 📝 `src-tauri/src/http_server.rs` (+49 -0) 📝 `src-tauri/src/lib.rs` (+2 -0) 📝 `src/features/shell/settings/components/ProfileImportSection.tsx` (+249 -52) 📝 `src/shared/api/profile-api.ts` (+46 -2) </details> ### 📄 Description ## Linked issue N/A ## Why this change - Profile import preview needed to line up with the real import path so users can review what will be replaced before committing a profile restore. - Legacy profile compatibility needed safer preview coverage for JSON/ZIP assets, legacy array assets, and connection rows without writing secrets during preview. ## What changed - Added profile import preview commands for local files and uploads, plus a remote `/api/profile/import/preview` route. - Refactored profile import and ZIP import through shared preview/commit mode paths so format detection and import planning stay aligned. - Added preview validation/counting for profile assets and legacy tables without writing collections, assets, or connection secret keys. - Updated the Settings profile import flow to scan first, show source/conversion/count/warning details, then confirm before import. - Guarded local file imports with a preview fingerprint so changed files are rejected before commit. ## Refactor impact Primary owner: - Rust storage profile imports, shared profile API wrapper, and Settings profile import UI. Impact areas reviewed: - Embedded Tauri profile import commands. - Hostable remote profile upload/preview route. - Profile JSON and ZIP import paths. - Native refactor profile exports, legacy fileStorage profiles, and legacy array profiles. - Asset restore/preview validation and connection secret handling. Boundary notes: - Feature UI continues to call the focused `profileApi` wrapper. - Runtime wrapper owns embedded-vs-remote preview/import routing. - Rust storage modules own privileged parsing, asset handling, collection replacement, and preview validation. - No engine imports or mode-owner boundaries changed. Pressure points touched: - `src-tauri/src/lib.rs` command registration. - Profile import modules under `src-tauri/src/commands/storage/profile*`. - Dedicated HTTP route wiring in `src-tauri/src/http_server.rs`. ## Validation - [x] Matching validation command passes locally (for example `pnpm typecheck`, `pnpm build`, `pnpm check:architecture`, `pnpm check:docs`, or full `pnpm check` when warranted) - [x] Full `pnpm check` passes before PR push/handoff - [x] Human/manual validation completed by contributor or reviewer ### Manual verification notes - `cargo test --manifest-path src-tauri/Cargo.toml profile_import_preview -- --nocapture` passed. - `cargo test --manifest-path src-tauri/Cargo.toml profile_import_legacy_array -- --nocapture` passed. - `cargo test --manifest-path src-tauri/Cargo.toml preview_profile_zip -- --nocapture` passed. - `cargo test --manifest-path src-tauri/Cargo.toml profile_file_import_rejects_file_changed_after_preview -- --nocapture` passed. - `cargo test --manifest-path src-tauri/Cargo.toml storage_commands::profile:: -- --nocapture` passed on the rebased branch. - `pnpm typecheck` passed. - `pnpm check:architecture` passed. - `cargo check --manifest-path src-tauri/Cargo.toml` passed. - `pnpm check` passed on the rebased branch. - `git diff --check` passed. - Native Tauri UI/manual import flow verification was not run. ## Feature Discoverability Check exactly one: - [ ] Updated `src/features/shell/discovery/` because this PR adds or materially changes a user-discoverable feature, workflow, setting, mode, panel, import path, agent, media capability, or advanced tool. - [x] N/A because this PR is only a bugfix, refactor, test, docs, internal wiring, visual polish, copy edit, or compatibility fix and does not add a new thing users need to find. Reason: - Existing Settings profile import workflow improved; no new discoverable feature entry was added. ## Docs and release impact - [x] No docs changes needed - [ ] Updated `README.md` - [ ] Updated `CONTRIBUTING.md` - [ ] Updated `docs/developer/` - [ ] Updated repo skills or `AGENTS.md` - [x] Confirmed this PR does not restore old staging/package-workspace/release claims Notes: - No root changelog file exists in this checkout. - No docs changes were needed for this compatibility and safety improvement. ## UI evidence - Not captured. Remaining gap: native Tauri manual confirmation-flow QA. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Profile imports now include a preview phase before confirming the import * Import statistics display detailed counts of records and any warnings * File fingerprinting validates that imported files remain unchanged between preview and import <!-- 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:16:26 +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#5450
No description provided.