[PR #1177] [MERGED] Fix legacy profile settings import #4960

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

📋 Pull Request Information

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

Base: refactor ← Head: fix/issue-1124-profile-import-pk


📝 Commits (1)

  • af2c25b Fix legacy profile settings import

📊 Changes

3 files changed (+195 additions, -0 deletions)

View changed files

📝 src-tauri/src/commands/storage/imports/marinara.rs (+44 -0)
📝 src-tauri/src/commands/storage/profile.rs (+61 -0)
📝 src-tauri/src/commands/storage/profile/legacy.rs (+90 -0)

📄 Description

What?

Fixes legacy full-profile imports on the refactor branch so data.fileStorage.tables.app_settings rows with key: "ui" are restored as app-settings records with id: "ui".

Also recognizes marinara_profile exports in the generic Marinara importer and returns guidance to use Settings -> Import Profile instead of the low-level unknown import type message.

Fixes #1124

Why?

A fresh Docker/file-storage instance can already have seeded synced UI settings before a full profile import runs. Legacy profile exports store that row under app_settings.key, while refactor storage reads settings by id; without normalization, imported UI settings are not addressable through the storage API.

How?

  • Normalizes legacy app_settings.key into app-settings.id during legacy profile table import.
  • Removes the stale legacy key field after normalization.
  • Adds a should-not-match guard so blank legacy keys do not create id: "ui".
  • Adds profile-export guidance for generic .json Marinara imports and profile ZIPs selected through the single-file importer.

Machine Verification

  • Before fix: cargo test --manifest-path src-tauri/Cargo.toml legacy_app_settings_key_rows_import_as_settings_ids failed because imported UI settings were not addressable by id.
  • Before fix: cargo test --manifest-path src-tauri/Cargo.toml generic_marinara_import_directs_profile_exports_to_profile_import failed because the generic importer did not direct profile exports to Import Profile.
  • After fix: cargo test --manifest-path src-tauri/Cargo.toml profile passed, 12 tests.
  • After fix: pnpm check passed.
  • Proof gate: node C:\Users\celia\.codex\tools\marinara-proof-gate.mjs scratch\bugfix-verification.json passed.
  • Bunny: pre-PR Bunny review passed for the current diff.

Manual Verification

None required for the core claim; the storage/import behavior is covered by route-level and helper-level Rust regression tests plus pnpm check.

Notes

This PR targets refactor as requested. The exact old duplicate-primary-key insert path from the issue body has been replaced on refactor; the matching broken branch behavior was legacy app_settings.key rows not being normalized into id-based app settings.

Summary by CodeRabbit

  • Bug Fixes
    • Marinara profile imports now validate against full profile exports and direct users to the correct "Import Profile" feature in Settings
    • Improved legacy profile data migration with proper normalization of settings during imports

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/1177 **Author:** [@cha1latte](https://github.com/cha1latte) **Created:** 5/24/2026 **Status:** ✅ Merged **Merged:** 5/24/2026 **Merged by:** [@cha1latte](https://github.com/cha1latte) **Base:** `refactor` ← **Head:** `fix/issue-1124-profile-import-pk` --- ### 📝 Commits (1) - [`af2c25b`](https://github.com/Pasta-Devs/Marinara-Engine/commit/af2c25bb680d1ee7e8587eb218b69e74b1b6451c) Fix legacy profile settings import ### 📊 Changes **3 files changed** (+195 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `src-tauri/src/commands/storage/imports/marinara.rs` (+44 -0) 📝 `src-tauri/src/commands/storage/profile.rs` (+61 -0) 📝 `src-tauri/src/commands/storage/profile/legacy.rs` (+90 -0) </details> ### 📄 Description ## What? Fixes legacy full-profile imports on the refactor branch so `data.fileStorage.tables.app_settings` rows with `key: "ui"` are restored as `app-settings` records with `id: "ui"`. Also recognizes `marinara_profile` exports in the generic Marinara importer and returns guidance to use Settings -> Import Profile instead of the low-level unknown import type message. Fixes #1124 ## Why? A fresh Docker/file-storage instance can already have seeded synced UI settings before a full profile import runs. Legacy profile exports store that row under `app_settings.key`, while refactor storage reads settings by `id`; without normalization, imported UI settings are not addressable through the storage API. ## How? - Normalizes legacy `app_settings.key` into `app-settings.id` during legacy profile table import. - Removes the stale legacy `key` field after normalization. - Adds a should-not-match guard so blank legacy keys do not create `id: "ui"`. - Adds profile-export guidance for generic `.json` Marinara imports and profile ZIPs selected through the single-file importer. ## Machine Verification - Before fix: `cargo test --manifest-path src-tauri/Cargo.toml legacy_app_settings_key_rows_import_as_settings_ids` failed because imported UI settings were not addressable by id. - Before fix: `cargo test --manifest-path src-tauri/Cargo.toml generic_marinara_import_directs_profile_exports_to_profile_import` failed because the generic importer did not direct profile exports to Import Profile. - After fix: `cargo test --manifest-path src-tauri/Cargo.toml profile` passed, 12 tests. - After fix: `pnpm check` passed. - Proof gate: `node C:\Users\celia\.codex\tools\marinara-proof-gate.mjs scratch\bugfix-verification.json` passed. - Bunny: pre-PR Bunny review passed for the current diff. ## Manual Verification None required for the core claim; the storage/import behavior is covered by route-level and helper-level Rust regression tests plus `pnpm check`. ## Notes This PR targets `refactor` as requested. The exact old duplicate-primary-key insert path from the issue body has been replaced on `refactor`; the matching broken branch behavior was legacy `app_settings.key` rows not being normalized into id-based app settings. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Marinara profile imports now validate against full profile exports and direct users to the correct "Import Profile" feature in Settings * Improved legacy profile data migration with proper normalization of settings during imports <!-- 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/1177?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:12:02 +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#4960
No description provided.