[PR #1937] [MERGED] Fix startup storage persistence and import rollback flushes #5347

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

📋 Pull Request Information

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

Base: refactor ← Head: fix/startup-state-storage-tests


📝 Commits (2)

  • 8a2190a Fix startup storage persistence and import rollback flushes
  • 0992398 Guard ST preset import rollback on flush failure

📊 Changes

7 files changed (+284 additions, -139 deletions)

View changed files

📝 src-tauri/src/commands/storage/imports/bulk_imports.rs (+23 -4)
📝 src-tauri/src/commands/storage/imports/marinara.rs (+5 -0)
📝 src-tauri/src/commands/storage/imports/rollback.rs (+4 -0)
📝 src-tauri/src/commands/storage/imports/service.rs (+2 -0)
📝 src-tauri/src/commands/storage/imports/service_tests.rs (+70 -0)
📝 src-tauri/src/commands/storage/imports/st_preset.rs (+171 -135)
📝 src-tauri/src/state.rs (+9 -0)

📄 Description

Linked issue

No linked issue.

Why this change

Startup storage repair tests and import rollback paths need to observe durable storage writes when correctness depends on persisted data. A debounced storage write could leave startup fixtures invisible to a fresh storage instance, and import flows could return success before a pending write failure was surfaced.

What changed

  • Flush startup test fixture storage before constructing a fresh AppState.
  • Add an import-layer helper that flushes pending storage writes before import success responses.
  • Apply the flush boundary to SillyTavern chat/persona/preset imports and Marinara character/persona/lorebook/preset imports.
  • Preserve rollback behavior when flush failures occur, including persona avatar imports removing both managed avatar files and created persona rows.

Refactor impact

Primary owner:

Rust storage and imports.

Impact areas reviewed:

  • Startup state repair and media migration tests
  • Import success and rollback paths
  • SillyTavern chat/persona/preset imports
  • Marinara envelope character/persona/lorebook/preset imports

Boundary notes:

No React, engine, shared API, or remote-runtime boundaries changed. The change stays in src-tauri storage/import ownership.

Pressure points touched:

Import modules under src-tauri/src/commands/storage/imports.

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 state::tests -- --nocapture
  • cargo test --manifest-path src-tauri/Cargo.toml import_persona_avatar_file_rolls_back_avatar_when_persona_write_fails -- --nocapture
  • cargo test --manifest-path src-tauri/Cargo.toml rolls_back -- --nocapture
  • cargo test --manifest-path src-tauri/Cargo.toml branch_import_fails -- --nocapture
  • pnpm check:rust:test
  • pnpm check:rust
  • pnpm check:rust:nextest
  • pnpm check
  • git diff --check

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:

This is a Rust storage/import rollback correctness fix and does not add a discoverable feature.

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 needed; no public workflow, command, architecture, or discoverability documentation changed.

UI evidence

No UI changes.


🔄 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/1937 **Author:** [@Xelvanis](https://github.com/Xelvanis) **Created:** 6/2/2026 **Status:** ✅ Merged **Merged:** 6/2/2026 **Merged by:** [@Xelvanis](https://github.com/Xelvanis) **Base:** `refactor` ← **Head:** `fix/startup-state-storage-tests` --- ### 📝 Commits (2) - [`8a2190a`](https://github.com/Pasta-Devs/Marinara-Engine/commit/8a2190ad0f33467ab685890f0cbc0d67ca47cab8) Fix startup storage persistence and import rollback flushes - [`0992398`](https://github.com/Pasta-Devs/Marinara-Engine/commit/099239894b5b3f1235c14c9619e20284deeae56b) Guard ST preset import rollback on flush failure ### 📊 Changes **7 files changed** (+284 additions, -139 deletions) <details> <summary>View changed files</summary> 📝 `src-tauri/src/commands/storage/imports/bulk_imports.rs` (+23 -4) 📝 `src-tauri/src/commands/storage/imports/marinara.rs` (+5 -0) 📝 `src-tauri/src/commands/storage/imports/rollback.rs` (+4 -0) 📝 `src-tauri/src/commands/storage/imports/service.rs` (+2 -0) 📝 `src-tauri/src/commands/storage/imports/service_tests.rs` (+70 -0) 📝 `src-tauri/src/commands/storage/imports/st_preset.rs` (+171 -135) 📝 `src-tauri/src/state.rs` (+9 -0) </details> ### 📄 Description ## Linked issue No linked issue. ## Why this change Startup storage repair tests and import rollback paths need to observe durable storage writes when correctness depends on persisted data. A debounced storage write could leave startup fixtures invisible to a fresh storage instance, and import flows could return success before a pending write failure was surfaced. ## What changed - Flush startup test fixture storage before constructing a fresh `AppState`. - Add an import-layer helper that flushes pending storage writes before import success responses. - Apply the flush boundary to SillyTavern chat/persona/preset imports and Marinara character/persona/lorebook/preset imports. - Preserve rollback behavior when flush failures occur, including persona avatar imports removing both managed avatar files and created persona rows. ## Refactor impact Primary owner: Rust storage and imports. Impact areas reviewed: - Startup state repair and media migration tests - Import success and rollback paths - SillyTavern chat/persona/preset imports - Marinara envelope character/persona/lorebook/preset imports Boundary notes: No React, engine, shared API, or remote-runtime boundaries changed. The change stays in `src-tauri` storage/import ownership. Pressure points touched: Import modules under `src-tauri/src/commands/storage/imports`. ## 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 - `cargo test --manifest-path src-tauri/Cargo.toml state::tests -- --nocapture` - `cargo test --manifest-path src-tauri/Cargo.toml import_persona_avatar_file_rolls_back_avatar_when_persona_write_fails -- --nocapture` - `cargo test --manifest-path src-tauri/Cargo.toml rolls_back -- --nocapture` - `cargo test --manifest-path src-tauri/Cargo.toml branch_import_fails -- --nocapture` - `pnpm check:rust:test` - `pnpm check:rust` - `pnpm check:rust:nextest` - `pnpm check` - `git diff --check` ## 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: This is a Rust storage/import rollback correctness fix and does not add a discoverable feature. ## 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 needed; no public workflow, command, architecture, or discoverability documentation changed. ## UI evidence No UI changes. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:15:27 +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#5347
No description provided.