[PR #2267] [MERGED] Fix prompt preset import compatibility #5521

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

📋 Pull Request Information

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

Base: refactor ← Head: fix/prompt-preset-import-compat


📝 Commits (1)

  • aa58edb Fix prompt preset import compatibility

📊 Changes

8 files changed (+443 additions, -56 deletions)

View changed files

📝 src-tauri/src/commands/storage/contracts.rs (+2 -0)
📝 src-tauri/src/commands/storage/imports/marinara_tests.rs (+60 -0)
📝 src-tauri/src/commands/storage/imports/service_tests.rs (+84 -0)
📝 src-tauri/src/commands/storage/imports/st_preset.rs (+42 -36)
📝 src-tauri/src/commands/storage/profile.rs (+90 -0)
📝 src-tauri/src/commands/storage/shared.rs (+96 -0)
📝 src-tauri/src/state.rs (+38 -1)
📝 src/engine/contracts/schemas/prompt.schema.ts (+31 -19)

📄 Description

Linked issue

Closes https://github.com/Pasta-Devs/Marinara-Engine/issues/2263 and https://github.com/Pasta-Devs/Marinara-Engine/issues/2262

Why this change

  • Imported prompt presets could carry legacy default flags that were not normalized consistently with isDefault.
  • Existing legacy rows with conflicting prompt default flags could fail startup repair instead of being healed.
  • SillyTavern reasoning_effort: "auto" should preserve automatic provider behavior instead of forcing maximum reasoning.

What changed

  • Added prompt preset default alias normalization for create, update, profile import, Marinara preset import, and SillyTavern preset import paths.
  • Kept strict conflict rejection for new create/import/profile payloads while allowing startup repair to heal legacy prompt rows.
  • Changed SillyTavern reasoning effort auto imports to store null.
  • Added focused Rust coverage for alias normalization, conflict rejection, startup repair, and SillyTavern reasoning fallback behavior.
  • Updated the prompt preset Zod schema to accept and normalize the legacy default alias.

Refactor impact

Primary owner:

Rust storage and imports, with a matching engine prompt schema update.

Impact areas reviewed:

  • Prompt preset create/update normalization
  • Native profile import
  • Marinara preset import
  • SillyTavern preset import
  • Startup JSON repair
  • Prompt generation parameter consumers for reasoning effort

Boundary notes:

  • Product prompt schema remains in src/engine/contracts.
  • Storage/import compatibility stays in Rust storage modules.
  • No React UI, shared API wrapper, command registration, or remote runtime route changes.

Pressure points touched:

  • Import modules under src-tauri/src/commands/storage/imports.
  • Startup storage repair in src-tauri/src/state.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

Local validation run:

  • cargo test --manifest-path src-tauri/Cargo.toml app_state_startup_repairs_legacy_prompt_default_conflicts
  • cargo test --manifest-path src-tauri/Cargo.toml import_st_preset_keeps_reasoning_effort_auto_unset_and_keeps_fallbacks
  • cargo test --manifest-path src-tauri/Cargo.toml default_alias
  • cargo test --manifest-path src-tauri/Cargo.toml conflicting_default
  • cargo check --manifest-path src-tauri/Cargo.toml
  • pnpm typecheck
  • pnpm check
  • git diff --check

No native Tauri manual QA was run; this is covered by focused storage/import tests and the full local PR gate.

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, 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:

Compatibility bugfix for existing prompt preset import and startup repair behavior; no new discoverable user surface.

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

Docs/release notes: no tracked changelog, release-note, or changeset file exists; no docs changes needed for this compatibility bugfix.

UI evidence

N/A - no visible UI changes.

Summary by CodeRabbit

  • Bug Fixes

    • Improved normalization of prompt preset default field settings during profile and preset imports and application startup, with automatic conversion of legacy field format to current standard.
    • Enhanced validation to detect and reject conflicting default flag configurations, preventing data inconsistency.
  • Tests

    • Added comprehensive test coverage for prompt default field format migration, validation, and conflict detection.

🔄 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/2267 **Author:** [@Xelvanis](https://github.com/Xelvanis) **Created:** 6/5/2026 **Status:** ✅ Merged **Merged:** 6/5/2026 **Merged by:** [@Xelvanis](https://github.com/Xelvanis) **Base:** `refactor` ← **Head:** `fix/prompt-preset-import-compat` --- ### 📝 Commits (1) - [`aa58edb`](https://github.com/Pasta-Devs/Marinara-Engine/commit/aa58edb0e040b42ddab15d20fbe27c585e86e5a1) Fix prompt preset import compatibility ### 📊 Changes **8 files changed** (+443 additions, -56 deletions) <details> <summary>View changed files</summary> 📝 `src-tauri/src/commands/storage/contracts.rs` (+2 -0) 📝 `src-tauri/src/commands/storage/imports/marinara_tests.rs` (+60 -0) 📝 `src-tauri/src/commands/storage/imports/service_tests.rs` (+84 -0) 📝 `src-tauri/src/commands/storage/imports/st_preset.rs` (+42 -36) 📝 `src-tauri/src/commands/storage/profile.rs` (+90 -0) 📝 `src-tauri/src/commands/storage/shared.rs` (+96 -0) 📝 `src-tauri/src/state.rs` (+38 -1) 📝 `src/engine/contracts/schemas/prompt.schema.ts` (+31 -19) </details> ### 📄 Description ## Linked issue Closes https://github.com/Pasta-Devs/Marinara-Engine/issues/2263 and https://github.com/Pasta-Devs/Marinara-Engine/issues/2262 ## Why this change - Imported prompt presets could carry legacy `default` flags that were not normalized consistently with `isDefault`. - Existing legacy rows with conflicting prompt default flags could fail startup repair instead of being healed. - SillyTavern `reasoning_effort: "auto"` should preserve automatic provider behavior instead of forcing maximum reasoning. ## What changed - Added prompt preset default alias normalization for create, update, profile import, Marinara preset import, and SillyTavern preset import paths. - Kept strict conflict rejection for new create/import/profile payloads while allowing startup repair to heal legacy prompt rows. - Changed SillyTavern reasoning effort `auto` imports to store `null`. - Added focused Rust coverage for alias normalization, conflict rejection, startup repair, and SillyTavern reasoning fallback behavior. - Updated the prompt preset Zod schema to accept and normalize the legacy `default` alias. ## Refactor impact Primary owner: Rust storage and imports, with a matching engine prompt schema update. Impact areas reviewed: - Prompt preset create/update normalization - Native profile import - Marinara preset import - SillyTavern preset import - Startup JSON repair - Prompt generation parameter consumers for reasoning effort Boundary notes: - Product prompt schema remains in `src/engine/contracts`. - Storage/import compatibility stays in Rust storage modules. - No React UI, shared API wrapper, command registration, or remote runtime route changes. Pressure points touched: - Import modules under `src-tauri/src/commands/storage/imports`. - Startup storage repair in `src-tauri/src/state.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 Local validation run: - `cargo test --manifest-path src-tauri/Cargo.toml app_state_startup_repairs_legacy_prompt_default_conflicts` - `cargo test --manifest-path src-tauri/Cargo.toml import_st_preset_keeps_reasoning_effort_auto_unset_and_keeps_fallbacks` - `cargo test --manifest-path src-tauri/Cargo.toml default_alias` - `cargo test --manifest-path src-tauri/Cargo.toml conflicting_default` - `cargo check --manifest-path src-tauri/Cargo.toml` - `pnpm typecheck` - `pnpm check` - `git diff --check` No native Tauri manual QA was run; this is covered by focused storage/import tests and the full local PR gate. ## 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, 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: Compatibility bugfix for existing prompt preset import and startup repair behavior; no new discoverable user surface. ## 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 Docs/release notes: no tracked changelog, release-note, or changeset file exists; no docs changes needed for this compatibility bugfix. ## UI evidence N/A - no visible UI changes. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Improved normalization of prompt preset default field settings during profile and preset imports and application startup, with automatic conversion of legacy field format to current standard. * Enhanced validation to detect and reject conflicting default flag configurations, preventing data inconsistency. * **Tests** * Added comprehensive test coverage for prompt default field format migration, validation, and conflict detection. <!-- 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:17: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#5521
No description provided.