[PR #2116] [MERGED] Fix remote profile import and export parity #5441

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

📋 Pull Request Information

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

Base: refactor ← Head: fix/profile-import-export-parity


📝 Commits (3)

  • 94e6f27 Fix remote profile import and export parity
  • 7136c91 Address profile transfer review findings
  • ad0cba4 Fix profile transfer clippy failures

📊 Changes

11 files changed (+552 additions, -76 deletions)

View changed files

📝 src-tauri/Cargo.lock (+24 -0)
📝 src-tauri/Cargo.toml (+1 -1)
📝 src-tauri/src/commands/storage/backup.rs (+15 -8)
📝 src-tauri/src/commands/storage/exports.rs (+9 -5)
📝 src-tauri/src/commands/storage/profile.rs (+115 -3)
📝 src-tauri/src/commands/storage/profile/assets.rs (+24 -16)
📝 src-tauri/src/http_dispatch.rs (+2 -8)
📝 src-tauri/src/http_server.rs (+285 -15)
📝 src/features/shell/settings/components/ProfileImportSection.tsx (+1 -9)
📝 src/shared/api/profile-api.ts (+67 -5)
📝 src/shared/api/remote-runtime.ts (+9 -6)

📄 Description

Linked issue

Related to https://github.com/Pasta-Devs/Marinara-Engine/issues/2108

Why this change

  • Remote runtime profile import/export needed parity with the embedded Tauri path for profile JSON and ZIP transfers. Large profile files should not be forced through /api/invoke JSON/base64 payload limits.
  • JSON profile imports with manifest-only asset entries should warn without clearing existing managed asset directories.
  • Invalid profile JSON uploads should report an input error instead of surfacing as an internal server error.

What changed

  • Added dedicated /api/profile/export download and /api/profile/import multipart upload routes for the hostable runtime, including admin access, upload size limits, rate-limit coverage, and content-disposition metadata.
  • Routed the shared profile API to the dedicated remote endpoints while keeping embedded Tauri profile import/export behavior intact.
  • Reused byte-oriented profile ZIP and compatible export helpers for binary remote downloads.
  • Changed JSON profile asset restore so missing inline asset payloads become warnings without creating an empty asset replacement transaction.
  • Mapped invalid JSON file/upload imports to invalid_input and added focused Rust coverage for the changed profile paths.

Refactor impact

Primary owner:

Rust storage/profile import-export and shared API remote runtime profile wrapper.

Impact areas reviewed:

  • Profile import/export storage contracts.
  • Managed asset restore transaction behavior.
  • Hostable HTTP middleware for body limits, rate limits, admin access, and error status mapping.
  • Shared profile API and settings import caller.
  • Remote managed asset invalidation after profile imports.

Boundary notes:

  • React settings UI continues to call the typed src/shared/api/profile-api.ts wrapper.
  • Shared API wrapper owns the embedded-versus-remote dispatch choice.
  • Privileged profile file transfer, storage mutation, and asset restore behavior remain in Rust.
  • No engine-layer changes.

Pressure points touched:

  • Import modules under src-tauri/src/commands/storage/profile*.
  • Hostable HTTP routing 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

  • pnpm check passed locally.
  • cargo test --manifest-path src-tauri/Cargo.toml profile -- --nocapture passed locally.
  • cargo test --manifest-path src-tauri/Cargo.toml http_server -- --nocapture passed locally.
  • cargo check --manifest-path src-tauri/Cargo.toml passed locally.
  • pnpm typecheck and pnpm check:architecture passed locally during review.
  • Native Tauri manual profile import/export QA was not run.
  • Hands-on remote runtime browser upload/download QA 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:

  • Updates existing profile import/export behavior for remote runtime parity; no new discoverable surface 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

No docs or release-note changes were made because this preserves an existing settings workflow and remote-runtime compatibility path without adding a new user-facing surface. No staging/package-workspace/release claims were touched.

UI evidence

No screenshots or recordings; this change does not alter visible layout.

Summary by CodeRabbit

Release Notes

  • New Features

    • Added HTTP API endpoints for profile export and import operations with improved file handling and admin access control.
  • Bug Fixes

    • Enhanced profile import robustness by converting hard-failure behaviors to warning-based handling for missing asset data.
    • Improved error messages for invalid JSON profile validation during imports.

🔄 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/2116 **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:** `fix/profile-import-export-parity` --- ### 📝 Commits (3) - [`94e6f27`](https://github.com/Pasta-Devs/Marinara-Engine/commit/94e6f27358245e630fb29d5536e582e687a742c4) Fix remote profile import and export parity - [`7136c91`](https://github.com/Pasta-Devs/Marinara-Engine/commit/7136c9165a65d32a5485bf2ab2112b42bebfdf98) Address profile transfer review findings - [`ad0cba4`](https://github.com/Pasta-Devs/Marinara-Engine/commit/ad0cba4a523b5ed855abeb660c43bc811050d81c) Fix profile transfer clippy failures ### 📊 Changes **11 files changed** (+552 additions, -76 deletions) <details> <summary>View changed files</summary> 📝 `src-tauri/Cargo.lock` (+24 -0) 📝 `src-tauri/Cargo.toml` (+1 -1) 📝 `src-tauri/src/commands/storage/backup.rs` (+15 -8) 📝 `src-tauri/src/commands/storage/exports.rs` (+9 -5) 📝 `src-tauri/src/commands/storage/profile.rs` (+115 -3) 📝 `src-tauri/src/commands/storage/profile/assets.rs` (+24 -16) 📝 `src-tauri/src/http_dispatch.rs` (+2 -8) 📝 `src-tauri/src/http_server.rs` (+285 -15) 📝 `src/features/shell/settings/components/ProfileImportSection.tsx` (+1 -9) 📝 `src/shared/api/profile-api.ts` (+67 -5) 📝 `src/shared/api/remote-runtime.ts` (+9 -6) </details> ### 📄 Description ## Linked issue Related to https://github.com/Pasta-Devs/Marinara-Engine/issues/2108 ## Why this change - Remote runtime profile import/export needed parity with the embedded Tauri path for profile JSON and ZIP transfers. Large profile files should not be forced through `/api/invoke` JSON/base64 payload limits. - JSON profile imports with manifest-only asset entries should warn without clearing existing managed asset directories. - Invalid profile JSON uploads should report an input error instead of surfacing as an internal server error. ## What changed - Added dedicated `/api/profile/export` download and `/api/profile/import` multipart upload routes for the hostable runtime, including admin access, upload size limits, rate-limit coverage, and content-disposition metadata. - Routed the shared profile API to the dedicated remote endpoints while keeping embedded Tauri profile import/export behavior intact. - Reused byte-oriented profile ZIP and compatible export helpers for binary remote downloads. - Changed JSON profile asset restore so missing inline asset payloads become warnings without creating an empty asset replacement transaction. - Mapped invalid JSON file/upload imports to `invalid_input` and added focused Rust coverage for the changed profile paths. ## Refactor impact Primary owner: Rust storage/profile import-export and shared API remote runtime profile wrapper. Impact areas reviewed: - Profile import/export storage contracts. - Managed asset restore transaction behavior. - Hostable HTTP middleware for body limits, rate limits, admin access, and error status mapping. - Shared profile API and settings import caller. - Remote managed asset invalidation after profile imports. Boundary notes: - React settings UI continues to call the typed `src/shared/api/profile-api.ts` wrapper. - Shared API wrapper owns the embedded-versus-remote dispatch choice. - Privileged profile file transfer, storage mutation, and asset restore behavior remain in Rust. - No engine-layer changes. Pressure points touched: - Import modules under `src-tauri/src/commands/storage/profile*`. - Hostable HTTP routing 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 - [ ] Human/manual validation completed by contributor or reviewer ### Manual verification notes - `pnpm check` passed locally. - `cargo test --manifest-path src-tauri/Cargo.toml profile -- --nocapture` passed locally. - `cargo test --manifest-path src-tauri/Cargo.toml http_server -- --nocapture` passed locally. - `cargo check --manifest-path src-tauri/Cargo.toml` passed locally. - `pnpm typecheck` and `pnpm check:architecture` passed locally during review. - Native Tauri manual profile import/export QA was not run. - Hands-on remote runtime browser upload/download QA 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: - Updates existing profile import/export behavior for remote runtime parity; no new discoverable surface 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 No docs or release-note changes were made because this preserves an existing settings workflow and remote-runtime compatibility path without adding a new user-facing surface. No staging/package-workspace/release claims were touched. ## UI evidence No screenshots or recordings; this change does not alter visible layout. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Release Notes * **New Features** * Added HTTP API endpoints for profile export and import operations with improved file handling and admin access control. * **Bug Fixes** * Enhanced profile import robustness by converting hard-failure behaviors to warning-based handling for missing asset data. * Improved error messages for invalid JSON profile validation during imports. <!-- 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:21 +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#5441
No description provided.